Wait for selects to complete

This commit is contained in:
Andrew Kane
2023-08-21 02:24:53 -07:00
parent 3a4ac34756
commit fc29e78724
3 changed files with 8 additions and 3 deletions
+3
View File
@@ -4,6 +4,7 @@
#include "hnsw.h"
#include "pgstat.h"
#include "storage/bufmgr.h"
#include "storage/lmgr.h"
#include "utils/memutils.h"
/*
@@ -144,7 +145,9 @@ hnswgettuple(IndexScanDesc scan, ScanDirection dir)
HnswNormValue(so->normprocinfo, so->collation, &value, NULL);
}
LockPage(scan->indexRelation, HNSW_HEAD_BLKNO, ShareLock);
so->w = GetScanItems(scan, value);
UnlockPage(scan->indexRelation, HNSW_HEAD_BLKNO, ShareLock);
so->first = false;
}
+1 -3
View File
@@ -625,9 +625,7 @@ HnswSearchLayer(Datum q, List *ep, int ef, int lc, Relation index, FmgrInfo *pro
else
HnswLoadElement(e->element, &eDistance, &q, index, procinfo, collation, inserting);
/* Skip if fully deleted */
if (e->element->deleted)
continue;
Assert(!e->element->deleted);
/* Skip self for vacuuming update */
if (skipElement != NULL && e->element->neighborPage == skipElement->neighborPage && e->element->neighborOffno == skipElement->neighborOffno)
+4
View File
@@ -404,6 +404,10 @@ MarkDeleted(HnswVacuumState * vacuumstate)
Relation index = vacuumstate->index;
BufferAccessStrategy bas = vacuumstate->bas;
/* Wait for selects to complete */
LockPage(index, HNSW_HEAD_BLKNO, ExclusiveLock);
UnlockPage(index, HNSW_HEAD_BLKNO, ExclusiveLock);
while (BlockNumberIsValid(blkno))
{
Buffer buf;