From d03f99a7c7ecd5f3e9e94f84c9b8a3b22d8f232a Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Sat, 05 Oct 2013 18:19:50 +0000
Subject: [PATCH] Reverted part of r9660 and all of r9661. I think it was invalid to think that we might want to call getCount() for a given serverId (hence replicaDB) by using the serverId from one of the CSNs. We can very well call getCount() with from and to CSNs that are not present on the targeted replicaDB.

---
 opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java b/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
index 284e7f9..8ac9d55 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
@@ -1307,13 +1307,14 @@
  /**
   * Count the number of changes in the replication changelog for the provided
   * serverID, between 2 provided CSNs.
+  * @param serverId Identifier of the server for which to compute the count.
   * @param from lower limit CSN.
   * @param to   upper limit CSN.
   * @return the number of changes.
   */
-  public long getCount(CSN from, CSN to)
+  public long getCount(int serverId, CSN from, CSN to)
   {
-    return domainDB.getCount(baseDN, from, to);
+    return domainDB.getCount(baseDN, serverId, from, to);
   }
 
   /**
@@ -2805,7 +2806,7 @@
     for (CSN csn : getLatestServerState())
     {
       CSN startCSN = startState.getCSN(csn.getServerId());
-      long serverIdRes = getCount(startCSN, endCSN);
+      long serverIdRes = getCount(csn.getServerId(), startCSN, endCSN);
 
       // The startPoint is excluded when counting the ECL eligible changes
       if (startCSN != null && serverIdRes > 0)
@@ -2831,9 +2832,10 @@
     long res = 0;
     for (CSN csn : getLatestServerState())
     {
+      int serverId = csn.getServerId();
       CSN lStartCSN =
-          new CSN(startCSN.getTime(), startCSN.getSeqnum(), csn.getServerId());
-      res += getCount(lStartCSN, endCSN);
+          new CSN(startCSN.getTime(), startCSN.getSeqnum(), serverId);
+      res += getCount(serverId, lStartCSN, endCSN);
     }
     return res;
   }

--
Gitblit v1.10.0