From 4097284648812ee7dea49e8d5a20f17167424188 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Tue, 15 Jun 2010 14:32:34 +0000
Subject: [PATCH] Fix an issue with External Changelog after having disabled a replication suffix.

---
 opends/src/server/org/opends/server/replication/server/ECLServerHandler.java |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 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 e481158..c39a7b7 100644
--- a/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
@@ -685,6 +685,12 @@
       boolean allowUnknownDomains)
   throws DirectoryException
   {
+    // This map is initialized from the providedCookie.
+    // Below, it will be traversed and each domain configured with ECL will be
+    // checked and removed from the map.
+    // At the end, normally the map should be empty.
+    // Depending on allowUnknownDomains provided flag, a non empty map will
+    // be considered as an error when allowUnknownDomains is false.
     HashMap<String,ServerState> startStatesFromProvidedCookie =
       new HashMap<String,ServerState>();
 
@@ -832,6 +838,22 @@
 
       domainCtxts = tmpSet.toArray(new DomainContext[0]);
 
+      // When it is valid to have the provided cookie containing unknown domains
+      // (allowUnknownDomains is true), 2 cases must be considered :
+      // - if the cookie contains a domain that is replicated but where
+      //   ECL is disabled, then this case is considered above
+      // - if the cookie contains a domain that is even not replicated
+      //   then this case need to be considered here in another loop.
+      if (!startStatesFromProvidedCookie.isEmpty())
+      {
+        if (allowUnknownDomains)
+          for (String providedDomain : startStatesFromProvidedCookie.keySet())
+            if (rs.getReplicationServerDomain(providedDomain, false) == null)
+              // the domain provided in the cookie is not replicated
+              startStatesFromProvidedCookie.remove(providedDomain);
+      }
+
+      // Now do the final checking
       if (!startStatesFromProvidedCookie.isEmpty())
       {
         // After reading all the knows domains from the provided cookie, there

--
Gitblit v1.10.0