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:
@ -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
|
||||
|
Reference in New Issue
Block a user