From 74be925257cd0df68cfde1a77f77cbb930c7832f Mon Sep 17 00:00:00 2001
From: pgamba <pgamba@localhost>
Date: Wed, 24 Oct 2007 14:04:25 +0000
Subject: [PATCH] Fix 2425 - dsreplication initialize-all fails - fix ConcurrentModificationException in the Initialize task by using methods that lock the entry - fix unroutable message, by forwarding message only to the replication servers that have   replica connected Miscellaneous improvements in error or debug traces

---
 opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java |   43 +++++++++++++++++++++++++++++++++----------
 1 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java b/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
index 608b7d8..78a088f 100644
--- a/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
@@ -283,6 +283,7 @@
      * @param count The value with which to initialize the counters.
      */
     public void initImportExportCounters(long count)
+      throws DirectoryException
     {
       entryCount = count;
       entryLeftCount = count;
@@ -307,6 +308,7 @@
      * an import or export.
      */
     public void updateCounters()
+      throws DirectoryException
     {
       entryLeftCount--;
 
@@ -344,7 +346,7 @@
   public ReplicationDomain(ReplicationDomainCfg configuration)
     throws ConfigException
   {
-    super("replication flush");
+    super("replicationDomain_" + configuration.getBaseDN());
 
     // Read the configuration parameters.
     replicationServers = configuration.getReplicationServer();
@@ -2536,7 +2538,10 @@
         msg = broker.receive();
 
         if (debugEnabled())
-          TRACER.debugInfo("Import: EntryBytes received " + msg);
+          TRACER.debugInfo(
+              " sid:" + this.serverId +
+              " base DN:" + this.baseDN +
+              " Import EntryBytes received " + msg);
         if (msg == null)
         {
           // The server is in the shutdown process
@@ -2750,11 +2755,20 @@
     }
     catch (DirectoryException de)
     {
-      Message message =
+      if ((ieContext != null) && (ieContext.checksumOutput) &&
+          (ros.getNumExportedEntries() >= ieContext.entryCount))
+      {
+        // This is the normal end when computing the generationId
+        // We can interrupt the export only by an IOException
+      }
+      else
+      {
+        Message message =
           ERR_LDIFEXPORT_ERROR_DURING_EXPORT.get(de.getMessageObject());
-      logError(message);
-      throw new DirectoryException(
-          ResultCode.OTHER, message, null);
+        logError(message);
+        throw new DirectoryException(
+            ResultCode.OTHER, message, null);
+      }
     }
     catch (Exception e)
     {
@@ -2843,7 +2857,14 @@
         serverId, ieContext.exportTarget, lDIFEntry.getBytes());
       broker.publish(entryMessage);
     }
-    ieContext.updateCounters();
+    try
+    {
+      ieContext.updateCounters();
+    }
+    catch (DirectoryException de)
+    {
+      throw new IOException(de);
+    }
   }
 
   /**
@@ -2857,7 +2878,8 @@
   public void initializeFromRemote(short source, Task initTask)
   throws DirectoryException
   {
-    // TRACER.debugInfo("Entering initializeFromRemote");
+    if (debugEnabled())
+      TRACER.debugInfo("Entering initializeFromRemote");
 
     acquireIEContext();
     ieContext.initializeTask = initTask;
@@ -2881,7 +2903,6 @@
   public short decodeSource(String sourceString)
   throws DirectoryException
   {
-    TRACER.debugInfo("Entering decodeSource");
     short  source = 0;
     Throwable cause = null;
     try
@@ -3140,7 +3161,9 @@
       // Process import
       backend.importLDIF(importConfig);
 
-      TRACER.debugInfo("The import has ended successfully.");
+      if (debugEnabled())
+        TRACER.debugInfo("The import has ended successfully on " +
+          this.baseDN);
       stateSavingDisabled = false;
 
     }

--
Gitblit v1.10.0