diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c index 9a3ca695d6..adaa570566 100644 --- a/src/backend/access/nbtree/nbtinsert.c +++ b/src/backend/access/nbtree/nbtinsert.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.162 2007/11/16 19:53:50 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.163 2007/12/31 04:52:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -338,7 +338,7 @@ _bt_check_unique(Relation rel, IndexTuple itup, Relation heapRel, if (!P_IGNORE(opaque)) break; if (P_RIGHTMOST(opaque)) - elog(ERROR, "fell off the end of \"%s\"", + elog(ERROR, "fell off the end of index \"%s\"", RelationGetRelationName(rel)); } maxoff = PageGetMaxOffsetNumber(page); @@ -492,7 +492,7 @@ _bt_findinsertloc(Relation rel, if (!P_IGNORE(lpageop)) break; if (P_RIGHTMOST(lpageop)) - elog(ERROR, "fell off the end of \"%s\"", + elog(ERROR, "fell off the end of index \"%s\"", RelationGetRelationName(rel)); } _bt_relbuf(rel, buf); @@ -840,7 +840,9 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright, item = (IndexTuple) PageGetItem(origpage, itemid); if (PageAddItem(rightpage, (Item) item, itemsz, rightoff, false, false) == InvalidOffsetNumber) - elog(PANIC, "failed to add hikey to the right sibling"); + elog(PANIC, "failed to add hikey to the right sibling" + " while splitting block %u of index \"%s\"", + BufferGetBlockNumber(buf), RelationGetRelationName(rel)); rightoff = OffsetNumberNext(rightoff); } @@ -865,7 +867,9 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright, } if (PageAddItem(leftpage, (Item) item, itemsz, leftoff, false, false) == InvalidOffsetNumber) - elog(PANIC, "failed to add hikey to the left sibling"); + elog(PANIC, "failed to add hikey to the left sibling" + " while splitting block %u of index \"%s\"", + BufferGetBlockNumber(buf), RelationGetRelationName(rel)); leftoff = OffsetNumberNext(leftoff); /* @@ -942,7 +946,10 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright, spage = BufferGetPage(sbuf); sopaque = (BTPageOpaque) PageGetSpecialPointer(spage); if (sopaque->btpo_prev != ropaque->btpo_prev) - elog(PANIC, "right sibling's left-link doesn't match"); + elog(PANIC, "right sibling's left-link doesn't match: " + "block %u links to %u instead of expected %u in index \"%s\"", + ropaque->btpo_next, sopaque->btpo_prev, ropaque->btpo_prev, + RelationGetRelationName(rel)); /* * Check to see if we can set the SPLIT_END flag in the right-hand @@ -1305,7 +1312,7 @@ _bt_findsplitloc(Relation rel, * in case ... */ if (!state.have_split) - elog(ERROR, "could not find a feasible split point for \"%s\"", + elog(ERROR, "could not find a feasible split point for index \"%s\"", RelationGetRelationName(rel)); *newitemonleft = state.newitemonleft; @@ -1509,7 +1516,7 @@ _bt_insert_parent(Relation rel, /* Check for error only after writing children */ if (pbuf == InvalidBuffer) - elog(ERROR, "failed to re-find parent key in \"%s\" for split pages %u/%u", + elog(ERROR, "failed to re-find parent key in index \"%s\" for split pages %u/%u", RelationGetRelationName(rel), bknum, rbknum); /* Recursively update the parent */ @@ -1717,7 +1724,9 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf) */ if (PageAddItem(rootpage, (Item) new_item, itemsz, P_HIKEY, false, false) == InvalidOffsetNumber) - elog(PANIC, "failed to add leftkey to new root page"); + elog(PANIC, "failed to add leftkey to new root page" + " while splitting block %u of index \"%s\"", + BufferGetBlockNumber(lbuf), RelationGetRelationName(rel)); pfree(new_item); /* @@ -1735,7 +1744,9 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf) */ if (PageAddItem(rootpage, (Item) new_item, itemsz, P_FIRSTKEY, false, false) == InvalidOffsetNumber) - elog(PANIC, "failed to add rightkey to new root page"); + elog(PANIC, "failed to add rightkey to new root page" + " while splitting block %u of index \"%s\"", + BufferGetBlockNumber(lbuf), RelationGetRelationName(rel)); pfree(new_item); MarkBufferDirty(rootbuf); @@ -1822,7 +1833,7 @@ _bt_pgaddtup(Relation rel, if (PageAddItem(page, (Item) itup, itemsize, itup_off, false, false) == InvalidOffsetNumber) - elog(PANIC, "failed to add item to the %s for \"%s\"", + elog(PANIC, "failed to add item to the %s in index \"%s\"", where, RelationGetRelationName(rel)); } diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c index 8eee5a74cc..4f9045db4a 100644 --- a/src/backend/access/nbtree/nbtpage.c +++ b/src/backend/access/nbtree/nbtpage.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.104 2007/11/15 21:14:32 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.105 2007/12/31 04:52:05 tgl Exp $ * * NOTES * Postgres btree pages look like ordinary relation pages. The opaque @@ -293,14 +293,14 @@ _bt_getroot(Relation rel, int access) /* it's dead, Jim. step right one page */ if (P_RIGHTMOST(rootopaque)) - elog(ERROR, "no live root page found in \"%s\"", + elog(ERROR, "no live root page found in index \"%s\"", RelationGetRelationName(rel)); rootblkno = rootopaque->btpo_next; } /* Note: can't check btpo.level on deleted pages */ if (rootopaque->btpo.level != rootlevel) - elog(ERROR, "root page %u of \"%s\" has level %u, expected %u", + elog(ERROR, "root page %u of index \"%s\" has level %u, expected %u", rootblkno, RelationGetRelationName(rel), rootopaque->btpo.level, rootlevel); } @@ -395,14 +395,14 @@ _bt_gettrueroot(Relation rel) /* it's dead, Jim. step right one page */ if (P_RIGHTMOST(rootopaque)) - elog(ERROR, "no live root page found in \"%s\"", + elog(ERROR, "no live root page found in index \"%s\"", RelationGetRelationName(rel)); rootblkno = rootopaque->btpo_next; } /* Note: can't check btpo.level on deleted pages */ if (rootopaque->btpo.level != rootlevel) - elog(ERROR, "root page %u of \"%s\" has level %u, expected %u", + elog(ERROR, "root page %u of index \"%s\" has level %u, expected %u", rootblkno, RelationGetRelationName(rel), rootopaque->btpo.level, rootlevel); @@ -761,7 +761,7 @@ _bt_parent_deletion_safe(Relation rel, BlockNumber target, BTStack stack) ItemPointerSet(&(stack->bts_btentry.t_tid), target, P_HIKEY); pbuf = _bt_getstackbuf(rel, stack, BT_READ); if (pbuf == InvalidBuffer) - elog(ERROR, "failed to re-find parent key in \"%s\" for deletion target page %u", + elog(ERROR, "failed to re-find parent key in index \"%s\" for deletion target page %u", RelationGetRelationName(rel), target); parent = stack->bts_blkno; poffset = stack->bts_offset; @@ -1019,7 +1019,7 @@ _bt_pagedel(Relation rel, Buffer buf, BTStack stack, bool vacuum_full) return 0; } if (opaque->btpo_prev != leftsib) - elog(ERROR, "left link changed unexpectedly in block %u of \"%s\"", + elog(ERROR, "left link changed unexpectedly in block %u of index \"%s\"", target, RelationGetRelationName(rel)); /* @@ -1035,7 +1035,7 @@ _bt_pagedel(Relation rel, Buffer buf, BTStack stack, bool vacuum_full) ItemPointerSet(&(stack->bts_btentry.t_tid), target, P_HIKEY); pbuf = _bt_getstackbuf(rel, stack, BT_WRITE); if (pbuf == InvalidBuffer) - elog(ERROR, "failed to re-find parent key in \"%s\" for deletion target page %u", + elog(ERROR, "failed to re-find parent key in index \"%s\" for deletion target page %u", RelationGetRelationName(rel), target); parent = stack->bts_blkno; poffset = stack->bts_offset; @@ -1056,7 +1056,7 @@ _bt_pagedel(Relation rel, Buffer buf, BTStack stack, bool vacuum_full) if (poffset == P_FIRSTDATAKEY(opaque)) parent_half_dead = true; else - elog(ERROR, "failed to delete rightmost child %u of %u in \"%s\"", + elog(ERROR, "failed to delete rightmost child %u of block %u in index \"%s\"", target, parent, RelationGetRelationName(rel)); } else @@ -1138,7 +1138,8 @@ _bt_pagedel(Relation rel, Buffer buf, BTStack stack, bool vacuum_full) itemid = PageGetItemId(page, nextoffset); itup = (IndexTuple) PageGetItem(page, itemid); if (ItemPointerGetBlockNumber(&(itup->t_tid)) != rightsib) - elog(PANIC, "right sibling is not next child in \"%s\"", + elog(PANIC, "right sibling %u of block %u is not next child of %u in index \"%s\"", + rightsib, target, BufferGetBlockNumber(pbuf), RelationGetRelationName(rel)); PageIndexTupleDelete(page, nextoffset); } diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c index 7b71f544f8..e87ef26c6d 100644 --- a/src/backend/access/nbtree/nbtsearch.c +++ b/src/backend/access/nbtree/nbtsearch.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.114 2007/11/15 21:14:32 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.115 2007/12/31 04:52:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -192,7 +192,7 @@ _bt_moveright(Relation rel, } if (P_IGNORE(opaque)) - elog(ERROR, "fell off the end of \"%s\"", + elog(ERROR, "fell off the end of index \"%s\"", RelationGetRelationName(rel)); return buf; @@ -1282,7 +1282,7 @@ _bt_walk_left(Relation rel, Buffer buf) for (;;) { if (P_RIGHTMOST(opaque)) - elog(ERROR, "fell off the end of \"%s\"", + elog(ERROR, "fell off the end of index \"%s\"", RelationGetRelationName(rel)); blkno = opaque->btpo_next; buf = _bt_relandgetbuf(rel, buf, blkno, BT_READ); @@ -1305,8 +1305,8 @@ _bt_walk_left(Relation rel, Buffer buf) * into an infinite loop if there's anything wrong. */ if (opaque->btpo_prev == lblkno) - elog(ERROR, "could not find left sibling in \"%s\"", - RelationGetRelationName(rel)); + elog(ERROR, "could not find left sibling of block %u in index \"%s\"", + obknum, RelationGetRelationName(rel)); /* Okay to try again with new lblkno value */ } } @@ -1364,7 +1364,7 @@ _bt_get_endpoint(Relation rel, uint32 level, bool rightmost) { blkno = opaque->btpo_next; if (blkno == P_NONE) - elog(ERROR, "fell off the end of \"%s\"", + elog(ERROR, "fell off the end of index \"%s\"", RelationGetRelationName(rel)); buf = _bt_relandgetbuf(rel, buf, blkno, BT_READ); page = BufferGetPage(buf); @@ -1375,7 +1375,8 @@ _bt_get_endpoint(Relation rel, uint32 level, bool rightmost) if (opaque->btpo.level == level) break; if (opaque->btpo.level < level) - elog(ERROR, "btree level %u not found", level); + elog(ERROR, "btree level %u not found in index \"%s\"", + level, RelationGetRelationName(rel)); /* Descend to leftmost or rightmost child page */ if (rightmost)