Re: Minimal logical decoding on standbys
Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Commits
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Reduce the log level in 035_standby_logical_decoding.pl.
- 3034dc56ef4b 16.0 landed
-
035_standby_logical_decoding: Add missing waits for replication
- 57411c82ce86 16.0 landed
-
For cascading replication, wake physical and logical walsenders separately
- e101dfac3a53 16.0 landed
-
Handle logical slot conflicts on standby
- 26669757b6a7 16.0 landed
-
Support invalidating replication slots due to horizon and wal_level
- be87200efd93 16.0 landed
-
Prevent use of invalidated logical slot in CreateDecodingContext()
- 4397abd0a2af 16.0 landed
-
Replace replication slot's invalidated_at LSN with an enum
- 15f8203a5975 16.0 landed
-
Pass down table relation into more index relation functions
- 61b313e47eb9 16.0 landed
-
Assert only valid flag bits are passed to visibilitymap_set()
- a88a18b1250b 16.0 landed
-
Remove unused _bt_delitems_delete() argument.
- dc43492e46c7 14.0 cited
-
Add xl_btree_delete optimization.
- d2e5e20e5711 13.0 cited
Hi, On 1/26/23 9:13 PM, Andres Freund wrote: > Hi, > > On 2023-01-26 18:56:10 +0100, Drouvot, Bertrand wrote: >> - I'm struggling to create a test for btree killtuples as there is a need for rows removal on the table (that could produce a conflict too): >> Do you've a scenario in mind for this one? (and btw in what kind of WAL record should the conflict be detected in such a case? xl_btree_delete?) > > Hm, it might indeed be hard in "modern" postgres. I think you'd need at least > two concurrent sessions, to prevent on-access pruning on the table. > > > DROP TABLE IF EXISTS indexdel; > CREATE TABLE indexdel(id int8 primary key); > INSERT INTO indexdel SELECT generate_series(1, 10000); > VACUUM indexdel; -- ensure hint bits are set etc > > DELETE FROM indexdel; > > SELECT pg_current_wal_insert_lsn(); > > SET enable_indexonlyscan = false; > -- This scan finds that the index items are dead - but doesn't yet issue a > -- btree delete WAL record, that only happens when needing space on the page > -- again. > EXPLAIN (COSTS OFF, SUMMARY OFF) SELECT id FROM indexdel WHERE id < 10 ORDER BY id ASC; > SELECT id FROM indexdel WHERE id < 100 ORDER BY id ASC; > > -- The insertions into the range of values prev > INSERT INTO indexdel SELECT generate_series(1, 100); > > > Does generate the btree deletion record, but it also does emit a PRUNE (from > heapam_index_fetch_tuple() -> heap_page_prune_opt()). > > While the session could create a cursor to prevent later HOT cleanup, the > query would also trigger hot pruning (or prevent the rows from being dead, if > you declare the cursor before the DELETE). So you'd need overlapping cursors > in a concurrent session... > Thanks for the scenario and explanation! I agree that a second session would be needed (and so I understand why I was struggling when trying with a single session ;-) ) > Too complicated. > Yeah. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com