diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2016-05-25 19:39:49 -0400 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2016-05-25 19:39:49 -0400 |
commit | 7a0f09da7dc3378130547c81e47b9c96bcfd0634 (patch) | |
tree | bb3b8e46c1cff85392741f92c5c76448ec3f8499 /src/backend/access | |
parent | 4b612a78fdb501f79c768f65075df167477a5017 (diff) | |
download | postgresql-7a0f09da7dc3378130547c81e47b9c96bcfd0634.tar.gz postgresql-7a0f09da7dc3378130547c81e47b9c96bcfd0634.zip |
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.
Analysis and report by Marco Nenciarini
Bug fix by Simon Riggs
This is a correct backpatch of commit 66fbcb0d2e to branches 9.1 through
9.4. That commit was backpatched to 9.0 originally, but it was
immediately reverted in 9.0-9.4 because it didn't compile.
Diffstat (limited to 'src/backend/access')
-rw-r--r-- | src/backend/access/heap/heapam.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 91cd3710ba8..de51cf7eec0 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -7556,7 +7556,13 @@ heap_xlog_freeze_page(XLogRecPtr lsn, XLogRecord *record) * consider the frozen xids as running. */ if (InHotStandby) - ResolveRecoveryConflictWithSnapshot(cutoff_xid, xlrec->node); + { + TransactionId latestRemovedXid = cutoff_xid; + + TransactionIdRetreat(latestRemovedXid); + + ResolveRecoveryConflictWithSnapshot(latestRemovedXid, xlrec->node); + } /* If we have a full-page image, restore it and we're done */ if (record->xl_info & XLR_BKP_BLOCK(0)) |