1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

dsdb: Do not run dsdb_replace() on the calculated difference between old and new schema

We can set the database @INDEXLIST and @ATTRIBUTES to the full calculated
values, not the difference, and let the ldb layer work it out under the
transaction lock.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Andrew Bartlett 2017-06-07 10:44:50 +12:00 committed by Stefan Metzmacher
parent 5067bceaa2
commit ec9b1e881c

View File

@ -174,7 +174,12 @@ int dsdb_schema_set_indices_and_attributes(struct ldb_context *ldb,
goto op_error;
}
if (mod_msg->num_elements > 0) {
ret = dsdb_replace(ldb, mod_msg, 0);
/*
* Do the replace with the constructed message,
* to avoid needing a lock between this search
* and the replace
*/
ret = dsdb_replace(ldb, msg, 0);
}
talloc_free(mod_msg);
}
@ -210,7 +215,12 @@ int dsdb_schema_set_indices_and_attributes(struct ldb_context *ldb,
goto op_error;
}
if (mod_msg->num_elements > 0) {
ret = dsdb_replace(ldb, mod_msg, 0);
/*
* Do the replace with the constructed message,
* to avoid needing a lock between this search
* and the replace
*/
ret = dsdb_replace(ldb, msg_idx, 0);
}
talloc_free(mod_msg);
}