From 891159050af4aa3fe47c67e3ba7d3f21299027a4 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 02 Dec 2013 14:01:32 +0000
Subject: [PATCH] OPENDJ-1174 (CR-2631) Transfer responsibility for populating the ChangeNumberIndexDB to ChangelogDB
---
opends/src/server/org/opends/server/replication/server/ReplicationServer.java | 34 ++++++++++++++++++++++++++--------
1 files changed, 26 insertions(+), 8 deletions(-)
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 ae96f6d..a48d025 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -144,9 +144,7 @@
throws ConfigException
{
this.config = configuration;
-
- this.changelogDB =
- new JEChangelogDB(this, configuration.getReplicationDBDirectory());
+ this.changelogDB = new JEChangelogDB(this, configuration);
replSessionSecurity = new ReplSessionSecurity();
initialize();
@@ -764,6 +762,9 @@
public ConfigChangeResult applyConfigurationChange(
ReplicationServerCfg configuration)
{
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+
// Some of those properties change don't need specific code.
// They will be applied for next connections. Some others have immediate
// effect
@@ -779,6 +780,20 @@
{
this.changelogDB.setPurgeDelay(getTrimAge());
}
+ final boolean computeCN = config.isComputeChangenumber();
+ if (computeCN != oldConfig.isComputeChangenumber())
+ {
+ try
+ {
+ this.changelogDB.setComputeChangeNumber(computeCN);
+ }
+ catch (ChangelogException e)
+ {
+ if (debugEnabled())
+ TRACER.debugCaught(DebugLogLevel.ERROR, e);
+ resultCode = ResultCode.OPERATIONS_ERROR;
+ }
+ }
// changing the listen port requires to stop the listen thread
// and restart it.
@@ -800,10 +815,14 @@
}
catch (IOException e)
{
+ if (debugEnabled())
+ TRACER.debugCaught(DebugLogLevel.ERROR, e);
logError(ERR_COULD_NOT_CLOSE_THE_SOCKET.get(e.toString()));
}
catch (InterruptedException e)
{
+ if (debugEnabled())
+ TRACER.debugCaught(DebugLogLevel.ERROR, e);
logError(ERR_COULD_NOT_STOP_LISTEN_THREAD.get(e.toString()));
}
}
@@ -849,10 +868,9 @@
final String newDir = config.getReplicationDBDirectory();
if (newDir != null && !newDir.equals(oldConfig.getReplicationDBDirectory()))
{
- return new ConfigChangeResult(ResultCode.SUCCESS, true);
+ adminActionRequired = true;
}
-
- return new ConfigChangeResult(ResultCode.SUCCESS, false);
+ return new ConfigChangeResult(resultCode, adminActionRequired);
}
/**
@@ -1505,7 +1523,7 @@
public MultiDomainServerState getNewestECLCookie(Set<String> excludedBaseDNs)
{
// Initialize start state for all running domains with empty state
- MultiDomainServerState result = new MultiDomainServerState();
+ final MultiDomainServerState result = new MultiDomainServerState();
for (ReplicationServerDomain rsDomain : getReplicationServerDomains())
{
if (contains(excludedBaseDNs, rsDomain.getBaseDN().toNormalizedString()))
@@ -1513,7 +1531,7 @@
final ServerState latestDBServerState = rsDomain.getLatestServerState();
if (latestDBServerState.isEmpty())
continue;
- result.update(rsDomain.getBaseDN(), latestDBServerState);
+ result.replace(rsDomain.getBaseDN(), latestDBServerState);
}
return result;
}
--
Gitblit v1.10.0