mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Valery Kharseko
20 hours ago 400fb2694641b05e53217d3c742a6e49e3a254c6
opendj-server-legacy/src/main/java/org/opends/server/replication/server/MessageHandler.java
@@ -178,6 +178,19 @@
  }
  /**
   * Returns the newest update of this replica deliberately not handed to this queue.
   * RS handlers use domain-wide peer receipts so a newly registered handler sees
   * updates whose publication began before it registered.
   *
   * @param serverId the replica which produced the update
   * @return its newest unqueued update, or {@code null} when none is known
   */
  protected CSN getLatestUnqueuedUpdate(int serverId)
  {
    return null;
  }
  /**
   * Whether the consumer has every change the queue may lack which the changelog still holds - see
   * {@link #queueLacksUpTo} and {@link #consumerLacksFromTheChangelog(CSN, ServerState)}.
   * <p>
@@ -263,7 +276,11 @@
    {
      replicationServerDomain = replicationServer.getReplicationServerDomain(
          baseDN, true);
      if (waitConnections)
      // Let a bootstrapping domain learn its generation and topology before accepting
      // a DS. A domain already serving a DS must be able to accept another while the
      // connect thread is waiting for a peer RS.
      if (waitConnections && (replicationServerDomain.getGenerationId() <= 0
          || replicationServerDomain.getConnectedDSs().isEmpty()))
      {
        replicationServer.waitConnections();
      }
@@ -525,6 +542,17 @@
             */
            continue;
          }
          // A replica may have written through a peer since this queue was last used.
          // Its next direct write must not advance our cursor past that unqueued prefix.
          // Other replicas keep following normally: an RS does not relay idle peer traffic.
          final CSN next = msgQueue.first().getCSN();
          final CSN unqueued = getLatestUnqueuedUpdate(next.getServerId());
          if (unqueued != null && !serverState.cover(next) && !serverState.cover(unqueued)
              && consumerLacksFromTheChangelog(unqueued, replicationServerDomain.getLatestServerState()))
          {
            following = false;
            continue;
          }
          UpdateMsg msg = msgQueue.removeFirst();
          if (updateServerState(msg))
          {