Skip to content

Commit a4fed31

Browse files
committed
Use ereport not elog for some corrupt-HOT-chain reports.
These errors have been seen in the field in corrupted-data situations. It seems worthwhile to report them with ERRCODE_DATA_CORRUPTED, rather than the generic ERRCODE_INTERNAL_ERROR, for the benefit of log monitoring and tools like amcheck. However, use errmsg_internal so that the text strings still aren't translated; it seems unlikely to be worth translators' time to do so. Back-patch to 9.3, like the predecessor commit d70cf81 that introduced these elog calls originally (replacing Asserts). Peter Geoghegan Discussion: https://postgr.es/m/CAH2-Wzmn4-Pg-UGFwyuyK-wiTih9j32pwg_7T9iwqXpAUZr=Mg@mail.gmail.com
1 parent 3ee2383 commit a4fed31

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/backend/catalog/index.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,9 +2437,12 @@ IndexBuildHeapScan(Relation heapRelation,
24372437
offnum = ItemPointerGetOffsetNumber(&heapTuple->t_self);
24382438

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

24442447
ItemPointerSetOffsetNumber(&rootTuple.t_self,
24452448
root_offsets[offnum - 1]);
@@ -2858,10 +2861,12 @@ validate_index_heapscan(Relation heapRelation,
28582861
{
28592862
root_offnum = root_offsets[root_offnum - 1];
28602863
if (!OffsetNumberIsValid(root_offnum))
2861-
elog(ERROR, "failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
2862-
ItemPointerGetBlockNumber(heapcursor),
2863-
ItemPointerGetOffsetNumber(heapcursor),
2864-
RelationGetRelationName(heapRelation));
2864+
ereport(ERROR,
2865+
(errcode(ERRCODE_DATA_CORRUPTED),
2866+
errmsg_internal("failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
2867+
ItemPointerGetBlockNumber(heapcursor),
2868+
ItemPointerGetOffsetNumber(heapcursor),
2869+
RelationGetRelationName(heapRelation))));
28652870
ItemPointerSetOffsetNumber(&rootTuple, root_offnum);
28662871
}
28672872

0 commit comments

Comments
 (0)