pgsql: Refresh apply delay on reload of recovery_min_apply_delay at rec

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Refresh apply delay on reload of recovery_min_apply_delay at rec
Date: 2021-08-16 03:12:58
Message-ID: E1mFT3a-0002S8-Hz@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Refresh apply delay on reload of recovery_min_apply_delay at recovery

This commit ensures that the wait interval in the replay delay loop
waiting for an amount of time defined by recovery_min_apply_delay is
correctly handled on reload, recalculating the delay if this GUC value
is updated, based on the timestamp of the commit record being replayed.

The previous behavior would be problematic for example with replay
still waiting even if the delay got reduced or just cancelled. If the
apply delay was increased to a larger value, the wait would have just
respected the old value set, finishing earlier.

Author: Soumyadeep Chakraborty, Ashwin Agrawal
Reviewed-by: Kyotaro Horiguchi, Michael Paquier
Discussion: https://postgr.es/m/CAE-ML+93zfr-HLN8OuxF0BjpWJ17O5dv1eMvSE5jsj9jpnAXZA@mail.gmail.com
Backpatch-through: 9.6

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/942416f4bdb056c2b12a97ef7fb2d21b565df3cb

Modified Files
--------------
src/backend/access/transam/xlog.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2021-08-16 11:41:07 pgsql: Clarify initdb --sync-only help message and docs
Previous Message Tom Lane 2021-08-13 18:42:37 pgsql: Un-break s_lock_test.