pgvector.git / summary / log / commit / refs
commit 69addf05d033ef9474d5d856c2af714fedfa62c6
Author: Andrew Kane <andrew@ankane.org>
Date: Tue Aug 22 05:21:53 2023 +0000
Updated comments [skip ci]
src/hnswvacuum.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/hnswvacuum.c b/src/hnswvacuum.c
index b869326f..224be1a8 100644
--- a/src/hnswvacuum.c
+++ b/src/hnswvacuum.c
@@ -248,19 +248,21 @@ RepairGraphEntryPoint(HnswVacuumState * vacuumstate)
HnswElement entryPoint;
MemoryContext oldCtx = MemoryContextSwitchTo(vacuumstate->tmpCtx);
- /*
- * TODO Handle missing highest point properly. Cannot make entry point
- * empty since may be outdated.
- *
- * TODO Look for newer highest point. Outdated point works if exists, but
- * can remove connections at higher levels in the graph, which is not
- * ideal.
- */
-
if (!BlockNumberIsValid(highestPoint->blkno))
highestPoint = NULL;
- /* Repair graph for highest non-entry point */
+ /*
+ * Repair graph for highest non-entry point. May be outdated due to
+ * inserts that happen during RemoveHeapTids.
+ *
+ * Outdated point can remove connections at higher levels in the graph
+ * until they are repaired. Could set the insert page to the last page at
+ * the start of RemoveHeapTids to reduce this possibility, but likely
+ * better to keep reusing space.
+ *
+ * If highest point is empty and entry point is deleted, the entry point
+ * can be empty for a short period until a live element is repaired.
+ */
if (highestPoint != NULL)
{
/* Get a shared lock */
@@ -280,7 +282,9 @@ RepairGraphEntryPoint(HnswVacuumState * vacuumstate)
/* Prevent concurrent inserts when possibly updating entry point */
LockPage(index, HNSW_UPDATE_LOCK, ExclusiveLock);
+ /* Get latest entry point */
entryPoint = HnswGetEntryPoint(index);
+
if (entryPoint != NULL)
{
ItemPointerData epData;
[parent: 4a5ae8a8df14]