diff options
Diffstat (limited to 'contrib/bloom/blinsert.c')
-rw-r--r-- | contrib/bloom/blinsert.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/contrib/bloom/blinsert.c b/contrib/bloom/blinsert.c index 3953af996bb..78eec5c67e0 100644 --- a/contrib/bloom/blinsert.c +++ b/contrib/bloom/blinsert.c @@ -237,6 +237,13 @@ blinsert(Relation index, Datum *values, bool *isnull, state = GenericXLogStart(index); page = GenericXLogRegisterBuffer(state, buffer, 0); + /* + * We might have found a page that was recently deleted by VACUUM. If + * so, we can reuse it, but we must reinitialize it. + */ + if (PageIsNew(page) || BloomPageIsDeleted(page)) + BloomInitPage(page, 0); + if (BloomPageAddItem(&blstate, page, itup)) { /* Success! Apply the change, clean up, and exit */ @@ -295,6 +302,10 @@ blinsert(Relation index, Datum *values, bool *isnull, LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE); page = GenericXLogRegisterBuffer(state, buffer, 0); + /* Basically same logic as above */ + if (PageIsNew(page) || BloomPageIsDeleted(page)) + BloomInitPage(page, 0); + if (BloomPageAddItem(&blstate, page, itup)) { /* Success! Apply the changes, clean up, and exit */ |