public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Tomas Vondra <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: sequences vs. synchronous replication
Date: Fri, 17 Dec 2021 23:52:48 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
Tomas Vondra <[email protected]> writes:
> The problem is exactly the same as in [1] - the aborted transaction
> generated WAL, but RecordTransactionAbort() ignores that and does not
> update LogwrtResult.Write, with the reasoning that aborted transactions
> do not matter. But sequences violate that, because we only write WAL
> once every 32 increments, so the following nextval() gets "committed"
> without waiting for the replica (because it did not produce WAL).
Ugh.
> I'm not sure this is a clear data corruption bug, but it surely walks
> and quacks like one. My proposal is to fix this by tracking the lsn of
> the last LSN for a sequence increment, and then check that LSN in
> RecordTransactionCommit() before calling XLogFlush().
(1) Does that work if the aborted increment was in a different
session? I think it is okay but I'm tired enough to not be sure.
(2) I'm starting to wonder if we should rethink the sequence logging
mechanism altogether. It was cool when designed, but it seems
really problematic when you start thinking about replication
behaviors. Perhaps if wal_level > minimal, we don't do things
the same way?
regards, tom lane
view thread (78+ messages) latest in thread
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], [email protected]
Subject: Re: sequences vs. synchronous replication
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