From 7fa2297e926ddb64045b97a33de723ea613ead68 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.
---
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java | 15 ++++++++++++---
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRule.java | 13 ++++++++++++-
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRule.java
index 23bf463..8cea779 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRule.java
@@ -133,7 +133,18 @@
public ByteString normalizeValue(ByteString value)
{
String[] token = value.stringValue().split(":", 3);
- return new ASN1OctetString(token[1]);
+
+ /* Change the format of the value to index and start
+ * with the serverId. In that manner, the search response
+ * time is optimised for a particulare serverId.
+ * The format of the key is now :
+ * serverId + timestamp + seqNum
+ */
+ String timestamp = token[1].substring(0,16);
+ String serverId = token[1].substring(16,20);
+ String seqNumber = token[1].substring(20, 28);
+
+ return new ASN1OctetString(serverId + timestamp + seqNumber);
}
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java
index 6254fae..92088b3 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java
+++ b/opendj-sdk/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