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

Commitd70cf81

Browse files
committed
During index build, check and elog (not just Assert) for broken HOT chain.
The recently-fixed bug in WAL replay could result in not finding a parenttuple for a heap-only tuple. The existing code would either Assert orgenerate an invalid index entry, neither of which is desirable. Throw aregular error instead.
1 parentd663d43 commitd70cf81

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

‎src/backend/catalog/index.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,7 +2438,10 @@ IndexBuildHeapScan(Relation heapRelation,
24382438
rootTuple=*heapTuple;
24392439
offnum=ItemPointerGetOffsetNumber(&heapTuple->t_self);
24402440

2441-
Assert(OffsetNumberIsValid(root_offsets[offnum-1]));
2441+
if (!OffsetNumberIsValid(root_offsets[offnum-1]))
2442+
elog(ERROR,"failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
2443+
ItemPointerGetBlockNumber(&heapTuple->t_self),
2444+
offnum,RelationGetRelationName(heapRelation));
24422445

24432446
ItemPointerSetOffsetNumber(&rootTuple.t_self,
24442447
root_offsets[offnum-1]);
@@ -2856,7 +2859,11 @@ validate_index_heapscan(Relation heapRelation,
28562859
if (HeapTupleIsHeapOnly(heapTuple))
28572860
{
28582861
root_offnum=root_offsets[root_offnum-1];
2859-
Assert(OffsetNumberIsValid(root_offnum));
2862+
if (!OffsetNumberIsValid(root_offnum))
2863+
elog(ERROR,"failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
2864+
ItemPointerGetBlockNumber(heapcursor),
2865+
ItemPointerGetOffsetNumber(heapcursor),
2866+
RelationGetRelationName(heapRelation));
28602867
ItemPointerSetOffsetNumber(&rootTuple,root_offnum);
28612868
}
28622869

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp