summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2012-09-12 09:40:06 +0200
committerRob Crittenden <rcritten@redhat.com>2012-09-16 17:59:19 -0400
commit2ecfe571faf9291eab7ffacea2a1e94d5be0d689 (patch)
tree6919bce2bf0a49899310d5b2bd5ccbcec9a1c8f6
parentd8ba7d9145bda85aac3cf4810d36927f2325e267 (diff)
downloadfreeipa.git-2ecfe571faf9291eab7ffacea2a1e94d5be0d689.tar.gz
freeipa.git-2ecfe571faf9291eab7ffacea2a1e94d5be0d689.tar.xz
freeipa.git-2ecfe571faf9291eab7ffacea2a1e94d5be0d689.zip
Run index task in ldap updater only when needed
When LDAP updater detected an update instruction in indexing tree, it run an indexing task and waited until it ends. However, the task was run regardless of the update instruction result. This lead to unnecessary index tasks being defined and waited for which makes the whole LDAP last longer. Execute indexing task only when an index add/update instruction is successful. https://fedorahosted.org/freeipa/ticket/2866
-rw-r--r--ipaserver/install/ldapupdate.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
index 528e349d..eb95858f 100644
--- a/ipaserver/install/ldapupdate.py
+++ b/ipaserver/install/ldapupdate.py
@@ -754,6 +754,8 @@ class LDAPUpdate:
self.print_entity(entry, "Final value after applying updates")
+ added = False
+ updated = False
if not found:
# New entries get their orig_data set to the entry itself. We want to
# empty that so that everything appears new when generating the
@@ -773,13 +775,13 @@ class LDAPUpdate:
self.info("Parent DN of %s may not exist, cannot create the entry",
entry.dn)
return
+ added = True
self.modified = True
except Exception, e:
self.error("Add failure %s", e)
else:
# Update LDAP
try:
- updated = False
changes = self.conn.generateModList(entry.origDataDict(), entry.toDict())
if (entry.dn == DN(('cn', 'schema'))):
d = dict()
@@ -805,13 +807,14 @@ class LDAPUpdate:
self.error("Update failed: %s", e)
updated = False
- if (DN(('cn', 'index')) in entry.dn and
- DN(('cn', 'userRoot')) in entry.dn):
- taskid = self.create_index_task(entry.getValue('cn'))
- self.monitor_index_task(taskid)
-
if updated:
self.modified = True
+
+ if entry.dn.endswith(DN(('cn', 'index'), ('cn', 'userRoot'),
+ ('cn', 'ldbm database'), ('cn', 'plugins'),
+ ('cn', 'config'))) and (added or updated):
+ taskid = self.create_index_task(entry.getValue('cn'))
+ self.monitor_index_task(taskid)
return
def _delete_record(self, updates):