summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoriko Hosoi <nhosoi@redhat.com>2010-08-27 17:01:11 -0700
committerNoriko Hosoi <nhosoi@redhat.com>2010-08-31 10:39:00 -0700
commitcc36301a7cae6737d9f8a0e53bed653a52130a1d (patch)
tree6f5358559e3b709985c12d4af47061015e3191c0
parenta0282b832d09951a893a4293707a2586020d09cf (diff)
downloadds-cc36301a7cae6737d9f8a0e53bed653a52130a1d.tar.gz
ds-cc36301a7cae6737d9f8a0e53bed653a52130a1d.tar.xz
ds-cc36301a7cae6737d9f8a0e53bed653a52130a1d.zip
Bug 627738 - The cn=monitor statistics entries for the dnentry cache do not change or change very rarely
https://bugzilla.redhat.com/show_bug.cgi?id=627738 Description: 1) id2entry_add_ext replaces an dn instance in the dn cache even if the DN value is identical. Replace it only when they don't match. 2) Modifying the dn cache related labels: dnEntrycachehits dnEntrycachetries dnEntrycachehitratio dnCurrententrycachesize dnMaxentrycachesize dnCurrententrycachecount dnMaxentrycachecount ===> dncachehits dncachetries dncachehitratio currentdncachesize maxdncachesize currentdncachecount maxdncachecount
-rw-r--r--ldap/servers/slapd/back-ldbm/id2entry.c6
-rw-r--r--ldap/servers/slapd/back-ldbm/monitor.c14
2 files changed, 11 insertions, 9 deletions
diff --git a/ldap/servers/slapd/back-ldbm/id2entry.c b/ldap/servers/slapd/back-ldbm/id2entry.c
index 977e0b44..40512146 100644
--- a/ldap/servers/slapd/back-ldbm/id2entry.c
+++ b/ldap/servers/slapd/back-ldbm/id2entry.c
@@ -100,8 +100,10 @@ id2entry_add_ext( backend *be, struct backentry *e, back_txn *txn, int encrypt
struct backdn *bdn = backdn_init(sdn, e->ep_id, 0);
options |= SLAPI_DUMP_RDN_ENTRY;
- /* If the ID already exists in the DN cache, replace it. */
- if (CACHE_ADD( &inst->inst_dncache, bdn, &oldbdn ) == 1) {
+ /* If the ID already exists in the DN cache && the DNs do not match,
+ * replace it. */
+ if ((CACHE_ADD( &inst->inst_dncache, bdn, &oldbdn ) == 1) &&
+ (slapi_sdn_compare(sdn, oldbdn->dn_sdn))) {
cache_replace( &inst->inst_dncache, oldbdn, bdn );
CACHE_RETURN(&inst->inst_dncache, &oldbdn); /* to free oldbdn */
}
diff --git a/ldap/servers/slapd/back-ldbm/monitor.c b/ldap/servers/slapd/back-ldbm/monitor.c
index 265021c9..075a48fc 100644
--- a/ldap/servers/slapd/back-ldbm/monitor.c
+++ b/ldap/servers/slapd/back-ldbm/monitor.c
@@ -131,19 +131,19 @@ int ldbm_back_monitor_instance_search(Slapi_PBlock *pb, Slapi_Entry *e,
cache_get_stats(&(inst->inst_dncache), &hits, &tries,
&nentries, &maxentries, &size, &maxsize);
sprintf(buf, "%" NSPRIu64, hits);
- MSET("dnEntryCacheHits");
+ MSET("dnCacheHits");
sprintf(buf, "%" NSPRIu64, tries);
- MSET("dnEntryCacheTries");
+ MSET("dnCacheTries");
sprintf(buf, "%lu", (unsigned long)(100.0*(double)hits / (double)(tries > 0 ? tries : 1)));
- MSET("dnEntryCacheHitRatio");
+ MSET("dnCacheHitRatio");
sprintf(buf, "%lu", size);
- MSET("dnCurrentEntryCacheSize");
+ MSET("currentDnCacheSize");
sprintf(buf, "%lu", maxsize);
- MSET("dnMaxEntryCacheSize");
+ MSET("maxDnCacheSize");
sprintf(buf, "%ld", nentries);
- MSET("dnCurrentEntryCacheCount");
+ MSET("currentDnCacheCount");
sprintf(buf, "%ld", maxentries);
- MSET("dnMaxEntryCacheCount");
+ MSET("maxDnCacheCount");
}
#ifdef DEBUG