Skip to content

Commit 084fc00

Browse files
author
Artur Zakirov
committed
Move isBuild to RumState struct
1 parent 04dadd7 commit 084fc00

File tree

5 files changed

+5
-7
lines changed

5 files changed

+5
-7
lines changed

rum.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ typedef struct RumOptions
327327
typedef struct RumState
328328
{
329329
Relation index;
330+
bool isBuild;
330331
bool oneCol; /* true if single-column index */
331332
bool useAlternativeOrder;
332333
AttrNumber attrnOrderByColumn;
@@ -458,7 +459,6 @@ typedef struct RumBtreeData
458459
Relation index;
459460
RumState *rumstate; /* not valid in a data scan */
460461
bool fullScan;
461-
bool isBuild;
462462

463463
BlockNumber rightblkno;
464464

rumdatapage.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,8 @@ dataSplitPageInternal(RumBtree btree, Buffer lbuf, Buffer rbuf,
12341234
* we suppose that during index creation table scaned from begin to end,
12351235
* so ItemPointers are monotonically increased..
12361236
*/
1237-
if (btree->isBuild && RumPageRightMost(newlPage))
1237+
if (btree->rumstate && btree->rumstate->isBuild
1238+
&& RumPageRightMost(newlPage))
12381239
separator = freeSpace / sizeofitem;
12391240
else
12401241
separator = maxoff / 2;
@@ -1444,7 +1445,6 @@ rumPrepareDataScan(RumBtree btree, Relation index, OffsetNumber attnum, RumState
14441445
btree->searchMode = FALSE;
14451446
btree->isDelete = FALSE;
14461447
btree->fullScan = FALSE;
1447-
btree->isBuild = FALSE;
14481448

14491449
btree->entryAttnum = attnum;
14501450
}

rumentrypage.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,6 @@ rumPrepareEntryScan(RumBtree btree, OffsetNumber attnum,
552552
btree->isData = FALSE;
553553
btree->searchMode = FALSE;
554554
btree->fullScan = FALSE;
555-
btree->isBuild = FALSE;
556555

557556
btree->entryAttnum = attnum;
558557
btree->entryKey = key;

ruminsert.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ addItemPointersToLeafTuple(RumState * rumstate,
285285

286286
/* Now insert the TIDs-to-be-added into the posting tree */
287287
gdi = rumPrepareScanPostingTree(rumstate->index, postingRoot, FALSE, attnum, rumstate);
288-
gdi->btree.isBuild = (buildStats != NULL);
289288

290289
rumInsertItemPointers(rumstate, attnum, gdi, items, nitem, buildStats);
291290

@@ -365,7 +364,6 @@ buildFreshLeafTuple(RumState * rumstate,
365364

366365
gdi = rumPrepareScanPostingTree(rumstate->index, postingRoot, FALSE,
367366
attnum, rumstate);
368-
gdi->btree.isBuild = (buildStats != NULL);
369367

370368
rumInsertItemPointers(rumstate,
371369
attnum,
@@ -429,7 +427,6 @@ rumEntryInsert(RumState * rumstate,
429427
/* insert into posting tree */
430428
gdi = rumPrepareScanPostingTree(rumstate->index, rootPostingTree,
431429
FALSE, attnum, rumstate);
432-
gdi->btree.isBuild = (buildStats != NULL);
433430
rumInsertItemPointers(rumstate, attnum, gdi, items,
434431
nitem, buildStats);
435432
pfree(gdi);
@@ -584,6 +581,7 @@ rumbuild(Relation heap, Relation index, struct IndexInfo *indexInfo)
584581
RelationGetRelationName(index));
585582

586583
initRumState(&buildstate.rumstate, index);
584+
buildstate.rumstate.isBuild = true;
587585
buildstate.indtuples = 0;
588586
memset(&buildstate.buildStats, 0, sizeof(GinStatsData));
589587

rumutil.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ initRumState(RumState * state, Relation index)
119119
MemSet(state, 0, sizeof(RumState));
120120

121121
state->index = index;
122+
state->isBuild = false;
122123
state->oneCol = (origTupdesc->natts == 1) ? true : false;
123124
state->origTupdesc = origTupdesc;
124125

0 commit comments

Comments
 (0)