mirror of
https://github.com/samba-team/samba.git
synced 2025-01-13 13:18:06 +03:00
replmd: Only modify the object if it actually changed
Commit 775054afbe
reworked replmd_process_link_attribute() so that
we batch together DB operations for the same source object. However, it
was possible that the object had not actually changed at all, e.g.
- link was already processed by critical-objects-only during join, or
- we were doing a full-sync and processing info that was already
up-to-date in our DB.
In these cases we modified the object anyway, even though nothing had
changed. This patch fixes it up, so we check that the object has
actually changed before modifying the DB.
Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
cb3520fbaf
commit
c371fef586
@ -8228,6 +8228,7 @@ static int replmd_process_la_group(struct ldb_module *module,
|
||||
struct ldb_context *ldb = ldb_module_get_ctx(module);
|
||||
const struct dsdb_attribute *attr = NULL;
|
||||
replmd_link_changed change_type;
|
||||
uint32_t num_changes = 0;
|
||||
|
||||
/*
|
||||
* get the attribute being modified and the search result for the
|
||||
@ -8287,6 +8288,10 @@ static int replmd_process_la_group(struct ldb_module *module,
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (change_type != LINK_CHANGE_NONE) {
|
||||
num_changes++;
|
||||
}
|
||||
|
||||
if ((++replmd_private->num_processed % 8192) == 0) {
|
||||
DBG_NOTICE("Processed %u/%u linked attributes\n",
|
||||
replmd_private->num_processed,
|
||||
@ -8294,6 +8299,15 @@ static int replmd_process_la_group(struct ldb_module *module,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* it's possible we're already up-to-date and so don't need to modify
|
||||
* the object at all (e.g. doing a 'drs replicate --full-sync')
|
||||
*/
|
||||
if (num_changes == 0) {
|
||||
TALLOC_FREE(tmp_ctx);
|
||||
return LDB_SUCCESS;
|
||||
}
|
||||
|
||||
/* apply the link changes to the source object */
|
||||
ret = linked_attr_modify(module, msg, NULL);
|
||||
if (ret != LDB_SUCCESS) {
|
||||
|
Loading…
Reference in New Issue
Block a user