From 88b3513bbf0f7679c2d6fa44b10933a7fba32bc6 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Fri, 23 Feb 2007 19:22:39 +0000
Subject: [PATCH] Changed ID2Entry#getRecordCount to use the Database#count method in JE 3.1.0. The JE backend no longer keeps a count of entries in entry ID 0. Modified TestVerifyJob unit test to no longer simulate a incorrect entry count.

---
 opends/src/server/org/opends/server/backends/jeb/EntryContainer.java |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 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 b8a5a52..e60ae62 100644
--- a/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
+++ b/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
@@ -1521,8 +1521,6 @@
         }
       }
 
-      // Increment the entry count.
-      id2entry.adjustRecordCount(txn, 1);
     }
 
     /**
@@ -2021,8 +2019,6 @@
       id2cBuffered.flush();
       id2sBuffered.flush();
 
-      // Decrement the entry count.
-      id2entry.adjustRecordCount(txn, -getDeletedEntryCount());
     }
 
     /**
@@ -3253,7 +3249,7 @@
    */
   public long getEntryCount() throws DatabaseException
   {
-    return id2entry.getRecordCount(null);
+    return id2entry.getRecordCount();
   }
 
   /**
@@ -3737,6 +3733,21 @@
   }
 
   /**
+   * Get the count of key/data pairs in the database in a JE database.
+   * This is a simple wrapper around the JE Database.count method.
+   * @param database the JE database handle.
+   * @return The count of key/data pairs in the database.
+   * @throws DatabaseException If an error occurs in the JE operation.
+   */
+  public static long count(Database database) throws DatabaseException
+  {
+    long count = database.count();
+    assert debugAccess("count", DATABASE_READ, null, database,
+        null, null, null);
+    return count;
+  }
+
+  /**
    * Remove a database from disk.
    *
    * @param name The short database name, to which the entryContainer name will

--
Gitblit v1.10.0