Re: logical decoding and replication of sequences, take 2
Tomas Vondra <tomas.vondra@enterprisedb.com>
From: Tomas Vondra <tomas.vondra@enterprisedb.com>
To: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Masahiko Sawada <sawada.mshk@gmail.com>,
Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Date: 2023-07-29T13:03:31Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Migrate logical slots to the new node during an upgrade.
- 29d0a77fa660 17.0 cited
-
Make test_decoding ddl.out shorter
- d6677b93c79b 17.0 landed
- c5c5832600e9 14.9 landed
- b1dc946eee3d 16.0 landed
- 3bb8b9342f8a 15.4 landed
-
Fix snapshot handling in logicalmsg_decode
- 949ac32e1267 15.3 landed
- 8b9cbd42b61f 14.8 landed
- 4df581fa0f4b 13.11 landed
- 497f863f0598 12.15 landed
- 8de91ebf2ac1 11.20 landed
- 7fe1aa991b62 16.0 landed
-
doc: Adjust a few more references to "postmaster"
- 17e72ec45d31 16.0 cited
-
Revert "Logical decoding of sequences"
- 2c7ea57e56ca 15.0 cited
Attachments
- 0001-Logical-decoding-of-sequences-20230729.patch (text/x-patch) patch 0001
- 0002-Add-decoding-of-sequences-to-test_decoding-20230729.patch (text/x-patch) patch 0002
- 0003-Add-decoding-of-sequences-to-built-in-repli-20230729.patch (text/x-patch) patch 0003
- 0004-Catchup-up-to-a-LSN-after-copy-of-the-seque-20230729.patch (text/x-patch) patch 0004
- 0005-use-page-LSN-for-sequences-20230729.patch (text/x-patch) patch 0005
- 0006-per-transaction-hash-of-sequences-20230729.patch (text/x-patch) patch 0006
On 7/28/23 14:35, Ashutosh Bapat wrote: > > ... > > We hold a strong lock on sequence when changing its relfilenode. The > sequence whose relfilenode is being changed can not be accessed by any > concurrent transaction. So I am not able to understand what you are > trying to say. > > I think per (top level) transaction hash table is cleaner design. It > puts the hash table where it should be. But if that makes code > difficult, current design works too. > I was thinking about switching to the per-txn hash, so here's a patch adopting that approach (in part 0006). I can't say it's much simpler, but maybe it can be simplified a bit. Most of the complexity comes from assignments maybe happening with a delay, so it's hard to say what's a top-level xact. The patch essentially does this: 1) the HTAB is moved to ReorderBufferTXN 2) after decoding SGMR_CREATE, we add an entry to the current TXN and (for subtransactions) to the parent TXN (even the copy references the subxact) 3) when processing an assignment, we copy the HTAB entries from the subxact to the parent 4) after a subxact abort, we remove the HTAB entries from the parent 5) while searching for the relfilenode, we only scan the HTAB in the top-level xacts (this is possible due to the copying) This could work without the copy in parent HTAB, but then we'd have to scan all the transactions for every increment. And there may be many lookups and many (sub)transactions, but only a small number of new relfilenodes. So it seems like a good tradeoff. If we could convince ourselves the subxact has to be already assigned while decoding the sequence change, then we could simply search only the current transaction (and the parent). But I've been unable to convince myself that's guaranteed. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company