Improved code [skip ci]

This commit is contained in:
Andrew Kane
2024-01-22 16:37:32 -08:00
parent cc641002d3
commit e54ec4d637

View File

@@ -418,11 +418,12 @@ HnswUpdateNeighborPagesInMemory(char *base, FmgrInfo *procinfo, Oid collation, H
* Write changes in memory * Write changes in memory
*/ */
static void static void
WriteElementInMemory(FmgrInfo *procinfo, Oid collation, HnswElement element, int m, int efConstruction, HnswElement entryPoint, HnswBuildState * buildstate, HnswGraph * graph, bool updateEntryPoint) WriteElementInMemory(FmgrInfo *procinfo, Oid collation, HnswElement element, int m, int efConstruction, HnswElement entryPoint, HnswBuildState * buildstate, bool updateEntryPoint)
{ {
HnswGraph *graph = buildstate->graph;
char *base = buildstate->hnswarea; char *base = buildstate->hnswarea;
/* Try to add to existing page */ /* Look for duplicate */
if (HnswFindDuplicateInMemory(base, element)) if (HnswFindDuplicateInMemory(base, element))
return; return;
@@ -475,7 +476,7 @@ InsertTupleInMemory(HnswBuildState * buildstate, HnswElement element)
HnswInsertElement(base, element, entryPoint, NULL, procinfo, collation, m, efConstruction, false); HnswInsertElement(base, element, entryPoint, NULL, procinfo, collation, m, efConstruction, false);
/* Write to memory */ /* Write to memory */
WriteElementInMemory(procinfo, collation, element, m, efConstruction, entryPoint, buildstate, graph, updateEntryPoint); WriteElementInMemory(procinfo, collation, element, m, efConstruction, entryPoint, buildstate, updateEntryPoint);
/* Release entry lock */ /* Release entry lock */
LWLockRelease(entryLock); LWLockRelease(entryLock);