ldap/servers/slapd/csnset.c | 4 +++-
ldap/servers/slapd/entrywsi.c | 18 +++---------------
2 files changed, 6 insertions(+), 16 deletions(-)
New commits:
commit c07717326879119f321512d87e558b69045a86fd
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri Oct 28 12:51:08 2011 -0600
Bug 748575 - part 2 - rhds81 modrdn operation and 100% cpu use in replication
https://bugzilla.redhat.com/show_bug.cgi?id=748575
Resolves: bug 748575
Bug Description: rhds81 modrdn operation and 100% cpu use in replication
Reviewed by: ???
Branch: master
Fix Description: The entry code takes great pains to add or insert in
ascending order the dncsn to the e_dncsnset. But the only place this is
ever used is in the call to entry_get_dncsn, which just calls
csnset_get_last_csn, which just gets the last one in the list. Since the
last one in the list is the one with the greatest csn, and the function
csnset_update_csn already stores the greatest csn, we can just use that
function, rather than using csnset_add and insert and building a potentially
very large list. This should also have the effect of making importing
a replica init LDIF faster.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c
index dc038ba..506a1f9 100644
--- a/ldap/servers/slapd/entrywsi.c
+++ b/ldap/servers/slapd/entrywsi.c
@@ -184,10 +184,7 @@ int
entry_add_dncsn(Slapi_Entry *entry, const CSN *csn)
{
PR_ASSERT(entry!=NULL);
- if(!csnset_contains(entry->e_dncsnset,csn))
- {
- csnset_add_csn(&entry->e_dncsnset, CSN_TYPE_VALUE_DISTINGUISHED, csn);
- }
+ csnset_update_csn(&entry->e_dncsnset, CSN_TYPE_VALUE_DISTINGUISHED, csn);
return 0;
}
@@ -204,17 +201,7 @@ int
entry_add_dncsn_ext(Slapi_Entry *entry, const CSN *csn, PRUint32 flags)
{
PR_ASSERT(entry!=NULL);
- if(!csnset_contains(entry->e_dncsnset,csn))
- {
- if (flags & ENTRY_DNCSN_INCREASING)
- {
- csnset_insert_csn(&entry->e_dncsnset, CSN_TYPE_VALUE_DISTINGUISHED, csn);
- }
- else
- {
- csnset_add_csn(&entry->e_dncsnset, CSN_TYPE_VALUE_DISTINGUISHED, csn);
- }
- }
+ csnset_update_csn(&entry->e_dncsnset, CSN_TYPE_VALUE_DISTINGUISHED, csn);
return 0;
}
commit 23467126c33a1f6004bb8357d87bc355a53eb25d
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Wed Oct 26 17:13:28 2011 -0600
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: master
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
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 9087651..dc038ba 100644
--- a/ldap/servers/slapd/entrywsi.c
+++ b/ldap/servers/slapd/entrywsi.c
@@ -358,6 +358,7 @@ entry_purge_state_information(Slapi_Entry *e, const CSN *csnUpTo)
*/
attr_purge_state_information(e, a, csnUpTo);
}
+ csnset_purge(&e->e_dncsnset, csnUpTo);
}
/*