From 63f1d8aa27cd58a798acc351e69fa36d9ef810b6 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Fri, 04 May 2007 16:13:32 +0000
Subject: [PATCH] Fixes for the 2 replication problems :
---
opends/src/server/org/opends/server/messages/ReplicationMessages.java | 9 +++++++++
opends/src/server/org/opends/server/replication/server/ReplicationServer.java | 29 ++++++++++++++++++++++++-----
opends/resource/config/replication.ldif | 1 +
3 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/opends/resource/config/replication.ldif b/opends/resource/config/replication.ldif
index 9f07598..9b13133 100644
--- a/opends/resource/config/replication.ldif
+++ b/opends/resource/config/replication.ldif
@@ -14,6 +14,7 @@
objectClass: top
objectClass: ds-cfg-synchronization-provider
objectClass: ds-cfg-multimaster-synchronization-provider
+cn: Multimaster Synchronization
ds-cfg-synchronization-provider-enabled: true
ds-cfg-synchronization-provider-class: org.opends.server.replication.plugin.MultimasterReplication
diff --git a/opends/src/server/org/opends/server/messages/ReplicationMessages.java b/opends/src/server/org/opends/server/messages/ReplicationMessages.java
index a2dde6d..48f7704e 100644
--- a/opends/src/server/org/opends/server/messages/ReplicationMessages.java
+++ b/opends/src/server/org/opends/server/messages/ReplicationMessages.java
@@ -361,6 +361,13 @@
CATEGORY_MASK_SYNC | SEVERITY_MASK_SEVERE_ERROR | 50;
/**
+ * The message ID for the message that will be used when
+ * a replication server hostname cannot be resolved as an IP address.
+ */
+ public static final int MSGID_COULD_NOT_SOLVE_HOSTNAME =
+ CATEGORY_MASK_SYNC | SEVERITY_MASK_SEVERE_ERROR | 51;
+
+ /**
* Register the messages from this class in the core server.
*
*/
@@ -495,5 +502,7 @@
"Multiple domains match the base DN provided");
registerMessage(MSGID_INVALID_PROVIDER,
"The provider class does not allow the operation requested");
+ registerMessage(MSGID_COULD_NOT_SOLVE_HOSTNAME,
+ "The hostname %s could not be resolved as an IP address");
}
}
diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationServer.java b/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
index 3c27378..3441a68 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -103,6 +103,7 @@
private int queueSize;
private String dbDirname = null;
private long trimAge; // the time (in sec) after which the changes must
+ private int replicationPort;
// de deleted from the persistent storage.
/**
@@ -116,7 +117,7 @@
{
shutdown = false;
runListen = true;
- int replicationPort = configuration.getReplicationPort();
+ replicationPort = configuration.getReplicationPort();
replicationServerId = (short) configuration.getReplicationServerId();
replicationServers = configuration.getReplicationServer();
if (replicationServers == null)
@@ -254,10 +255,29 @@
*/
for (String serverURL : replicationServers)
{
- if ((serverURL.compareTo(this.serverURL) != 0) &&
- (!connectedReplServers.contains(serverURL)))
+ String token[] = serverURL.split(":");
+ String hostname = token[0];
+ String port = token[1];
+
+ try
{
- this.connect(serverURL, replicationCache.getBaseDn());
+ InetAddress inetAddress = InetAddress.getByName(hostname);
+ String serverAddress = inetAddress.getHostAddress() + ":" + port;
+
+ if ((serverAddress.compareTo("127.0.0.1:" + replicationPort) != 0)
+ && (serverAddress.compareTo(this.localURL) != 0)
+ && (!connectedReplServers.contains(serverAddress)))
+ {
+ this.connect(serverURL, replicationCache.getBaseDn());
+ }
+ }
+ catch (IOException e)
+ {
+ int msgID = MSGID_COULD_NOT_SOLVE_HOSTNAME;
+ String message = getMessage(msgID, hostname);
+ logError(ErrorLogCategory.SYNCHRONIZATION,
+ ErrorLogSeverity.SEVERE_ERROR,
+ message, msgID);
}
}
}
@@ -510,7 +530,6 @@
public boolean isConfigurationChangeAcceptable(
ReplicationServerCfg configuration, List<String> unacceptableReasons)
{
- // TODO : implement this
return true;
}
}
--
Gitblit v1.10.0