Skip to content

Commit 8ecdc2f

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 477ad05 commit 8ecdc2f

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

28642864
if (!OffsetNumberIsValid(root_offsets[offnum - 1]))
2865-
elog(ERROR, "failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
2866-
ItemPointerGetBlockNumber(&heapTuple->t_self),
2867-
offnum, RelationGetRelationName(heapRelation));
2865+
ereport(ERROR,
2866+
(errcode(ERRCODE_DATA_CORRUPTED),
2867+
errmsg_internal("failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
2868+
ItemPointerGetBlockNumber(&heapTuple->t_self),
2869+
offnum,
2870+
RelationGetRelationName(heapRelation))));
28682871

28692872
ItemPointerSetOffsetNumber(&rootTuple.t_self,
28702873
root_offsets[offnum - 1]);
@@ -3327,10 +3330,12 @@ validate_index_heapscan(Relation heapRelation,
33273330
{
33283331
root_offnum = root_offsets[root_offnum - 1];
33293332
if (!OffsetNumberIsValid(root_offnum))
3330-
elog(ERROR, "failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
3331-
ItemPointerGetBlockNumber(heapcursor),
3332-
ItemPointerGetOffsetNumber(heapcursor),
3333-
RelationGetRelationName(heapRelation));
3333+
ereport(ERROR,
3334+
(errcode(ERRCODE_DATA_CORRUPTED),
3335+
errmsg_internal("failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
3336+
ItemPointerGetBlockNumber(heapcursor),
3337+
ItemPointerGetOffsetNumber(heapcursor),
3338+
RelationGetRelationName(heapRelation))));
33343339
ItemPointerSetOffsetNumber(&rootTuple, root_offnum);
33353340
}
33363341

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