1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-30 19:42:05 +03:00

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>
This commit is contained in:
Joe Guo
2019-01-03 15:55:16 +13:00
committed by Andrew Bartlett
parent 5f9a5ef262
commit fa8a848365
2 changed files with 21 additions and 3 deletions

View File

@ -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]: