From 25862fdf888ed23207ab51937a43e6f9ad41d805 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 22 Sep 2014 16:23:50 +0000
Subject: [PATCH] OPENDJ-1206 (CR-4393) Create a new ReplicationBackend/ChangelogBackend to support cn=changelog
---
opendj3-server-dev/src/server/org/opends/server/replication/server/ECLServerHandler.java | 43 +++++++++++++++++++++++--------------------
1 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/replication/server/ECLServerHandler.java b/opendj3-server-dev/src/server/org/opends/server/replication/server/ECLServerHandler.java
index b015eac..3157ee4 100644
--- a/opendj3-server-dev/src/server/org/opends/server/replication/server/ECLServerHandler.java
+++ b/opendj3-server-dev/src/server/org/opends/server/replication/server/ECLServerHandler.java
@@ -34,6 +34,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ResultCode;
+import org.opends.server.backends.ChangelogBackend;
import org.opends.server.replication.common.CSN;
import org.opends.server.replication.common.MultiDomainServerState;
import org.opends.server.replication.common.ServerState;
@@ -155,8 +156,13 @@
private final ReplicationServerDomain rsDomain;
/**
- * Active when there are still changes supposed eligible for the ECL. It is
- * active by default.
+ * Active when there are still changes supposed eligible for the ECL.
+ * Here is the lifecycle of this field:
+ * <ol>
+ * <li>active==true at the start of the INIT phase,</li>
+ * <li>active==false when there are no more changes for a domain in the the INIT phase,</li>
+ * <li>active==true if it is a persistent search on external changelog. It never moves again</li>
+ * </ol>
*/
private boolean active = true;
private UpdateMsg nextMsg;
@@ -354,8 +360,7 @@
super(session, queueSize, replicationServer, rcvWindowSize);
try
{
- DN baseDN = DN.valueOf(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT);
- setBaseDNAndDomain(baseDN, true);
+ setBaseDNAndDomain(ChangelogBackend.CHANGELOG_BASE_DN, true);
}
catch(DirectoryException de)
{
@@ -853,14 +858,6 @@
}
/**
- * Registers this handler into its related domain and notifies the domain.
- */
- private void registerIntoDomain()
- {
- replicationServerDomain.registerHandler(this);
- }
-
- /**
* Shutdown this handler.
*/
@Override
@@ -871,14 +868,20 @@
logger.trace(this + " shutdown()");
}
releaseCursor();
- for (DomainContext domainCtxt : domainCtxts) {
- if (!domainCtxt.unRegisterHandler()) {
- logger.error(LocalizableMessage.raw(this + " shutdown() - error when unregistering handler "+ domainCtxt.mh));
+ if (domainCtxts != null)
+ {
+ for (DomainContext domainCtxt : domainCtxts)
+ {
+ if (!domainCtxt.unRegisterHandler())
+ {
+ logger.error(LocalizableMessage.raw(this + " shutdown() - error when unregistering handler " + domainCtxt.mh));
+ }
+ domainCtxt.stopServer();
}
- domainCtxt.stopServer();
+ domainCtxts = null;
}
+
super.shutdown();
- domainCtxts = null;
}
private void releaseCursor()
@@ -1020,11 +1023,11 @@
closeInitPhase();
}
- registerIntoDomain();
+ replicationServerDomain.registerHandler(this);
if (logger.isTraceEnabled())
{
- logger.trace(getClass().getCanonicalName() + " " + getOperationId()
+ logger.trace(getClass().getSimpleName() + " " + getOperationId()
+ " initialized: " + " " + dumpState() + domaimCtxtsToString(""));
}
}
@@ -1372,7 +1375,7 @@
+ dumpState());
}
- // go to persistent phase if one
+ // set all domains to be active again for the persistent phase
for (DomainContext domainCtxt : domainCtxts) domainCtxt.active = true;
if (startECLSessionMsg.getPersistent() != NON_PERSISTENT)
--
Gitblit v1.10.0