[SCM] Samba Shared Repository - branch master updated

simo idra at samba.org
Thu Aug 9 08:18:27 MDT 2012


On Thu, 2012-08-09 at 08:21 +0200, Andrew Bartlett wrote: 
> The branch, master has been updated
>        via  a117fd6 s4-dsdb: Ensure we have indexing enabled during the provision
>        via  ef87b4e s4-pydsdb: Provide control of if we should write index attributes when reloading a schema
>       from  1a1f01e s4-dsdb: Change talloc parent
> 
> http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
> 
> 
> - Log -----------------------------------------------------------------
> commit a117fd6d11aef5360a1af1fc6da542829da8b7b0
> Author: Andrew Bartlett <abartlet at samba.org>
> Date:   Thu Aug 9 14:33:49 2012 +1000
> 
>     s4-dsdb: Ensure we have indexing enabled during the provision
>     
>     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 at samba.org>
>     Autobuild-Date(master): Thu Aug  9 08:20:36 CEST 2012 on sn-devel-104
> 
> commit ef87b4e4f10eb7d5974cb0e0861648d537153a00
> Author: Andrew Bartlett <abartlet at samba.org>
> Date:   Thu Aug 9 14:23:12 2012 +1000
> 
>     s4-pydsdb: Provide control of if we should write index attributes when reloading a schema
>     
>     This allows us to carefully control the loading of the schema.
>     
>     Andrew Bartlett
> 
> -----------------------------------------------------------------------
> 
> Summary of changes:
>  source4/dsdb/pydsdb.c                              |    6 ++++--
>  .../scripting/python/samba/provision/__init__.py   |    7 ++++++-
>  source4/scripting/python/samba/samdb.py            |    8 ++++----
>  3 files changed, 14 insertions(+), 7 deletions(-)
> 
> 
> Changeset truncated at 500 lines:
> 
> diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c
> index 3558049..9023d69 100644
> --- a/source4/dsdb/pydsdb.c
> +++ b/source4/dsdb/pydsdb.c
> @@ -873,7 +873,9 @@ static PyObject *py_dsdb_set_schema_from_ldb(PyObject *self, PyObject *args)
>  	struct ldb_context *from_ldb;
>  	struct dsdb_schema *schema;
>  	int ret;
> -	if (!PyArg_ParseTuple(args, "OO", &py_ldb, &py_from_ldb))
> +	char write_attributes = true;
> +	if (!PyArg_ParseTuple(args, "OO|b",
> +			      &py_ldb, &py_from_ldb, &write_attributes))
>  		return NULL;
>  
>  	PyErr_LDB_OR_RAISE(py_ldb, ldb);
> @@ -886,7 +888,7 @@ static PyObject *py_dsdb_set_schema_from_ldb(PyObject *self, PyObject *args)
>  		return NULL;
>  	}
>  
> -	ret = dsdb_reference_schema(ldb, schema, true);
> +	ret = dsdb_reference_schema(ldb, schema, write_attributes);
>  	PyErr_LDB_ERROR_IS_ERR_RAISE(py_ldb_get_exception(), ret, ldb);
>  
>  	Py_RETURN_NONE;
> diff --git a/source4/scripting/python/samba/provision/__init__.py b/source4/scripting/python/samba/provision/__init__.py
> index 192130e..94e857e 100644
> --- a/source4/scripting/python/samba/provision/__init__.py
> +++ b/source4/scripting/python/samba/provision/__init__.py
> @@ -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
>  
> 
> diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py
> index 7451b6c..3355e9a 100644
> --- a/source4/scripting/python/samba/samdb.py
> +++ b/source4/scripting/python/samba/samdb.py
> @@ -608,11 +608,11 @@ accountExpires: %u
>      def load_partition_usn(self, base_dn):
>          return dsdb._dsdb_load_partition_usn(self, base_dn)
>  
> -    def set_schema(self, schema):
> -        self.set_schema_from_ldb(schema.ldb)
> +    def set_schema(self, schema, write_attributes=True):
> +        self.set_schema_from_ldb(schema.ldb, write_attributes=write_attributes)
>  
> -    def set_schema_from_ldb(self, ldb_conn):
> -        dsdb._dsdb_set_schema_from_ldb(self, ldb_conn)
> +    def set_schema_from_ldb(self, ldb_conn, write_attributes=True):
> +        dsdb._dsdb_set_schema_from_ldb(self, ldb_conn, write_attributes)
>  
>      def dsdb_DsReplicaAttribute(self, ldb, ldap_display_name, ldif_elements):
>          '''convert a list of attribute values to a DRSUAPI DsReplicaAttribute'''
> 
> 

This code would be clearer if you called the variable write_index,
rather then write_attributes

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Principal Software Engineer at Red Hat, Inc. <simo at redhat.com>



More information about the samba-cvs mailing list