pgvector.git / summary / log / commit / refs

commit    e5da5cc5328209a54fd77f6c936d6bbe1c6f70bb
Author:   Andrew Kane <andrew@ankane.org>
Date:     Fri Feb 11 11:41:54 2022 +0000

    Add one to error message to ceil [skip ci]


src/ivfkmeans.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ivfkmeans.c b/src/ivfkmeans.c index 763dc76d..78b4f519 100644 --- a/src/ivfkmeans.c +++ b/src/ivfkmeans.c @@ -204,11 +204,12 @@ ElkanKmeans(Relation index, VectorArray samples, VectorArray centers) Size totalSize = centerCountsSize + closestCentersSize + lowerBoundSize + upperBoundSize + sSize + halfcdistSize + newcdistSize; /* Check memory requirements */ + /* Add one to error message to ceil */ if (totalSize / 1024 > maintenance_work_mem) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("memory required is %zu MB, maintenance_work_mem is %zu MB", - totalSize / (1024 * 1024), ((Size) maintenance_work_mem) / 1024))); + totalSize / (1024 * 1024) + 1, ((Size) maintenance_work_mem) / 1024))); /* Set support functions */ procinfo = index_getprocinfo(index, 1, IVFFLAT_KMEANS_DISTANCE_PROC); [parent: f59b1184fcd1]