1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-08 11:42:09 +03:00

Further GIN refactoring.

Merge some functions that were always called together. Makes the code
little bit more readable.
This commit is contained in:
Heikki Linnakangas
2013-11-20 16:09:14 +02:00
parent b21de4e7b3
commit 04965ad40e
6 changed files with 77 additions and 128 deletions

View File

@ -81,7 +81,6 @@ addItemPointersToLeafTuple(GinState *ginstate,
{
/* posting list would be too big, convert to posting tree */
BlockNumber postingRoot;
GinPostingTreeScan *gdi;
/*
* Initialize posting tree with the old tuple's posting list. It's
@ -94,12 +93,9 @@ addItemPointersToLeafTuple(GinState *ginstate,
buildStats);
/* Now insert the TIDs-to-be-added into the posting tree */
gdi = ginPrepareScanPostingTree(ginstate->index, postingRoot, FALSE);
gdi->btree.isBuild = (buildStats != NULL);
ginInsertItemPointers(gdi, items, nitem, buildStats);
pfree(gdi);
ginInsertItemPointers(ginstate->index, postingRoot,
items, nitem,
buildStats);
/* And build a new posting-tree-only result tuple */
res = GinFormTuple(ginstate, attnum, key, category, NULL, 0, true);
@ -177,7 +173,7 @@ ginEntryInsert(GinState *ginstate,
ginPrepareEntryScan(&btree, attnum, key, category, ginstate);
stack = ginFindLeafPage(&btree, NULL);
stack = ginFindLeafPage(&btree, GIN_ROOT_BLKNO, false);
page = BufferGetPage(stack->buffer);
if (btree.findItem(&btree, stack))
@ -189,18 +185,15 @@ ginEntryInsert(GinState *ginstate,
{
/* add entries to existing posting tree */
BlockNumber rootPostingTree = GinGetPostingTree(itup);
GinPostingTreeScan *gdi;
/* release all stack */
LockBuffer(stack->buffer, GIN_UNLOCK);
freeGinBtreeStack(stack);
/* insert into posting tree */
gdi = ginPrepareScanPostingTree(ginstate->index, rootPostingTree, FALSE);
gdi->btree.isBuild = (buildStats != NULL);
ginInsertItemPointers(gdi, items, nitem, buildStats);
pfree(gdi);
ginInsertItemPointers(ginstate->index, rootPostingTree,
items, nitem,
buildStats);
return;
}