From 42d43dc414e477fa875c1d815d74297252ec412b Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Fri, 09 Nov 2007 22:20:28 +0000
Subject: [PATCH] This set of updates fix several issues related to the JEB backend:
---
opends/src/server/org/opends/server/backends/jeb/EntryContainer.java | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java b/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
index 7073463..e810c93 100644
--- a/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
+++ b/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
@@ -3831,7 +3831,32 @@
*/
public long getEntryCount() throws DatabaseException
{
- return id2entry.getRecordCount();
+ EntryID entryID = dn2id.get(null, baseDN);
+ if (entryID != null)
+ {
+ DatabaseEntry key =
+ new DatabaseEntry(JebFormat.entryIDToDatabase(entryID.longValue()));
+ EntryIDSet entryIDSet;
+ entryIDSet = id2subtree.readKey(key, null, LockMode.DEFAULT);
+
+ long count = entryIDSet.size();
+ if(count != Long.MAX_VALUE)
+ {
+ // Add the base entry itself
+ return ++count;
+ }
+ else
+ {
+ // The count is not maintained. Fall back to the slow method
+ return id2entry.getRecordCount();
+ }
+ }
+ else
+ {
+ // Base entry doesn't not exist so this entry container
+ // must not have any entries
+ return 0;
+ }
}
/**
--
Gitblit v1.10.0