s4-dsdb: Ensure we have indexing enabled during the provision
authorAndrew Bartlett <abartlet@samba.org>
Thu, 9 Aug 2012 04:33:49 +0000 (14:33 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 9 Aug 2012 06:20:36 +0000 (08:20 +0200)
Because we set the schema before we connected the ldb to a file, the @INDEX records
were not added until next startup.  This cost 100% more time in running provision on
my laptop.

Andrew Bartlett

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Aug  9 08:20:36 CEST 2012 on sn-devel-104

source4/scripting/python/samba/provision/__init__.py

index 192130ea1cd29f877c1f94d25de5aa174bda533d..94e857e9f4298467ef86d144805555f60e4ff6f8 100644 (file)
@@ -1121,7 +1121,7 @@ def setup_samdb(path, session_info, provision_backend, lp, names,
     logger.info("Pre-loading the Samba 4 and AD schema")
 
     # Load the schema from the one we computed earlier
-    samdb.set_schema(schema)
+    samdb.set_schema(schema, write_attributes=False)
 
     # Set the NTDS settings DN manually - in order to have it already around
     # before the provisioned tree exists and we connect
@@ -1131,6 +1131,11 @@ def setup_samdb(path, session_info, provision_backend, lp, names,
     # DB
     samdb.connect(path)
 
+    # But we have to give it one more kick to have it use the schema
+    # during provision - it needs, now that it is connected, to write
+    # the schema @INDEX records to the database.
+    samdb.set_schema(schema, write_attributes=True)
+
     return samdb