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

Commit1632724

Browse files
committed
amcheck: Fix ordering bug in update_cached_xid_range()
The initialization order in update_cached_xid_range() was wrong, callingFullTransactionIdFromXidAndCtx() before setting->next_xid. FullTransactionIdFromXidAndCtx() uses ->next_xid.In most situations this will not cause visible issues, because the next callto update_cached_xid_range() will use a less wrong ->next_xid. It's rare thatxids advance fast enough for this to be a problem.Found while adding more asserts to the 64bit xid infrastructure.Reviewed-by: Mark Dilger <mark.dilger@enterprisedb.com>Discussion:https://postgr.es/m/20230108002923.cyoser3ttmt63bfn@awork3.anarazel.deBackpatch: 14-, where heapam verification was introduced
1 parent4e63301 commit1632724

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎contrib/amcheck/verify_heapam.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1576,6 +1576,9 @@ FullTransactionIdFromXidAndCtx(TransactionId xid, const HeapCheckContext *ctx)
15761576
{
15771577
uint32epoch;
15781578

1579+
Assert(TransactionIdIsNormal(ctx->next_xid));
1580+
Assert(FullTransactionIdIsNormal(ctx->next_fxid));
1581+
15791582
if (!TransactionIdIsNormal(xid))
15801583
returnFullTransactionIdFromEpochAndXid(0,xid);
15811584
epoch=EpochFromFullTransactionId(ctx->next_fxid);
@@ -1597,8 +1600,8 @@ update_cached_xid_range(HeapCheckContext *ctx)
15971600
LWLockRelease(XidGenLock);
15981601

15991602
/* And compute alternate versions of the same */
1600-
ctx->oldest_fxid=FullTransactionIdFromXidAndCtx(ctx->oldest_xid,ctx);
16011603
ctx->next_xid=XidFromFullTransactionId(ctx->next_fxid);
1604+
ctx->oldest_fxid=FullTransactionIdFromXidAndCtx(ctx->oldest_xid,ctx);
16021605
}
16031606

16041607
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp