From ed847e95ab009b3f8a7b57636aa3bbe977bf875d Mon Sep 17 00:00:00 2001
From: pgamba <pgamba@localhost>
Date: Mon, 19 Oct 2009 07:56:29 +0000
Subject: [PATCH] Fix #4270 ECL Should not establish connections between RSes

---
 opends/src/server/org/opends/server/replication/server/ECLServerHandler.java |   37 +++++++++++++++++++------------------
 1 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java b/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
index 923e1b6..d9e67d6 100644
--- a/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
@@ -371,19 +371,17 @@
           replicationServerURL,
           getServiceId(),
           maxRcvWindow,
-          replicationServerDomain.getDbServerState(),
+          new ServerState(),
           protocolVersion,
           localGenerationId,
           sslEncryption,
           getLocalGroupId(),
-          replicationServerDomain.
-          getReplicationServer().getDegradedStatusThreshold(),
+          0,
           replicationServer.getWeight(),
-          replicationServerDomain.getConnectedLDAPservers().size());
+          0);
 
 
       session.publish(outReplServerStartDSMsg);
-
       return outReplServerStartDSMsg;
     }
   }
@@ -462,9 +460,11 @@
         processStartFromRemote(inECLStartMsg);
 
       // lock with timeout
-      lockDomain(true);
+      if (this.replicationServerDomain != null)
+        lockDomain(true);
 
-      this.localGenerationId = replicationServerDomain.getGenerationId();
+//    this.localGenerationId = replicationServerDomain.getGenerationId();
+      this.localGenerationId = -1;
 
       // send start to remote
       StartMsg outStartMsg =
@@ -708,7 +708,7 @@
   {
     HashMap<String,ServerState> startStates = new HashMap<String,ServerState>();
 
-    ReplicationServer rs = replicationServerDomain.getReplicationServer();
+    ReplicationServer rs = this.replicationServer;
 
     // Parse the provided cookie and overwrite startState from it.
     if ((providedCookie != null) && (providedCookie.length()!=0))
@@ -740,6 +740,10 @@
           if (excludedServiceIDs.contains(rsd.getBaseDn()))
             continue;
 
+          // skip unused domains
+          if (rsd.getDbServerState().isEmpty())
+            continue;
+
           // Creates the new domain context
           DomainContext newDomainCtxt = new DomainContext();
           newDomainCtxt.active = true;
@@ -826,7 +830,8 @@
    */
   private void registerIntoDomain()
   {
-    replicationServerDomain.registerHandler(this);
+    if (replicationServerDomain!=null)
+      replicationServerDomain.registerHandler(this);
   }
 
   /**
@@ -877,7 +882,7 @@
     String str = serverURL + " " + String.valueOf(serverId);
 
     return "Connected External Changelog Server " + str +
-    ",cn=" + replicationServerDomain.getMonitorInstanceName();
+    ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT;
   }
 
   /**
@@ -982,8 +987,7 @@
       sendWindow = new Semaphore(sendWindowSize);
 
       // create reader
-      reader = new ServerReader(session, serverId,
-          this, replicationServerDomain);
+      reader = new ServerReader(session, serverId, this);
       reader.start();
 
       if (writer == null)
@@ -1132,8 +1136,7 @@
     ECLUpdateMsg oldestChange = null;
 
     if (debugEnabled())
-      TRACER.debugInfo("In " + replicationServerDomain.getReplicationServer().
-          getMonitorInstanceName() + "," + this +
+      TRACER.debugInfo("In cn=changelog" + this +
           " getNextECLUpdate starts: " + dumpState());
 
     try
@@ -1443,8 +1446,7 @@
     // starvation of changelog messages
     // all domain have been unactived means are covered
     if (debugEnabled())
-      TRACER.debugInfo("In " + replicationServerDomain.getReplicationServer().
-          getMonitorInstanceName() + "," + this + " closeInitPhase(): "
+      TRACER.debugInfo("In cn=changelog" + "," + this + " closeInitPhase(): "
           + dumpState());
 
     // go to persistent phase if one
@@ -1503,8 +1505,7 @@
     }
 
     if (debugEnabled())
-      TRACER.debugInfo("In " + replicationServerDomain.getReplicationServer().
-          getMonitorInstanceName()
+      TRACER.debugInfo("In cn=changelog"
           + "," + this + " getOldestChangeFromDomainCtxts() returns " +
           ((oldest!=-1)?domainCtxts[oldest].nextMsg:"-1"));
 

--
Gitblit v1.10.0