summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorTim Beale <timbeale@catalyst.net.nz>2018-11-12 15:49:28 +1300
committerTim Beale <timbeale@samba.org>2018-11-21 01:51:11 +0100
commit05147d25e7b4a9343378c59927f443b723606960 (patch)
tree8eac455abe4b87e61faf8baf2add84cc383ccc59 /source4
parent698cf271f439c252c77f67fb88b09c9dcc84139d (diff)
downloadsamba-05147d25e7b4a9343378c59927f443b723606960.tar.gz
replmd: Avoid redundant dsdb_get_deleted_objects_dn() checks
Quite a bit of time was spent in dsdb_get_deleted_objects_dn() processing during either a join (~9%) or a full-sync (~28%). The problem is we're *always* doing the dsdb_get_deleted_objects_dn() call for each object, regardless of whether it's actually deleted or not. i.e. we were doing an expensive query and a lot of the time just ignoring the query result. If it's not a deleted object we're dealing with, we can just return early and skip the unnecessary processing. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/samdb/ldb_modules/repl_meta_data.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 433f8f7d6ca..b88aaf251e7 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -6807,9 +6807,18 @@ static int replmd_replicated_apply_isDeleted(struct replmd_replicated_request *a
{
struct ldb_dn *deleted_objects_dn;
struct ldb_message *msg = ar->objs->objects[ar->index_current].msg;
- int ret = dsdb_get_deleted_objects_dn(ldb_module_get_ctx(ar->module), msg, msg->dn,
- &deleted_objects_dn);
- if (ar->isDeleted && (ret != LDB_SUCCESS || ldb_dn_compare(msg->dn, deleted_objects_dn) != 0)) {
+ int ret;
+
+ if (!ar->isDeleted) {
+
+ /* not a deleted object, so nothing to do */
+ ar->index_current++;
+ return replmd_replicated_apply_next(ar);
+ }
+
+ ret = dsdb_get_deleted_objects_dn(ldb_module_get_ctx(ar->module), msg,
+ msg->dn, &deleted_objects_dn);
+ if (ret != LDB_SUCCESS || ldb_dn_compare(msg->dn, deleted_objects_dn) != 0) {
/*
* Do a delete here again, so that if there is
* anything local that conflicts with this