From 2b89a960a5dcfb1d6ee803eafd944f4ea5ce5c71 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 12 Jun 2015 11:12:41 +0000
Subject: [PATCH] OPENDJ-2106 : Entry is not replicated on second instance in 2 RS topology

---
 opendj-server-legacy/src/main/java/org/opends/server/replication/server/MessageHandler.java |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 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 a5e96ec..dc76ab3 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
@@ -233,16 +233,13 @@
   }
 
   /**
-   * Get the next update that must be sent to the consumer from the message queue or from the
-   * database.
+   * Get the next update that must be sent to the consumer from the message queue or from the database.
    *
-   * @param sendToServerId
-   *          serverId of the replica where changes will be sent
    * @return The next update that must be sent to the consumer, or {@code null} when queue is empty
    * @throws ChangelogException
    *            If a problem occurs when reading the changelog
    */
-  protected UpdateMsg getNextMessage(int sendToServerId) throws ChangelogException
+  protected UpdateMsg getNextMessage() throws ChangelogException
   {
     while (activeConsumer)
     {
@@ -275,7 +272,7 @@
            *           restart as usual
            *   load this change on the delayList
            */
-          fillLateQueue(sendToServerId);
+          fillLateQueue();
           if (lateQueue.isEmpty())
           {
             // we could not find any messages in the changelog
@@ -373,17 +370,13 @@
    * Fills the late queue with the most recent changes, accepting only the
    * messages from provided replica ids.
    */
-  private void fillLateQueue(int sendToServerId) throws ChangelogException
+  private void fillLateQueue() throws ChangelogException
   {
     try (DBCursor<UpdateMsg> cursor = replicationServerDomain.getCursorFrom(serverState);)
     {
       while (cursor.next() && isLateQueueBelowThreshold())
       {
-        final UpdateMsg record = cursor.getRecord();
-        if (record.getCSN().getServerId() != sendToServerId)
-        {
-          lateQueue.add(record);
-        }
+        lateQueue.add(cursor.getRecord());
       }
     }
   }
@@ -433,7 +426,7 @@
 
   private CSN findOldestCSNFromReplicaDBs()
   {
-    try (DBCursor<UpdateMsg> cursor = replicationServerDomain.getCursorFrom(serverState);)
+    try (DBCursor<UpdateMsg> cursor = replicationServerDomain.getCursorFrom(serverState))
     {
       while (cursor.next())
       {

--
Gitblit v1.10.0