pgvector.git / summary / log / commit / refs

commit    e1bc929429eead48c85d332a39e1a216415b1d0a
Author:   Andrew Kane <andrew@ankane.org>
Date:     Fri Oct 11 22:29:23 2024 +0000

    Simplify lists for IvfflatScanOpaque [skip ci]


src/ivfflat.h | 2 +- src/ivfscan.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ivfflat.h b/src/ivfflat.h index 71acb43b..c9955ff3 100644 --- a/src/ivfflat.h +++ b/src/ivfflat.h @@ -278,7 +278,7 @@ typedef struct IvfflatScanOpaqueData pairingheap *listQueue; BlockNumber *listPages; int listIndex; - IvfflatScanList lists[FLEXIBLE_ARRAY_MEMBER]; /* must come last */ + IvfflatScanList *lists; } IvfflatScanOpaqueData; typedef IvfflatScanOpaqueData * IvfflatScanOpaque; diff --git a/src/ivfscan.c b/src/ivfscan.c index bc795e3c..d526ec9e 100644 --- a/src/ivfscan.c +++ b/src/ivfscan.c @@ -280,7 +280,7 @@ ivfflatbeginscan(Relation index, int nkeys, int norderbys) if (maxProbes > lists) maxProbes = lists; - so = (IvfflatScanOpaque) palloc(offsetof(IvfflatScanOpaqueData, lists) + maxProbes * sizeof(IvfflatScanList)); + so = (IvfflatScanOpaque) palloc(sizeof(IvfflatScanOpaqueData)); so->typeInfo = IvfflatGetTypeInfo(index); so->first = true; so->probes = probes; @@ -314,6 +314,7 @@ ivfflatbeginscan(Relation index, int nkeys, int norderbys) so->listQueue = pairingheap_allocate(CompareLists, scan); so->listPages = palloc(maxProbes * sizeof(BlockNumber)); so->listIndex = 0; + so->lists = palloc(maxProbes * sizeof(IvfflatScanList)); scan->opaque = so; @@ -409,6 +410,7 @@ ivfflatendscan(IndexScanDesc scan) tuplesort_end(so->sortstate); FreeAccessStrategy(so->bas); FreeTupleDesc(so->tupdesc); + pfree(so->lists); /* TODO Free vslot and mslot without freeing TupleDesc */ [parent: 38285aacc7c0]