From 8cf3cd2cfc00db70168d6e2f7b217c597e44facb Mon Sep 17 00:00:00 2001
From: pgamba <pgamba@localhost>
Date: Wed, 17 Jan 2007 11:01:32 +0000
Subject: [PATCH] Fix Issue 783 synchronization does not detect that the parent is renamed during add operations
---
opendj-sdk/opends/src/server/org/opends/server/synchronization/plugin/SynchronizationDomain.java | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/synchronization/plugin/SynchronizationDomain.java b/opendj-sdk/opends/src/server/org/opends/server/synchronization/plugin/SynchronizationDomain.java
index 825ab82..cfcde54 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/synchronization/plugin/SynchronizationDomain.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/synchronization/plugin/SynchronizationDomain.java
@@ -532,6 +532,30 @@
addOperation.setResultCode(ResultCode.SUCCESS);
return new SynchronizationProviderResult(false);
}
+
+ /* The parent entry may have been renamed here since the change was done
+ * on the first server, and another entry have taken the former dn
+ * of the parent entry
+ */
+
+ // There is a potential of perfs improvement here
+ // if we could avoid the following parent entry retrieval
+ DN parentDnFromCtx = findEntryDN(ctx.getParentUid());
+
+ if (parentDnFromCtx != null)
+ {
+ DN entryDN = addOperation.getEntryDN();
+ DN parentDnFromEntryDn = entryDN.getParentDNInSuffix();
+ if ((parentDnFromEntryDn != null)
+ && (!parentDnFromCtx.equals(parentDnFromEntryDn)))
+ {
+ // parentEntry has been renamed
+ // Synchronization name conflict resolution is expected to fix that
+ // later in the flow
+ addOperation.setResultCode(ResultCode.NO_SUCH_OBJECT);
+ return new SynchronizationProviderResult(false);
+ }
+ }
}
return new SynchronizationProviderResult(true);
}
@@ -1397,7 +1421,7 @@
* Solve a conflict detected when replaying a ADD operation.
*
* @param op The operation that triggered the conflict detection.
- * @param msg The operation that triggered the conflict detection.
+ * @param msg The message that triggered the conflict detection.
* @return true if the process is completed, false if it must continue.
* @throws Exception When the operation is not valid.
*/
--
Gitblit v1.10.0