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:57:30 -0400
commit3ae2a92d8881b44f503dcd04affea4e124bd69ce (patch)
tree37d5d8dae6f60fcb67649aed4d8a7589a2e241fe
parent87f880bb7f60438e27674872dc93d94e42b72159 (diff)
downloadfreeipa-3ae2a92d8881b44f503dcd04affea4e124bd69ce.tar.gz
freeipa-3ae2a92d8881b44f503dcd04affea4e124bd69ce.tar.xz
freeipa-3ae2a92d8881b44f503dcd04affea4e124bd69ce.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 528e349d7..eb95858f9 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):