mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-12 23:56:55 +08:00
Wait for selects to complete
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
#include "hnsw.h"
|
#include "hnsw.h"
|
||||||
#include "pgstat.h"
|
#include "pgstat.h"
|
||||||
#include "storage/bufmgr.h"
|
#include "storage/bufmgr.h"
|
||||||
|
#include "storage/lmgr.h"
|
||||||
#include "utils/memutils.h"
|
#include "utils/memutils.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -144,7 +145,9 @@ hnswgettuple(IndexScanDesc scan, ScanDirection dir)
|
|||||||
HnswNormValue(so->normprocinfo, so->collation, &value, NULL);
|
HnswNormValue(so->normprocinfo, so->collation, &value, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LockPage(scan->indexRelation, HNSW_HEAD_BLKNO, ShareLock);
|
||||||
so->w = GetScanItems(scan, value);
|
so->w = GetScanItems(scan, value);
|
||||||
|
UnlockPage(scan->indexRelation, HNSW_HEAD_BLKNO, ShareLock);
|
||||||
so->first = false;
|
so->first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -625,9 +625,7 @@ HnswSearchLayer(Datum q, List *ep, int ef, int lc, Relation index, FmgrInfo *pro
|
|||||||
else
|
else
|
||||||
HnswLoadElement(e->element, &eDistance, &q, index, procinfo, collation, inserting);
|
HnswLoadElement(e->element, &eDistance, &q, index, procinfo, collation, inserting);
|
||||||
|
|
||||||
/* Skip if fully deleted */
|
Assert(!e->element->deleted);
|
||||||
if (e->element->deleted)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Skip self for vacuuming update */
|
/* Skip self for vacuuming update */
|
||||||
if (skipElement != NULL && e->element->neighborPage == skipElement->neighborPage && e->element->neighborOffno == skipElement->neighborOffno)
|
if (skipElement != NULL && e->element->neighborPage == skipElement->neighborPage && e->element->neighborOffno == skipElement->neighborOffno)
|
||||||
|
|||||||
@@ -404,6 +404,10 @@ MarkDeleted(HnswVacuumState * vacuumstate)
|
|||||||
Relation index = vacuumstate->index;
|
Relation index = vacuumstate->index;
|
||||||
BufferAccessStrategy bas = vacuumstate->bas;
|
BufferAccessStrategy bas = vacuumstate->bas;
|
||||||
|
|
||||||
|
/* Wait for selects to complete */
|
||||||
|
LockPage(index, HNSW_HEAD_BLKNO, ExclusiveLock);
|
||||||
|
UnlockPage(index, HNSW_HEAD_BLKNO, ExclusiveLock);
|
||||||
|
|
||||||
while (BlockNumberIsValid(blkno))
|
while (BlockNumberIsValid(blkno))
|
||||||
{
|
{
|
||||||
Buffer buf;
|
Buffer buf;
|
||||||
|
|||||||
Reference in New Issue
Block a user