diff --git a/src/hnswscan.c b/src/hnswscan.c index e79a367..ce1a5fc 100644 --- a/src/hnswscan.c +++ b/src/hnswscan.c @@ -233,7 +233,11 @@ hnswgettuple(IndexScanDesc scan, ScanDirection dir) } else { - /* TODO Figure out locking */ + /* + * Locking ensures when neighbors are read, the elements they + * reference will not be marked as deleted (and replaced) + * during the iteration + */ LockPage(scan->indexRelation, HNSW_SCAN_LOCK, ShareLock); HnswBench("scan iteration", so->w = ResumeScanItems(scan));