From: knizhnik (@knizhnik) <noreply+knizhnik@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] PR #282: Hnsw iterator
Date: Thu, 26 Sep 2024 13:23:51 +0000
Message-ID: <gh-pgvector-pgvector-282-c2376966884@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-282@github.com>
References: <gh-pgvector-pgvector-282@github.com>
Few more questions:
1. Is there race condition between repairing graph in vacuum and scan? Scan is traversing graph, vacuum is reconstructing it. Yes, both are locking current buffer, but this lock lock is released before going to neighbours.
2. Can `HNSW_UPDATE_LOCK` prevent race condition between repairing graph in vacuum and appending elements to the graph (hnswinsert)? This lock is obtained by vacuum to wait completion of all active updates. But then it is immediately released. If some update is intiated right after releasing this lock?
3. How races between scan and append is avoided? Scan is not obtaining `HNSW_UPDATE_LOCK` either insert is not obtaining `HNSW_SCAN_LOCK`, so both ore holding lock only on current buffer which is released after building neighbours list.