Skip to content

Commit e1ca691

Browse files
Avoid hot standby cancels from VAC FREEZE
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
1 parent 45c6917 commit e1ca691

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/backend/access/heap/heapam.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4239,7 +4239,13 @@ heap_xlog_freeze(XLogRecPtr lsn, XLogRecord *record)
42394239
* consider the frozen xids as running.
42404240
*/
42414241
if (InHotStandby)
4242-
ResolveRecoveryConflictWithSnapshot(cutoff_xid, xlrec->node);
4242+
{
4243+
TransactionId latestRemovedXid = cutoff_xid;
4244+
4245+
TransactionIdRetreat(latestRemovedXid);
4246+
4247+
ResolveRecoveryConflictWithSnapshot(latestRemovedXid, rnode);
4248+
}
42434249

42444250
/* If we have a full-page image, restore it and we're done */
42454251
if (record->xl_info & XLR_BKP_BLOCK(0))

0 commit comments

Comments
 (0)