summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-08-14 08:29:19 +1000
committerAndrew Bartlett <abartlet@samba.org>2009-08-17 09:50:59 +1000
commit410114e41c713ccba2ac7d46e3f5acfddd986669 (patch)
tree3f22b60e0e7b507822e15eea6ad7b2225a203a96
parentecd234a0f10c544ff83f79bbe8c9e0df597ccd7b (diff)
downloadsamba-410114e41c713ccba2ac7d46e3f5acfddd986669.tar.gz
samba-410114e41c713ccba2ac7d46e3f5acfddd986669.tar.bz2
samba-410114e41c713ccba2ac7d46e3f5acfddd986669.zip
s4:provision Keep a single transaction for the erase and rebuild
Using a single transaction to both erase the bulk of the data and the rebuild of that data means that the in-memory index list is maintained, and not written out to disk until it is all compleated. All the writes then occour at the end. Andrew Bartlett
-rw-r--r--source4/scripting/python/samba/provision.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index 253add1205..12625d98d6 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -838,24 +838,15 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
# Load the schema (again). This time it will force a reindex, to make the below computationally sane
samdb.set_schema_from_ldb(schema.ldb)
samdb.erase_partitions()
-
- except:
- samdb.transaction_cancel()
- raise
-
- samdb.transaction_commit()
- samdb.set_opaque_integer("domainFunctionality", domainFunctionality)
- samdb.set_opaque_integer("forestFunctionality", forestFunctionality)
- samdb.set_opaque_integer("domainControllerFunctionality", domainControllerFunctionality)
+ samdb.set_opaque_integer("domainFunctionality", domainFunctionality)
+ samdb.set_opaque_integer("forestFunctionality", forestFunctionality)
+ samdb.set_opaque_integer("domainControllerFunctionality", domainControllerFunctionality)
- samdb.set_domain_sid(str(domainsid))
- if serverrole == "domain controller":
- samdb.set_invocation_id(invocationid)
+ samdb.set_domain_sid(str(domainsid))
+ if serverrole == "domain controller":
+ samdb.set_invocation_id(invocationid)
- samdb.transaction_start()
-
- try:
message("Adding DomainDN: %s" % names.domaindn)
if serverrole == "domain controller":
domain_oc = "domainDNS"