summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2017-04-18 11:35:38 +0100
committerSimon Riggs <simon@2ndQuadrant.com>2017-04-18 11:35:38 +0100
commitee01f7092fb6430ad9bb9bb1f42f19d22bcb9329 (patch)
tree0c424822e6bdef4be98e7ca796192f3edc00749a
parentaa203e76004daaee3d70b19cc727ed17b87b3d3a (diff)
Exit correctly from PrepareRedoRemove() when not found
Complex crash bug all started with this failure. Diagnosed and fixed by Nikhil Sontakke, reviewed by me. Reported-by: Jeff Janes Author: Nikhil Sontakke Discussion: https://postgr.es/m/CAMkU=1xBP8cqdS5eK8APHL=X6RHMMM2vG5g+QamduuTsyCwv9g@mail.gmail.com
-rw-r--r--src/backend/access/transam/twophase.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 6e6678cfff6..49b64292187 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -2375,6 +2375,7 @@ PrepareRedoRemove(TransactionId xid, bool giveWarning)
{
GlobalTransaction gxact = NULL;
int i;
+ bool found = false;
Assert(RecoveryInProgress());
@@ -2386,6 +2387,7 @@ PrepareRedoRemove(TransactionId xid, bool giveWarning)
if (gxact->xid == xid)
{
Assert(gxact->inredo);
+ found = true;
break;
}
}
@@ -2394,7 +2396,7 @@ PrepareRedoRemove(TransactionId xid, bool giveWarning)
/*
* Just leave if there is nothing, this is expected during WAL replay.
*/
- if (gxact == NULL)
+ if (!found)
return;
/*