From bafe3b00730184e7f9860cbab545f8b21c1dc70b Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Mon, 27 Jul 2015 12:30:26 +0300 Subject: [PATCH] Reuse all-zero pages in GIN. In GIN, an all-zeros page would be leaked forever, and never reused. Just add them to the FSM in vacuum, and they will be reinitialized when grabbed from the FSM. On master and 9.5, attempting to access the page's opaque struct also caused an assertion failure, although that was otherwise harmless. Reported by Jeff Janes. Backpatch to all supported versions. --- src/backend/access/gin/ginvacuum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/access/gin/ginvacuum.c b/src/backend/access/gin/ginvacuum.c index e6241850e1f..31b765287f6 100644 --- a/src/backend/access/gin/ginvacuum.c +++ b/src/backend/access/gin/ginvacuum.c @@ -756,7 +756,7 @@ ginvacuumcleanup(PG_FUNCTION_ARGS) LockBuffer(buffer, GIN_SHARE); page = (Page) BufferGetPage(buffer); - if (GinPageIsDeleted(page)) + if (PageIsNew(page) || GinPageIsDeleted(page)) { Assert(blkno != GIN_ROOT_BLKNO); RecordFreeIndexPage(index, blkno); -- 2.39.5