Re: logical decoding and replication of sequences, take 2

From: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Subject: Re: logical decoding and replication of sequences, take 2
Date: 2023-07-19 21:01:04
Message-ID: aa04d6e1-1cb2-c1f1-a8d7-df546ae14fa7@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 7/19/23 12:53, Tomas Vondra wrote:
> ...
>
> I did however look at the proposed alternative to the "created" flag.
> The attached 0006 part ditches the flag with XLOG_SMGR_CREATE decoding.
> The smgr_decode code needs a review (I'm not sure the
> skipping/fast-forwarding part is correct), but it seems to be working
> fine overall, although we need to ensure the WAL record has the correct XID.
>

cfbot reported two issues in the patch - compilation warning, due to
unused variable in sequence_decode, and a failing test in test_decoding.

The second thing happens because when creating the relfilenode, it may
happen before we know the XID. The patch already does ensure the WAL
with the sequence data has XID, but that's later. And when the CREATE
record did not have the correct XID, that broke the logic deciding which
increments should be "transactional".

This forces us to assign XID a bit earlier (it'd happen anyway, when
logging the increment). There's a bit of a drawback, because we don't
have the relation yet, so we can't do RelationNeedsWAL ...

regards

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

Attachment Content-Type Size
0001-Make-test_decoding-ddl.out-shorter-20230719b.patch text/x-patch 473.3 KB
0002-Logical-decoding-of-sequences-20230719b.patch text/x-patch 52.4 KB
0003-Add-decoding-of-sequences-to-test_decoding-20230719b.patch text/x-patch 20.6 KB
0004-Add-decoding-of-sequences-to-built-in-repl-20230719b.patch text/x-patch 265.7 KB
0005-Simplify-protocol-versioning-20230719b.patch text/x-patch 15.6 KB
0006-replace-created-flag-with-XLOG_SMGR_CREATE-20230719b.patch text/x-patch 17.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2023-07-19 21:38:25 Re: Use of additional index columns in rows filtering
Previous Message Andrew Dunstan 2023-07-19 20:47:28 Re: Extracting cross-version-upgrade knowledge from buildfarm client