aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gin/gininsert.c
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2013-11-27 15:43:05 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2013-11-27 15:43:05 +0200
commitce5326eed386959aac7a322880896ddeade7fd52 (patch)
tree16f903bb47df48ab748c485c7e350e5dced2c253 /src/backend/access/gin/gininsert.c
parent4118f7e8ede8a3616189b53983aea293fd0b3cb1 (diff)
downloadpostgresql-ce5326eed386959aac7a322880896ddeade7fd52.tar.gz
postgresql-ce5326eed386959aac7a322880896ddeade7fd52.zip
More GIN refactoring.
Separate the insertion payload from the more static portions of GinBtree. GinBtree now only contains information related to searching the tree, and the information of what to insert is passed separately. Add root block number to GinBtree, instead of passing it around all the functions as argument. Split off ginFinishSplit() from ginInsertValue(). ginFinishSplit is responsible for finding the parent and inserting the downlink to it.
Diffstat (limited to 'src/backend/access/gin/gininsert.c')
-rw-r--r--src/backend/access/gin/gininsert.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c
index 0a2883aae3d..556e31854ea 100644
--- a/src/backend/access/gin/gininsert.c
+++ b/src/backend/access/gin/gininsert.c
@@ -163,17 +163,20 @@ ginEntryInsert(GinState *ginstate,
GinStatsData *buildStats)
{
GinBtreeData btree;
+ GinBtreeEntryInsertData insertdata;
GinBtreeStack *stack;
IndexTuple itup;
Page page;
+ insertdata.isDelete = FALSE;
+
/* During index build, count the to-be-inserted entry */
if (buildStats)
buildStats->nEntries++;
ginPrepareEntryScan(&btree, attnum, key, category, ginstate);
- stack = ginFindLeafPage(&btree, GIN_ROOT_BLKNO, false);
+ stack = ginFindLeafPage(&btree, false);
page = BufferGetPage(stack->buffer);
if (btree.findItem(&btree, stack))
@@ -201,7 +204,7 @@ ginEntryInsert(GinState *ginstate,
itup = addItemPointersToLeafTuple(ginstate, itup,
items, nitem, buildStats);
- btree.isDelete = TRUE;
+ insertdata.isDelete = TRUE;
}
else
{
@@ -211,8 +214,8 @@ ginEntryInsert(GinState *ginstate,
}
/* Insert the new or modified leaf tuple */
- btree.entry = itup;
- ginInsertValue(&btree, stack, buildStats);
+ insertdata.entry = itup;
+ ginInsertValue(&btree, stack, &insertdata, buildStats);
pfree(itup);
}