diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2015-07-27 12:30:26 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2015-07-27 12:31:05 +0300 |
commit | 202aea62a84135256c6aa394af2c4dbfa1700c85 (patch) | |
tree | a11590e55d3eb32a4a2be59e684fdfd6cf70fde5 | |
parent | 2fa8ba34804211714a6e0a7fcf5512423c77f8dd (diff) | |
download | postgresql-202aea62a84135256c6aa394af2c4dbfa1700c85.tar.gz postgresql-202aea62a84135256c6aa394af2c4dbfa1700c85.zip |
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.
-rw-r--r-- | src/backend/access/gin/ginvacuum.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/access/gin/ginvacuum.c b/src/backend/access/gin/ginvacuum.c index eba572b0d8a..1315762ecf9 100644 --- a/src/backend/access/gin/ginvacuum.c +++ b/src/backend/access/gin/ginvacuum.c @@ -710,7 +710,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); |