mirror of
https://github.com/pgvector/pgvector.git
synced 2026-06-30 17:51:18 +08:00
Wait for selects to complete
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user