s4:provision Keep a single transaction for the erase and rebuild
authorAndrew Bartlett <abartlet@samba.org>
Thu, 13 Aug 2009 22:29:19 +0000 (08:29 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 16 Aug 2009 23:50:59 +0000 (09:50 +1000)
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

source4/scripting/python/samba/provision.py

index 253add1205cbf14876791c8c8727b3222b6b27b9..12625d98d6a7af4c152c96b9689a7c20bdc945ff 100644 (file)
@@ -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"