From ff99696311668f339200080a826bbc6efc708291 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 23 Dec 2013 10:18:05 +0000
Subject: [PATCH] OPENDJ-1263 Changenumber does not progress on the second replication server of a topology

---
 opends/src/server/org/opends/server/replication/server/changelog/je/ChangeNumberIndexer.java |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/changelog/je/ChangeNumberIndexer.java b/opends/src/server/org/opends/server/replication/server/changelog/je/ChangeNumberIndexer.java
index 3b2c115..a9320a4 100644
--- a/opends/src/server/org/opends/server/replication/server/changelog/je/ChangeNumberIndexer.java
+++ b/opends/src/server/org/opends/server/replication/server/changelog/je/ChangeNumberIndexer.java
@@ -176,7 +176,7 @@
    */
   public void publishHeartbeat(DN baseDN, CSN heartbeatCSN)
   {
-    if (MultimasterReplication.isECLDisabledDomain(baseDN))
+    if (!isECLEnabledDomain(baseDN))
     {
       return;
     }
@@ -198,7 +198,7 @@
   public void publishUpdateMsg(DN baseDN, UpdateMsg updateMsg)
       throws ChangelogException
   {
-    if (MultimasterReplication.isECLDisabledDomain(baseDN))
+    if (!isECLEnabledDomain(baseDN))
     {
       return;
     }
@@ -211,6 +211,23 @@
   }
 
   /**
+   * Returns whether the provided baseDN represents a replication domain enabled
+   * for the external changelog.
+   * <p>
+   * This method is a test seam that break the dependency on a static method.
+   *
+   * @param baseDN
+   *          the replication domain to check
+   * @return true if the provided baseDN is enabled for the external changelog,
+   *         false if the provided baseDN is disabled for the external changelog
+   *         or unknown to multimaster replication.
+   */
+  protected boolean isECLEnabledDomain(DN baseDN)
+  {
+    return MultimasterReplication.isECLEnabledDomain(baseDN);
+  }
+
+  /**
    * Returns the last time each serverId was seen alive for the specified
    * replication domain.
    *
@@ -288,6 +305,11 @@
         : changelogState.getDomainToServerIds().entrySet())
     {
       final DN baseDN = entry.getKey();
+      if (!isECLEnabledDomain(baseDN))
+      {
+        continue;
+      }
+
       for (Integer serverId : entry.getValue())
       {
         final CSN csn = mediumConsistencyRUV.getCSN(baseDN, serverId);

--
Gitblit v1.10.0