public inbox for [email protected]
help / color / mirror / Atom feedFrom: Christophe Pettus <[email protected]>
To: Phillip Diffley <[email protected]>
Cc: [email protected]
Subject: Re: Replication slot WAL reservation
Date: Tue, 25 Mar 2025 10:07:12 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAGAwPgR=B9VTDwKkHZRHjYTmQzvJ+30mK-uyc7MMw6Tf9s9Fsw@mail.gmail.com>
References: <CAGAwPgR=B9VTDwKkHZRHjYTmQzvJ+30mK-uyc7MMw6Tf9s9Fsw@mail.gmail.com>
> On Mar 25, 2025, at 09:56, Phillip Diffley <[email protected]> wrote:
> 1. Every DML operation (insert, update, delete, truncate) will have a row in the WAL and that row will have an LSN assigned to it.
> 2. The LSNs are assigned when the operation happens.
> 3. Operations within a transaction are written to the WAL in a contiguous block when the transaction commits.
> 4. Each transaction block in the WAL has a commit timestamp associated with it, and these timestamps are monotonically increasing (I'm only inferring this, so please correct me if this is not always the case).
This isn't *quite* right. LSNs are byte offsets, not operation sequence numbers (despite the name), so they don't have to be "assigned"; they're just an offset to a particular point in the (virtual) WAL bytestream.
The WAL is written as it is generated (allowing for buffering etc.). A transaction end flushes out any remaining WAL that is involved in that transaction (and any other WAL that might be between operations for that transaction), unless you are not in synchronous_commit mode.
It's not quite the "transaction block" that has the commit timestamp; it's the commit record for a particular transaction. I can't come up with a scenario off the top of my head in which the commit timestamp would go down, but I wouldn't absolutely bet on it never doing so.
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Replication slot WAL reservation
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox