opends/src/ads/org/opends/admin/ads/ServerDescriptor.java
@@ -1102,11 +1102,11 @@ if (cacheFilter.searchMonitoringInformation()) { ctls = new SearchControls(); ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE); ctls.setSearchScope(SearchControls.SUBTREE_SCOPE); ctls.setReturningAttributes( new String[] { "approx-older-change-not-synchronized-millis", "missing-changes", "base-dn", "server-id" "domain-name", "server-id" }); filter = "(missing-changes=*)"; @@ -1122,7 +1122,7 @@ { SearchResult sr = (SearchResult)monitorEntries.next(); String dn = getFirstValue(sr, "base-dn"); String dn = getFirstValue(sr, "domain-name"); int replicaId = -1; try { opends/src/server/org/opends/server/replication/server/DbHandler.java
@@ -579,8 +579,11 @@ @Override public String getMonitorInstanceName() { return "ReplicationServer database " + baseDn.toString() + " " + String.valueOf(serverId); ReplicationServerDomain domain = replicationServer.getReplicationServerDomain(baseDn, false); return "ReplicationServer database " + String.valueOf(serverId) + ",cn=" + domain.getMonitorInstanceName(); } /** opends/src/server/org/opends/server/replication/server/LightweightServerHandler.java
@@ -22,7 +22,7 @@ * CDDL HEADER END * * * Copyright 2008 Sun Microsystems, Inc. * Copyright 2008-2009 Sun Microsystems, Inc. */ package org.opends.server.replication.server; @@ -203,9 +203,9 @@ public String getMonitorInstanceName() { String serverURL=""; // FIXME String str = rsDomain.getBaseDn().toString() + " " + serverURL + " " + String.valueOf(serverId); return "Undirect LDAP Server " + str; String str = serverURL + " " + String.valueOf(serverId); return "Undirect Replica " + str + ",cn=" + replServerHandler.getMonitorInstanceName(); } /** @@ -253,7 +253,7 @@ attributes.add(Attributes.create("server-id", String.valueOf(serverId))); attributes.add(Attributes.create("base-dn", attributes.add(Attributes.create("domain-name", rsDomain.getBaseDn())); attributes.add(Attributes.create("connected-to", replServerHandler.getMonitorInstanceName())); @@ -262,7 +262,7 @@ MonitorData md; try { md = rsDomain.getMonitorData(); md = rsDomain.computeMonitorData(); ServerState remoteState = md.getLDAPServerState(serverId); if (remoteState == null) opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -50,13 +50,11 @@ import org.opends.messages.Message; import org.opends.messages.MessageBuilder; import org.opends.server.admin.server.ConfigurationChangeListener; import org.opends.server.admin.std.server.MonitorProviderCfg; import org.opends.server.admin.std.server.ReplicationServerCfg; import org.opends.server.api.Backend; import org.opends.server.api.BackupTaskListener; import org.opends.server.api.ExportTaskListener; import org.opends.server.api.ImportTaskListener; import org.opends.server.api.MonitorProvider; import org.opends.server.api.RestoreTaskListener; import org.opends.server.config.ConfigException; import org.opends.server.core.DirectoryServer; @@ -64,9 +62,6 @@ import org.opends.server.loggers.debug.DebugTracer; import org.opends.server.replication.protocol.ProtocolSession; import org.opends.server.replication.protocol.ReplSessionSecurity; import org.opends.server.types.Attribute; import org.opends.server.types.AttributeBuilder; import org.opends.server.types.Attributes; import org.opends.server.types.BackupConfig; import org.opends.server.types.ConfigChangeResult; import org.opends.server.types.DN; @@ -90,8 +85,8 @@ * It is responsible for creating the replication server replicationServerDomain * and managing it */ public class ReplicationServer extends MonitorProvider<MonitorProviderCfg> implements Runnable, ConfigurationChangeListener<ReplicationServerCfg>, public class ReplicationServer implements ConfigurationChangeListener<ReplicationServerCfg>, BackupTaskListener, RestoreTaskListener, ImportTaskListener, ExportTaskListener { @@ -164,8 +159,6 @@ public ReplicationServer(ReplicationServerCfg configuration) throws ConfigException { super("Replication Server" + configuration.getReplicationPort()); replicationPort = configuration.getReplicationPort(); serverId = (short) configuration.getReplicationServerId(); replicationServers = configuration.getReplicationServer(); @@ -205,8 +198,6 @@ replSessionSecurity = new ReplSessionSecurity(); initialize(replicationPort); configuration.addChangeListener(this); DirectoryServer.registerMonitorProvider(this); try { backendConfigEntryDN = DN.decode( @@ -550,7 +541,6 @@ { dbEnv.shutdown(); } DirectoryServer.deregisterMonitorProvider(getMonitorInstanceName()); } @@ -760,86 +750,6 @@ } /** * {@inheritDoc} */ @Override public void initializeMonitorProvider(MonitorProviderCfg configuraiton) { // Nothing to do for now } /** * {@inheritDoc} */ @Override public String getMonitorInstanceName() { return "Replication Server " + this.replicationPort + " " + serverId; } /** * {@inheritDoc} */ @Override public long getUpdateInterval() { /* we don't wont to do polling on this monitor */ return 0; } /** * {@inheritDoc} */ @Override public void updateMonitorData() { // As long as getUpdateInterval() returns 0, this will never get called } /** * {@inheritDoc} */ @Override public ArrayList<Attribute> getMonitorData() { /* * publish the server id and the port number. */ ArrayList<Attribute> attributes = new ArrayList<Attribute>(); attributes.add(Attributes.create("replication server id", String.valueOf(serverId))); attributes.add(Attributes.create("replication server port", String.valueOf(replicationPort))); /* * Add all the base DNs that are known by this replication server. */ AttributeBuilder builder = new AttributeBuilder("base-dn"); for (String base : baseDNs.keySet()) { builder.add(base.toString()); } attributes.add(builder.toAttribute()); // Publish to monitor the generation ID by replicationServerDomain builder = new AttributeBuilder("base-dn-generation-id"); for (String base : baseDNs.keySet()) { long generationId=-1; ReplicationServerDomain replicationServerDomain = getReplicationServerDomain(base, false); if (replicationServerDomain != null) generationId = replicationServerDomain.getGenerationId(); builder.add(base.toString() + " " + generationId); } attributes.add(builder.toAttribute()); return attributes; } /** * Get the value of generationId for the replication replicationServerDomain * associated with the provided baseDN. * @@ -1147,4 +1057,22 @@ replicationServerDomain.stopReplicationServers(serversToDisconnect); } } /** * {@inheritDoc} */ public String getMonitorInstanceName() { return "Replication Server " + replicationPort + " " + serverId; } /** * Retrieves the port used by this ReplicationServer. * * @return The port used by this ReplicationServer. */ public int getReplicationPort() { return replicationPort; } } opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
@@ -31,6 +31,9 @@ import static org.opends.server.loggers.debug.DebugLogger.*; import org.opends.server.admin.std.server.MonitorProviderCfg; import org.opends.server.api.MonitorProvider; import org.opends.server.core.DirectoryServer; import org.opends.server.loggers.debug.DebugTracer; import static org.opends.server.loggers.ErrorLogger.logError; import static org.opends.messages.ReplicationMessages.*; @@ -57,6 +60,9 @@ import org.opends.server.replication.protocol.MonitorMsg; import org.opends.server.replication.protocol.MonitorRequestMsg; import org.opends.server.replication.protocol.ResetGenerationIdMsg; import org.opends.server.types.Attribute; import org.opends.server.types.AttributeBuilder; import org.opends.server.types.Attributes; import org.opends.server.types.DirectoryException; import org.opends.server.types.ResultCode; import org.opends.server.util.TimeThread; @@ -89,7 +95,7 @@ * received to the disk and for trimming them * Decision to trim can be based on disk space or age of the message */ public class ReplicationServerDomain public class ReplicationServerDomain extends MonitorProvider<MonitorProviderCfg> { private final Object flowControlLock = new Object(); private final String baseDn; @@ -184,10 +190,15 @@ public ReplicationServerDomain( String baseDn, ReplicationServer replicationServer) { super("Replication Server " + replicationServer.getReplicationPort() + " " + baseDn + " " + replicationServer.getServerId()); this.baseDn = baseDn; this.replicationServer = replicationServer; this.assuredTimeoutTimer = new Timer("Replication Assured Timer for " + baseDn + " in RS " + replicationServer.getServerId(), true); DirectoryServer.registerMonitorProvider(this); } /** @@ -1556,6 +1567,8 @@ */ public void shutdown() { DirectoryServer.deregisterMonitorProvider(getMonitorInstanceName()); // Terminate the assured timer assuredTimeoutTimer.cancel(); @@ -2187,7 +2200,7 @@ * @return The monitor data. * @throws DirectoryException When an error occurs. */ synchronized protected MonitorData getMonitorData() synchronized protected MonitorData computeMonitorData() throws DirectoryException { if (monitorData.getBuildDate() + monitorDataLifeTime > TimeThread.getTime()) @@ -2609,5 +2622,77 @@ statusAnalyzer.setDeradedStatusThreshold(degradedStatusThreshold); } } /** * {@inheritDoc} */ @Override public void initializeMonitorProvider(MonitorProviderCfg configuraiton) { // Nothing to do for now } /** * {@inheritDoc} */ @Override public String getMonitorInstanceName() { return "Replication Server " + replicationServer.getReplicationPort() + " " + " " + replicationServer.getServerId() + ",cn=" + baseDn.replace(',', '_').replace('=', '_') + ",cn=replication"; } /** * {@inheritDoc} */ @Override public long getUpdateInterval() { /* we don't wont to do polling on this monitor */ return 0; } /** * {@inheritDoc} */ @Override public void updateMonitorData() { // As long as getUpdateInterval() returns 0, this will never get called } /** * {@inheritDoc} */ @Override public ArrayList<Attribute> getMonitorData() { /* * publish the server id and the port number. */ ArrayList<Attribute> attributes = new ArrayList<Attribute>(); attributes.add(Attributes.create("replication server id", String.valueOf(replicationServer.getServerId()))); attributes.add(Attributes.create("replication server port", String.valueOf(replicationServer.getReplicationPort()))); /* * Add all the base DNs that are known by this replication server. */ AttributeBuilder builder = new AttributeBuilder("domain-name"); builder.add(baseDn); attributes.add(builder.toAttribute()); // Publish to monitor the generation ID by replicationServerDomain builder = new AttributeBuilder("generation-id"); builder.add(baseDn.toString() + " " + generationId); attributes.add(builder.toAttribute()); return attributes; } } opends/src/server/org/opends/server/replication/server/ServerHandler.java
@@ -1968,13 +1968,14 @@ @Override public String getMonitorInstanceName() { String str = baseDn.toString() + " " + serverURL + " " + String.valueOf(serverId); String str = serverURL + " " + String.valueOf(serverId); if (serverIsLDAPserver) return "Directory Server " + str; return "Connected Replica " + str + ",cn=" + replicationServerDomain.getMonitorInstanceName(); else return "Remote Replication Server " + str; return "Connected Replication Server " + str + ",cn=" + replicationServerDomain.getMonitorInstanceName(); } /** @@ -2020,7 +2021,7 @@ ArrayList<Attribute> attributes = new ArrayList<Attribute>(); if (serverIsLDAPserver) { attributes.add(Attributes.create("LDAP-Server", serverURL)); attributes.add(Attributes.create("replica", serverURL)); attributes.add(Attributes.create("connected-to", this.replicationServerDomain.getReplicationServer() .getMonitorInstanceName())); @@ -2028,17 +2029,17 @@ } else { attributes.add(Attributes.create("ReplicationServer-Server", attributes.add(Attributes.create("Replication-Server", serverURL)); } attributes.add(Attributes.create("server-id", String .valueOf(serverId))); attributes.add(Attributes.create("base-dn", baseDn.toString())); attributes.add(Attributes.create("domain-name", baseDn.toString())); try { MonitorData md; md = replicationServerDomain.getMonitorData(); md = replicationServerDomain.computeMonitorData(); if (serverIsLDAPserver) { opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
@@ -540,10 +540,10 @@ } /** * Gets the info for DSs in the topology (except us). * @return The info for DSs in the topology (except us) * Gets the info for Replicas in the topology (except us). * @return The info for Replicas in the topology (except us) */ public List<DSInfo> getDsList() public List<DSInfo> getReplicasList() { return broker.getDsList(); } opends/src/server/org/opends/server/replication/service/ReplicationMonitor.java
@@ -76,8 +76,9 @@ @Override public String getMonitorInstanceName() { return "Replication Domain " + domain.getServiceID() + " " + domain.getServerId(); return "Replication Domain " + domain.getServerId() + ",cn=" + domain.getServiceID().replace(',', '_').replace('=', '_') + ",cn=replication"; } /** @@ -94,7 +95,7 @@ ArrayList<Attribute> attributes = new ArrayList<Attribute>(); /* get the base dn */ Attribute attr = Attributes.create("base-dn", domain.getServiceID()); Attribute attr = Attributes.create("domain-name", domain.getServiceID()); attributes.add(attr); /* get the base dn */ opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReSyncTest.java
@@ -22,7 +22,7 @@ * CDDL HEADER END * * * Copyright 2007-2008 Sun Microsystems, Inc. * Copyright 2007-2009 Sun Microsystems, Inc. */ package org.opends.server.replication; @@ -224,9 +224,7 @@ connection.processDelete(DN.decode("dc=fooUniqueName2," + EXAMPLE_DN)); String buildRoot = System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT); String path = buildRoot + File.separator + "build" + File.separator + "unit-tests" + File.separator + "package-instance"+ File.separator + "ReSynchTest"; String path = "ReSynchTest"; task("dn: ds-task-id=" + UUID.randomUUID() + ",cn=Scheduled Tasks,cn=Tasks\n" opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java
@@ -635,7 +635,7 @@ protected long getMonitorAttrValue(DN baseDn, String attr) throws Exception { String monitorFilter = "(&(cn=replication Domain*)(base-dn=" + baseDn + "))"; "(&(cn=replication Domain*)(domain-name=" + baseDn + "))"; InternalSearchOperation op; int count = 0; opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/AssuredReplicationPluginTest.java
@@ -1855,7 +1855,7 @@ * Find monitoring entry for requested base DN */ String monitorFilter = "(&(cn=replication Domain*)(base-dn=" + baseDn + "))"; "(&(cn=replication Domain*)(domain-name=" + baseDn + "))"; InternalSearchOperation op; int count = 0; opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/TopologyViewTest.java
@@ -22,7 +22,7 @@ * CDDL HEADER END * * * Copyright 2008 Sun Microsystems, Inc. * Copyright 2008-2009 Sun Microsystems, Inc. */ package org.opends.server.replication.plugin; @@ -1086,7 +1086,7 @@ /** * Get the topo view of the current analyzed DS */ List<DSInfo> internalDsList = rd.getDsList(); List<DSInfo> internalDsList = rd.getReplicasList(); // Add info for DS itself: // we need to clone the list as we don't want to modify the list kept // inside the DS. opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/AssuredReplicationServerTest.java
@@ -2035,7 +2035,7 @@ List<RSInfo> rsInfo = null; while(nSec > 0) { dsInfo = fakeRd.getDsList(); dsInfo = fakeRd.getReplicasList(); rsInfo = fakeRd.getRsList(); nDs = dsInfo.size(); nRs = rsInfo.size(); @@ -3739,7 +3739,7 @@ // Wait for connections to be finished // DS must see expected numbers of DSs/RSs waitForStableTopo(fakeRd1, 1, 1); List<DSInfo> dsInfos = fakeRd1.getDsList(); List<DSInfo> dsInfos = fakeRd1.getReplicasList(); DSInfo dsInfo = dsInfos.get(0); assertEquals(dsInfo.getDsId(), FDS2_ID); assertEquals(dsInfo.getStatus(), ServerStatus.NORMAL_STATUS); @@ -3771,7 +3771,7 @@ boolean error = true; for (int count = 0; count < 12; count++) { dsInfos = fakeRd1.getDsList(); dsInfos = fakeRd1.getReplicasList(); if (dsInfos == null) continue; if (dsInfos.size() == 0) @@ -3886,7 +3886,7 @@ error = true; for (int count = 0; count < 12; count++) { dsInfos = fakeRd1.getDsList(); dsInfos = fakeRd1.getReplicasList(); if (dsInfos == null) continue; if (dsInfos.size() == 0) opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ReplicationDomainTest.java
@@ -129,7 +129,7 @@ assertTrue(replServerInfo.getGenerationId() == 1); } for (DSInfo serverInfo : domain1.getDsList()) for (DSInfo serverInfo : domain1.getReplicasList()) { assertTrue(serverInfo.getStatus() == ServerStatus.NORMAL_STATUS); } @@ -145,7 +145,7 @@ assertTrue(replServerInfo.getGenerationId() == 2); } for (DSInfo serverInfo : domain1.getDsList()) for (DSInfo serverInfo : domain1.getReplicasList()) { if (serverInfo.getDsId() == 2) assertTrue(serverInfo.getStatus() == ServerStatus.BAD_GEN_ID_STATUS); @@ -156,7 +156,7 @@ } } for (DSInfo serverInfo : domain2.getDsList()) for (DSInfo serverInfo : domain2.getReplicasList()) { if (serverInfo.getDsId() == 2) assertTrue(serverInfo.getStatus() == ServerStatus.BAD_GEN_ID_STATUS); @@ -231,7 +231,7 @@ * Trigger a total update from domain1 to domain2. * Check that the exported data is correctly received on domain2. */ for (DSInfo remoteDS : domain2.getDsList()) for (DSInfo remoteDS : domain2.getReplicasList()) { if (remoteDS.getDsId() != domain2.getServerId()) { @@ -361,7 +361,7 @@ boolean alone = true; while (alone) { for (DSInfo remoteDS : domain1.getDsList()) for (DSInfo remoteDS : domain1.getReplicasList()) { if (remoteDS.getDsId() != domain1.getServerId()) {