postgres.git / summary / log / commit / refs

commit    46acbeb2f09c862bae5056d34473223764ff99b0
Author:   Andres Freund <andres@anarazel.de>
Date:     Fri Jul 15 21:37:06 2016 +0000

    Make HEAP_LOCK/HEAP2_LOCK_UPDATED replay reset HEAP_XMAX_INVALID.
    
    0ac5ad5 started to compress infomask bits in WAL records. Unfortunately
    the replay routines for XLOG_HEAP_LOCK/XLOG_HEAP2_LOCK_UPDATED forgot to
    reset the HEAP_XMAX_INVALID (and some other) hint bits.
    
    Luckily that's not problematic in the majority of cases, because after a
    crash/on a standby row locks aren't meaningful. Unfortunately that does
    not hold true in the presence of prepared transactions. This means that
    after a crash, or after promotion, row level locks held by a prepared,
    but not yet committed, prepared transaction might not be enforced.
    
    Discussion: 20160715192319.ubfuzim4zv3rqnxv@alap3.anarazel.de
    Backpatch: 9.3, the oldest branch on which 0ac5ad5 is present.


src/backend/access/heap/heapam.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 9a40c2282b5..b98b084eded 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -7865,6 +7865,8 @@ heap_xlog_lock(XLogRecPtr lsn, XLogRecord *record) htup = (HeapTupleHeader) PageGetItem(page, lp); + htup->t_infomask &= ~(HEAP_XMAX_BITS | HEAP_MOVED); + htup->t_infomask2 &= ~HEAP_KEYS_UPDATED; fix_infomask_from_infobits(xlrec->infobits_set, &htup->t_infomask, &htup->t_infomask2); @@ -7925,6 +7927,8 @@ heap_xlog_lock_updated(XLogRecPtr lsn, XLogRecord *record) htup = (HeapTupleHeader) PageGetItem(page, lp); + htup->t_infomask &= ~(HEAP_XMAX_BITS | HEAP_MOVED); + htup->t_infomask2 &= ~HEAP_KEYS_UPDATED; fix_infomask_from_infobits(xlrec->infobits_set, &htup->t_infomask, &htup->t_infomask2); HeapTupleHeaderSetXmax(htup, xlrec->xmax); [parent: 6c243f90ab69]