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

Commitc370125

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 parent3857234 commitc370125

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
@@ -2476,7 +2476,10 @@ IndexBuildHeapScan(Relation heapRelation,
24762476
rootTuple=*heapTuple;
24772477
offnum=ItemPointerGetOffsetNumber(&heapTuple->t_self);
24782478

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

24812484
ItemPointerSetOffsetNumber(&rootTuple.t_self,
24822485
root_offsets[offnum-1]);
@@ -2891,7 +2894,11 @@ validate_index_heapscan(Relation heapRelation,
28912894
if (HeapTupleIsHeapOnly(heapTuple))
28922895
{
28932896
root_offnum=root_offsets[root_offnum-1];
2894-
Assert(OffsetNumberIsValid(root_offnum));
2897+
if (!OffsetNumberIsValid(root_offnum))
2898+
elog(ERROR,"failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
2899+
ItemPointerGetBlockNumber(heapcursor),
2900+
ItemPointerGetOffsetNumber(heapcursor),
2901+
RelationGetRelationName(heapRelation));
28952902
ItemPointerSetOffsetNumber(&rootTuple,root_offnum);
28962903
}
28972904

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp