From f3076a0a7b60fa444dbaea5a69f40ab423562765 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Thu, 10 Sep 2026 13:23:09 +0000
Subject: [PATCH] [#955] Answer a ModifyDN whose entry is gone before the new superior is looked up (#965)

---
 opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index 4ad0c39..c736131 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -3629,6 +3629,21 @@
   // get the current DN of this entry in the database.
   DN currentDN = findEntryDN(entryUUID);
 
+  if (currentDN == null)
+  {
+    /*
+     * The entry targeted by the Modify DN is not in the database anymore.
+     * This is a conflict between a delete and this modify DN.
+     * The entry has been deleted, we can safely assume that the operation is completed.
+     *
+     * This is answered before the new superior is looked up, and before the branch which
+     * marks the entry as conflicting: an entry which is not in the database can not be
+     * marked, and the delete has already settled what this Modify DN was trying to do.
+     */
+    numResolvedNamingConflicts.incrementAndGet();
+    return ConflictResolution.NOTHING_TO_DO;
+  }
+
   // Construct the new DN to use for the entry.
   DN entryDN = op.getEntryDN();
   DN newSuperior;
@@ -3657,17 +3672,6 @@
 
   DN newDN = newSuperior.child(newRDN);
 
-  if (currentDN == null)
-  {
-    // The entry targeted by the Modify DN is not in the database
-    // anymore.
-    // This is a conflict between a delete and this modify DN.
-    // The entry has been deleted, we can safely assume
-    // that the operation is completed.
-    numResolvedNamingConflicts.incrementAndGet();
-    return ConflictResolution.NOTHING_TO_DO;
-  }
-
   // if the newDN and the current DN match then the operation
   // is a no-op (this was probably a second replay)
   // don't do anything.

--
Gitblit v1.10.0