mirror of
https://github.com/pgvector/pgvector.git
synced 2026-12-05 16:58:38 +00:00
Copy entry point to avoid updating in-place [skip ci]
This commit is contained in:
1 parent
187029d44d
commit
aa045b72ad
1 file changed
+5
-3
+5
-3
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user