From 7b6a831c344c33c128a15328ec0b8e46690248ec Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Nov 07 2011 22:54:20 +0000 Subject: Bug 748575 - rhds81 modrn operation and 100% cpu use in replication https://bugzilla.redhat.com/show_bug.cgi?id=748575 Resolves: bug 748575 Bug Description: rhds81 modrn operation and 100% cpu use in replication Reviewed by: ??? Branch: Directory_Server_8_2_Branch Fix Description: The modrdn operation causes the entry to be copied multiple times by calling slapi_entry_dup. This in turn does a csnset_dup of the e_dncsnset in the entry. This function was very inefficient. It would simply call csnset_add_csn, which would iterate to the end of the linked list for every addition. Once you get several thousand items in the list, it has to iterate to the end of several thousand items each time. I changed it to keep track of the last item in the list, and just add the new item to the end of the list. This improves the performance quite a bit, but the cpu still gets pegged at a high percentage eventually, it just takes longer to reach that point. Platforms tested: RHEL6 x86_64 Flag Day: no Doc impact: no (cherry picked from commit 23467126c33a1f6004bb8357d87bc355a53eb25d) --- diff --git a/ldap/servers/slapd/csnset.c b/ldap/servers/slapd/csnset.c index 645c17e..d98cecf 100644 --- a/ldap/servers/slapd/csnset.c +++ b/ldap/servers/slapd/csnset.c @@ -374,11 +374,13 @@ CSNSet * csnset_dup(const CSNSet *csnset) { CSNSet *newcsnset= NULL; + CSNSet **curnode = &newcsnset; const CSNSet *n= csnset; while(n!=NULL) { - csnset_add_csn(&newcsnset,n->type,&n->csn); + csnset_add_csn(curnode,n->type,&n->csn); n= n->next; + curnode = &((*curnode)->next); } return newcsnset; } diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c index 01c160c..83a9c2a 100644 --- a/ldap/servers/slapd/entrywsi.c +++ b/ldap/servers/slapd/entrywsi.c @@ -357,6 +357,7 @@ entry_purge_state_information(Slapi_Entry *e, const CSN *csnUpTo) */ attr_purge_state_information(e, a, csnUpTo); } + csnset_purge(&e->e_dncsnset, csnUpTo); } /*