Skip to content

Commit 6aa2e49

Browse files
Must not reach consistency before XLOG_BACKUP_RECORD
When waiting for an XLOG_BACKUP_RECORD the minRecoveryPoint will be incorrect, so we must not declare recovery as consistent before we have seen the record. Major bug allowing recovery to end too early in some cases, allowing people to see inconsistent db. This patch to HEAD and 9.2, other fix required for 9.1 and 9.0 Simon Riggs and Andres Freund, bug report by Jeff Janes
1 parent 357cbaa commit 6aa2e49

File tree

1 file changed

+5
-2
lines changed
  • src/backend/access/transam

1 file changed

+5
-2
lines changed

src/backend/access/transam/xlog.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6332,9 +6332,12 @@ CheckRecoveryConsistency(void)
63326332
return;
63336333

63346334
/*
6335-
* Have we passed our safe starting point?
6335+
* Have we passed our safe starting point? Note that minRecoveryPoint
6336+
* is known to be incorrectly set if ControlFile->backupEndRequired,
6337+
* until the XLOG_BACKUP_RECORD arrives to advise us of the correct
6338+
* minRecoveryPoint. All we prior to that is its not consistent yet.
63366339
*/
6337-
if (!reachedConsistency &&
6340+
if (!reachedConsistency && !ControlFile->backupEndRequired &&
63386341
XLByteLE(minRecoveryPoint, EndRecPtr) &&
63396342
XLogRecPtrIsInvalid(ControlFile->backupStartPoint))
63406343
{

0 commit comments

Comments
 (0)