Avoid hot standby cancels from VAC FREEZE
authorSimon Riggs <[email protected]>
Fri, 26 Jun 2015 23:41:47 +0000 (00:41 +0100)
committerSimon Riggs <[email protected]>
Fri, 26 Jun 2015 23:41:47 +0000 (00:41 +0100)
VACUUM FREEZE generated false cancelations of standby queries on an
otherwise idle master. Caused by an off-by-one error on cutoff_xid
which goes back to original commit.

Backpatch to all versions 9.0+

Analysis and report by Marco Nenciarini

Bug fix by Simon Riggs

src/backend/access/heap/heapam.c

index 208457584d975fe5d0697316ed4ec8397c19e85e..86a2e6bae6abdb5fdc62f1a2078f645111abc8a4 100644 (file)
@@ -7572,9 +7572,12 @@ heap_xlog_freeze_page(XLogReaderState *record)
    if (InHotStandby)
    {
        RelFileNode rnode;
+       TransactionId latestRemovedXid = cutoff_xid;
+
+       TransactionIdRetreat(latestRemovedXid);
 
        XLogRecGetBlockTag(record, 0, &rnode, NULL, NULL);
-       ResolveRecoveryConflictWithSnapshot(cutoff_xid, rnode);
+       ResolveRecoveryConflictWithSnapshot(latestRemovedXid, rnode);
    }
 
    if (XLogReadBufferForRedo(record, 0, &buffer) == BLK_NEEDS_REDO)