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

gbellato
07.01.2009 39d78ca1702b263b66948c483ade1a88620367a7
Fix for 4171 : Replica initialization hangs if replication servers unreachable

3 files modified
42 ■■■■■ changed files
opends/src/messages/messages/replication.properties 3 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java 26 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/service/ReplicationDomain.java 13 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/replication.properties
@@ -412,4 +412,7 @@
 in a replicated topology does not makes sense
MILD_ERR_DRAFT_CHANGENUMBER_DATABASE_173=An error occurred when accessing the \
 database of the draft change number : %s
SEVERE_ERR_INITIALIZATION_FAILED_NOCONN_174=The initialization failed because \
 the domain %s is not connected to a replication server
 
opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
@@ -65,7 +65,11 @@
import org.opends.server.replication.protocol.AckMsg;
import org.opends.server.replication.protocol.ChangeTimeHeartbeatMsg;
import org.opends.server.replication.protocol.ChangeStatusMsg;
import org.opends.server.replication.protocol.DoneMsg;
import org.opends.server.replication.protocol.EntryMsg;
import org.opends.server.replication.protocol.ErrorMsg;
import org.opends.server.replication.protocol.InitializeRequestMsg;
import org.opends.server.replication.protocol.InitializeTargetMsg;
import org.opends.server.replication.protocol.MonitorMsg;
import org.opends.server.replication.protocol.MonitorRequestMsg;
import org.opends.server.replication.protocol.ProtocolVersion;
@@ -1529,7 +1533,11 @@
    // Test the message for which a ReplicationServer is expected
    // to be the destination
    if (msg.getDestination() == this.replicationServer.getServerId())
    if (!(msg instanceof InitializeRequestMsg) &&
        !(msg instanceof InitializeTargetMsg) &&
        !(msg instanceof EntryMsg) &&
        !(msg instanceof DoneMsg) &&
        (msg.getDestination() == this.replicationServer.getServerId()))
    {
      if (msg instanceof ErrorMsg)
      {
@@ -1665,6 +1673,22 @@
      {
        logError(NOTE_ERR_ROUTING_TO_SERVER.get(
          msg.getClass().getCanonicalName()));
        MessageBuilder mb1 = new MessageBuilder();
        mb1.append(
            NOTE_ERR_ROUTING_TO_SERVER.get(msg.getClass().getCanonicalName()));
        mb1.append("serverID:" + msg.getDestination());
        ErrorMsg errMsg = new ErrorMsg(
          msg.getsenderID(), mb1.toMessage());
        try
        {
          senderHandler.send(errMsg);
        } catch (IOException ioe1)
        {
          // an error happened on the sender session trying to recover
          // from an error on the receiver session.
          // Not much more we can do at this point.
        }
      }
      return;
    }
opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
@@ -1682,6 +1682,19 @@
    if (debugEnabled())
      TRACER.debugInfo("Entering initializeFromRemote");
    if (!broker.isConnected())
    {
      if (initTask instanceof InitializeTask)
      {
        InitializeTask task = (InitializeTask) initTask;
        task.updateTaskCompletionState(
            new DirectoryException(
                ResultCode.OTHER, ERR_INITIALIZATION_FAILED_NOCONN.get(
                    getServiceID())));
      }
      return;
    }
    acquireIEContext(true);
    ieContext.initializeTask = initTask;