mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
nbtree: Make BTMaxItemSize into object-like macro.
Make nbtree's "1/3 of a page limit" BTMaxItemSize function-like macro (which accepts a "page" argument) into an object-like macro that can be used from code that doesn't have convenient access to an nbtree page. Preparation for an upcoming patch that adds skip scan to nbtree. Parallel index scans that use skip scan will serialize datums (not just SAOP array subscripts) when scheduling primitive scans. BTMaxItemSize will be used by btestimateparallelscan to determine how much DSM to request. Author: Peter Geoghegan <pg@bowt.ie> Discussion: https://postgr.es/m/CAH2-Wz=H_RG5weNGeUG_TkK87tRBnH9mGCQj6WpM4V4FNWKv2g@mail.gmail.com
This commit is contained in:
@@ -3245,7 +3245,7 @@ _bt_check_third_page(Relation rel, Relation heap, bool needheaptidspace,
|
||||
itemsz = MAXALIGN(IndexTupleSize(newtup));
|
||||
|
||||
/* Double check item size against limit */
|
||||
if (itemsz <= BTMaxItemSize(page))
|
||||
if (itemsz <= BTMaxItemSize)
|
||||
return;
|
||||
|
||||
/*
|
||||
@@ -3253,7 +3253,7 @@ _bt_check_third_page(Relation rel, Relation heap, bool needheaptidspace,
|
||||
* index uses version 2 or version 3, or that page is an internal page, in
|
||||
* which case a slightly higher limit applies.
|
||||
*/
|
||||
if (!needheaptidspace && itemsz <= BTMaxItemSizeNoHeapTid(page))
|
||||
if (!needheaptidspace && itemsz <= BTMaxItemSizeNoHeapTid)
|
||||
return;
|
||||
|
||||
/*
|
||||
@@ -3270,8 +3270,7 @@ _bt_check_third_page(Relation rel, Relation heap, bool needheaptidspace,
|
||||
errmsg("index row size %zu exceeds btree version %u maximum %zu for index \"%s\"",
|
||||
itemsz,
|
||||
needheaptidspace ? BTREE_VERSION : BTREE_NOVAC_VERSION,
|
||||
needheaptidspace ? BTMaxItemSize(page) :
|
||||
BTMaxItemSizeNoHeapTid(page),
|
||||
needheaptidspace ? BTMaxItemSize : BTMaxItemSizeNoHeapTid,
|
||||
RelationGetRelationName(rel)),
|
||||
errdetail("Index row references tuple (%u,%u) in relation \"%s\".",
|
||||
ItemPointerGetBlockNumber(BTreeTupleGetHeapTID(newtup)),
|
||||
|
Reference in New Issue
Block a user