Skip to content
Snippets Groups Projects
Commit e9e441c9 authored by Teodor Sigaev's avatar Teodor Sigaev
Browse files

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.
parent 80afb62d
No related branches found
No related tags found
No related merge requests found
...@@ -108,7 +108,12 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, ...@@ -108,7 +108,12 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
Assert(itupPtr == BloomPageGetTuple(&state, page, Assert(itupPtr == BloomPageGetTuple(&state, page,
OffsetNumberNext(BloomPageGetMaxOffset(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) countPage < BloomMetaBlockN)
notFullPage[countPage++] = blkno; notFullPage[countPage++] = blkno;
...@@ -116,7 +121,7 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, ...@@ -116,7 +121,7 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
if (itupPtr != itup) if (itupPtr != itup)
{ {
/* Is it empty page now? */ /* Is it empty page now? */
if (itupPtr == BloomPageGetData(page)) if (BloomPageGetMaxOffset(page) == 0)
BloomPageSetDeleted(page); BloomPageSetDeleted(page);
/* Adjust pg_lower */ /* Adjust pg_lower */
((PageHeader) page)->pd_lower = (Pointer) itupPtr - page; ((PageHeader) page)->pd_lower = (Pointer) itupPtr - page;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment