mirror of
https://github.com/pgvector/pgvector.git
synced 2026-06-06 05:51:21 +08:00
Init collation as well [skip ci]
This commit is contained in:
@@ -406,7 +406,7 @@ bool HnswLoadNeighborTids(HnswElement element, ItemPointerData *indextids, Rela
|
||||
void HnswInitLockTranche(void);
|
||||
const HnswTypeInfo *HnswGetTypeInfo(Relation index);
|
||||
PGDLLEXPORT void HnswParallelBuildMain(dsm_segment *seg, shm_toc *toc);
|
||||
void HnswInitProcinfo(FmgrInfo **procinfo, Relation index);
|
||||
void HnswInitProcinfo(FmgrInfo **procinfo, Oid **collation, Relation index);
|
||||
bool HnswIndexTupleIsEqual(IndexTuple a, IndexTuple b, TupleDesc tupdesc);
|
||||
|
||||
/* Index access methods */
|
||||
|
||||
@@ -753,9 +753,8 @@ InitBuildState(HnswBuildState * buildstate, Relation heap, Relation index, Index
|
||||
buildstate->indtuples = 0;
|
||||
|
||||
/* Get support functions */
|
||||
HnswInitProcinfo(buildstate->procinfo, index);
|
||||
HnswInitProcinfo(buildstate->procinfo, &buildstate->collation, index);
|
||||
buildstate->normprocinfo = HnswOptionalProcInfo(index, HNSW_NORM_PROC);
|
||||
buildstate->collation = index->rd_indcollation;
|
||||
|
||||
InitGraph(&buildstate->graphData, NULL, (Size) maintenance_work_mem * 1024L);
|
||||
buildstate->graph = &buildstate->graphData;
|
||||
|
||||
@@ -699,11 +699,11 @@ HnswInsertTupleOnDisk(Relation index, Datum value, Datum *values, bool *isnull,
|
||||
int m;
|
||||
int efConstruction = HnswGetEfConstruction(index);
|
||||
FmgrInfo *procinfo[2];
|
||||
Oid *collation = index->rd_indcollation;
|
||||
Oid *collation;
|
||||
LOCKMODE lockmode = ShareLock;
|
||||
char *base = NULL;
|
||||
|
||||
HnswInitProcinfo(procinfo, index);
|
||||
HnswInitProcinfo(procinfo, &collation, index);
|
||||
|
||||
/*
|
||||
* Get a shared lock. This allows vacuum to ensure no in-flight inserts
|
||||
|
||||
@@ -88,9 +88,8 @@ hnswbeginscan(Relation index, int nkeys, int norderbys)
|
||||
ALLOCSET_DEFAULT_SIZES);
|
||||
|
||||
/* Set support functions */
|
||||
HnswInitProcinfo(so->procinfo, index);
|
||||
HnswInitProcinfo(so->procinfo, &so->collation, index);
|
||||
so->normprocinfo = HnswOptionalProcInfo(index, HNSW_NORM_PROC);
|
||||
so->collation = index->rd_indcollation;
|
||||
|
||||
scan->opaque = so;
|
||||
|
||||
|
||||
@@ -157,12 +157,14 @@ HnswOptionalProcInfo(Relation index, uint16 procnum)
|
||||
* Init procinfo
|
||||
*/
|
||||
void
|
||||
HnswInitProcinfo(FmgrInfo **procinfo, Relation index)
|
||||
HnswInitProcinfo(FmgrInfo **procinfo, Oid **collation, Relation index)
|
||||
{
|
||||
procinfo[0] = index_getprocinfo(index, 1, HNSW_DISTANCE_PROC);
|
||||
|
||||
if (IndexRelationGetNumberOfKeyAttributes(index) > 1)
|
||||
procinfo[1] = index_getprocinfo(index, 2, HNSW_ATTRIBUTE_DISTANCE_PROC);
|
||||
|
||||
*collation = index->rd_indcollation;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -581,8 +581,7 @@ InitVacuumState(HnswVacuumState * vacuumstate, IndexVacuumInfo *info, IndexBulkD
|
||||
vacuumstate->callback_state = callback_state;
|
||||
vacuumstate->efConstruction = HnswGetEfConstruction(index);
|
||||
vacuumstate->bas = GetAccessStrategy(BAS_BULKREAD);
|
||||
HnswInitProcinfo(vacuumstate->procinfo, index);
|
||||
vacuumstate->collation = index->rd_indcollation;
|
||||
HnswInitProcinfo(vacuumstate->procinfo, &vacuumstate->collation, index);
|
||||
vacuumstate->ntup = palloc0(HNSW_TUPLE_ALLOC_SIZE);
|
||||
vacuumstate->tmpCtx = AllocSetContextCreate(CurrentMemoryContext,
|
||||
"Hnsw vacuum temporary context",
|
||||
|
||||
Reference in New Issue
Block a user