From: Andrew Bartlett Date: Fri, 28 Feb 2020 20:06:51 +0000 (+1300) Subject: dsdb: Add very verbose debugging if a delete fails in repl_meta_data X-Git-Tag: ldb-2.2.0~1534 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1a0d43bbcc9e8be5f7149a9399b6a9776cd7f3ba;p=thirdparty%2Fsamba.git dsdb: Add very verbose debugging if a delete fails in repl_meta_data The modification into a tombstone should be a pretty reliable operation so if it fails print lots of info for debugging. Signed-off-by: Andrew Bartlett Reviewed-by: Gary Lockyer --- diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 824a4612f5a..db3a3e8c023 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -4777,8 +4777,42 @@ static int replmd_delete_internals(struct ldb_module *module, struct ldb_request ret = dsdb_module_modify(module, msg, dsdb_flags|DSDB_FLAG_OWN_MODULE, req); if (ret != LDB_SUCCESS) { - ldb_asprintf_errstring(ldb, "replmd_delete: Failed to modify object %s in delete - %s", - ldb_dn_get_linearized(old_dn), ldb_errstring(ldb)); + char *s = NULL; + /* + * This should not fail, so be quite verbose in the + * error handling if it fails + */ + if (strcmp(ldb_dn_get_linearized(old_dn), + ldb_dn_get_linearized(new_dn)) != 0) { + DBG_NOTICE("Failure to handle '%s' of object %s " + "after successful rename to %s. " + "Error during tombstone modificaton was: %s\n", + re_delete ? "re-delete" : "delete", + ldb_dn_get_linearized(new_dn), + ldb_dn_get_linearized(old_dn), + ldb_errstring(ldb)); + } else { + DBG_NOTICE("Failure to handle '%s' of object %s. " + "Error during tombstone modificaton was: %s\n", + re_delete ? "re-delete" : "delete", + ldb_dn_get_linearized(new_dn), + ldb_errstring(ldb)); + } + s = ldb_ldif_message_redacted_string(ldb_module_get_ctx(module), + tmp_ctx, + LDB_CHANGETYPE_MODIFY, + msg); + + DBG_INFO("Failed tombstone modify%s was:\n%s\n", + (dsdb_flags & DSDB_REPLMD_VANISH_LINKS) ? + " with VANISH_LINKS" : "", + s); + ldb_asprintf_errstring(ldb, + "replmd_delete: Failed to modify" + " object %s in '%s' - %s", + ldb_dn_get_linearized(old_dn), + re_delete ? "re-delete" : "delete", + ldb_errstring(ldb)); talloc_free(tmp_ctx); return ret; }