The branch, master has been updated via 6a6f095 samba-tool domain schemaupgrade: Avoid reindex after every hunk from fafc6da ldapcmp: Improve the difference checker of ldapcmp for 2012 R2
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 6a6f0952a5769628bfa07d1bf1c04bd23d827492 Author: Andrew Bartlett <abart...@samba.org> Date: Thu Dec 21 12:07:46 2017 +1300 samba-tool domain schemaupgrade: Avoid reindex after every hunk This takes advantage of the fact that a single LDB operation is atomic even inside our transaction and so we can retry it after updating the schema. This makes the smaba-tool domain schemaupgrade take 1m30s compared with 4m4s. Signed-off-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Garming Sam <garm...@catalyst.net.nz> Autobuild-User(master): Garming Sam <garm...@samba.org> Autobuild-Date(master): Thu Dec 21 08:28:51 CET 2017 on sn-devel-144 ----------------------------------------------------------------------- Summary of changes: python/samba/netcmd/domain.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) Changeset truncated at 500 lines: diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py index a3dd565..ada7d6b 100644 --- a/python/samba/netcmd/domain.py +++ b/python/samba/netcmd/domain.py @@ -3915,7 +3915,21 @@ schemaUpdateNow: 1 """Applies a single LDIF update to the schema""" try: - samdb.modify_ldif(self.ldif, controls=['relax:0']) + try: + samdb.modify_ldif(self.ldif, controls=['relax:0']) + except ldb.LdbError as e: + if e.args[0] == ldb.ERR_INVALID_ATTRIBUTE_SYNTAX: + + # REFRESH after a failed change + + # Otherwise the OID-to-attribute mapping in + # _apply_updates_in_file() won't work, because it + # can't lookup the new OID in the schema + self._ldap_schemaUpdateNow(samdb) + + samdb.modify_ldif(self.ldif, controls=['relax:0']) + else: + raise except ldb.LdbError as e: if self.can_ignore_failure(e): return 0 @@ -3927,11 +3941,6 @@ schemaUpdateNow: 1 raise - # REFRESH AFTER EVERY CHANGE - # Otherwise the OID-to-attribute mapping in _apply_updates_in_file() - # won't work, because it can't lookup the new OID in the schema - self._ldap_schemaUpdateNow(samdb) - return 1 class cmd_domain_schema_upgrade(Command): -- Samba Shared Repository