From: Douglas Bagnall Date: Thu, 30 Jan 2025 21:31:32 +0000 (+1300) Subject: provision: always use a large transaction index cache X-Git-Tag: samba-4.20.8~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47eaf606a44ba3765b9375c033529f2e0463a88c;p=thirdparty%2Fsamba.git provision: always use a large transaction index cache A larger cache costs more per transaction, but makes a large number of operations within a transaction faster. We expect to be dealing with the latter case here, regardless of the batch_mode parameter and the database size. 200000 is chosen because it is also used in join and schemaupgrade, and should be sufficient in most cases. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15795 Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett Autobuild-User(master): Douglas Bagnall Autobuild-Date(master): Tue Feb 4 22:47:35 UTC 2025 on atb-devel-224 (cherry picked from commit e705dbbc6765454813375fee9f6a3365b947e021) Autobuild-User(v4-20-test): Jule Anger Autobuild-Date(v4-20-test): Wed Feb 26 09:40:17 UTC 2025 on atb-devel-224 --- diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py index 56ca7496407..b2e06350f34 100644 --- a/python/samba/provision/__init__.py +++ b/python/samba/provision/__init__.py @@ -1294,12 +1294,9 @@ def setup_samdb(path, session_info, provision_backend, lp, names, options.append("lmdb_env_size:" + str(store_size)) if batch_mode: options.append("batch_mode:1") - if batch_mode: - # Estimate the number of index records in the transaction_index_cache - # Numbers chosen give the prime 202481 for the default backend size, - # which works well for a 100,000 user database - cache_size = int(store_size / 42423) + 1 - options.append("transaction_index_cache_size:" + str(cache_size)) + + # For bulk operations like this we use a large transaction index cache. + options.append("transaction_index_cache_size:200000") # Load the database, but don's load the global schema and don't connect # quite yet