mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user