From 23e98d540a23d7f7a21e3ffae94938ea066306ac Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Mon, 31 May 2010 09:49:21 +0000
Subject: [PATCH] Fix issue #3891 - Handle replication conflict when adding child entry and parent is deleted

---
 opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java |   27 +++++++++------------------
 1 files changed, 9 insertions(+), 18 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 e472a43..f887c0a 100644
--- a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -77,7 +77,6 @@
 import org.opends.server.backends.jeb.BackendImpl;
 import org.opends.server.backends.task.Task;
 import org.opends.server.config.ConfigException;
-import org.opends.server.controls.SubtreeDeleteControl;
 import org.opends.server.core.AddOperation;
 import org.opends.server.core.DeleteOperation;
 import org.opends.server.core.DirectoryServer;
@@ -2564,11 +2563,10 @@
               /*
                * Create a new operation as the ConflictResolution
                * different operation.
+               *  Note: When msg is a DeleteMsg, the DeleteOperation is properly
+               *  created with subtreeDelete request control when needed.
                */
               op = msg.createOperation(conn);
-              if (op instanceof DeleteOperation) {
-                op.addRequestControl(new SubtreeDeleteControl(false));
-              }
             }
           }
           else
@@ -3189,21 +3187,14 @@
           for (SearchResultEntry entry : entries)
           {
             /*
-             * Check the ADD and ModRDN date of the child entry. If it is after
-             * the delete date then keep the entry as a conflicting entry,
-             * otherwise delete the entry with the operation.
+             * Check the ADD and ModRDN date of the child entry (All of them,
+             * not only the one that are newer than the DEL op)
+             * and keep the entry as a conflicting entry,
              */
-            if (cn != null)
-            {
-              Historical hist = Historical.load(entry);
-              if (hist.AddedOrRenamedAfter(cn))
-              {
-                conflict = true;
-                markConflictEntry(conflictOp, entry.getDN(), entryDN);
-                renameConflictEntry(conflictOp, entry.getDN(),
-                                Historical.getEntryUuid(entry));
-              }
-            }
+            conflict = true;
+            markConflictEntry(conflictOp, entry.getDN(), entryDN);
+            renameConflictEntry(conflictOp, entry.getDN(),
+                Historical.getEntryUuid(entry));
           }
         }
       }

--
Gitblit v1.10.0