aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gin/ginxlog.c
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-04-14 21:03:01 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-04-14 21:13:19 +0300
commitf1dadd34fa9fccc72800ed206b8c274073dfd039 (patch)
treec77f8ff6c396ba9694060f14b4c925d71bd06f4e /src/backend/access/gin/ginxlog.c
parent69671ab548459814d489315bf5cd421f84e984a4 (diff)
downloadpostgresql-f1dadd34fa9fccc72800ed206b8c274073dfd039.tar.gz
postgresql-f1dadd34fa9fccc72800ed206b8c274073dfd039.zip
Set pd_lower on internal GIN posting tree pages.
This allows squeezing out the unused space in full-page writes. And more importantly, it can be a useful debugging aid. In hindsight we should've done this back when GIN was added - we wouldn't need the 'maxoff' field in the page opaque struct if we had used pd_lower and pd_upper like on normal pages. But as long as there can be pages in the index that have been binary-upgraded from pre-9.4 versions, we can't rely on that, and have to continue using 'maxoff'. Most of the code churn comes from renaming some macros, now that they're used on internal pages, too. This change is completely backwards-compatible, no effect on pg_upgrade.
Diffstat (limited to 'src/backend/access/gin/ginxlog.c')
-rw-r--r--src/backend/access/gin/ginxlog.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/access/gin/ginxlog.c b/src/backend/access/gin/ginxlog.c
index a263a1350cf..4bb59d4312e 100644
--- a/src/backend/access/gin/ginxlog.c
+++ b/src/backend/access/gin/ginxlog.c
@@ -96,7 +96,7 @@ ginRedoCreatePTree(XLogRecPtr lsn, XLogRecord *record)
/* Place page data */
memcpy(GinDataLeafPageGetPostingList(page), ptr, data->size);
- GinDataLeafPageSetPostingListSize(page, data->size);
+ GinDataPageSetDataSize(page, data->size);
PageSetLSN(page, lsn);
@@ -169,7 +169,7 @@ ginRedoRecompress(Page page, ginxlogRecompressDataLeaf *data)
totalsize = SizeOfGinPostingList(plist);
memcpy(GinDataLeafPageGetPostingList(page), plist, totalsize);
- GinDataLeafPageSetPostingListSize(page, totalsize);
+ GinDataPageSetDataSize(page, totalsize);
GinPageSetCompressed(page);
GinPageGetOpaque(page)->maxoff = InvalidOffsetNumber;
}
@@ -296,7 +296,7 @@ ginRedoRecompress(Page page, ginxlogRecompressDataLeaf *data)
}
totalsize = segmentend - (Pointer) GinDataLeafPageGetPostingList(page);
- GinDataLeafPageSetPostingListSize(page, totalsize);
+ GinDataPageSetDataSize(page, totalsize);
}
static void
@@ -423,14 +423,14 @@ ginRedoSplitData(Page lpage, Page rpage, void *rdata)
Pointer lptr = (Pointer) rdata + sizeof(ginxlogSplitDataLeaf);
Pointer rptr = lptr + data->lsize;
- Assert(data->lsize > 0 && data->lsize <= GinDataLeafMaxContentSize);
- Assert(data->rsize > 0 && data->rsize <= GinDataLeafMaxContentSize);
+ Assert(data->lsize > 0 && data->lsize <= GinDataPageMaxDataSize);
+ Assert(data->rsize > 0 && data->rsize <= GinDataPageMaxDataSize);
memcpy(GinDataLeafPageGetPostingList(lpage), lptr, data->lsize);
memcpy(GinDataLeafPageGetPostingList(rpage), rptr, data->rsize);
- GinDataLeafPageSetPostingListSize(lpage, data->lsize);
- GinDataLeafPageSetPostingListSize(rpage, data->rsize);
+ GinDataPageSetDataSize(lpage, data->lsize);
+ GinDataPageSetDataSize(rpage, data->rsize);
*GinDataPageGetRightBound(lpage) = data->lrightbound;
*GinDataPageGetRightBound(rpage) = data->rrightbound;
}