diff options
author | Andrew Bartlett <abartlet@samba.org> | 2012-08-09 10:21:38 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2012-08-09 04:32:18 +0200 |
commit | 6a648b727f50e33a4c66a77e3980d7c0c2adcb49 (patch) | |
tree | dd9edbdb3a140ff929bd30a5f543d9400fe54896 /source4/dsdb | |
parent | 47c5900040604fb768d7ad54072f94fb69597e24 (diff) | |
download | samba-6a648b727f50e33a4c66a77e3980d7c0c2adcb49.tar.gz samba-6a648b727f50e33a4c66a77e3980d7c0c2adcb49.tar.bz2 samba-6a648b727f50e33a4c66a77e3980d7c0c2adcb49.zip |
s4-dsdb: Reduce calls to the ldb layer by reloading less often
We do not need to reload the partition list to get the global sequence
number, as that number is stored in the metadata.tdb, not the ldb files.
Andrew Bartlett
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]; |