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

Commit9a57858

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 parent4162a55 commit9a57858

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
@@ -7721,11 +7721,19 @@ heap_xlog_lock(XLogRecPtr lsn, XLogRecord *record)
77217721

77227722
fix_infomask_from_infobits(xlrec->infobits_set,&htup->t_infomask,
77237723
&htup->t_infomask2);
7724-
HeapTupleHeaderClearHotUpdated(htup);
7724+
7725+
/*
7726+
* Clear relevant update flags, but only if the modified infomask says
7727+
* there's no update.
7728+
*/
7729+
if (HEAP_XMAX_IS_LOCKED_ONLY(htup->t_infomask))
7730+
{
7731+
HeapTupleHeaderClearHotUpdated(htup);
7732+
/* Make sure there is no forward chain link in t_ctid */
7733+
htup->t_ctid=xlrec->target.tid;
7734+
}
77257735
HeapTupleHeaderSetXmax(htup,xlrec->locking_xid);
77267736
HeapTupleHeaderSetCmax(htup,FirstCommandId, false);
7727-
/* Make sure there is no forward chain link in t_ctid */
7728-
htup->t_ctid=xlrec->target.tid;
77297737
PageSetLSN(page,lsn);
77307738
MarkBufferDirty(buffer);
77317739
UnlockReleaseBuffer(buffer);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp