mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-10 06:40:57 +08:00
Improved code [skip ci]
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user