From 18c2dbcff97cbb862da50c2af102b84cf0816642 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 13 May 2014 11:45:14 +0000
Subject: [PATCH] Fixed "External Changelog Two Suffixes (Both Replicated)" robot functional test.

---
 opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java |   34 ++++++++++++++++++++++++++++++----
 1 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
index ffea811..2c37ab2 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
@@ -388,7 +388,9 @@
       // until here session is encrypted then it depends on the negotiation
       // The session initiator decides whether to use SSL.
       if (!sessionInitiatorSSLEncryption)
+      {
         session.stopEncryption();
+      }
 
       // wait and process StartSessionMsg from remote RS
       StartECLSessionMsg inStartECLSessionMsg =
@@ -655,8 +657,10 @@
               e);
     }
     if (debugEnabled())
+    {
       TRACER.debugInfo("initializeChangelogDomainCtxts() ends with "
           + dumpState());
+    }
   }
 
   private Set<DomainContext> buildDomainContexts(String providedCookie,
@@ -681,7 +685,9 @@
     {
       // skip the 'unreal' changelog domain
       if (domain == this.replicationServerDomain)
+      {
         continue;
+      }
 
       // skip the excluded domains
       Set<String> excludedBaseDNs = startECLSessionMsg.getExcludedBaseDNs();
@@ -689,14 +695,18 @@
       {
         // this is an excluded domain
         if (allowUnknownDomains)
+        {
           startStatesFromProvidedCookie.remove(domain.getBaseDN());
+        }
         continue;
       }
 
       // skip unused domains
       final ServerState latestState = domain.getLatestServerState();
       if (latestState.isEmpty())
+      {
         continue;
+      }
 
       // Creates the new domain context
       final DomainContext newDomainCtxt;
@@ -848,7 +858,9 @@
   public void shutdown()
   {
     if (debugEnabled())
+    {
       TRACER.debugInfo(this + " shutdown()");
+    }
     releaseCursor();
     for (DomainContext domainCtxt : domainCtxts) {
       if (!domainCtxt.unRegisterHandler()) {
@@ -1004,8 +1016,10 @@
     registerIntoDomain();
 
     if (debugEnabled())
+    {
       TRACER.debugInfo(getClass().getCanonicalName() + " " + getOperationId()
           + " initialized: " + " " + dumpState() + domaimCtxtsToString(""));
+    }
   }
 
   private void initializeChangelogSearch(StartECLSessionMsg msg)
@@ -1035,7 +1049,9 @@
 
     // TODO:ECL We should refactor so that a SH always have a session
     if (session == null)
+    {
       return msg;
+    }
 
     boolean interrupted = true;
     boolean acquired = false;
@@ -1071,7 +1087,9 @@
     {
       ECLUpdateMsg eclMsg = getNextECLUpdate();
       if (eclMsg != null)
+      {
         return eclMsg.getUpdateMsg();
+      }
     }
     catch(DirectoryException de)
     {
@@ -1088,8 +1106,10 @@
   public ECLUpdateMsg getNextECLUpdate() throws DirectoryException
   {
     if (debugEnabled())
+    {
       TRACER.debugInfo("In cn=changelog " + this +
           " getNextECLUpdate starts: " + dumpState());
+    }
 
     ECLUpdateMsg oldestChange = null;
     try
@@ -1191,14 +1211,18 @@
     {
       final CSN csn = oldestChange.getUpdateMsg().getCSN();
       if (debugEnabled())
+      {
         TRACER.debugInfo("getNextECLUpdate updates previousCookie:" + csn);
+      }
 
       previousCookie.update(oldestChange.getBaseDN(), csn);
       oldestChange.setCookie(previousCookie);
 
       if (debugEnabled())
+      {
         TRACER.debugInfo("getNextECLUpdate returns result oldestChange="
             + oldestChange);
+      }
     }
     return oldestChange;
   }
@@ -1253,10 +1277,12 @@
       final DN baseDNFromCNIndexDB = currentRecord.getBaseDN();
 
       if (debugEnabled())
+      {
         TRACER.debugInfo("assignChangeNumber() comparing the replicaDB's and"
             + " CNIndexDB's baseDNs :" + baseDNFromReplicaDB + "?="
             + baseDNFromCNIndexDB + " timestamps:" + asDate(csnFromReplicaDB)
             + " ?older" + asDate(csnFromCNIndexDB));
+      }
 
       if (areSameChange(csnFromReplicaDB, baseDNFromReplicaDB,
           csnFromCNIndexDB, baseDNFromCNIndexDB))
@@ -1268,14 +1294,13 @@
               + currentRecord.getChangeNumber() + " to change="
               + replicaDBChange);
 
-        previousCookie =
-            new MultiDomainServerState(currentRecord.getPreviousCookie());
+        previousCookie.update(
+            new MultiDomainServerState(currentRecord.getPreviousCookie()));
         replicaDBChange.setCookie(previousCookie);
         replicaDBChange.setChangeNumber(currentRecord.getChangeNumber());
         return true;
       }
 
-
       if (!csnFromCNIndexDB.isOlderThan(csnFromReplicaDB))
       {
         // the change from the replicaDB is older
@@ -1287,7 +1312,6 @@
         return false; // TO BE CHECKED
       }
 
-
       // The change from the CNIndexDB is older.
       // It means that the CNIndexDB change has been purged from the replicaDB
       // and CNIndexDB has not been trimmed yet.
@@ -1339,8 +1363,10 @@
     // starvation of changelog messages
     // all domain have been unactived means are covered
     if (debugEnabled())
+    {
       TRACER.debugInfo("In cn=changelog" + "," + this + " closeInitPhase(): "
           + dumpState());
+    }
 
     // go to persistent phase if one
     for (DomainContext domainCtxt : domainCtxts) domainCtxt.active = true;

--
Gitblit v1.10.0