mirror of
https://github.com/samba-team/samba.git
synced 2025-01-22 22:04:08 +03:00
dbcheck: don't check expired tombstone objects by default anymore
These will be removed anyway and any change on them risks to be an originating update that causes replication problems. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13816 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Thu Mar 14 03:12:27 UTC 2019 on sn-devel-144 (cherry picked from commit a2c5f8cf41c2dfdc4f122e8427d1dfeabb6ba311)
This commit is contained in:
parent
3fca3dcc1c
commit
693c349874
@ -41,7 +41,8 @@ class dbcheck(object):
|
||||
|
||||
def __init__(self, samdb, samdb_schema=None, verbose=False, fix=False,
|
||||
yes=False, quiet=False, in_transaction=False,
|
||||
reset_well_known_acls=False):
|
||||
reset_well_known_acls=False,
|
||||
check_expired_tombstones=False):
|
||||
self.samdb = samdb
|
||||
self.dict_oid_name = None
|
||||
self.samdb_schema = (samdb_schema or samdb)
|
||||
@ -88,6 +89,8 @@ class dbcheck(object):
|
||||
self.fix_doubled_userparameters = False
|
||||
self.fix_sid_rid_set_conflict = False
|
||||
self.reset_well_known_acls = reset_well_known_acls
|
||||
self.check_expired_tombstones = check_expired_tombstones
|
||||
self.expired_tombstones = 0
|
||||
self.reset_all_well_known_acls = False
|
||||
self.in_transaction = in_transaction
|
||||
self.infrastructure_dn = ldb.Dn(samdb, "CN=Infrastructure," + samdb.domain_dn())
|
||||
@ -233,6 +236,13 @@ class dbcheck(object):
|
||||
if DN is None:
|
||||
error_count += self.check_rootdse()
|
||||
|
||||
if self.expired_tombstones > 0:
|
||||
self.report("NOTICE: found %d expired tombstones, "
|
||||
"'samba' will remove them daily, "
|
||||
"'samba-tool domain tombstones expunge' "
|
||||
"would do that immediately." % (
|
||||
self.expired_tombstones))
|
||||
|
||||
if error_count != 0 and not self.fix:
|
||||
self.report("Please use --fix to fix these errors")
|
||||
|
||||
@ -1742,6 +1752,37 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
|
||||
self.report("Fixed attribute '%s' of '%s'\n" % (sd_attr, dn))
|
||||
self.samdb.set_session_info(self.system_session_info)
|
||||
|
||||
def is_expired_tombstone(self, dn, repl_val):
|
||||
if self.check_expired_tombstones:
|
||||
# This is not the default, it's just
|
||||
# used to keep dbcheck tests work with
|
||||
# old static provision dumps
|
||||
return False
|
||||
|
||||
repl = ndr_unpack(drsblobs.replPropertyMetaDataBlob, repl_val)
|
||||
|
||||
isDeleted = self.find_repl_attid(repl, drsuapi.DRSUAPI_ATTID_isDeleted)
|
||||
|
||||
delete_time = samba.nttime2unix(isDeleted.originating_change_time)
|
||||
current_time = time.time()
|
||||
|
||||
tombstone_delta = self.tombstoneLifetime * (24 * 60 * 60)
|
||||
|
||||
delta = current_time - delete_time
|
||||
if delta <= tombstone_delta:
|
||||
return False
|
||||
|
||||
self.report("SKIPING: object %s is an expired tombstone" % dn)
|
||||
self.report("isDeleted: attid=0x%08x version=%d invocation=%s usn=%s (local=%s) at %s" % (
|
||||
isDeleted.attid,
|
||||
isDeleted.version,
|
||||
isDeleted.originating_invocation_id,
|
||||
isDeleted.originating_usn,
|
||||
isDeleted.local_usn,
|
||||
time.ctime(samba.nttime2unix(isDeleted.originating_change_time))))
|
||||
self.expired_tombstones += 1
|
||||
return True
|
||||
|
||||
def find_changes_after_deletion(self, repl_val):
|
||||
repl = ndr_unpack(drsblobs.replPropertyMetaDataBlob, repl_val)
|
||||
|
||||
@ -2223,6 +2264,8 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
|
||||
error_count += 1
|
||||
self.err_changes_after_deletion(dn, repl_meta_data_val)
|
||||
return error_count
|
||||
if self.is_expired_tombstone(dn, repl_meta_data_val):
|
||||
return error_count
|
||||
|
||||
for attrname in obj:
|
||||
if attrname == 'dn' or attrname == "distinguishedName":
|
||||
|
@ -136,8 +136,10 @@ class cmd_dbcheck(Command):
|
||||
started_transaction = True
|
||||
try:
|
||||
chk = dbcheck(samdb, samdb_schema=samdb_schema, verbose=verbose,
|
||||
fix=fix, yes=yes, quiet=quiet, in_transaction=started_transaction,
|
||||
reset_well_known_acls=reset_well_known_acls)
|
||||
fix=fix, yes=yes, quiet=quiet,
|
||||
in_transaction=started_transaction,
|
||||
reset_well_known_acls=reset_well_known_acls,
|
||||
check_expired_tombstones=selftest_check_expired_tombstones)
|
||||
|
||||
for option in yes_rules:
|
||||
if hasattr(chk, option):
|
||||
|
@ -1,9 +1,19 @@
|
||||
Checking 232 objects
|
||||
WARNING: no target object found for GUID component link lastKnownParent in deleted object CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp - <GUID=f28216e9-1234-5678-8b2d-6bb229563b62>;OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp
|
||||
Not removing dangling one-way link on deleted object (tombstone garbage collection in progress?)
|
||||
ERROR: wrong dn[CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp] cn='fred\nDEL:2301a64c-1122-5566-851e-12d4a711cfb4' name=b'fred\nDEL:2301a64c-1122-5566-851e-12d4a711cfb4' new_dn[CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,CN=Deleted Objects,DC=release-4-5-0-pre1,DC=samba,DC=corp]
|
||||
Rename CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp to CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,CN=Deleted Objects,DC=release-4-5-0-pre1,DC=samba,DC=corp? [YES]
|
||||
Renamed CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp into CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,CN=Deleted Objects,DC=release-4-5-0-pre1,DC=samba,DC=corp
|
||||
WARNING: parent object not found for CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp
|
||||
Not moving to LostAndFound (tombstone garbage collection in progress?)
|
||||
Checked 232 objects (1 errors)
|
||||
SKIPING: object CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp is an expired tombstone
|
||||
isDeleted: attid=0x00020030 version=1 invocation=4e4496a3-7fb8-4f97-8a33-d238db8b5e2d usn=3746 (local=3746) at Wed Jun 29 04:36:39 2016
|
||||
SKIPING: object CN=fred\0ADEL:2301a64c-5b42-4ca8-851e-12d4a711cfb4,CN=Deleted Objects,DC=release-4-5-0-pre1,DC=samba,DC=corp is an expired tombstone
|
||||
isDeleted: attid=0x00020030 version=1 invocation=4e4496a3-7fb8-4f97-8a33-d238db8b5e2d usn=3746 (local=3746) at Wed Jun 29 04:36:39 2016
|
||||
SKIPING: object CN=dsg\0ADEL:6d66d0ef-cad7-4e5d-b1b6-4a233a21c269,CN=Deleted Objects,DC=release-4-5-0-pre1,DC=samba,DC=corp is an expired tombstone
|
||||
isDeleted: attid=0x00020030 version=1 invocation=4e4496a3-7fb8-4f97-8a33-d238db8b5e2d usn=3734 (local=3734) at Wed Jun 29 04:34:32 2016
|
||||
SKIPING: object CN=udg\0ADEL:7cff5537-51b1-4d26-a295-0225dbea8525,CN=Deleted Objects,DC=release-4-5-0-pre1,DC=samba,DC=corp is an expired tombstone
|
||||
isDeleted: attid=0x00020030 version=1 invocation=4e4496a3-7fb8-4f97-8a33-d238db8b5e2d usn=3739 (local=3739) at Wed Jun 29 04:34:34 2016
|
||||
SKIPING: object CN=usg\0ADEL:d012e8f5-a4bd-40ea-a2a1-68ff2508847d,CN=Deleted Objects,DC=release-4-5-0-pre1,DC=samba,DC=corp is an expired tombstone
|
||||
isDeleted: attid=0x00020030 version=1 invocation=4e4496a3-7fb8-4f97-8a33-d238db8b5e2d usn=3736 (local=3736) at Wed Jun 29 04:34:33 2016
|
||||
SKIPING: object CN=ddg\0ADEL:fb8c2fe3-5448-43de-99f9-e1d3b9357cfc,CN=Deleted Objects,DC=release-4-5-0-pre1,DC=samba,DC=corp is an expired tombstone
|
||||
isDeleted: attid=0x00020030 version=1 invocation=4e4496a3-7fb8-4f97-8a33-d238db8b5e2d usn=3737 (local=3737) at Wed Jun 29 04:34:34 2016
|
||||
SKIPING: object CN=gsg\0ADEL:91aa85cc-fc19-4b8c-9fc7-aaba425439c7,CN=Deleted Objects,DC=release-4-5-0-pre1,DC=samba,DC=corp is an expired tombstone
|
||||
isDeleted: attid=0x00020030 version=1 invocation=4e4496a3-7fb8-4f97-8a33-d238db8b5e2d usn=3735 (local=3735) at Wed Jun 29 04:34:33 2016
|
||||
SKIPING: object CN=gdg\0ADEL:e0f581e7-14ee-4fc2-839c-8f46f581c72a,CN=Deleted Objects,DC=release-4-5-0-pre1,DC=samba,DC=corp is an expired tombstone
|
||||
isDeleted: attid=0x00020030 version=1 invocation=4e4496a3-7fb8-4f97-8a33-d238db8b5e2d usn=3738 (local=3738) at Wed Jun 29 04:34:34 2016
|
||||
NOTICE: found 8 expired tombstones, 'samba' will remove them daily, 'samba-tool domain tombstones expunge' would do that immediately.
|
||||
Checked 232 objects (0 errors)
|
||||
|
@ -539,7 +539,7 @@ EOF
|
||||
dbcheck_lost_deleted_user3() {
|
||||
# here we don't pass --selftest-check-expired-tombstones
|
||||
# as we want to test the default
|
||||
dbcheck "-lost-deleted-user3" "1" ""
|
||||
dbcheck "-lost-deleted-user3" "0" ""
|
||||
return $?
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user