From 2c7e382da347e11820463fcf977d885c2f40d764 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Thu, 10 Sep 2026 08:50:34 +0000
Subject: [PATCH] [#917] Wait for every peer replication server to forward the ReplicaOfflineMsg (#947)

---
 opendj-server-legacy/src/main/java/org/opends/server/replication/server/ServerWriter.java |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ServerWriter.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ServerWriter.java
index aa9dc21..9c91cec 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ServerWriter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ServerWriter.java
@@ -105,7 +105,22 @@
            "Connection closure: null update returned by domain.");
           break;
         }
-        if (!isUpdateMsgFiltered(updateMsg))
+        if (isUpdateMsgFiltered(updateMsg))
+        {
+          /*
+           * The message is dropped here and will not be published to this server. When it is the
+           * ReplicaOfflineMsg a shutdown is waiting for - its filter is wider than the one
+           * ReplicationServerDomain.put() applied when it queued the message, so a peer RS can
+           * be given a message this drops - the shutdown must stop waiting for a forward which
+           * will never be reported.
+           */
+          if (updateMsg instanceof ReplicaOfflineMsg && !handler.isDataServer())
+          {
+            dsrsShutdownSync.replicaOfflineMsgNotForwarded(
+                replicationServerDomain.getBaseDN(), handler.getServerId());
+          }
+        }
+        else
         {
           // Publish the update to the remote server using a protocol version it supports
           session.publish(updateMsg);
@@ -121,7 +136,7 @@
           if (updateMsg instanceof ReplicaOfflineMsg && !handler.isDataServer())
           {
             dsrsShutdownSync.replicaOfflineMsgForwarded(
-                replicationServerDomain.getBaseDN(), updateMsg.getCSN());
+                replicationServerDomain.getBaseDN(), updateMsg.getCSN(), handler.getServerId());
           }
         }
       }

--
Gitblit v1.10.0