aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-03-17 12:36:11 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2014-03-17 12:36:11 -0400
commitd70cf811f7dd26c07dbb78df4a51b667e7a3489b (patch)
tree415d82acb416f4e3cc87b9c8783037d593600a06 /src
parentd663d4399e767223e454302ea90d04f78b2f9d29 (diff)
downloadpostgresql-d70cf811f7dd26c07dbb78df4a51b667e7a3489b.tar.gz
postgresql-d70cf811f7dd26c07dbb78df4a51b667e7a3489b.zip
During index build, check and elog (not just Assert) for broken HOT chain.
The recently-fixed bug in WAL replay could result in not finding a parent tuple for a heap-only tuple. The existing code would either Assert or generate an invalid index entry, neither of which is desirable. Throw a regular error instead.
Diffstat (limited to 'src')
-rw-r--r--src/backend/catalog/index.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 877d7678f7a..432067488b7 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -2438,7 +2438,10 @@ IndexBuildHeapScan(Relation heapRelation,
rootTuple = *heapTuple;
offnum = ItemPointerGetOffsetNumber(&heapTuple->t_self);
- Assert(OffsetNumberIsValid(root_offsets[offnum - 1]));
+ 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));
ItemPointerSetOffsetNumber(&rootTuple.t_self,
root_offsets[offnum - 1]);
@@ -2856,7 +2859,11 @@ validate_index_heapscan(Relation heapRelation,
if (HeapTupleIsHeapOnly(heapTuple))
{
root_offnum = root_offsets[root_offnum - 1];
- Assert(OffsetNumberIsValid(root_offnum));
+ 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));
ItemPointerSetOffsetNumber(&rootTuple, root_offnum);
}