Skip to content

Commit 2b2c5aa

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 aad956a commit 2b2c5aa

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

25912591
if (!OffsetNumberIsValid(root_offsets[offnum - 1]))
2592-
elog(ERROR, "failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
2593-
ItemPointerGetBlockNumber(&heapTuple->t_self),
2594-
offnum, RelationGetRelationName(heapRelation));
2592+
ereport(ERROR,
2593+
(errcode(ERRCODE_DATA_CORRUPTED),
2594+
errmsg_internal("failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
2595+
ItemPointerGetBlockNumber(&heapTuple->t_self),
2596+
offnum,
2597+
RelationGetRelationName(heapRelation))));
25952598

25962599
ItemPointerSetOffsetNumber(&rootTuple.t_self,
25972600
root_offsets[offnum - 1]);
@@ -3054,10 +3057,12 @@ validate_index_heapscan(Relation heapRelation,
30543057
{
30553058
root_offnum = root_offsets[root_offnum - 1];
30563059
if (!OffsetNumberIsValid(root_offnum))
3057-
elog(ERROR, "failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
3058-
ItemPointerGetBlockNumber(heapcursor),
3059-
ItemPointerGetOffsetNumber(heapcursor),
3060-
RelationGetRelationName(heapRelation));
3060+
ereport(ERROR,
3061+
(errcode(ERRCODE_DATA_CORRUPTED),
3062+
errmsg_internal("failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
3063+
ItemPointerGetBlockNumber(heapcursor),
3064+
ItemPointerGetOffsetNumber(heapcursor),
3065+
RelationGetRelationName(heapRelation))));
30613066
ItemPointerSetOffsetNumber(&rootTuple, root_offnum);
30623067
}
30633068

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy