From d27c892c81f6df051f737f54298cbdb530881d35 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Fri, 30 Oct 2026 13:18:36 +0000
Subject: [PATCH] [#1252] Go back to the changelog when the queue of a following handler dropped changes while its writer waited on it (#1253)

---
 opendj-server-legacy/src/main/java/org/opends/server/replication/server/MessageHandler.java |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/MessageHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/MessageHandler.java
index 5d4596a..f79dbce 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/MessageHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/MessageHandler.java
@@ -513,9 +513,16 @@
           {
             return null;
           }
-          if (msgQueue.isEmpty())
+          if (msgQueue.isEmpty() || !following)
           {
-            // this handler is going back to the changelog, see stopFollowingWhenChangesAreMissing()
+            /*
+             * This handler is going back to the changelog: changes are missing, see
+             * stopFollowingWhenChangesAreMissing(), or the queue dropped its oldest changes in
+             * add() while this thread waited without the monitor - more changes arrived than
+             * it holds. Its head is then the first change after the dropped ones: taken now, it
+             * would move the state of the consumer past them, and the changelog would be read
+             * from after them, so they would never be sent - see issue #1252.
+             */
             continue;
           }
           UpdateMsg msg = msgQueue.removeFirst();

--
Gitblit v1.10.0