On Sat, Dec 18, 2021 at 7:24 AM Tomas Vondra
<tomas.von...@enterprisedb.com> wrote:
>
> while working on logical decoding of sequences, I ran into an issue with
> nextval() in a transaction that rolls back, described in [1]. But after
> thinking about it a bit more (and chatting with Petr Jelinek), I think
> this issue affects physical sync replication too.
>
> Imagine you have a primary <-> sync_replica cluster, and you do this:
>
>    CREATE SEQUENCE s;
>
>    -- shutdown the sync replica
>
>    BEGIN;
>    SELECT nextval('s') FROM generate_series(1,50);
>    ROLLBACK;
>
>    BEGIN;
>    SELECT nextval('s');
>    COMMIT;
>
> The natural expectation would be the COMMIT gets stuck, waiting for the
> sync replica (which is not running), right? But it does not.
>

How about if we always WAL log the first sequence change in a transaction?

-- 
With Regards,
Amit Kapila.


Reply via email to