s4-dsdb: Use only the replication USN for schema reload.
authorAndrew Bartlett <abartlet@samba.org>
Sat, 11 Aug 2012 00:56:58 +0000 (10:56 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 11 Aug 2012 02:53:42 +0000 (12:53 +1000)
This way we do not track both the partition seq number and the
replication USN for schema reload purposes.

We only need one indication of actual data change, and the replication
per-partition sequence number is no more expensive to obtain than the
ldb per-partition sequence number.

Andrew Bartlett

source4/dsdb/samdb/ldb_modules/schema_load.c
source4/dsdb/schema/schema.h

index 0ba0180e95aac5f235ddb3980cfde0b6038d56ac..2521cab367fba85977ccb745cf496e683c936345 100644 (file)
@@ -188,30 +188,6 @@ static struct dsdb_schema *dsdb_schema_refresh(struct ldb_module *module, struct
                return schema;
        }
 
-       res = talloc_zero(schema, struct ldb_result);
-       if (res == NULL) {
-               return NULL;
-       }
-       tseq = talloc_zero(res, struct ldb_seqnum_request);
-       if (tseq == NULL) {
-               talloc_free(res);
-               return NULL;
-       }
-       tseq->type = LDB_SEQ_HIGHEST_SEQ;
-       
-       ret = ldb_build_extended_req(&treq, ldb_module_get_ctx(module), res,
-                                    LDB_EXTENDED_SEQUENCE_NUMBER,
-                                    tseq,
-                                    NULL,
-                                    res,
-                                    ldb_extended_default_callback,
-                                    NULL);
-       LDB_REQ_SET_LOCATION(treq);
-       if (ret != LDB_SUCCESS) {
-               talloc_free(res);
-               return NULL;
-       }
-
        /*
         * We update right now the last refresh timestamp so that if
         * the schema partition hasn't change we don't keep on retrying.
@@ -230,42 +206,6 @@ static struct dsdb_schema *dsdb_schema_refresh(struct ldb_module *module, struct
        }
        schema->last_refresh = ts;
 
-       ctrl = talloc(treq, struct dsdb_control_current_partition);
-       if (!ctrl) {
-               talloc_free(res);
-               return NULL;
-       }
-       ctrl->version = DSDB_CONTROL_CURRENT_PARTITION_VERSION;
-       ctrl->dn = schema->base_dn;
-       
-       ret = ldb_request_add_control(treq,
-                                     DSDB_CONTROL_CURRENT_PARTITION_OID,
-                                     false, ctrl);
-       if (ret != LDB_SUCCESS) {
-               talloc_free(res);
-               return NULL;
-       }
-       
-       ret = ldb_next_request(module, treq);
-       if (ret != LDB_SUCCESS) {
-               talloc_free(res);
-               return NULL;
-       }
-       ret = ldb_wait(treq->handle, LDB_WAIT_ALL);
-       if (ret != LDB_SUCCESS) {
-               talloc_free(res);
-               return NULL;
-       }
-       tseqr = talloc_get_type(res->extended->data,
-                               struct ldb_seqnum_result);
-       if (tseqr->seq_num == schema->reload_seq_number) {
-               talloc_free(res);
-               return schema;
-       }
-
-       schema->reload_seq_number = tseqr->seq_num;
-       talloc_free(res);
-               
        ret = dsdb_module_load_partition_usn(module, schema->base_dn, &current_usn, NULL, NULL);
        if (ret != LDB_SUCCESS || current_usn == schema->loaded_usn) {
                return schema;
index 54903f549fc02152cf564c46bf170577106246fe..81ac129d5e75e8dbf54d66418058957a832825ef 100644 (file)
@@ -252,12 +252,6 @@ struct dsdb_schema {
         * requested to reload the schema (either due through DRS or via the schemaUpdateNow).
         */
        uint64_t metadata_usn;
-       /* an 'opaque' sequence number that corresponds to the highest USN of the schema
-        * partition it used in the reload to check if a reload
-        * should really be performed. As the schema is periodically reloaded this
-        * is still needed in order to avoid costly complete schema reload.
-        */
-       uint64_t reload_seq_number;
 
        /* Should the syntax handlers in this case handle all incoming OIDs automatically, assigning them as an OID if no text name is known? */
        bool relax_OID_conversions;