Rename nbtree tuple macros.

Rename two function-style macros, removing the word "inner".  This makes
things more consistent.
This commit is contained in:
Peter Geoghegan 2019-12-16 17:49:45 -08:00
parent 5d43c3c54d
commit fcf3b6917b
7 changed files with 24 additions and 24 deletions

View File

@ -758,7 +758,7 @@ bt_check_level_from_leftmost(BtreeCheckState *state, BtreeLevel level)
state->target,
P_FIRSTDATAKEY(opaque));
itup = (IndexTuple) PageGetItem(state->target, itemid);
nextleveldown.leftmost = BTreeInnerTupleGetDownLink(itup);
nextleveldown.leftmost = BTreeTupleGetDownLink(itup);
nextleveldown.level = opaque->btpo.level - 1;
}
else
@ -978,7 +978,7 @@ bt_target_page_check(BtreeCheckState *state)
/* Fingerprint downlink blocks in heapallindexed + readonly case */
if (state->heapallindexed && state->readonly && !P_ISLEAF(topaque))
{
BlockNumber childblock = BTreeInnerTupleGetDownLink(itup);
BlockNumber childblock = BTreeTupleGetDownLink(itup);
bloom_add_element(state->downlinkfilter,
(unsigned char *) &childblock,
@ -1267,7 +1267,7 @@ bt_target_page_check(BtreeCheckState *state)
*/
if (!P_ISLEAF(topaque) && state->readonly)
{
BlockNumber childblock = BTreeInnerTupleGetDownLink(itup);
BlockNumber childblock = BTreeTupleGetDownLink(itup);
bt_downlink_check(state, skey, childblock);
}
@ -1746,7 +1746,7 @@ bt_downlink_missing_check(BtreeCheckState *state)
itemid = PageGetItemIdCareful(state, state->targetblock, state->target,
P_FIRSTDATAKEY(topaque));
itup = (IndexTuple) PageGetItem(state->target, itemid);
childblk = BTreeInnerTupleGetDownLink(itup);
childblk = BTreeTupleGetDownLink(itup);
for (;;)
{
CHECK_FOR_INTERRUPTS();
@ -1771,7 +1771,7 @@ bt_downlink_missing_check(BtreeCheckState *state)
itemid = PageGetItemIdCareful(state, childblk, child,
P_FIRSTDATAKEY(copaque));
itup = (IndexTuple) PageGetItem(child, itemid);
childblk = BTreeInnerTupleGetDownLink(itup);
childblk = BTreeTupleGetDownLink(itup);
/* Be slightly more pro-active in freeing this memory, just in case */
pfree(child);
}

View File

@ -1807,7 +1807,7 @@ _bt_insert_parent(Relation rel,
/* form an index tuple that points at the new right page */
new_item = CopyIndexTuple(ritem);
BTreeInnerTupleSetDownLink(new_item, rbknum);
BTreeTupleSetDownLink(new_item, rbknum);
/*
* Re-find and write lock the parent of buf.
@ -1991,7 +1991,7 @@ _bt_getstackbuf(Relation rel, BTStack stack, BlockNumber child)
itemid = PageGetItemId(page, offnum);
item = (IndexTuple) PageGetItem(page, itemid);
if (BTreeInnerTupleGetDownLink(item) == child)
if (BTreeTupleGetDownLink(item) == child)
{
/* Return accurate pointer to where link is now */
stack->bts_blkno = blkno;
@ -2007,7 +2007,7 @@ _bt_getstackbuf(Relation rel, BTStack stack, BlockNumber child)
itemid = PageGetItemId(page, offnum);
item = (IndexTuple) PageGetItem(page, itemid);
if (BTreeInnerTupleGetDownLink(item) == child)
if (BTreeTupleGetDownLink(item) == child)
{
/* Return accurate pointer to where link is now */
stack->bts_blkno = blkno;
@ -2096,7 +2096,7 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
left_item_sz = sizeof(IndexTupleData);
left_item = (IndexTuple) palloc(left_item_sz);
left_item->t_info = left_item_sz;
BTreeInnerTupleSetDownLink(left_item, lbkno);
BTreeTupleSetDownLink(left_item, lbkno);
BTreeTupleSetNAtts(left_item, 0);
/*
@ -2107,7 +2107,7 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
right_item_sz = ItemIdGetLength(itemid);
item = (IndexTuple) PageGetItem(lpage, itemid);
right_item = CopyIndexTuple(item);
BTreeInnerTupleSetDownLink(right_item, rbkno);
BTreeTupleSetDownLink(right_item, rbkno);
/* NO EREPORT(ERROR) from here till newroot op is logged */
START_CRIT_SECTION();

View File

@ -1605,17 +1605,17 @@ _bt_mark_page_halfdead(Relation rel, Buffer leafbuf, BTStack stack)
#ifdef USE_ASSERT_CHECKING
itemid = PageGetItemId(page, topoff);
itup = (IndexTuple) PageGetItem(page, itemid);
Assert(BTreeInnerTupleGetDownLink(itup) == target);
Assert(BTreeTupleGetDownLink(itup) == target);
#endif
nextoffset = OffsetNumberNext(topoff);
itemid = PageGetItemId(page, nextoffset);
itup = (IndexTuple) PageGetItem(page, itemid);
if (BTreeInnerTupleGetDownLink(itup) != rightsib)
if (BTreeTupleGetDownLink(itup) != rightsib)
ereport(ERROR,
(errcode(ERRCODE_INDEX_CORRUPTED),
errmsg_internal("right sibling %u of block %u is not next child %u of block %u in index \"%s\"",
rightsib, target, BTreeInnerTupleGetDownLink(itup),
rightsib, target, BTreeTupleGetDownLink(itup),
BufferGetBlockNumber(topparent), RelationGetRelationName(rel))));
/*
@ -1638,7 +1638,7 @@ _bt_mark_page_halfdead(Relation rel, Buffer leafbuf, BTStack stack)
itemid = PageGetItemId(page, topoff);
itup = (IndexTuple) PageGetItem(page, itemid);
BTreeInnerTupleSetDownLink(itup, rightsib);
BTreeTupleSetDownLink(itup, rightsib);
nextoffset = OffsetNumberNext(topoff);
PageIndexTupleDelete(page, nextoffset);
@ -1902,7 +1902,7 @@ _bt_unlink_halfdead_page(Relation rel, Buffer leafbuf, bool *rightsib_empty)
/* remember the next non-leaf child down in the branch. */
itemid = PageGetItemId(page, P_FIRSTDATAKEY(opaque));
nextchild = BTreeInnerTupleGetDownLink((IndexTuple) PageGetItem(page, itemid));
nextchild = BTreeTupleGetDownLink((IndexTuple) PageGetItem(page, itemid));
if (nextchild == leafblkno)
nextchild = InvalidBlockNumber;
}

View File

@ -142,7 +142,7 @@ _bt_search(Relation rel, BTScanInsert key, Buffer *bufP, int access,
offnum = _bt_binsrch(rel, key, *bufP);
itemid = PageGetItemId(page, offnum);
itup = (IndexTuple) PageGetItem(page, itemid);
blkno = BTreeInnerTupleGetDownLink(itup);
blkno = BTreeTupleGetDownLink(itup);
par_blkno = BufferGetBlockNumber(*bufP);
/*
@ -2120,7 +2120,7 @@ _bt_get_endpoint(Relation rel, uint32 level, bool rightmost,
offnum = P_FIRSTDATAKEY(opaque);
itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, offnum));
blkno = BTreeInnerTupleGetDownLink(itup);
blkno = BTreeTupleGetDownLink(itup);
buf = _bt_relandgetbuf(rel, buf, blkno, BT_READ);
page = BufferGetPage(buf);

View File

@ -982,7 +982,7 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, IndexTuple itup)
P_LEFTMOST((BTPageOpaque) PageGetSpecialPointer(opage)));
Assert(BTreeTupleGetNAtts(state->btps_lowkey, wstate->index) == 0 ||
!P_LEFTMOST((BTPageOpaque) PageGetSpecialPointer(opage)));
BTreeInnerTupleSetDownLink(state->btps_lowkey, oblkno);
BTreeTupleSetDownLink(state->btps_lowkey, oblkno);
_bt_buildadd(wstate, state->btps_next, state->btps_lowkey);
pfree(state->btps_lowkey);
@ -1089,7 +1089,7 @@ _bt_uppershutdown(BTWriteState *wstate, BTPageState *state)
P_LEFTMOST(opaque));
Assert(BTreeTupleGetNAtts(s->btps_lowkey, wstate->index) == 0 ||
!P_LEFTMOST(opaque));
BTreeInnerTupleSetDownLink(s->btps_lowkey, blkno);
BTreeTupleSetDownLink(s->btps_lowkey, blkno);
_bt_buildadd(wstate, s->btps_next, s->btps_lowkey);
pfree(s->btps_lowkey);
s->btps_lowkey = NULL;

View File

@ -597,11 +597,11 @@ btree_xlog_mark_page_halfdead(uint8 info, XLogReaderState *record)
nextoffset = OffsetNumberNext(poffset);
itemid = PageGetItemId(page, nextoffset);
itup = (IndexTuple) PageGetItem(page, itemid);
rightsib = BTreeInnerTupleGetDownLink(itup);
rightsib = BTreeTupleGetDownLink(itup);
itemid = PageGetItemId(page, poffset);
itup = (IndexTuple) PageGetItem(page, itemid);
BTreeInnerTupleSetDownLink(itup, rightsib);
BTreeTupleSetDownLink(itup, rightsib);
nextoffset = OffsetNumberNext(poffset);
PageIndexTupleDelete(page, nextoffset);

View File

@ -298,10 +298,10 @@ typedef struct BTMetaPageData
#define BT_N_KEYS_OFFSET_MASK 0x0FFF
#define BT_HEAP_TID_ATTR 0x1000
/* Get/set downlink block number */
#define BTreeInnerTupleGetDownLink(itup) \
/* Get/set downlink block number in pivot tuple */
#define BTreeTupleGetDownLink(itup) \
ItemPointerGetBlockNumberNoCheck(&((itup)->t_tid))
#define BTreeInnerTupleSetDownLink(itup, blkno) \
#define BTreeTupleSetDownLink(itup, blkno) \
ItemPointerSetBlockNumber(&((itup)->t_tid), (blkno))
/*