diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-03-01 16:23:30 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-03-01 16:23:49 -0500 |
commit | fb1d72f409497a8e217f877184ff1e0056e1394e (patch) | |
tree | 9d38cdd044ff28ecdaba7611118069216fff37f2 /src | |
parent | 491bbc36ea8f206dd0e03687b4d6a773be43a5f9 (diff) | |
download | postgresql-fb1d72f409497a8e217f877184ff1e0056e1394e.tar.gz postgresql-fb1d72f409497a8e217f877184ff1e0056e1394e.zip |
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 d70cf811f 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
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/catalog/index.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 90822d8be6a..85b8cb01d19 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -2574,9 +2574,12 @@ IndexBuildHeapRangeScan(Relation heapRelation, offnum = ItemPointerGetOffsetNumber(&heapTuple->t_self); if (!OffsetNumberIsValid(root_offsets[offnum - 1])) - elog(ERROR, "failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"", - ItemPointerGetBlockNumber(&heapTuple->t_self), - offnum, RelationGetRelationName(heapRelation)); + ereport(ERROR, + (errcode(ERRCODE_DATA_CORRUPTED), + errmsg_internal("failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"", + ItemPointerGetBlockNumber(&heapTuple->t_self), + offnum, + RelationGetRelationName(heapRelation)))); ItemPointerSetOffsetNumber(&rootTuple.t_self, root_offsets[offnum - 1]); @@ -2995,10 +2998,12 @@ validate_index_heapscan(Relation heapRelation, { root_offnum = root_offsets[root_offnum - 1]; if (!OffsetNumberIsValid(root_offnum)) - elog(ERROR, "failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"", - ItemPointerGetBlockNumber(heapcursor), - ItemPointerGetOffsetNumber(heapcursor), - RelationGetRelationName(heapRelation)); + ereport(ERROR, + (errcode(ERRCODE_DATA_CORRUPTED), + errmsg_internal("failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"", + ItemPointerGetBlockNumber(heapcursor), + ItemPointerGetOffsetNumber(heapcursor), + RelationGetRelationName(heapRelation)))); ItemPointerSetOffsetNumber(&rootTuple, root_offnum); } |