Re: logical decoding and replication of sequences

From: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Petr Jelinek <petr(dot)jelinek(at)enterprisedb(dot)com>
Subject: Re: logical decoding and replication of sequences
Date: 2022-01-26 02:16:57
Message-ID: 22aef14d-0ea1-9044-c2e7-29f88762eaec@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Here's a rebased version of the patch series. I decided to go back to
the version from 2021/12/14, which does not include the changes to WAL
logging. So this has the same issue with nextval() now waiting for WAL
flush (and/or sync replica), as demonstrated by occasional failures of
the TAP test in 0003, but my reasoning is this:

1) This is a preexisting issue, affecting sequences in general. It's not
related to this patch, really. The fix will be independent of this, and
there's little reason to block the decoding until that happens.

2) We've discussed a couple ways to fix this in [1] - logging individual
sequence increments, flushing everything right away, waiting for page
LSN, etc. My opinion is we'll use some form of waiting for page LSN, but
no matter what fix we use it'll have almost no impact on this patch.
There might be minor changes to the test, but that's about it.

3) There are ways to stabilize the tests even without that - it's enough
to generate a little bit of WAL / get XID, not just nextval(). But
that's only for 0003 which I don't intend to commit yet, and 0001/0002
have no problems at all.

regards

[1]
https://www.postgresql.org/message-id/712cad46-a9c8-1389-aef8-faf0203c9be9@enterprisedb.com

--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
0001-Logical-decoding-of-sequences-20220126.patch text/x-patch 46.3 KB
0002-Add-support-for-decoding-sequences-to-test_-20220126.patch text/x-patch 20.3 KB
0003-Add-support-for-decoding-sequences-to-built-20220126.patch text/x-patch 76.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2022-01-26 02:28:01 Re: Skipping logical replication transactions on subscriber side
Previous Message David G. Johnston 2022-01-26 02:01:24 Re: Skipping logical replication transactions on subscriber side