From aa045b72add78cc30faac641f90b7264e8903713 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Fri, 4 Dec 2026 05:46:02 -0800 Subject: [PATCH] Copy entry point to avoid updating in-place [skip ci] --- src/hnswvacuum.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hnswvacuum.c b/src/hnswvacuum.c index 566e0e4a..dbc7f9eb 100644 --- a/src/hnswvacuum.c +++ b/src/hnswvacuum.c @@ -238,6 +238,10 @@ RepairGraphElement(HnswVacuumState * vacuumstate, HnswElement element, HnswEleme /* Use memory context */ oldCtx = MemoryContextSwitchTo(vacuumstate->repairCtx); + /* Copy entry point to avoid updating in-place */ + if (entryPoint != NULL) + entryPoint = HnswInitElementFromBlock(entryPoint->blkno, entryPoint->offno); + /* Init fields */ HnswInitNeighbors(base, element, m, NULL); element->heaptidsLength = 0; @@ -269,10 +273,8 @@ RepairGraphElement(HnswVacuumState * vacuumstate, HnswElement element, HnswEleme /* Update neighbors */ HnswUpdateNeighborsOnDisk(index, support, element, m, false); - /* Reset pointers for safety */ + /* Reset pointer for safety */ HnswPtrStore(base, element->neighbors, (HnswNeighborArrayPtr *) NULL); - if (entryPoint != NULL) - HnswPtrStore(base, entryPoint->value, (char *) NULL); /* Reset memory context */ MemoryContextSwitchTo(oldCtx);