summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGary Lockyer <gary@catalyst.net.nz>2019-07-04 16:49:29 +1200
committerAndrew Bartlett <abartlet@samba.org>2019-07-04 10:02:23 +0000
commit6226ab3b61091af176abbb40e21deebe2529ceb0 (patch)
tree7afb798afbb158ab69c3adc9a9f7c3dece55aed4 /lib
parentf87472c9e3d70f856eff9b0324cb48d9aed580b3 (diff)
downloadsamba-6226ab3b61091af176abbb40e21deebe2529ceb0.tar.gz
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 <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/ldb/ldb_key_value/ldb_kv_index.c16
1 files changed, 11 insertions, 5 deletions
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;
+ }
}
/*