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

Commita42f515

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 parent7865280 commita42f515

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
@@ -1578,6 +1578,9 @@ FullTransactionIdFromXidAndCtx(TransactionId xid, const HeapCheckContext *ctx)
15781578
{
15791579
uint32epoch;
15801580

1581+
Assert(TransactionIdIsNormal(ctx->next_xid));
1582+
Assert(FullTransactionIdIsNormal(ctx->next_fxid));
1583+
15811584
if (!TransactionIdIsNormal(xid))
15821585
returnFullTransactionIdFromEpochAndXid(0,xid);
15831586
epoch=EpochFromFullTransactionId(ctx->next_fxid);
@@ -1599,8 +1602,8 @@ update_cached_xid_range(HeapCheckContext *ctx)
15991602
LWLockRelease(XidGenLock);
16001603

16011604
/* And compute alternate versions of the same */
1602-
ctx->oldest_fxid=FullTransactionIdFromXidAndCtx(ctx->oldest_xid,ctx);
16031605
ctx->next_xid=XidFromFullTransactionId(ctx->next_fxid);
1606+
ctx->oldest_fxid=FullTransactionIdFromXidAndCtx(ctx->oldest_xid,ctx);
16041607
}
16051608

16061609
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp