Commit 6aa2e49a authored by Simon Riggs's avatar Simon Riggs

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
parent 357cbaae
...@@ -6332,9 +6332,12 @@ CheckRecoveryConsistency(void) ...@@ -6332,9 +6332,12 @@ CheckRecoveryConsistency(void)
return; return;
/* /*
* Have we passed our safe starting point? * Have we passed our safe starting point? Note that minRecoveryPoint
* is known to be incorrectly set if ControlFile->backupEndRequired,
* until the XLOG_BACKUP_RECORD arrives to advise us of the correct
* minRecoveryPoint. All we prior to that is its not consistent yet.
*/ */
if (!reachedConsistency && if (!reachedConsistency && !ControlFile->backupEndRequired &&
XLByteLE(minRecoveryPoint, EndRecPtr) && XLByteLE(minRecoveryPoint, EndRecPtr) &&
XLogRecPtrIsInvalid(ControlFile->backupStartPoint)) XLogRecPtrIsInvalid(ControlFile->backupStartPoint))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment