diff options
author | Fujii Masao <fujii@postgresql.org> | 2019-09-30 10:18:15 +0900 |
---|---|---|
committer | Fujii Masao <fujii@postgresql.org> | 2019-09-30 10:18:15 +0900 |
commit | 7acf8a876b7704ae162fc4f48ff97f4290fb0a61 (patch) | |
tree | 61b8e9b472f0f6e9059268c4a3c8aa9fd4d198e9 /src/backend/access/transam/xlog.c | |
parent | ac88807f9b227ddcd92b8be9a053094837c1b99a (diff) | |
download | postgresql-7acf8a876b7704ae162fc4f48ff97f4290fb0a61.tar.gz postgresql-7acf8a876b7704ae162fc4f48ff97f4290fb0a61.zip |
Make crash recovery ignore recovery target settings.
In v11 or before, recovery target settings could not take effect in
crash recovery because they are specified in recovery.conf and
crash recovery always starts without recovery.conf. But commit
2dedf4d9a8 integrated recovery.conf into postgresql.conf and
which unexpectedly allowed recovery target settings to take effect
even in crash recovery. This is definitely not good behavior.
To fix the issue, this commit makes crash recovery always ignore
recovery target settings.
Back-patch to v12.
Author: Peter Eisentraut
Reviewed-by: Fujii Masao
Discussion: https://postgr.es/m/e445616d-023e-a268-8aa1-67b8b335340c@pgmasters.net
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 6c69eb6dd76..61ba6b852e6 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -5618,6 +5618,13 @@ recoveryStopsBefore(XLogReaderState *record) TimestampTz recordXtime = 0; TransactionId recordXid; + /* + * Ignore recovery target settings when not in archive recovery (meaning + * we are in crash recovery). + */ + if (!ArchiveRecoveryRequested) + return false; + /* Check if we should stop as soon as reaching consistency */ if (recoveryTarget == RECOVERY_TARGET_IMMEDIATE && reachedConsistency) { @@ -5759,6 +5766,13 @@ recoveryStopsAfter(XLogReaderState *record) uint8 rmid; TimestampTz recordXtime; + /* + * Ignore recovery target settings when not in archive recovery (meaning + * we are in crash recovery). + */ + if (!ArchiveRecoveryRequested) + return false; + info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; rmid = XLogRecGetRmid(record); |