@@ -3947,10 +3947,8 @@ heap_inplace_update(Relation relation, HeapTuple tuple)
39473947 * because this function is applied during WAL recovery, when we don't have
39483948 * access to any such state, and can't depend on the hint bits to be set.)
39493949 *
3950- * In lazy VACUUM, we call this while initially holding only a shared lock
3951- * on the tuple's buffer. If any change is needed, we trade that in for an
3952- * exclusive lock before making the change. Caller should pass the buffer ID
3953- * if shared lock is held, InvalidBuffer if exclusive lock is already held.
3950+ * If the tuple is in a shared buffer, caller must hold an exclusive lock on
3951+ * that buffer.
39543952 *
39553953 * Note: it might seem we could make the changes without exclusive lock, since
39563954 * TransactionId read/write is assumed atomic anyway. However there is a race
@@ -3962,8 +3960,7 @@ heap_inplace_update(Relation relation, HeapTuple tuple)
39623960 * infomask bits.
39633961 */
39643962bool
3965- heap_freeze_tuple (HeapTupleHeader tuple ,TransactionId cutoff_xid ,
3966- Buffer buf )
3963+ heap_freeze_tuple (HeapTupleHeader tuple ,TransactionId cutoff_xid )
39673964{
39683965bool changed = false;
39693966TransactionId xid ;
@@ -3972,13 +3969,6 @@ heap_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
39723969if (TransactionIdIsNormal (xid )&&
39733970TransactionIdPrecedes (xid ,cutoff_xid ))
39743971{
3975- if (buf != InvalidBuffer )
3976- {
3977- /* trade in share lock for exclusive lock */
3978- LockBuffer (buf ,BUFFER_LOCK_UNLOCK );
3979- LockBuffer (buf ,BUFFER_LOCK_EXCLUSIVE );
3980- buf = InvalidBuffer ;
3981- }
39823972HeapTupleHeaderSetXmin (tuple ,FrozenTransactionId );
39833973
39843974/*
@@ -3990,28 +3980,12 @@ heap_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
39903980changed = true;
39913981}
39923982
3993- /*
3994- * When we release shared lock, it's possible for someone else to change
3995- * xmax before we get the lock back, so repeat the check after acquiring
3996- * exclusive lock.(We don't need this pushup for xmin, because only
3997- * VACUUM could be interested in changing an existing tuple's xmin, and
3998- * there's only one VACUUM allowed on a table at a time.)
3999- */
4000- recheck_xmax :
40013983if (!(tuple -> t_infomask & HEAP_XMAX_IS_MULTI ))
40023984{
40033985xid = HeapTupleHeaderGetXmax (tuple );
40043986if (TransactionIdIsNormal (xid )&&
40053987TransactionIdPrecedes (xid ,cutoff_xid ))
40063988{
4007- if (buf != InvalidBuffer )
4008- {
4009- /* trade in share lock for exclusive lock */
4010- LockBuffer (buf ,BUFFER_LOCK_UNLOCK );
4011- LockBuffer (buf ,BUFFER_LOCK_EXCLUSIVE );
4012- buf = InvalidBuffer ;
4013- gotorecheck_xmax ;/* see comment above */
4014- }
40153989HeapTupleHeaderSetXmax (tuple ,InvalidTransactionId );
40163990
40173991/*
@@ -4046,30 +4020,15 @@ heap_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
40464020}
40474021
40484022/*
4049- * Although xvac per se could only be set by old-style VACUUM FULL, it
4050- * shares physical storage space with cmax, and so could be wiped out by
4051- * someone setting xmax. Hence recheck after changing lock, same as for
4052- * xmax itself.
4053- *
40544023 * Old-style VACUUM FULL is gone, but we have to keep this code as long as
40554024 * we support having MOVED_OFF/MOVED_IN tuples in the database.
40564025 */
4057- recheck_xvac :
40584026if (tuple -> t_infomask & HEAP_MOVED )
40594027{
40604028xid = HeapTupleHeaderGetXvac (tuple );
40614029if (TransactionIdIsNormal (xid )&&
40624030TransactionIdPrecedes (xid ,cutoff_xid ))
40634031{
4064- if (buf != InvalidBuffer )
4065- {
4066- /* trade in share lock for exclusive lock */
4067- LockBuffer (buf ,BUFFER_LOCK_UNLOCK );
4068- LockBuffer (buf ,BUFFER_LOCK_EXCLUSIVE );
4069- buf = InvalidBuffer ;
4070- gotorecheck_xvac ;/* see comment above */
4071- }
4072-
40734032/*
40744033 * If a MOVED_OFF tuple is not dead, the xvac transaction must
40754034 * have failed; whereas a non-dead MOVED_IN tuple must mean the
@@ -4711,7 +4670,7 @@ heap_xlog_freeze(XLogRecPtr lsn, XLogRecord *record)
47114670ItemId lp = PageGetItemId (page ,* offsets );
47124671HeapTupleHeader tuple = (HeapTupleHeader )PageGetItem (page ,lp );
47134672
4714- (void )heap_freeze_tuple (tuple ,cutoff_xid , InvalidBuffer );
4673+ (void )heap_freeze_tuple (tuple ,cutoff_xid );
47154674offsets ++ ;
47164675}
47174676}