mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-12 07:36:55 +08:00
Improved locking code [skip ci]
This commit is contained in:
@@ -145,9 +145,17 @@ hnswgettuple(IndexScanDesc scan, ScanDirection dir)
|
||||
HnswNormValue(so->normprocinfo, so->collation, &value, NULL);
|
||||
}
|
||||
|
||||
LockPage(scan->indexRelation, HNSW_HEAD_BLKNO, ShareLock);
|
||||
/*
|
||||
* Get a shared lock. This allows vacuum to ensure no in-flight scans
|
||||
* before marking tuples as deleted.
|
||||
*/
|
||||
LockPage(scan->indexRelation, HNSW_SCAN_LOCK, ShareLock);
|
||||
|
||||
so->w = GetScanItems(scan, value);
|
||||
UnlockPage(scan->indexRelation, HNSW_HEAD_BLKNO, ShareLock);
|
||||
|
||||
/* Release shared lock */
|
||||
UnlockPage(scan->indexRelation, HNSW_SCAN_LOCK, ShareLock);
|
||||
|
||||
so->first = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user