1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

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.
This commit is contained in:
Heikki Linnakangas
2013-11-27 15:43:05 +02:00
parent 4118f7e8ed
commit ce5326eed3
7 changed files with 310 additions and 219 deletions

View File

@ -774,7 +774,7 @@ ginContinueSplit(ginIncompleteSplit *split)
GinState ginstate;
Relation reln;
Buffer buffer;
GinBtreeStack stack;
GinBtreeStack *stack;
/*
* elog(NOTICE,"ginContinueSplit root:%u l:%u r:%u", split->rootBlkno,
@ -802,22 +802,22 @@ ginContinueSplit(ginIncompleteSplit *split)
}
else
{
ginPrepareDataScan(&btree, reln);
ginPrepareDataScan(&btree, reln, split->rootBlkno);
}
stack.blkno = split->leftBlkno;
stack.buffer = buffer;
stack.off = InvalidOffsetNumber;
stack.parent = NULL;
stack = palloc(sizeof(GinBtreeStack));
stack->blkno = split->leftBlkno;
stack->buffer = buffer;
stack->off = InvalidOffsetNumber;
stack->parent = NULL;
ginFindParents(&btree, &stack, split->rootBlkno);
ginFindParents(&btree, stack);
LockBuffer(stack->parent->buffer, GIN_UNLOCK);
ginFinishSplit(&btree, stack, NULL);
btree.prepareDownlink(&btree, buffer);
ginInsertValue(&btree, stack.parent, NULL);
/* buffer is released by ginFinishSplit */
FreeFakeRelcacheEntry(reln);
UnlockReleaseBuffer(buffer);
}
void