diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2013-11-20 16:57:41 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2013-11-20 16:57:41 +0200 |
commit | 501012631e7d2e1c22f60b11ff8cb62ae021625e (patch) | |
tree | a697f2617f6a5f71cf7ccc38a1c1b8b5876009a8 /src/backend/access/gin/gindatapage.c | |
parent | 04965ad40e10677ceec94d871a183e73023b238f (diff) | |
download | postgresql-501012631e7d2e1c22f60b11ff8cb62ae021625e.tar.gz postgresql-501012631e7d2e1c22f60b11ff8cb62ae021625e.zip |
Refactor the internal GIN B-tree interface for forming a downlink.
This creates a new gin-btree callback function for creating a downlink for
a page. Previously, ginxlog.c duplicated the logic used during normal
operation.
Diffstat (limited to 'src/backend/access/gin/gindatapage.c')
-rw-r--r-- | src/backend/access/gin/gindatapage.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/backend/access/gin/gindatapage.c b/src/backend/access/gin/gindatapage.c index 67d748bd711..fbdde1dc024 100644 --- a/src/backend/access/gin/gindatapage.c +++ b/src/backend/access/gin/gindatapage.c @@ -580,12 +580,20 @@ dataSplitPage(GinBtree btree, Buffer lbuf, Buffer rbuf, OffsetNumber off, XLogRe rdata[1].len = MAXALIGN(maxoff * sizeofitem); rdata[1].next = NULL; - /* Prepare a downlink tuple for insertion to the parent */ + return lpage; +} + +/* + * Prepare the state in 'btree' for inserting a downlink for given buffer. + */ +static void +dataPrepareDownlink(GinBtree btree, Buffer lbuf) +{ + Page lpage = BufferGetPage(lbuf); + PostingItemSetBlockNumber(&(btree->pitem), BufferGetBlockNumber(lbuf)); btree->pitem.key = *GinDataPageGetRightBound(lpage); - btree->rightblkno = BufferGetBlockNumber(rbuf); - - return lpage; + btree->rightblkno = GinPageGetOpaque(lpage)->rightlink; } /* @@ -704,6 +712,7 @@ ginPrepareDataScan(GinBtree btree, Relation index) btree->placeToPage = dataPlaceToPage; btree->splitPage = dataSplitPage; btree->fillRoot = ginDataFillRoot; + btree->prepareDownlink = dataPrepareDownlink; btree->isData = TRUE; btree->isDelete = FALSE; |