OPENDJ-2337 Remove JE changelog code
Also removed ds-cfg-replication-db-implementation config from ds-cfg-replication-server because the switch now happens by default.
15 files deleted
31 files modified
| | |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="replication-db-implementation" advanced="true"> |
| | | <adm:synopsis> |
| | | The <adm:user-friendly-name /> database implementation |
| | | that stores all persistent information. |
| | | </adm:synopsis> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>log</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:enumeration> |
| | | <adm:value name="je"> |
| | | <adm:synopsis>Implementation based on Berkeley DB JE database.</adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="log"> |
| | | <adm:synopsis>Implementation based on log file.</adm:synopsis> |
| | | </adm:value> |
| | | </adm:enumeration> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-replication-db-implementation</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="replication-purge-delay"> |
| | | <adm:synopsis> |
| | | The time (in seconds) after which the |
| | |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDJ Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.36733.2.1.1.142 |
| | | NAME 'ds-cfg-replication-db-implementation' |
| | | EQUALITY caseExactMatch |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDJ Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.36733.2.1.1.143 |
| | | NAME 'ds-cfg-source-address' EQUALITY caseIgnoreMatch |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | |
| | | ds-cfg-window-size $ |
| | | ds-cfg-queue-size $ |
| | | ds-cfg-replication-db-directory $ |
| | | ds-cfg-replication-db-implementation $ |
| | | ds-cfg-replication-purge-delay $ |
| | | ds-cfg-group-id $ |
| | | ds-cfg-assured-timeout $ |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.meta.ReplicationServerCfgDefn.ReplicationDBImplementation; |
| | | import org.opends.server.admin.std.meta.VirtualAttributeCfgDefn.ConflictBehavior; |
| | | import org.opends.server.admin.std.server.ReplicationServerCfg; |
| | | import org.opends.server.admin.std.server.UserDefinedVirtualAttributeCfg; |
| | |
| | | import org.opends.server.replication.server.changelog.api.ChangelogException; |
| | | import org.opends.server.replication.server.changelog.file.ECLEnabledDomainPredicate; |
| | | import org.opends.server.replication.server.changelog.file.FileChangelogDB; |
| | | import org.opends.server.replication.server.changelog.je.JEChangelogDB; |
| | | import org.opends.server.replication.service.DSRSShutdownSync; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.DN; |
| | |
| | | this.domainPredicate = predicate; |
| | | |
| | | enableExternalChangeLog(); |
| | | ReplicationDBImplementation dbImpl = cfg.getReplicationDBImplementation(); |
| | | logger.trace("Using %s as DB implementation for changelog DB", dbImpl); |
| | | if (dbImpl == ReplicationDBImplementation.JE) |
| | | { |
| | | this.changelogDB = new JEChangelogDB(this, cfg); |
| | | } |
| | | else |
| | | { |
| | | this.changelogDB = new FileChangelogDB(this, cfg); |
| | | } |
| | | |
| | | replSessionSecurity = new ReplSessionSecurity(); |
| | | initialize(); |
| | |
| | | |
| | | /** See OPENDJ-1742 */ |
| | | register("3.0.0", |
| | | clearReplicationDbDirectory(), |
| | | modifyConfigEntry(INFO_UPGRADE_TASK_ENABLED_FILE_BASED_CHANGELOG.get(), |
| | | "(objectClass=ds-cfg-replication-server)", |
| | | "replace: ds-cfg-replication-db-implementation", |
| | | "ds-cfg-replication-db-implementation: log")); |
| | | clearReplicationDbDirectory()); |
| | | |
| | | /** |
| | | * All upgrades will refresh the server configuration schema and generate a new upgrade folder. |
| | |
| | | |
| | | @BeforeSuite |
| | | public final void suppressOutput() { |
| | | System.out.println("Replication DB implementation used in tests: '" + |
| | | ReplicationTestCase.replicationDbImplementation + "'."); |
| | | System.out.flush(); |
| | | |
| | | TestCaseUtils.suppressOutput(); |
| | | } |
| | | |
| | |
| | | while (DirectoryServerTestCase.class.isAssignableFrom(cls) && |
| | | !DirectoryServerTestCase.class.equals(cls)) |
| | | { |
| | | Field fields[] = cls.getDeclaredFields(); |
| | | for (int i = 0; i < fields.length; i++) { |
| | | Field field = fields[i]; |
| | | for (Field field : cls.getDeclaredFields()) { |
| | | int modifiers = field.getModifiers(); |
| | | Class<?> fieldClass = field.getType(); |
| | | |
| | |
| | | ReplServerFakeConfiguration config = new ReplServerFakeConfiguration( |
| | | replicationServerPort, |
| | | "ChangelogBackendTestDB", |
| | | replicationDbImplementation, |
| | | 0, // purge delay |
| | | 71, // server id |
| | | 0, // queue size |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | |
| | | + "cn: Replication Server\n" |
| | | + "ds-cfg-replication-port: " + replServerPort + "\n" |
| | | + "ds-cfg-replication-db-directory: ChangeNumberControlDbTest\n" |
| | | + "ds-cfg-replication-db-implementation: " + replicationDbImplementation + "\n" |
| | | + "ds-cfg-replication-server-id: 103\n"; |
| | | |
| | | // suffix synchronized |
| | |
| | | private ReplicationServer newReplicationServer(int replServerId, int windowSize, String dirName) throws Exception |
| | | { |
| | | int replServerPort = TestCaseUtils.findFreePort(); |
| | | ReplServerFakeConfiguration conf = new ReplServerFakeConfiguration( |
| | | replServerPort, dirName, replicationDbImplementation, 0, replServerId, 0, windowSize, null); |
| | | return new ReplicationServer(conf); |
| | | return new ReplicationServer(new ReplServerFakeConfiguration( |
| | | replServerPort, dirName, 0, replServerId, 0, windowSize, null)); |
| | | } |
| | | |
| | | private LDAPReplicationDomain startNewLDAPReplicationDomain(ReplicationServer replServer, DN baseDN, int serverId, |
| | |
| | | } |
| | | int rsPort = getRSPort(replServerId); |
| | | String rsDir = "generationIdTest" + replServerId + testCase + "Db"; |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(rsPort, rsDir, replicationDbImplementation, 0, replServerId, 0, 100, servers); |
| | | ReplicationServer replicationServer = new ReplicationServer(conf); |
| | | ReplicationServer replicationServer = new ReplicationServer( |
| | | new ReplServerFakeConfiguration(rsPort, rsDir, 0, replServerId, 0, 100, servers)); |
| | | Thread.sleep(1000); |
| | | return replicationServer; |
| | | } |
| | |
| | | } |
| | | |
| | | final int port = getReplServerPort(replServerId); |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration( |
| | | port, |
| | | "initOnlineTest" + port + testCase + "Db", |
| | | replicationDbImplementation, |
| | | 0, replServerId, 0, 100, servers); |
| | | ReplServerFakeConfiguration conf = new ReplServerFakeConfiguration( |
| | | port, "initOnlineTest" + port + testCase + "Db", 0, replServerId, 0, 100, servers); |
| | | ReplicationServer replicationServer = new ReplicationServer(conf); |
| | | Thread.sleep(1000); |
| | | return replicationServer; |
| | |
| | | |
| | | // configure the replication Server. |
| | | replicationServer = new ReplicationServer(new ReplServerFakeConfiguration( |
| | | replServerPort, "protocolWindowTestDb", replicationDbImplementation, |
| | | 0, 1, REPLICATION_QUEUE_SIZE, WINDOW_SIZE, null)); |
| | | replServerPort, "protocolWindowTestDb", 0, 1, REPLICATION_QUEUE_SIZE, WINDOW_SIZE, null)); |
| | | |
| | | String personLdif = "dn: uid=user.windowTest," + TEST_ROOT_DN_STRING + "\n" |
| | | + "objectClass: top\n" + "objectClass: person\n" |
| | |
| | | + "cn: Replication Server\n" |
| | | + "ds-cfg-replication-port:" + replServerPort + "\n" |
| | | + "ds-cfg-replication-db-directory: ReSyncTest\n" |
| | | + "ds-cfg-replication-db-implementation: " + replicationDbImplementation + "\n" |
| | | + "ds-cfg-replication-server-id: 104\n"; |
| | | |
| | | // suffix synchronized |
| | |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.std.meta.ReplicationServerCfgDefn.ReplicationDBImplementation; |
| | | import org.opends.server.admin.std.server.ReplicationDomainCfg; |
| | | import org.opends.server.backends.task.TaskState; |
| | | import org.opends.server.core.AddOperation; |
| | |
| | | import org.opends.server.replication.protocol.Session; |
| | | import org.opends.server.replication.server.ReplicationServer; |
| | | import org.opends.server.replication.server.changelog.file.FileChangelogDB; |
| | | import org.opends.server.replication.server.changelog.je.JEChangelogDB; |
| | | import org.opends.server.replication.service.ReplicationBroker; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.Attributes; |
| | |
| | | |
| | | private static final String REPLICATION_DB_IMPL_PROPERTY = "org.opends.test.replicationDbImpl"; |
| | | |
| | | public static ReplicationDBImplementation replicationDbImplementation = ReplicationDBImplementation.valueOf( |
| | | System.getProperty(REPLICATION_DB_IMPL_PROPERTY, ReplicationDBImplementation.LOG.name())); |
| | | |
| | | /** Replication monitor stats. */ |
| | | private DN monitorDN; |
| | | private String monitorAttr; |
| | |
| | | |
| | | protected void clearChangelogDB(ReplicationServer rs) throws Exception |
| | | { |
| | | if (rs == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (replicationDbImplementation == ReplicationDBImplementation.JE) |
| | | { |
| | | ((JEChangelogDB) rs.getChangelogDB()).clearDB(); |
| | | } |
| | | else |
| | | if (rs != null) |
| | | { |
| | | ((FileChangelogDB) rs.getChangelogDB()).clearDB(); |
| | | } |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | protected static void setReplicationDBImplementation(ReplicationDBImplementation impl) |
| | | { |
| | | replicationDbImplementation = impl; |
| | | } |
| | | } |
| | |
| | | + "cn: Replication Server\n" |
| | | + "ds-cfg-replication-port: " + replServerPort + "\n" |
| | | + "ds-cfg-replication-db-directory: SchemaReplicationTest\n" |
| | | + "ds-cfg-replication-db-implementation: " + replicationDbImplementation + "\n" |
| | | + "ds-cfg-replication-server-id: 105\n"; |
| | | |
| | | // suffix synchronized |
| | |
| | | + "cn: Replication Server\n" |
| | | + "ds-cfg-replication-port: " + replServerPort + "\n" |
| | | + "ds-cfg-replication-db-directory: UpdateOperationTest\n" |
| | | + "ds-cfg-replication-db-implementation: " + replicationDbImplementation + "\n" |
| | | + "ds-cfg-replication-server-id: 107\n"; |
| | | |
| | | // suffix synchronized |
| | |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | |
| | | String dir = testName + RS_ID + testCase + "Db"; |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(replServerPort, dir, replicationDbImplementation, 0, RS_ID, 0, |
| | | 100, replServers); |
| | | replicationServer = new ReplicationServer(conf); |
| | | replicationServer = new ReplicationServer( |
| | | new ReplServerFakeConfiguration(replServerPort, dir, 0, RS_ID, 0, 100, replServers)); |
| | | } |
| | | |
| | | private static final String REPLICATION_GENERATION_ID = |
| | |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.std.meta.ReplicationServerCfgDefn.ReplicationDBImplementation; |
| | | import org.opends.server.replication.ReplicationTestCase; |
| | | import org.opends.server.replication.server.ReplServerFakeConfiguration; |
| | | import org.opends.server.replication.server.ReplicationServer; |
| | |
| | | import org.opends.server.types.HostPort; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | | * Some real connections from clients that should end up with a server with |
| | | * the right groupId if available. |
| | |
| | | |
| | | String dir = "groupIdHandshakeTest" + serverId + testCase + "Db"; |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(port, dir, replicationDbImplementation, 0, serverId, 0, |
| | | 100, replServers, groupId, 1000, 5000); |
| | | new ReplServerFakeConfiguration(port, dir, 0, serverId, 0, 100, replServers, groupId, 1000, 5000); |
| | | return new ReplicationServer(conf); |
| | | } |
| | | |
| | | /** |
| | | * Creates a new ReplicationDomain. |
| | | */ |
| | | /** Creates a new ReplicationDomain. */ |
| | | private LDAPReplicationDomain createReplicationDomain(int serverId, |
| | | int groupId, String testCase) throws Exception |
| | | { |
| | |
| | | otherReplServers.add("localhost:" + rs2Port); |
| | | String dir = "groupIdHandshakeTest" + RS3_ID + testCase + "Db"; |
| | | ReplServerFakeConfiguration rsConfWithNewGid = |
| | | new ReplServerFakeConfiguration(rs3Port, dir, replicationDbImplementation, 0, RS3_ID, 0, |
| | | 100, otherReplServers, 1, 1000, 5000); |
| | | new ReplServerFakeConfiguration(rs3Port, dir, 0, RS3_ID, 0, 100, otherReplServers, 1, 1000, 5000); |
| | | rs3.applyConfigurationChange(rsConfWithNewGid); |
| | | |
| | | /** |
| | |
| | | otherReplServers.add("localhost:" + rs2Port); |
| | | otherReplServers.add("localhost:" + rs3Port); |
| | | dir = "groupIdHandshakeTest" + RS1_ID + testCase + "Db"; |
| | | rsConfWithNewGid = new ReplServerFakeConfiguration(rs1Port, dir, ReplicationDBImplementation.JE, 0, |
| | | RS1_ID, 0, 100, otherReplServers, 3, 1000, 5000); |
| | | rsConfWithNewGid = |
| | | new ReplServerFakeConfiguration(rs1Port, dir, 0, RS1_ID, 0, 100, otherReplServers, 3, 1000, 5000); |
| | | rs1.applyConfigurationChange(rsConfWithNewGid); |
| | | checkConnection(30, DS1_ID, RS3_ID, |
| | | "Change GID of RS3 to 1 and RS1 to 3, DS1 should reconnect to RS3 with GID=1"); |
| | |
| | | int rsPort = TestCaseUtils.findFreePort(); |
| | | replServers.add("localhost:" + rsPort); |
| | | |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(rsPort, "HistoricalCsnOrdering", replicationDbImplementation, 0, |
| | | 1, 0, 100, replServers, 1, 1000, 5000); |
| | | ReplicationServer replicationServer = new ReplicationServer(conf); |
| | | ReplicationServer replicationServer = new ReplicationServer( |
| | | new ReplServerFakeConfiguration(rsPort, "HistoricalCsnOrdering", 0, 1, 0, 100, replServers, 1, 1000, 5000)); |
| | | clearChangelogDB(replicationServer); |
| | | return replicationServer; |
| | | } |
| | |
| | | + "cn: replication Server\n" |
| | | + "ds-cfg-replication-port: " + replServerPort + "\n" |
| | | + "ds-cfg-replication-db-directory: HistoricalTest\n" |
| | | + "ds-cfg-replication-db-implementation: " + replicationDbImplementation + "\n" |
| | | + "ds-cfg-replication-server-id: 102\n"; |
| | | |
| | | // The suffix to be synchronized. |
| | |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.replication.ReplicationTestCase; |
| | | import org.opends.server.replication.server.ReplServerFakeConfiguration; |
| | | import org.opends.server.replication.server.ReplicationServer; |
| | |
| | | import org.opends.server.types.HostPort; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | | * Test if the replication domain is able to switch of replication server |
| | | * if there is some replication server failure. |
| | |
| | | } |
| | | |
| | | String dir = "replicationServerFailoverTest" + serverId + suffix + "Db"; |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(port, dir, replicationDbImplementation, 0, serverId, 0, |
| | | 100, replServers); |
| | | return new ReplicationServer(conf); |
| | | return new ReplicationServer(new ReplServerFakeConfiguration(port, dir, 0, serverId, 0, 100, replServers)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import java.util.*; |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Iterator; |
| | | import java.util.Set; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | |
| | | import org.assertj.core.api.Assertions; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.std.server.ReplicationServerCfg; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.replication.ReplicationTestCase; |
| | | import org.opends.server.replication.server.ReplServerFakeConfiguration; |
| | | import org.opends.server.replication.server.ReplicationServer; |
| | |
| | | import org.opends.server.types.DN; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | | * Test in real situations the algorithm for load balancing the DSs connections |
| | | * to the RSs. This uses the weights of the RSs. We concentrate the tests on |
| | |
| | | } |
| | | |
| | | String dir = "replicationServerLoadBalancingTest" + rsIndex + testCase + "Db"; |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(rsPort[rsIndex], dir, replicationDbImplementation, 0, rsIndex+501, 0, |
| | | 100, replServers, 1, 1000, 5000, weight); |
| | | ReplServerFakeConfiguration conf = new ReplServerFakeConfiguration( |
| | | rsPort[rsIndex], dir, 0, rsIndex + 501, 0, 100, replServers, 1, 1000, 5000, weight); |
| | | return new ReplicationServer(conf); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | String dir = "replicationServerLoadBalancingTest" + rsIndex + testCase + "Db"; |
| | | return new ReplServerFakeConfiguration(rsPort[rsIndex], dir, replicationDbImplementation, |
| | | 0, rsIndex + 501, 0, 100, replServers, 1, 1000, 5000, weight); |
| | | return new ReplServerFakeConfiguration( |
| | | rsPort[rsIndex], dir, 0, rsIndex + 501, 0, 100, replServers, 1, 1000, 5000, weight); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | String dir = "stateMachineTest" + RS1_ID + testCase + "Db"; |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(rs1Port, dir, replicationDbImplementation, 0, RS1_ID, 0, |
| | | new ReplServerFakeConfiguration(rs1Port, dir, 0, RS1_ID, 0, |
| | | 100, replServers, 1, 1000, degradedStatusThreshold); |
| | | return new ReplicationServer(conf); |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.std.meta.ReplicationDomainCfgDefn.AssuredType; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.replication.ReplicationTestCase; |
| | | import org.opends.server.replication.common.AssuredMode; |
| | | import org.opends.server.replication.common.DSInfo; |
| | |
| | | import org.opends.server.types.HostPort; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | | * Some tests to know if at any time the view DSs and RSs have of the current |
| | | * topology is accurate, even after some connections, disconnections and |
| | |
| | | |
| | | String dir = "topologyViewTest" + rsId + testCase + "Db"; |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(rsPort, dir, replicationDbImplementation, 0, rsId, 0, |
| | | new ReplServerFakeConfiguration(rsPort, dir, 0, rsId, 0, |
| | | 100, replServers, groupId, 1000, 5000); |
| | | return new ReplicationServer(conf); |
| | | } |
| | |
| | | |
| | | String dir = testName + serverId + testCase + "Db"; |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(port, dir, replicationDbImplementation, 0, serverId, 0, |
| | | new ReplServerFakeConfiguration(port, dir, 0, serverId, 0, |
| | | 100, otherRsUrls, groupId, assuredTimeout, 5000); |
| | | // No monitoring publisher to not interfere with some SocketTimeoutException |
| | | // expected at some points in these tests |
| | |
| | | // Create real RS |
| | | String dir = testName + RS1_ID + testCase + "Db"; |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(rsPorts[0], dir, replicationDbImplementation, 0, RS1_ID, 0, |
| | | new ReplServerFakeConfiguration(rsPorts[0], dir, 0, RS1_ID, 0, |
| | | 100, new TreeSet<String>(), DEFAULT_GID, SMALL_TIMEOUT, 1); |
| | | rs1 = new ReplicationServer(conf); |
| | | |
| | |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.net.SocketException; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | import java.util.UUID; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.replication.ReplicationTestCase; |
| | | import org.opends.server.replication.common.CSN; |
| | | import org.opends.server.replication.common.CSNGenerator; |
| | |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | | * Tests for the replicationServer code. |
| | | */ |
| | |
| | | } |
| | | int chPort = getChangelogPort(changelogId); |
| | | String chDir = "monitorTest" + changelogId + suffix + "Db"; |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(chPort, chDir, replicationDbImplementation, 0, changelogId, 0, |
| | | 100, servers); |
| | | ReplServerFakeConfiguration conf = new ReplServerFakeConfiguration(chPort, chDir, 0, changelogId, 0, 100, servers); |
| | | final DN testBaseDN = this.baseDN; |
| | | ReplicationServer replicationServer = new ReplicationServer(conf, new DSRSShutdownSync(), new ECLEnabledDomainPredicate() |
| | | { |
| | |
| | | import org.opends.server.admin.Configuration; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.server.ServerManagedObject; |
| | | import org.opends.server.admin.std.meta.ReplicationServerCfgDefn.ReplicationDBImplementation; |
| | | import org.opends.server.admin.std.server.ReplicationServerCfg; |
| | | import org.opends.server.types.DN; |
| | | |
| | |
| | | private long monitoringPeriod = 3000; |
| | | private boolean computeChangenumber; |
| | | |
| | | /** The DB implementation to use for replication changelog. */ |
| | | private final ReplicationDBImplementation dbImpl; |
| | | |
| | | /** |
| | | * Constructor without group id, assured info and weight. |
| | | */ |
| | | /** Constructor without group id, assured info and weight. */ |
| | | public ReplServerFakeConfiguration( |
| | | int port, String dirName, ReplicationDBImplementation dbImpl, int purgeDelay, |
| | | int serverId, int queueSize, int windowSize, SortedSet<String> servers) |
| | | int port, String dirName, int purgeDelay, int serverId, int queueSize, int windowSize, SortedSet<String> servers) |
| | | { |
| | | this.port = port; |
| | | this.dbImpl = dbImpl; |
| | | this.dirName = dirName != null ? dirName : "changelogDb"; |
| | | |
| | | if (purgeDelay == 0) |
| | |
| | | * Constructor with group id and assured info. |
| | | */ |
| | | public ReplServerFakeConfiguration( |
| | | int port, String dirName, ReplicationDBImplementation dbImpl, int purgeDelay, |
| | | int serverId, int queueSize, int windowSize, |
| | | int port, String dirName, int purgeDelay, int serverId, int queueSize, int windowSize, |
| | | SortedSet<String> servers, int groupId, long assuredTimeout, int degradedStatusThreshold) |
| | | { |
| | | this(port, dirName, dbImpl, purgeDelay, serverId, queueSize, windowSize, servers); |
| | | this(port, dirName, purgeDelay, serverId, queueSize, windowSize, servers); |
| | | this.groupId = groupId; |
| | | this.assuredTimeout = assuredTimeout; |
| | | this.degradedStatusThreshold = degradedStatusThreshold; |
| | | } |
| | | |
| | | /** |
| | | * Constructor with group id, assured info and weight. |
| | | */ |
| | | /** Constructor with group id, assured info and weight. */ |
| | | public ReplServerFakeConfiguration( |
| | | int port, String dirName, ReplicationDBImplementation dbImpl, int purgeDelay, |
| | | int serverId, int queueSize, int windowSize, |
| | | int port, String dirName, int purgeDelay, int serverId, int queueSize, int windowSize, |
| | | SortedSet<String> servers, int groupId, long assuredTimeout, int degradedStatusThreshold, int weight) |
| | | { |
| | | this(port, dirName, dbImpl, purgeDelay, serverId, queueSize, windowSize, |
| | | this(port, dirName, purgeDelay, serverId, queueSize, windowSize, |
| | | servers, groupId, assuredTimeout, degradedStatusThreshold); |
| | | this.weight = weight; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addChangeListener( |
| | | ConfigurationChangeListener<ReplicationServerCfg> listener) |
| | |
| | | // not supported |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Class<? extends ReplicationServerCfg> configurationClass() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getReplicationDBDirectory() |
| | | { |
| | | return dirName; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getReplicationPort() |
| | | { |
| | | return port; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getReplicationPurgeDelay() |
| | | { |
| | | return purgeDelay; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SortedSet<String> getReplicationServer() |
| | | { |
| | | return servers; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getReplicationServerId() |
| | | { |
| | | return serverId; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public InetAddress getSourceAddress() { return null; } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getQueueSize() |
| | | { |
| | | return queueSize; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int getWindowSize() |
| | | { |
| | | return windowSize; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeChangeListener( |
| | | ConfigurationChangeListener<ReplicationServerCfg> listener) |
| | | public void removeChangeListener(ConfigurationChangeListener<ReplicationServerCfg> listener) |
| | | { |
| | | // not supported |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN dn() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | public ServerManagedObject<? extends Configuration> managedObject() { |
| | | return null; |
| | | } |
| | |
| | | { |
| | | this.computeChangenumber = computeChangenumber; |
| | | } |
| | | |
| | | @Override |
| | | public ReplicationDBImplementation getReplicationDBImplementation() |
| | | { |
| | | return dbImpl; |
| | | } |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.replication.ReplicationTestCase; |
| | | import org.opends.server.replication.service.ReplicationBroker; |
| | | import org.opends.server.types.DN; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | | * Tests that we can dynamically modify the configuration of replicationServer. |
| | | */ |
| | |
| | | int[] ports = TestCaseUtils.findFreePorts(2); |
| | | |
| | | // instantiate a Replication server using the first port number. |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration( |
| | | ports[0], null, replicationDbImplementation, 0, 1, 0, 0, null); |
| | | ReplServerFakeConfiguration conf = new ReplServerFakeConfiguration(ports[0], null, 0, 1, 0, 0, null); |
| | | replicationServer = new ReplicationServer(conf); |
| | | |
| | | // Most of the configuration change are trivial to apply. |
| | |
| | | // build a new ReplServerFakeConfiguration with a new server port |
| | | // apply this new configuration and check that it is now possible to |
| | | // connect to this new portnumber. |
| | | ReplServerFakeConfiguration newconf = |
| | | new ReplServerFakeConfiguration( |
| | | ports[1], null, replicationDbImplementation, 0, 1, 0, 0, null); |
| | | |
| | | ReplServerFakeConfiguration newconf = new ReplServerFakeConfiguration(ports[1], null, 0, 1, 0, 0, null); |
| | | replicationServer.applyConfigurationChange(newconf); |
| | | |
| | | ReplicationBroker broker = openReplicationSession( |
| | |
| | | "--provider-name", "Multimaster Synchronization", |
| | | "--set", "replication-db-directory:" + "replicationServerTestConfigureDb", |
| | | "--set", "replication-port:" + replicationServerPort, |
| | | "--set", "replication-db-implementation:" + replicationDbImplementation, |
| | | "--set", "replication-server-id:71"); |
| | | |
| | | for (SynchronizationProvider<?> provider : DirectoryServer |
| | |
| | | "localhost:" + ((i == 0) ? changelogPorts[1] : changelogPorts[0])); |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(changelogPorts[i], "replicationServerTestChangelogChainingDb"+i, |
| | | replicationDbImplementation, 0, changelogIds[i], 0, 100, servers); |
| | | 0, changelogIds[i], 0, 100, servers); |
| | | changelogs[i] = new ReplicationServer(conf); |
| | | } |
| | | |
| | |
| | | SortedSet<String> servers = new TreeSet<>(); |
| | | servers.add("localhost:" + changelogPorts[1]); |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(changelogPorts[0], "replicationServerTestChangelogChainingDb"+0, replicationDbImplementation, |
| | | new ReplServerFakeConfiguration(changelogPorts[0], "replicationServerTestChangelogChainingDb" + 0, |
| | | 0, changelogIds[0], 0, 100, servers); |
| | | changelogs[0] = new ReplicationServer(conf); |
| | | } |
| | |
| | | SortedSet<String> servers = new TreeSet<>(); |
| | | servers.add("localhost:"+changelogPorts[0]); |
| | | ReplServerFakeConfiguration conf = new ReplServerFakeConfiguration( |
| | | changelogPorts[1], null, replicationDbImplementation, 0, changelogIds[1], 0, 100, null); |
| | | changelogPorts[1], null, 0, changelogIds[1], 0, 100, null); |
| | | changelogs[1] = new ReplicationServer(conf); |
| | | |
| | | // Connect broker 2 to changelog2 |
| | |
| | | servers.add("localhost:" + changelogPorts[1]); |
| | | } |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(changelogPorts[i], "replicationServerTestReplicationServerConnectedDb"+i, replicationDbImplementation, |
| | | new ReplServerFakeConfiguration(changelogPorts[i], "replicationServerTestReplicationServerConnectedDb" + i, |
| | | 0, changelogIds[i], 0, 100, servers); |
| | | changelogs[i] = new ReplicationServer(conf); |
| | | } |
| | |
| | | SortedSet<String> servers = new TreeSet<>(); |
| | | // Configure replicationServer[0] to be disconnected from ReplicationServer[1] |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(changelogPorts[0], "changelogDb0", replicationDbImplementation, |
| | | 0, changelogIds[0], 0, 100, servers); |
| | | new ReplServerFakeConfiguration(changelogPorts[0], "changelogDb0", 0, changelogIds[0], 0, 100, servers); |
| | | changelogs[0].applyConfigurationChange(conf) ; |
| | | |
| | | // The link between RS[0] & RS[1] should be destroyed by the new configuration. |
| | |
| | | */ |
| | | package org.opends.server.replication.server.changelog.file; |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.opends.server.replication.server.changelog.file.FileReplicaDBTest.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.std.meta.ReplicationServerCfgDefn.ReplicationDBImplementation; |
| | | import org.opends.server.replication.ReplicationTestCase; |
| | | import org.opends.server.replication.common.CSN; |
| | | import org.opends.server.replication.server.ReplServerFakeConfiguration; |
| | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.opends.server.replication.server.changelog.file.FileReplicaDBTest.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | @SuppressWarnings("javadoc") |
| | | public class FileChangeNumberIndexDBTest extends ReplicationTestCase |
| | | { |
| | |
| | | assertEquals(cnIndexDB.count(), 3, "Db count"); |
| | | assertFalse(cnIndexDB.isEmpty()); |
| | | |
| | | DBCursor<ChangeNumberIndexRecord> cursor = cnIndexDB.getCursorFrom(cn1); |
| | | try (DBCursor<ChangeNumberIndexRecord> cursor = cnIndexDB.getCursorFrom(cn1)) |
| | | { |
| | | assertCursorReadsInOrder(cursor, cn1, cn2, cn3); |
| | | |
| | | cursor = cnIndexDB.getCursorFrom(cn2); |
| | | } |
| | | try (DBCursor<ChangeNumberIndexRecord> cursor = cnIndexDB.getCursorFrom(cn2)) |
| | | { |
| | | assertCursorReadsInOrder(cursor, cn2, cn3); |
| | | |
| | | cursor = cnIndexDB.getCursorFrom(cn3); |
| | | } |
| | | try (DBCursor<ChangeNumberIndexRecord> cursor = cnIndexDB.getCursorFrom(cn3)) |
| | | { |
| | | assertCursorReadsInOrder(cursor, cn3); |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | remove(replicationServer); |
| | |
| | | return cnIndexDB.addRecord(new ChangeNumberIndexRecord(baseDN, csn)); |
| | | } |
| | | |
| | | private void assertEqualTo(ChangeNumberIndexRecord record, CSN csn, DN baseDN) |
| | | { |
| | | assertEquals(record.getCSN(), csn); |
| | | assertEquals(record.getBaseDN(), baseDN); |
| | | } |
| | | |
| | | private FileChangeNumberIndexDB getCNIndexDB(ReplicationServer rs) throws ChangelogException |
| | | { |
| | | final FileChangelogDB changelogDB = (FileChangelogDB) rs.getChangelogDB(); |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | final int port = TestCaseUtils.findFreePort(); |
| | | final ReplServerFakeConfiguration cfg = |
| | | new ReplServerFakeConfiguration(port, null, ReplicationDBImplementation.LOG, 0, 2, 0, 100, null); |
| | | final ReplServerFakeConfiguration cfg = new ReplServerFakeConfiguration(port, null, 0, 2, 0, 100, null); |
| | | cfg.setComputeChangeNumber(true); |
| | | return new ReplicationServer(cfg); |
| | | } |
| | | |
| | | private void assertCursorReadsInOrder(DBCursor<ChangeNumberIndexRecord> cursor, |
| | | long... cns) throws ChangelogException |
| | | { |
| | | try |
| | | private void assertCursorReadsInOrder(DBCursor<ChangeNumberIndexRecord> cursor, long... cns) |
| | | throws ChangelogException |
| | | { |
| | | for (long cn : cns) |
| | | { |
| | |
| | | } |
| | | assertFalse(cursor.next()); |
| | | } |
| | | finally |
| | | { |
| | | cursor.close(); |
| | | } |
| | | } |
| | | } |
| | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.util.time.TimeService; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.std.meta.ReplicationServerCfgDefn.ReplicationDBImplementation; |
| | | import org.opends.server.admin.std.server.ReplicationServerCfg; |
| | | import org.opends.server.replication.ReplicationTestCase; |
| | | import org.opends.server.replication.common.CSN; |
| | | import org.opends.server.replication.common.CSNGenerator; |
| | |
| | | throws IOException, ConfigException |
| | | { |
| | | final int changelogPort = findFreePort(); |
| | | final ReplicationServerCfg conf = new ReplServerFakeConfiguration( |
| | | changelogPort, null, ReplicationDBImplementation.LOG, 0, 2, queueSize, windowSize, null); |
| | | return new ReplicationServer(conf); |
| | | return new ReplicationServer( |
| | | new ReplServerFakeConfiguration(changelogPort, null, 0, 2, queueSize, windowSize, null)); |
| | | } |
| | | |
| | | private FileReplicaDB newReplicaDB(ReplicationServer rs) throws Exception |
| | |
| | | int replicationPort, String dirName, int windowSize, |
| | | SortedSet<String> replServers) throws Exception |
| | | { |
| | | ReplServerFakeConfiguration cfg = |
| | | new ReplServerFakeConfiguration(replicationPort, dirName, replicationDbImplementation, 0, |
| | | serverId, 0, windowSize, replServers); |
| | | return new ReplicationServer(cfg); |
| | | return new ReplicationServer( |
| | | new ReplServerFakeConfiguration(replicationPort, dirName, 0, serverId, 0, windowSize, replServers)); |
| | | } |
| | | |
| | | private void disable(ReplicationDomain... domains) |