On Wed, May 19, 2021 at 01:46:45PM +0900, Fujii Masao wrote: > You're thinking to add the test like the following? > #1. Pause the recovery > #2. Confirm that pg_get_wal_replay_pause_state() returns 'paused' > #3. Trigger standby promotion > #4. Confirm that pg_get_wal_replay_pause_state() returns 'not paused' > > It seems not easy to do the test #4 stably because > pg_get_wal_replay_pause_state() needs to be executed > before the promotion finishes.
Couldn't you rely on recovery_end_command for number #4? The shared memory state tracked by SharedRecoveryState is updated after the end-recovery command is triggered, so pg_get_wal_replay_pause_state() can be executed at this point. A bit hairy, I agree, but that would work :) Still, it would be easy enough to have something for pg_get_wal_replay_pause_state() called on a standby when there is no pause (your case #2) and a second case on a standby with a pause triggered, though (not listed above). -- Michael
signature.asc
Description: PGP signature