postgresql/src/test/recovery/t
Alexander Korotkov 06c418e163 Implement pg_wal_replay_wait() stored procedure
pg_wal_replay_wait() is to be used on standby and specifies waiting for
the specific WAL location to be replayed before starting the transaction.
This option is useful when the user makes some data changes on primary and
needs a guarantee to see these changes on standby.

The queue of waiters is stored in the shared memory array sorted by LSN.
During replay of WAL waiters whose LSNs are already replayed are deleted from
the shared memory array and woken up by setting of their latches.

pg_wal_replay_wait() needs to wait without any snapshot held.  Otherwise,
the snapshot could prevent the replay of WAL records implying a kind of
self-deadlock.  This is why it is only possible to implement
pg_wal_replay_wait() as a procedure working in a non-atomic context,
not a function.

Catversion is bumped.

Discussion: https://postgr.es/m/eb12f9b03851bb2583adab5df9579b4b%40postgrespro.ru
Author: Kartyshov Ivan, Alexander Korotkov
Reviewed-by: Michael Paquier, Peter Eisentraut, Dilip Kumar, Amit Kapila
Reviewed-by: Alexander Lakhin, Bharath Rupireddy, Euler Taveira
2024-04-02 22:48:03 +03:00
..
001_stream_rep.pl Make spelling of cancelled/cancellation consistent 2024-01-26 12:38:15 +01:00
002_archiving.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
003_recovery_targets.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
004_timeline_switch.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
005_replay_delay.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
006_logical_decoding.pl Introduce a new GUC 'standby_slot_names'. 2024-03-08 08:10:45 +05:30
007_sync_rep.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
008_fsm_truncation.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
009_twophase.pl Rework redundant code in subtrans.c 2024-03-05 12:09:18 +01:00
010_logical_decoding_timelines.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
012_subtransactions.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
013_crash_restart.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
014_unlogged_reinit.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
015_promotion_pages.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
016_min_consistency.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
017_shm.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
018_wal_optimize.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
019_replslot_limit.pl Change last_inactive_time to inactive_since in pg_replication_slots. 2024-03-27 09:27:44 +05:30
020_archive_status.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
021_row_visibility.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
022_crash_temp_files.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
023_pitr_prepared_xact.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
024_archive_recovery.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
025_stuck_on_old_timeline.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
026_overwrite_contrecord.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
027_stream_regress.pl Add copyright notices to a few perl scripts that don't have them 2024-01-05 13:15:50 +00:00
028_pitr_timelines.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
029_stats_restart.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
030_stats_cleanup_replica.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
031_recovery_conflict.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
032_relfilenode_reuse.pl Add copyright notices to a few perl scripts that don't have them 2024-01-05 13:15:50 +00:00
033_replay_tsp_drops.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
034_create_database.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
035_standby_logical_decoding.pl Track invalidation_reason in pg_replication_slots. 2024-03-22 13:52:05 +05:30
036_truncated_dropped.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
037_invalid_database.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
038_save_logical_slots_shutdown.pl Fix a random failure in 038_save_logical_slots_shutdown.pl. 2024-03-13 08:33:26 +05:30
039_end_of_wal.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
040_standby_failover_slots_sync.pl Track invalidation_reason in pg_replication_slots. 2024-03-22 13:52:05 +05:30
041_checkpoint_at_promote.pl Add PostgreSQL::Test::Cluster::wait_for_event() 2024-03-04 10:27:50 +09:00
042_low_level_backup.pl Add basic TAP tests for the low-level backup method, take two 2024-03-15 08:29:54 +09:00
043_wal_replay_wait.pl Implement pg_wal_replay_wait() stored procedure 2024-04-02 22:48:03 +03:00
cp_history_files Make all Perl warnings fatal 2023-12-29 18:20:00 +01:00