8000 Use ereport not elog for some corrupt-HOT-chain reports. · itsmadness55/postgres@8e25be4 · GitHub
[go: up one dir, main page]

Skip to content
10000

Commit 8e25be4

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 0ddaaa4 commit 8e25be4

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
@@ -2573,9 +2573,12 @@ IndexBuildHeapRangeScan(Relation heapRelation,
25732573
offnum = ItemPointerGetOffsetNumber(&heapTuple->t_self);
25742574

25752575
if (!OffsetNumberIsValid(root_offsets[offnum - 1]))
2576-
elog(ERROR, "failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
2577-
ItemPointerGetBlockNumber(&heapTuple->t_self),
2578-
offnum, RelationGetRelationName(heapRelation));
2576+
ereport(ERROR,
2577+
(errcode(ERRCODE_DATA_CORRUPTED),
2578+
errmsg_internal("failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
2579+
ItemPointerGetBlockNumber(&heapTuple->t_self),
2580+
offnum,
2581+
RelationGetRelationName(heapRelation))));
25792582

25802583
ItemPointerSetOffsetNumber(&rootTuple.t_self,
25812584
root_offsets[offnum - 1]);
@@ -3042,10 +3045,12 @@ validate_index_heapscan(Relation heapRelation,
30423045
{
30433046
root_offnum = root_offsets[root_offnum - 1];
30443047
if (!OffsetNumberIsValid(root_offnum))
3045-
elog(ERROR, "failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
3046-
ItemPointerGetBlockNumber(heapcursor),
3047-
ItemPointerGetOffsetNumber(heapcursor),
3048-
RelationGetRelationName(heapRelation));
3048+
ereport(ERROR,
3049+
(errcode(ERRCODE_DATA_CORRUPTED),
3050+
errmsg_internal("failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
3051+
ItemPointerGetBlockNumber(heapcursor),
3052+
ItemPointerGetOffsetNumber(heapcursor),
3053+
RelationGetRelationName(heapRelation))));
30493054
ItemPointerSetOffsetNumber(&rootTuple, root_offnum);
30503055
}
30513056

0 commit comments

Comments
 (0)
0