From 7bb5b9a55a8d68f9622ca3ae6bb22b889b0a6a3f Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Mon, 16 Mar 2009 08:06:01 +0000
Subject: [PATCH] Fix for issue 3402 : Replication conflict: fail to resolve double mod_rdn of same entry

---
 opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index 0abde4a..db16f13 100644
--- a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -59,7 +59,7 @@
 import java.util.NoSuchElementException;
 import java.util.Set;
 import java.util.TreeSet;
-import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.zip.CheckedOutputStream;
@@ -178,7 +178,7 @@
 
   // The update to replay message queue where the listener thread is going to
   // push incoming update messages.
-  private final LinkedBlockingQueue<UpdateToReplay> updateToReplayQueue;
+  private final BlockingQueue<UpdateToReplay> updateToReplayQueue;
   private final AtomicInteger numResolvedNamingConflicts = new AtomicInteger();
   private final AtomicInteger numResolvedModifyConflicts = new AtomicInteger();
   private final AtomicInteger numUnresolvedNamingConflicts =
@@ -301,7 +301,7 @@
    * @throws ConfigException In case of invalid configuration.
    */
   public LDAPReplicationDomain(ReplicationDomainCfg configuration,
-    LinkedBlockingQueue<UpdateToReplay> updateToReplayQueue)
+    BlockingQueue<UpdateToReplay> updateToReplayQueue)
     throws ConfigException
   {
     super(configuration.getBaseDN().toNormalizedString(),
@@ -703,6 +703,16 @@
             ResultCode.NO_SUCH_OBJECT, null);
         }
       }
+      /*
+       * If the object has been renamed more recently than this
+       * operation, cancel the operation.
+       */
+      Historical hist = Historical.load(modifyDNOperation.getOriginalEntry());
+      if (hist.AddedOrRenamedAfter(ctx.getChangeNumber()))
+      {
+        return new SynchronizationProviderResult.StopProcessing(
+            ResultCode.SUCCESS, null);
+      }
     }
     else
     {

--
Gitblit v1.10.0