1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-28 18:48:04 +03:00

Pass ItemPointer not HeapTuple to IndexBuildCallback.

Not all AMs use HeapTuples internally, making it inconvenient to pass
a HeapTuple. As the index callbacks really only need the TID, not the
full tuple, modify callback to only take ItemPointer.

Author: Ashwin Agrawal
Reviewed-By: Andres Freund
Discussion: https://postgr.es/m/CALfoeis6=8ehuR=VNtHvj3z16cYfCwPdTcpaxU+sfSUJ5QgR3g@mail.gmail.com
This commit is contained in:
Andres Freund
2019-11-08 00:44:52 -08:00
parent 71a8a4f6e3
commit aae50236e4
10 changed files with 29 additions and 32 deletions

View File

@@ -269,7 +269,7 @@ static void _bt_spooldestroy(BTSpool *btspool);
static void _bt_spool(BTSpool *btspool, ItemPointer self,
Datum *values, bool *isnull);
static void _bt_leafbuild(BTSpool *btspool, BTSpool *btspool2);
static void _bt_build_callback(Relation index, HeapTuple htup, Datum *values,
static void _bt_build_callback(Relation index, ItemPointer tid, Datum *values,
bool *isnull, bool tupleIsAlive, void *state);
static Page _bt_blnewpage(uint32 level);
static BTPageState *_bt_pagestate(BTWriteState *wstate, uint32 level);
@@ -585,7 +585,7 @@ _bt_leafbuild(BTSpool *btspool, BTSpool *btspool2)
*/
static void
_bt_build_callback(Relation index,
HeapTuple htup,
ItemPointer tid,
Datum *values,
bool *isnull,
bool tupleIsAlive,
@@ -598,12 +598,12 @@ _bt_build_callback(Relation index,
* processing
*/
if (tupleIsAlive || buildstate->spool2 == NULL)
_bt_spool(buildstate->spool, &htup->t_self, values, isnull);
_bt_spool(buildstate->spool, tid, values, isnull);
else
{
/* dead tuples are put into spool2 */
buildstate->havedead = true;
_bt_spool(buildstate->spool2, &htup->t_self, values, isnull);
_bt_spool(buildstate->spool2, tid, values, isnull);
}
buildstate->indtuples += 1;