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

Commit701ec55

Browse files
committed
amcheck: Fix verify_heapam for tuples where xmin or xmax is 0.
In such cases, get_xid_status() doesn't set its output parameter (thethird argument), so we shouldn't fall through to code which will testthe value of that parameter. There are five existing calls toget_xid_status(), three of which seem to already handle this caseproperly. This commit tries to fix the other two.If we're checking xmin and find that it is invalid (i.e. 0) justreport that as corruption, similar to what's already done in thethree cases that seem correct. If we're checking xmax and findthat's invalid, that's fine: it just means that the tuple hasn'tbeen updated or deleted.Thanks to Andres Freund and valgrind for finding this problem, andalso to Andres for having a look at the patch. This bug seems to goall the way back to where verify_heapam was first introduced, butwasn't detected until recently, possibly because of the new test casesadded for update chain verification. Back-patch to v14, where thiscode showed up.Discussion:http://postgr.es/m/CA+TgmoZAYzQZqyUparXy_ks3OEOfLD9-bEXt8N-2tS1qghX9gQ@mail.gmail.com
1 parentb6bf90e commit701ec55

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎contrib/amcheck/verify_heapam.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,9 @@ check_tuple_visibility(HeapCheckContext *ctx)
739739
switch (get_xid_status(xmin,ctx,&xmin_status))
740740
{
741741
caseXID_INVALID:
742+
report_corruption(ctx,
743+
pstrdup("xmin is invalid"));
744+
return false;
742745
caseXID_BOUNDS_OK:
743746
break;
744747
caseXID_IN_FUTURE:
@@ -1074,6 +1077,9 @@ check_tuple_visibility(HeapCheckContext *ctx)
10741077
xmax=HeapTupleHeaderGetRawXmax(tuphdr);
10751078
switch (get_xid_status(xmax,ctx,&xmax_status))
10761079
{
1080+
caseXID_INVALID:
1081+
ctx->tuple_could_be_pruned= false;
1082+
return true;
10771083
caseXID_IN_FUTURE:
10781084
report_corruption(ctx,
10791085
psprintf("xmax %u equals or exceeds next valid transaction ID %u:%u",
@@ -1096,7 +1102,6 @@ check_tuple_visibility(HeapCheckContext *ctx)
10961102
XidFromFullTransactionId(ctx->oldest_fxid)));
10971103
return false;/* corrupt */
10981104
caseXID_BOUNDS_OK:
1099-
caseXID_INVALID:
11001105
break;
11011106
}
11021107

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp