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

Commit5ab0ad5

Browse files
committed
VACUUM must make sure that a HEAP_MARKED_FOR_UPDATE tuple gets marked
as either HEAP_XMAX_COMMITTED or HEAP_XMAX_INVALID once the updatingtransaction is gone. Otherwise some other transaction may come alongand try to test the commit status of t_xmax later --- which could beafter VACUUM has recycled the CLOG status for that xact. Bug introducedin post-beta4 bug fix.
1 parenteb5e8ba commit5ab0ad5

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

‎src/backend/utils/time/tqual.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.45 2001/12/19 17:18:39 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.46 2002/01/11 20:07:03 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -742,7 +742,21 @@ HeapTupleSatisfiesVacuum(HeapTupleHeader tuple, TransactionId OldestXmin)
742742

743743
if (tuple->t_infomask&HEAP_MARKED_FOR_UPDATE)
744744
{
745-
/* "deleting" xact really only marked it for update */
745+
/*
746+
* "Deleting" xact really only marked it for update, so the tuple
747+
* is live in any case. However, we must make sure that either
748+
* XMAX_COMMITTED or XMAX_INVALID gets set once the xact is gone;
749+
* otherwise it is unsafe to recycle CLOG status after vacuuming.
750+
*/
751+
if (!(tuple->t_infomask&HEAP_XMAX_COMMITTED))
752+
{
753+
if (TransactionIdIsInProgress(tuple->t_xmax))
754+
returnHEAPTUPLE_LIVE;
755+
if (TransactionIdDidCommit(tuple->t_xmax))
756+
tuple->t_infomask |=HEAP_XMAX_COMMITTED;
757+
else/* it's either aborted or crashed */
758+
tuple->t_infomask |=HEAP_XMAX_INVALID;
759+
}
746760
returnHEAPTUPLE_LIVE;
747761
}
748762

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp