From 4335f4b4e411d5c58bd0bd873115cb6c670a789c Mon Sep 17 00:00:00 2001 From: Gary Lockyer Date: Tue, 2 Jul 2019 12:31:52 +1200 Subject: domain join: enable ldb batch mode Enable ldb "batch_mode" transactions duting a join to improve performance. Signed-off-by: Gary Lockyer Reviewed-by: Andrew Bartlett --- python/samba/join.py | 4 ++-- python/samba/provision/__init__.py | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'python') diff --git a/python/samba/join.py b/python/samba/join.py index 77d260b42fa..ac4346c62a3 100644 --- a/python/samba/join.py +++ b/python/samba/join.py @@ -877,8 +877,8 @@ class DCJoinContext(object): use_ntvfs=ctx.use_ntvfs, dns_backend=ctx.dns_backend, plaintext_secrets=ctx.plaintext_secrets, backend_store=ctx.backend_store, - backend_store_size=ctx.backend_store_size - ) + backend_store_size=ctx.backend_store_size, + batch_mode=True) print("Provision OK for domain DN %s" % presult.domaindn) ctx.local_samdb = presult.samdb ctx.lp = presult.lp diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py index 6c345a43100..74492cd91dc 100644 --- a/python/samba/provision/__init__.py +++ b/python/samba/provision/__init__.py @@ -1301,7 +1301,7 @@ DEFAULT_BACKEND_SIZE = 8 * 1024 * 1024 *1024 def setup_samdb(path, session_info, provision_backend, lp, names, logger, fill, serverrole, schema, am_rodc=False, plaintext_secrets=False, backend_store=None, - backend_store_size=None): + backend_store_size=None, batch_mode=False): """Setup a complete SAM Database. :note: This will wipe the main SAM database file! @@ -1318,11 +1318,13 @@ def setup_samdb(path, session_info, provision_backend, lp, names, if backend_store == "mdb": if backend_store_size: store_size = backend_store_size - else : + else: # If no lmdb map size provided default to the default of # 8 GiB store_size = DEFAULT_BACKEND_SIZE options = ["lmdb_env_size:" + str(store_size)] + if batch_mode: + options.append("batch_mode:1") # Load the database, but don's load the global schema and don't connect # quite yet @@ -2164,7 +2166,7 @@ def provision(logger, session_info, smbconf=None, ldap_backend_forced_uri=None, nosync=False, ldap_dryrun_mode=False, ldap_backend_extra_port=None, base_schema="2012_R2", plaintext_secrets=False, backend_store=None, - backend_store_size=None): + backend_store_size=None, batch_mode=False): """Provision samba4 :note: caution, this wipes all existing data! @@ -2340,7 +2342,8 @@ def provision(logger, session_info, smbconf=None, schema=schema, fill=samdb_fill, am_rodc=am_rodc, plaintext_secrets=plaintext_secrets, backend_store=backend_store, - backend_store_size=backend_store_size) + backend_store_size=backend_store_size, + batch_mode=batch_mode) if serverrole == "active directory domain controller": if paths.netlogon is None: -- cgit v1.2.1