Improve WAIT FOR LSN test coverage Add regression coverage for several WAIT FOR LSN edge cases.
First, cover fresh walreceiver shared-memory initialization after a standby restart. Restart the standby while its upstream is down, so RequestXLogStreaming() seeds writtenUpto/flushedUpto to the segment-aligned receiveStart and the walreceiver cannot immediately advance them. Verify that the seeded flush position is segment-aligned, that replay can be ahead of it, and that standby_write/standby_flush still succeed for an already-replayed LSN via the replay-position floor in GetCurrentLSNForWaitType(). Second, add fencepost checks for the target <= currentLSN predicate. With replay paused and walreceiver stopped, verify exact boundaries for standby_replay using pg_last_wal_replay_lsn(), and for standby_flush using pg_last_wal_receive_lsn(). Also verify that a waiter for current + 1 sleeps while replay is paused and wakes with success once new WAL is delivered and replay advances. Finally, add a cascading-standby timeline-switch test. Start a waiter on the downstream standby, promote its upstream, generate WAL on the new timeline, and verify that the cascade follows the new timeline and the wait completes successfully once replay reaches the target LSN. Reported-by: Andres Freund <[email protected]> Discussion: https://postgr.es/m/1957514.1775526774%40sss.pgh.pa.us Author: Alexander Korotkov <[email protected]> Author: Xuneng Zhou <[email protected]> Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/cb096e6d6981e0a4b25beb46ab0cf9154971123a Modified Files -------------- src/test/recovery/t/049_wait_for_lsn.pl | 277 ++++++++++++++++++++++++++++++++ 1 file changed, 277 insertions(+)
