diff options
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/partition.c | 34 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/partition_init.c | 6 |
2 files changed, 26 insertions, 14 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c index d4f020fc5e..3533810deb 100644 --- a/source4/dsdb/samdb/ldb_modules/partition.c +++ b/source4/dsdb/samdb/ldb_modules/partition.c @@ -1154,14 +1154,6 @@ static int partition_sequence_number(struct ldb_module *module, struct ldb_reque struct dsdb_partition *p; int ret; - p = find_partition(data, NULL, req); - if (p != NULL) { - /* the caller specified what partition they want the - * sequence number operation on - just pass it on - */ - return ldb_next_request(p->module, req); - } - seq = talloc_get_type_abort(req->op.extended.data, struct ldb_seqnum_request); switch (seq->type) { case LDB_SEQ_NEXT: @@ -1172,6 +1164,26 @@ static int partition_sequence_number(struct ldb_module *module, struct ldb_reque break; case LDB_SEQ_HIGHEST_SEQ: + + /* + * We can only query per-partition the individual + * partition sequence number, so we don't need to run + * this reload for every query of the next global seq + * number + */ + ret = partition_reload_if_required(module, data, req); + if (ret != LDB_SUCCESS) { + return ret; + } + + p = find_partition(data, NULL, req); + if (p != NULL) { + /* the caller specified what partition they want the + * sequence number operation on - just pass it on + */ + return ldb_next_request(p->module, req); + } + ret = partition_metadata_sequence_number(module, &seq_number); if (ret != LDB_SUCCESS) { return ret; @@ -1221,12 +1233,6 @@ static int partition_extended(struct ldb_module *module, struct ldb_request *req ret = partition_metadata_inc_schema_sequence(module); return ldb_module_done(req, NULL, NULL, ret); } - - /* see if we are still up-to-date */ - ret = partition_reload_if_required(module, data, req); - if (ret != LDB_SUCCESS) { - return ret; - } if (strcmp(req->op.extended.oid, LDB_EXTENDED_SEQUENCE_NUMBER) == 0) { return partition_sequence_number(module, req); diff --git a/source4/dsdb/samdb/ldb_modules/partition_init.c b/source4/dsdb/samdb/ldb_modules/partition_init.c index dc09e13feb..a0770ccd6f 100644 --- a/source4/dsdb/samdb/ldb_modules/partition_init.c +++ b/source4/dsdb/samdb/ldb_modules/partition_init.c @@ -707,6 +707,12 @@ int partition_create(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_UNWILLING_TO_PERFORM; } + /* see if we are still up-to-date */ + ret = partition_reload_if_required(module, data, req); + if (ret != LDB_SUCCESS) { + return ret; + } + for (i=0; data->partitions && data->partitions[i]; i++) { if (ldb_dn_compare(data->partitions[i]->ctrl->dn, dn) == 0) { partition = data->partitions[i]; |