From 39d78ca1702b263b66948c483ade1a88620367a7 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Mon, 07 Sep 2009 15:01:28 +0000
Subject: [PATCH] Fix for 4171 : Replica initialization hangs if replication servers unreachable
---
opends/src/messages/messages/replication.properties | 3 +++
opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java | 26 +++++++++++++++++++++++++-
opends/src/server/org/opends/server/replication/service/ReplicationDomain.java | 13 +++++++++++++
3 files changed, 41 insertions(+), 1 deletions(-)
diff --git a/opends/src/messages/messages/replication.properties b/opends/src/messages/messages/replication.properties
index ce9307d..6636253 100644
--- a/opends/src/messages/messages/replication.properties
+++ b/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
+
\ No newline at end of file
diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java b/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
index 46ed7dd..ef5e145 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
+++ b/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;
}
diff --git a/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java b/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
index 3a05a7b..b2254b0 100644
--- a/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
+++ b/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;
--
Gitblit v1.10.0