summaryrefslogtreecommitdiff
path: root/src/backend/access/gin/ginvacuum.c
diff options
context:
space:
mode:
authorHeikki Linnakangas2014-04-14 18:03:01 +0000
committerHeikki Linnakangas2014-04-14 18:13:19 +0000
commitf1dadd34fa9fccc72800ed206b8c274073dfd039 (patch)
treec77f8ff6c396ba9694060f14b4c925d71bd06f4e /src/backend/access/gin/ginvacuum.c
parent69671ab548459814d489315bf5cd421f84e984a4 (diff)
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/ginvacuum.c')
-rw-r--r--src/backend/access/gin/ginvacuum.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backend/access/gin/ginvacuum.c b/src/backend/access/gin/ginvacuum.c
index 7dcc5cae476..72f734caf8d 100644
--- a/src/backend/access/gin/ginvacuum.c
+++ b/src/backend/access/gin/ginvacuum.c
@@ -301,6 +301,13 @@ ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkn
data.leftBlkno = leftBlkno;
data.rightLink = GinPageGetOpaque(page)->rightlink;
+ /*
+ * We can't pass buffer_std = TRUE, because we didn't set pd_lower
+ * on pre-9.4 versions. The page might've been binary-upgraded from
+ * an older version, and hence not have pd_lower set correctly.
+ * Ditto for the left page, but removing the item from the parent
+ * updated its pd_lower, so we know that's OK at this point.
+ */
rdata[0].buffer = dBuffer;
rdata[0].buffer_std = FALSE;
rdata[0].data = NULL;
@@ -308,7 +315,7 @@ ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkn
rdata[0].next = rdata + 1;
rdata[1].buffer = pBuffer;
- rdata[1].buffer_std = FALSE;
+ rdata[1].buffer_std = TRUE;
rdata[1].data = NULL;
rdata[1].len = 0;
rdata[1].next = rdata + 2;