From 9f0904fda87bfcf921deeccdbaeafe834fbad696 Mon Sep 17 00:00:00 2001
From: Yannick Lecaillez <yannick.lecaillez@forgerock.com>
Date: Fri, 24 Apr 2015 14:30:47 +0000
Subject: [PATCH] OPENDJ-1725: Persistit: very long recovery and many discarded txns after addrate test
---
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/EntryContainer.java | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/EntryContainer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/EntryContainer.java
index 5184f4c..d8f36a2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/EntryContainer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/EntryContainer.java
@@ -61,7 +61,6 @@
import com.sleepycat.je.*;
import static com.sleepycat.je.LockMode.*;
-
import static org.opends.messages.JebMessages.*;
import static org.opends.server.backends.jeb.JebFormat.*;
import static org.opends.server.core.DirectoryServer.*;
@@ -688,9 +687,10 @@
* Determine the number of subordinate entries for a given entry.
*
* @param entryDN The distinguished name of the entry.
- * @param subtree <code>true</code> will include all the entries under the
- * given entries. <code>false</code> will only return the
- * number of entries immediately under the given entry.
+ * @param subtree <code>true</code> will include the entry and all the
+ * entries under the given entries. <code>false</code>
+ * will only return the number of entries immediately
+ * under the given entry.
* @return The number of subordinate entries for the given entry or -1 if
* the entry does not exist.
* @throws DatabaseException If an error occurs in the JE database.
@@ -702,20 +702,23 @@
if (entryID != null)
{
DatabaseEntry key = new DatabaseEntry(entryIDToDatabase(entryID.longValue()));
- EntryIDSet entryIDSet;
+ final EntryIDSet entryIDSet;
+ long count;
if (subtree)
{
+ count = dn2id.get(null, entryDN, LockMode.DEFAULT) != null ? 1 : 0;
entryIDSet = id2subtree.readKey(key, null, LockMode.DEFAULT);
}
else
{
+ count = 0;
entryIDSet = id2children.readKey(key, null, LockMode.DEFAULT);
}
- long count = entryIDSet.size();
- if(count != Long.MAX_VALUE)
+ if(entryIDSet.size() == Long.MAX_VALUE)
{
- return count;
+ return -1;
}
+ return count + entryIDSet.size();
}
return -1;
}
--
Gitblit v1.10.0