Re: logical decoding and replication of sequences
Peter Eisentraut <peter.eisentraut@enterprisedb.com>
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Tomas Vondra <tomas.vondra@enterprisedb.com>,
vignesh C <vignesh21@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Petr Jelinek <petr.jelinek@enterprisedb.com>
Date: 2021-09-23T10:27:17Z
Lists: pgsql-hackers
On 30.07.21 20:26, Tomas Vondra wrote: > Here's a an updated version of this patch - rebased to current master, > and fixing some of the issues raised in Peter's review. This patch needs an update, as various conflicts have arisen now. As was discussed before, it might be better to present a separate patch for just the logical decoding part for now, since the replication and DDL stuff has the potential to conflict heavily with other patches being discussed right now. It looks like cutting this patch in two should be doable easily. I looked through the test cases in test_decoding again. It all looks pretty sensible. If anyone can think of any other tricky or dubious cases, we can add them there. It's easiest to discuss these things with concrete test cases rather than in theory. One slightly curious issue is that this can make sequence values go backwards, when seen by the logical decoding consumer, like in the test case: + BEGIN + sequence: public.test_sequence transactional: 1 created: 1 last_value: 1, log_cnt: 0 is_called: 0 + COMMIT + sequence: public.test_sequence transactional: 0 created: 0 last_value: 33, log_cnt: 0 is_called: 1 + BEGIN + sequence: public.test_sequence transactional: 1 created: 1 last_value: 4, log_cnt: 0 is_called: 1 + COMMIT + sequence: public.test_sequence transactional: 0 created: 0 last_value: 334, log_cnt: 0 is_called: 1 I suppose that's okay, since it's not really the intention that someone is concurrently consuming sequence values on the subscriber. Maybe something for the future. Fixing that would require changing the way transactional sequence DDL updates these values, so it's not directly the job of the decoding to address this. A small thing I found: Maybe the text that test_decoding produces for sequences can be made to look more consistent with the one for tables. For example, in + BEGIN + sequence: public.test_table_a_seq transactional: 1 created: 1 last_value: 1, log_cnt: 0 is_called: 0 + sequence: public.test_table_a_seq transactional: 1 created: 0 last_value: 33, log_cnt: 0 is_called: 1 + table public.test_table: INSERT: a[integer]:1 b[integer]:100 + table public.test_table: INSERT: a[integer]:2 b[integer]:200 + COMMIT note how the punctuation is different.
Commits
-
Fix cache invalidation bug in recovery_prefetch.
- d0d934490020 15.0 landed
- 932b01630095 16.0 landed
-
Revert "Logical decoding of sequences"
- 2c7ea57e56ca 15.0 landed
-
Minor improvements in sequence decoding code and docs
- 05843b1aa49d 15.0 landed
-
Handle sequences in preprocess_pubobj_list
- 002c9dd97a0c 15.0 landed
-
Update tab-completion for CREATE PUBLICATION with sequences
- 2d2232933b02 15.0 landed
-
Add decoding of sequences to built-in replication
- 75b1521dae1f 15.0 landed
-
Stabilize test_decoding touching with sequences
- a180c2b34de0 15.0 landed
-
Call ReorderBufferProcessXid from sequence_decode
- d5ed9da41d96 15.0 landed
-
Add decoding of sequences to test_decoding
- 80901b32913f 15.0 landed
-
Replace Test::More plans with done_testing
- 549ec201d613 15.0 cited
-
Logical decoding of sequences
- 0da92dc530c9 15.0 landed
-
Respect permissions within logical replication.
- a2ab9c06ea15 15.0 cited