Re: pg_get_wal_replay_pause_state() should not return 'paused' while a promotion is ongoing.

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_get_wal_replay_pause_state() should not return 'paused' while a promotion is ongoing.
Date: 2021-05-19 05:17:31
Message-ID: YKSfa+3qlgd8AN3W@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-05-19 05:21:21 Re: Subscription tests fail under CLOBBER_CACHE_ALWAYS
Previous Message Michael Paquier 2021-05-19 05:05:12 Re: Subscription tests fail under CLOBBER_CACHE_ALWAYS