mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-01 10:11:20 +08:00
Removed HnswPtrSetNull to avoid setting relptr_off directly
This commit is contained in:
@@ -106,7 +106,6 @@
|
||||
#define HnswPtrAccess(base, hp) ((base) == NULL ? (hp).ptr : relptr_access(base, (hp).relptr))
|
||||
#define HnswPtrStore(base, hp, value) ((base) == NULL ? (void) ((hp).ptr = (value)) : (void) relptr_store(base, (hp).relptr, value))
|
||||
#define HnswPtrIsNull(base, hp) ((base) == NULL ? (hp).ptr == NULL : relptr_is_null((hp).relptr))
|
||||
#define HnswPtrSetNull(base, hp) ((base) == NULL ? (void) ((hp).ptr = NULL) : (void) ((hp).relptr.relptr_off = 0))
|
||||
#define HnswPtrEqual(base, hp1, hp2) ((base) == NULL ? (hp1).ptr == (hp2).ptr : relptr_offset((hp1).relptr) == relptr_offset((hp2).relptr))
|
||||
|
||||
/* For code paths dedicated to each type */
|
||||
|
||||
@@ -551,8 +551,8 @@ BuildCallback(Relation index, CALLBACK_ITEM_POINTER, Datum *values,
|
||||
static void
|
||||
InitGraph(HnswGraph * graph, char *base, long memoryTotal)
|
||||
{
|
||||
HnswPtrSetNull(base, graph->head);
|
||||
HnswPtrSetNull(base, graph->entryPoint);
|
||||
HnswPtrStore(base, graph->head, (HnswElement) NULL);
|
||||
HnswPtrStore(base, graph->entryPoint, (HnswElement) NULL);
|
||||
graph->memoryUsed = 0;
|
||||
graph->memoryTotal = memoryTotal;
|
||||
graph->flushed = false;
|
||||
|
||||
@@ -274,7 +274,7 @@ HnswInitElement(char *base, ItemPointer heaptid, int m, double ml, int maxLevel,
|
||||
|
||||
HnswInitNeighbors(base, element, m, allocator);
|
||||
|
||||
HnswPtrSetNull(base, element->value);
|
||||
HnswPtrStore(base, element->value, (Pointer) NULL);
|
||||
|
||||
return element;
|
||||
}
|
||||
@@ -295,11 +295,12 @@ HnswElement
|
||||
HnswInitElementFromBlock(BlockNumber blkno, OffsetNumber offno)
|
||||
{
|
||||
HnswElement element = palloc(sizeof(HnswElementData));
|
||||
char *base = NULL;
|
||||
|
||||
element->blkno = blkno;
|
||||
element->offno = offno;
|
||||
HnswPtrSetNull(NULL, element->neighbors);
|
||||
HnswPtrSetNull(NULL, element->value);
|
||||
HnswPtrStore(base, element->neighbors, (HnswNeighborArrayPtr *) NULL);
|
||||
HnswPtrStore(base, element->value, (Pointer) NULL);
|
||||
return element;
|
||||
}
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ RepairGraphEntryPoint(HnswVacuumState * vacuumstate)
|
||||
{
|
||||
/* Reset neighbors from previous update */
|
||||
if (highestPoint != NULL)
|
||||
HnswPtrSetNull(NULL, highestPoint->neighbors);
|
||||
HnswPtrStore((char *) NULL, highestPoint->neighbors, (HnswNeighborArrayPtr *) NULL);
|
||||
|
||||
RepairGraphElement(vacuumstate, entryPoint, highestPoint);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user