From 7c30dbb5403772b323df3ad907d9ed15d23b5aee Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Thu, 29 Apr 2010 20:35:40 +0000
Subject: [PATCH] Last batch of changes for this week. This adds support for the IETF based Password Policy for LDAP as SubEntry. Also resolves the following issues : - 4544 :  initializeBackend() should not set JE env config params directly. - 4478 : ECL in draft compat mode / search lastchangenumber can be very long - 4538 : Virtual attributes not retrieved when entry cache configured - 4547 : Search Filter Matching differ for cn=Directory Manager and plain user. - 4514 : Logs shows unexpected message with replication monitoring data missing (Partial fix) - 4534 : Replication using security does not work after server restart - 4516 : SEVERE_ERROR: servers (...) have the same ServerId In addition, they also improve reliability and performance in various areas including CollectiveAttributes, Virtual Attributes and Subentries management, Schema loading, Replication...

---
 opends/src/server/org/opends/server/replication/server/DbHandler.java |   32 +++++++++++++++++++++++++++++---
 1 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/DbHandler.java b/opends/src/server/org/opends/server/replication/server/DbHandler.java
index b28b7b8..2ca2e67 100644
--- a/opends/src/server/org/opends/server/replication/server/DbHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/DbHandler.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2006-2009 Sun Microsystems, Inc.
+ *      Copyright 2006-2010 Sun Microsystems, Inc.
  */
 package org.opends.server.replication.server;
 import org.opends.messages.MessageBuilder;
@@ -294,7 +294,7 @@
    * @param to   The upper (newer) change number.
    * @return The computed number of changes.
    */
-  public int getCount(ChangeNumber from, ChangeNumber to)
+  public int traverseAndCount(ChangeNumber from, ChangeNumber to)
   {
     int count = 0;
     flush();
@@ -312,7 +312,7 @@
       ChangeNumber curr = null;
       while ((curr = cursor.nextChangeNumber())!=null)
       {
-        if (curr.newer(to))
+        if (curr.newerOrEquals(to))
           break;
         count++;
       }
@@ -696,4 +696,30 @@
   {
     return this.msgQueue.size();
   }
+
+  /**
+   * Set the counter writing window size (public for unit tests only).
+   * @param size Size in number of record.
+   */
+  public void setCounterWindowSize(int size)
+  {
+    db.setCounterWindowSize(size);
+  }
+
+  /**
+   * Return the number of changes between 2 provided change numbers.
+   * This a alternative to traverseAndCount, expected to be much more efficient
+   * when there is a huge number of changes in the Db.
+   * @param from The lower (older) change number.
+   * @param to   The upper (newer) change number.
+   * @return The computed number of changes.
+   */
+  public int getCount(ChangeNumber from, ChangeNumber to)
+  {
+    int c=0;
+    flush();
+    c = db.count(from, to);
+    return c;
+  }
+
 }

--
Gitblit v1.10.0