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

gbellato
28.38.2009 15200804c06b26016c515617700a46bf5badb6ca
Fix for 4015 : wrong error messages when replication heart-beat fails

When the replication heart-beat fails, the replication disconnects from the
replication server and reconnect to another one.

In such case the error messages are too verbose and may lead to false conclusion.
This change reduce the error messages logged in those case.
4 files modified
59 ■■■■ changed files
opends/src/server/org/opends/server/replication/protocol/ProtocolSession.java 11 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/protocol/SocketSession.java 14 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/protocol/TLSSocketSession.java 13 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/service/ReplicationBroker.java 21 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/protocol/ProtocolSession.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 */
package org.opends.server.replication.protocol;
@@ -147,4 +147,13 @@
   * @return The timestamp in milliseconds of the last message received.
   */
  public abstract long getLastReceiveTime();
  /**
   * This methods allows to determine if the session close was initiated
   * on this ProtocolSession.
   *
   * @return A boolean allowing to determine if the session close was initiated
   * on this ProtocolSession.
   */
  public abstract boolean closeInitiated();
}
opends/src/server/org/opends/server/replication/protocol/SocketSession.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 */
package org.opends.server.replication.protocol;
@@ -67,6 +67,8 @@
   */
  private long lastReceiveTime = 0;
  private boolean closeInitiated = false;
  /**
   * Creates a new SocketSession based on the provided socket.
@@ -90,6 +92,8 @@
   */
  public void close() throws IOException
  {
    closeInitiated = true;
    if (debugEnabled())
    {
      TRACER.debugInfo("Closing SocketSession."
@@ -231,4 +235,12 @@
  {
    socket.setSoTimeout(timeout);
  }
  /**
   * {@inheritDoc}
   */
  public boolean closeInitiated()
  {
    return closeInitiated;
  }
}
opends/src/server/org/opends/server/replication/protocol/TLSSocketSession.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 */
package org.opends.server.replication.protocol;
@@ -69,6 +69,8 @@
   */
  private long lastReceiveTime = 0;
  private boolean closeInitiated = false;
  /**
   * Creates a new TLSSocketSession.
@@ -96,6 +98,7 @@
   */
  public void close() throws IOException
  {
    closeInitiated = true;
    if (debugEnabled())
    {
      TRACER.debugInfo("Closing SocketSession." +
@@ -243,4 +246,12 @@
  {
    plainSocket.setSoTimeout(timeout);
  }
  /**
   * {@inheritDoc}
   */
  public boolean closeInitiated()
  {
    return closeInitiated;
  }
}
opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
@@ -1392,14 +1392,17 @@
      {
        if (shutdown == false)
        {
          Message message =
            NOTE_DISCONNECTED_FROM_CHANGELOG.get(replicationServer,
            Short.toString(rsServerId), baseDn.toString(),
            Short.toString(serverId));
          logError(message);
          debugInfo("ReplicationBroker.receive() " + baseDn +
            " Exception raised: " + e.getLocalizedMessage());
          if (!session.closeInitiated())
          {
            /*
             * If we did not initiate the close on our side, log a message.
             */
            Message message =
              NOTE_DISCONNECTED_FROM_CHANGELOG.get(replicationServer,
                  Short.toString(rsServerId), baseDn.toString(),
                  Short.toString(serverId));
            logError(message);
          }
          this.reStart(failingSession);
        }
      }
@@ -1613,7 +1616,7 @@
  private boolean debugEnabled()
  {
    return true;
    return false;
  }
  private static final void debugInfo(String s)