Copy entry point to avoid updating in-place [skip ci]

This commit is contained in:
Andrew Kane committed 2026-12-04 05:46:02 -08:00
1 parent 187029d44d
commit aa045b72ad
1 file changed
+5 -3
+5 -3
View File
@@ -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);