aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gin/ginxlog.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/ginxlog.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/ginxlog.c')
-rw-r--r--src/backend/access/gin/ginxlog.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/backend/access/gin/ginxlog.c b/src/backend/access/gin/ginxlog.c
index ddac3430613..ca7bee1f340 100644
--- a/src/backend/access/gin/ginxlog.c
+++ b/src/backend/access/gin/ginxlog.c
@@ -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