diff options
author | Joe Guo <joeg@catalyst.net.nz> | 2019-01-03 15:55:16 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-02-21 04:09:19 +0100 |
commit | fa8a8483651b4c5a4c337d23714f16d47e7d6ad0 (patch) | |
tree | f40019f6332f3f3e9da0b3b7c53d18d8def43542 /python/samba/dbchecker.py | |
parent | 5f9a5ef262b4700b47bfb931b6b096f56aa56b15 (diff) | |
download | samba-fa8a8483651b4c5a4c337d23714f16d47e7d6ad0.tar.gz |
dbcheck: skip reverse member link checks when cli option specified
currently dbcheck cmd tooks about 1 day to finish on a 100k user database.
We can skip member reverse link checks to speed it up dramatically.
A new cli option is added to enable the skipping.
Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python/samba/dbchecker.py')
-rw-r--r-- | python/samba/dbchecker.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py index bf999ddaab9..705be388827 100644 --- a/python/samba/dbchecker.py +++ b/python/samba/dbchecker.py @@ -60,6 +60,7 @@ class dbcheck(object): def __init__(self, samdb, samdb_schema=None, verbose=False, fix=False, yes=False, quiet=False, in_transaction=False, + quick_membership_checks=False, reset_well_known_acls=False): self.samdb = samdb self.dict_oid_name = None @@ -106,6 +107,7 @@ class dbcheck(object): self.fix_utf8_userparameters = False self.fix_doubled_userparameters = False self.fix_sid_rid_set_conflict = False + self.quick_membership_checks = quick_membership_checks self.reset_well_known_acls = reset_well_known_acls self.reset_all_well_known_acls = False self.in_transaction = in_transaction @@ -1199,8 +1201,13 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) else: reverse_syntax_oid = None - error_count, duplicate_dict, unique_dict = \ - self.check_duplicate_links(obj, attrname, syntax_oid, linkID, reverse_link_name) + is_member_link = attrname in ("member", "memberOf") + if is_member_link and self.quick_membership_checks: + duplicate_dict = {} + else: + error_count, duplicate_dict, unique_dict = \ + self.check_duplicate_links(obj, attrname, syntax_oid, + linkID, reverse_link_name) if len(duplicate_dict) != 0: @@ -1387,6 +1394,9 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) dsdb_dn, res[0].dn) continue + if is_member_link and self.quick_membership_checks: + continue + # check the reverse_link is correct if there should be one match_count = 0 if reverse_link_name in res[0]: |