Changes to recovery_min_apply_delay are ignored while waiting for delay
Soumyadeep Chakraborty <soumyadeep2007@gmail.com>
From: Soumyadeep Chakraborty <soumyadeep2007@gmail.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: ashwinstar@gmail.com
Date: 2021-08-03T05:21:56Z
Lists: pgsql-hackers
Attachments
- v1-0001-Refresh-delayUntil-in-recovery-delay-loop.patch (text/x-patch) patch v1-0001
Hello,
I came across this issue while I was tweaking a TAP test with Ashwin for
this thread [1].
We noticed that while the startup process waits for a recovery delay, it does
not respect changes to the recovery_min_apply_delay GUC. So:
// Standby is waiting on recoveryWakeupLatch with a large
recovery_min_apply_delay value
node_standby->safe_psql('postgres', 'ALTER SYSTEM SET
recovery_min_apply_delay TO 0;');
node_standby->reload;
// Standby is still waiting, it does not proceed until the old timeout
is elapsed.
I attached a small patch to fix this. It makes it so that
recovery_min_apply_delay is reconsulted in the loop to redetermine the wait
interval. This makes it similar to the loop in CheckpointerMain, where
CheckPointTimeout is consulted after interrupts are handled:
if (elapsed_secs >= CheckPointTimeout)
continue; /* no sleep for us ... */
I have also added a test to 005_replay_delay.pl.
Regards,
Soumyadeep(VMware)
[1] https://www.postgresql.org/message-id/flat/CANXE4Tc3FNvZ_xAimempJWv_RH9pCvsZH7Yq93o1VuNLjUT-mQ%40mail.gmail.com
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Refresh apply delay on reload of recovery_min_apply_delay at recovery
- 942416f4bdb0 9.6.24 landed
- 024fd44e0566 10.19 landed
- d392e86fa9c4 11.14 landed
- 84c1bac579db 12.9 landed
- 7f0873f328ef 13.5 landed
- f83d80ea1e57 14.0 landed
- e4ba1005c0f7 15.0 landed