postgresql/src/include/replication
Amit Kapila 2ec005b4e2 Ensure that the sync slots reach a consistent state after promotion without losing data.
We were directly copying the LSN locations while syncing the slots on the
standby. Now, it is possible that at some particular restart_lsn there are
some running xacts, which means if we start reading the WAL from that
location after promotion, we won't reach a consistent snapshot state at
that point. However, on the primary, we would have already been in a
consistent snapshot state at that restart_lsn so we would have just
serialized the existing snapshot.

To avoid this problem we will use the advance_slot functionality unless
the snapshot already exists at the synced restart_lsn location. This will
help us to ensure that snapbuilder/slot statuses are updated properly
without generating any changes. Note that the synced slot will remain as
RS_TEMPORARY till the decoding from corresponding restart_lsn can reach a
consistent snapshot state after which they will be marked as
RS_PERSISTENT.

Per buildfarm

Author: Hou Zhijie
Reviewed-by: Bertrand Drouvot, Shveta Malik, Bharath Rupireddy, Amit Kapila
Discussion: https://postgr.es/m/OS0PR01MB5716B3942AE49F3F725ACA92943B2@OS0PR01MB5716.jpnprd01.prod.outlook.com
2024-04-03 14:04:59 +05:30
..
decode.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
logical.h Ensure that the sync slots reach a consistent state after promotion without losing data. 2024-04-03 14:04:59 +05:30
logicallauncher.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
logicalproto.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
logicalrelation.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
logicalworker.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
message.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
origin.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
output_plugin.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgoutput.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
reorderbuffer.h Improve eviction algorithm in ReorderBuffer using max-heap for many subtransactions. 2024-04-03 11:40:42 +09:00
slot.h Change last_inactive_time to inactive_since in pg_replication_slots. 2024-03-27 09:27:44 +05:30
slotsync.h Refactor postmaster child process launching 2024-03-18 11:35:30 +02:00
snapbuild.h Ensure that the sync slots reach a consistent state after promotion without losing data. 2024-04-03 14:04:59 +05:30
syncrep.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
walreceiver.h Refactor postmaster child process launching 2024-03-18 11:35:30 +02:00
walsender.h Introduce a new GUC 'standby_slot_names'. 2024-03-08 08:10:45 +05:30
walsender_private.h Introduce a new GUC 'standby_slot_names'. 2024-03-08 08:10:45 +05:30
worker_internal.h Update copyright for 2024 2024-01-03 20:49:05 -05:00