diff options
author | Tim Beale <timbeale@catalyst.net.nz> | 2018-06-13 14:09:06 +1200 |
---|---|---|
committer | Douglas Bagnall <dbagnall@samba.org> | 2018-07-05 04:01:25 +0200 |
commit | 850bba4d329d062c8a79824c0a9987fa51340e2b (patch) | |
tree | b246021e8c30a56d9e9b4a5060cf736c39962680 /python | |
parent | 634a72df24e74bce07d2481fb86b0ce4b7ebaa38 (diff) | |
download | samba-850bba4d329d062c8a79824c0a9987fa51340e2b.tar.gz |
drs_utils: Always set the GET_TGT flag for clone renames
The DCCloneAndRenameContext replication was a little inefficient, in
that it would essentially replicate the entire DB twice. This was due to
resolving the link targets - it finds a target object it doesn't know
about, so retries the entire replication again with the GET_TGT flag set
this time.
Normally, the repl_meta_data code will use the target object's GUID,
however, it can't do this for cross-partition links (if it hasn't
replicated the target partition yet). The repl_md code can normally
detect that the link is a cross-parition link by checking the base-DN,
however, this doesn't work in the DCCloneAndRenameContext case because
we have renamed the base-DN.
This is not a big deal - it just means extra work. However, because the
domains being backed up could potentially be quite large, it probably
makes sense to just always set the GET_TGT in the rename case and skip
this extra work.
Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python')
-rw-r--r-- | python/samba/drs_utils.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/python/samba/drs_utils.py b/python/samba/drs_utils.py index db8326739d5..66f47503ca8 100644 --- a/python/samba/drs_utils.py +++ b/python/samba/drs_utils.py @@ -200,6 +200,7 @@ class drs_Replicate(object): if invocation_id == misc.GUID("00000000-0000-0000-0000-000000000000"): raise RuntimeError("Must not set GUID 00000000-0000-0000-0000-000000000000 as invocation_id") self.replication_state = self.net.replicate_init(self.samdb, lp, self.drs, invocation_id) + self.more_flags = 0 def _should_retry_with_get_tgt(self, error_code, req): @@ -228,7 +229,7 @@ class drs_Replicate(object): # setup for a GetNCChanges call if self.supported_extensions & drsuapi.DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V10: req = drsuapi.DsGetNCChangesRequest10() - req.more_flags = more_flags + req.more_flags = (more_flags | self.more_flags) req_level = 10 else: req_level = 8 @@ -367,6 +368,12 @@ class drs_ReplicateRenamer(drs_Replicate): self.old_base_dn = old_base_dn self.new_base_dn = new_base_dn + # because we're renaming the DNs, we know we're going to have trouble + # resolving link targets. Normally we'd get to the end of replication + # only to find we need to retry the whole replication with the GET_TGT + # flag set. Always setting the GET_TGT flag avoids this extra work. + self.more_flags = drsuapi.DRSUAPI_DRS_GET_TGT + def rename_dn(self, dn_str): '''Uses string substitution to replace the base DN''' return re.sub('%s$' % self.old_base_dn, self.new_base_dn, dn_str) |