From: Gary Lockyer Date: Thu, 4 Jul 2019 04:49:29 +0000 (+1200) Subject: ldb: Rework index_transaction_cache_size to allow caller to specify a larger size X-Git-Tag: ldb-2.0.5~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6226ab3b61091af176abbb40e21deebe2529ceb0;p=thirdparty%2Fsamba.git ldb: Rework index_transaction_cache_size to allow caller to specify a larger size The previous code would override the caller with the DB size estimate rather than allowing the caller to force the bigger size. Signed-off-by: Gary Lockyer Reviewed-by: Andrew Bartlett --- diff --git a/lib/ldb/ldb_key_value/ldb_kv_index.c b/lib/ldb/ldb_key_value/ldb_kv_index.c index 4d2ad3b677b..ef275b28013 100644 --- a/lib/ldb/ldb_key_value/ldb_kv_index.c +++ b/lib/ldb/ldb_key_value/ldb_kv_index.c @@ -3650,12 +3650,18 @@ int ldb_kv_reindex(struct ldb_module *module) } /* - * Calculate the size of the index cache that we'll need for - * the re-index + * Calculate the size of the index cache needed for + * the re-index. If specified always use the + * ldb_kv->index_transaction_cache_size otherwise use the maximum + * of the size estimate or the DEFAULT_INDEX_CACHE_SIZE */ - index_cache_size = ldb_kv->kv_ops->get_size(ldb_kv); - if (index_cache_size < DEFAULT_INDEX_CACHE_SIZE) { - index_cache_size = DEFAULT_INDEX_CACHE_SIZE; + if (ldb_kv->index_transaction_cache_size > 0) { + index_cache_size = ldb_kv->index_transaction_cache_size; + } else { + index_cache_size = ldb_kv->kv_ops->get_size(ldb_kv); + if (index_cache_size < DEFAULT_INDEX_CACHE_SIZE) { + index_cache_size = DEFAULT_INDEX_CACHE_SIZE; + } } /*