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

Commit44e4bbf

Browse files
committed
Remove special case for xmin == xmax in HeapTupleSatisfiesVacuum().
VACUUM was willing to remove a committed-dead tuple immediately if it wasdeleted by the same transaction that inserted it. The idea is that such atuple could never have been visible to any other transaction, so we don'tneed to keep it around to satisfy MVCC snapshots. However, there wasalready an exception for tuples that are part of an update chain, and thisexception created a problem: we might remove TOAST tuples (which are neverpart of an update chain) while their parent tuple stayed around (if it waspart of an update chain). This didn't pose a problem for most things,since the parent tuple is indeed dead: no snapshot will ever consider itvisible. But MVCC-safe CLUSTER had a problem, since it will try to copyRECENTLY_DEAD tuples to the new table. It then has to copy their TOASTdata too, and would fail if VACUUM had already removed the toast tuples.Easiest fix is to get rid of the special case for xmin == xmax. This maydelay reclaiming dead space for a little bit in some cases, but it's by farthe most reliable way to fix the issue.Per bug #5998 from Mark Reid. Back-patch to 8.3, which is the oldestversion with MVCC-safe CLUSTER.
1 parentfd2e2d0 commit44e4bbf

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

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

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,27 +1217,11 @@ HeapTupleSatisfiesVacuum(HeapTupleHeader tuple, TransactionId OldestXmin,
12171217
}
12181218

12191219
/*
1220-
* Deleter committed, but check special cases.
1220+
* Deleter committed, but perhaps it was recent enough that some open
1221+
* transactions could still see the tuple.
12211222
*/
1222-
1223-
if (TransactionIdEquals(HeapTupleHeaderGetXmin(tuple),
1224-
HeapTupleHeaderGetXmax(tuple)))
1225-
{
1226-
/*
1227-
* Inserter also deleted it, so it was never visible to anyone else.
1228-
* However, we can only remove it early if it's not an updated tuple;
1229-
* else its parent tuple is linking to it via t_ctid, and this tuple
1230-
* mustn't go away before the parent does.
1231-
*/
1232-
if (!(tuple->t_infomask&HEAP_UPDATED))
1233-
returnHEAPTUPLE_DEAD;
1234-
}
1235-
12361223
if (!TransactionIdPrecedes(HeapTupleHeaderGetXmax(tuple),OldestXmin))
1237-
{
1238-
/* deleting xact is too recent, tuple could still be visible */
12391224
returnHEAPTUPLE_RECENTLY_DEAD;
1240-
}
12411225

12421226
/* Otherwise, it's dead and removable */
12431227
returnHEAPTUPLE_DEAD;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp