summaryrefslogtreecommitdiff
path: root/contrib/bloom/blvacuum.c
diff options
context:
space:
mode:
authorTeodor Sigaev2016-04-02 11:20:46 +0000
committerTeodor Sigaev2016-04-02 11:20:46 +0000
commite9e441c9fac6cbc0510cded6abb9d0e6b646ecaf (patch)
treea2402fa220f535900fcfebe09d1f4657b9a2a73f /contrib/bloom/blvacuum.c
parent80afb62db0f118f70367a357cef0509a11112ebb (diff)
Prevent mark as deleted and as 'has free space' page in bloom module
Vacuum might put page into list of pages with some free space and mark as deleted at the same time.
Diffstat (limited to 'contrib/bloom/blvacuum.c')
-rw-r--r--contrib/bloom/blvacuum.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/contrib/bloom/blvacuum.c b/contrib/bloom/blvacuum.c
index 9fee3c1294f..d2703b02b2c 100644
--- a/contrib/bloom/blvacuum.c
+++ b/contrib/bloom/blvacuum.c
@@ -108,7 +108,12 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
Assert(itupPtr == BloomPageGetTuple(&state, page,
OffsetNumberNext(BloomPageGetMaxOffset(page))));
- if (BloomPageGetFreeSpace(&state, page) > state.sizeOfBloomTuple &&
+ /*
+ * Add page to notFullPage list if we will not mark page as deleted and
+ * there is a free space on it
+ */
+ if (BloomPageGetMaxOffset(page) == 0 &&
+ BloomPageGetFreeSpace(&state, page) > state.sizeOfBloomTuple &&
countPage < BloomMetaBlockN)
notFullPage[countPage++] = blkno;
@@ -116,7 +121,7 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
if (itupPtr != itup)
{
/* Is it empty page now? */
- if (itupPtr == BloomPageGetData(page))
+ if (BloomPageGetMaxOffset(page) == 0)
BloomPageSetDeleted(page);
/* Adjust pg_lower */
((PageHeader) page)->pd_lower = (Pointer) itupPtr - page;