From 9381f1aa6dac9731fa688dfbebdfdf4955abc317 Mon Sep 17 00:00:00 2001
From: fdorson <fdorson@localhost>
Date: Fri, 13 Jun 2008 12:41:33 +0000
Subject: [PATCH] fix for issue #3310 : It could take up to 6 minutes to restart a master.

---
 opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java b/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java
index 6254fae..92088b3 100644
--- a/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java
+++ b/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java
@@ -703,7 +703,9 @@
 
   /**
    * Search for the changes that happened since fromChangeNumber
-   * based on the historical attribute.
+   * based on the historical attribute. The only changes that will
+   * be send will be the one generated on the serverId provided in
+   * fromChangeNumber.
    * @param baseDn the base DN
    * @param fromChangeNumber The change number from which we want the changes
    * @param resultListener that will process the entries returned.
@@ -718,9 +720,16 @@
   {
     InternalClientConnection conn =
       InternalClientConnection.getRootConnection();
+    Short serverId = fromChangeNumber.getServerId();
+
+    String maxValueForId = "ffffffffffffffff" +
+      String.format("%04x", serverId) + "ffffffff";
+
     LDAPFilter filter = LDAPFilter.decode(
-      "(" + Historical.HISTORICALATTRIBUTENAME +
-      ">=dummy:" + fromChangeNumber + ")");
+       "(&(" + Historical.HISTORICALATTRIBUTENAME + ">=dummy:"
+       + fromChangeNumber + ")(" + Historical.HISTORICALATTRIBUTENAME +
+       "<=dummy:" + maxValueForId + "))");
+
     LinkedHashSet<String> attrs = new LinkedHashSet<String>(1);
     attrs.add(Historical.HISTORICALATTRIBUTENAME);
     attrs.add(Historical.ENTRYUIDNAME);

--
Gitblit v1.10.0