Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6bfa88a

Browse files
committed
Fix WAL replay of locking an updated tuple
We were resetting the tuple's HEAP_HOT_UPDATED flag as well as t_ctid onWAL replay of a tuple-lock operation, which is incorrect when the tupleis already updated.Back-patch to 9.3. The clearing of both header elements was therepreviously, but since no update could be present on a tuple that wasbeing locked, it was harmless.Bug reported by Peter Geoghegan and Greg Stark inCAM3SWZTMQiCi5PV5OWHb+bYkUcnCk=O67w0cSswPvV7XfUcU5g@mail.gmail.com andCAM-w4HPTOeMT4KP0OJK+mGgzgcTOtLRTvFZyvD0O4aH-7dxo3Q@mail.gmail.comrespectively; diagnosis by Andres Freund.
1 parent00976f2 commit6bfa88a

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

‎src/backend/access/heap/heapam.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8016,11 +8016,19 @@ heap_xlog_lock(XLogRecPtr lsn, XLogRecord *record)
80168016

80178017
fix_infomask_from_infobits(xlrec->infobits_set,&htup->t_infomask,
80188018
&htup->t_infomask2);
8019-
HeapTupleHeaderClearHotUpdated(htup);
8019+
8020+
/*
8021+
* Clear relevant update flags, but only if the modified infomask says
8022+
* there's no update.
8023+
*/
8024+
if (HEAP_XMAX_IS_LOCKED_ONLY(htup->t_infomask))
8025+
{
8026+
HeapTupleHeaderClearHotUpdated(htup);
8027+
/* Make sure there is no forward chain link in t_ctid */
8028+
htup->t_ctid=xlrec->target.tid;
8029+
}
80208030
HeapTupleHeaderSetXmax(htup,xlrec->locking_xid);
80218031
HeapTupleHeaderSetCmax(htup,FirstCommandId, false);
8022-
/* Make sure there is no forward chain link in t_ctid */
8023-
htup->t_ctid=xlrec->target.tid;
80248032
PageSetLSN(page,lsn);
80258033
MarkBufferDirty(buffer);
80268034
UnlockReleaseBuffer(buffer);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp