summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorAndres Freund2023-04-02 03:12:26 +0000
committerAndres Freund2023-04-02 03:18:29 +0000
commit61b313e47eb987682441c675724c22bf4363c9c4 (patch)
treed3cc190f131f23fa00e4d25edcff6d06b1499498 /contrib
parenta88a18b1250b9e6b40536e4dec04d32d655b8140 (diff)
Pass down table relation into more index relation functions
This is done in preparation for logical decoding on standby, which needs to include whether visibility affecting WAL records are about a (user) catalog table. Which is only known for the table, not the indexes. It's also nice to be able to pass the heap relation to GlobalVisTestFor() in vacuumRedirectAndPlaceholder(). Author: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com> Discussion: https://postgr.es/m/21b700c3-eecf-2e05-a699-f8c78dd31ec7@gmail.com
Diffstat (limited to 'contrib')
-rw-r--r--contrib/amcheck/verify_nbtree.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/contrib/amcheck/verify_nbtree.c b/contrib/amcheck/verify_nbtree.c
index 257cff671b..eb280d4893 100644
--- a/contrib/amcheck/verify_nbtree.c
+++ b/contrib/amcheck/verify_nbtree.c
@@ -183,6 +183,7 @@ static inline bool invariant_l_nontarget_offset(BtreeCheckState *state,
OffsetNumber upperbound);
static Page palloc_btree_page(BtreeCheckState *state, BlockNumber blocknum);
static inline BTScanInsert bt_mkscankey_pivotsearch(Relation rel,
+ Relation heaprel,
IndexTuple itup);
static ItemId PageGetItemIdCareful(BtreeCheckState *state, BlockNumber block,
Page page, OffsetNumber offset);
@@ -331,7 +332,7 @@ bt_index_check_internal(Oid indrelid, bool parentcheck, bool heapallindexed,
RelationGetRelationName(indrel))));
/* Extract metadata from metapage, and sanitize it in passing */
- _bt_metaversion(indrel, &heapkeyspace, &allequalimage);
+ _bt_metaversion(indrel, heaprel, &heapkeyspace, &allequalimage);
if (allequalimage && !heapkeyspace)
ereport(ERROR,
(errcode(ERRCODE_INDEX_CORRUPTED),
@@ -1258,7 +1259,7 @@ bt_target_page_check(BtreeCheckState *state)
}
/* Build insertion scankey for current page offset */
- skey = bt_mkscankey_pivotsearch(state->rel, itup);
+ skey = bt_mkscankey_pivotsearch(state->rel, state->heaprel, itup);
/*
* Make sure tuple size does not exceed the relevant BTREE_VERSION
@@ -1768,7 +1769,7 @@ bt_right_page_check_scankey(BtreeCheckState *state)
* memory remaining allocated.
*/
firstitup = (IndexTuple) PageGetItem(rightpage, rightitem);
- return bt_mkscankey_pivotsearch(state->rel, firstitup);
+ return bt_mkscankey_pivotsearch(state->rel, state->heaprel, firstitup);
}
/*
@@ -2681,7 +2682,7 @@ bt_rootdescend(BtreeCheckState *state, IndexTuple itup)
Buffer lbuf;
bool exists;
- key = _bt_mkscankey(state->rel, itup);
+ key = _bt_mkscankey(state->rel, state->heaprel, itup);
Assert(key->heapkeyspace && key->scantid != NULL);
/*
@@ -2694,7 +2695,7 @@ bt_rootdescend(BtreeCheckState *state, IndexTuple itup)
*/
Assert(state->readonly && state->rootdescend);
exists = false;
- stack = _bt_search(state->rel, key, &lbuf, BT_READ, NULL);
+ stack = _bt_search(state->rel, state->heaprel, key, &lbuf, BT_READ, NULL);
if (BufferIsValid(lbuf))
{
@@ -3133,11 +3134,11 @@ palloc_btree_page(BtreeCheckState *state, BlockNumber blocknum)
* the scankey is greater.
*/
static inline BTScanInsert
-bt_mkscankey_pivotsearch(Relation rel, IndexTuple itup)
+bt_mkscankey_pivotsearch(Relation rel, Relation heaprel, IndexTuple itup)
{
BTScanInsert skey;
- skey = _bt_mkscankey(rel, itup);
+ skey = _bt_mkscankey(rel, heaprel, itup);
skey->pivotsearch = true;
return skey;