| New file |
| | |
| | | # Use this file as an example of the Multi-master replication configuration. |
| | | # The content of this file should be edited and |
| | | # added to the config.ldif file to enable replication. |
| | | # |
| | | # Each synchronized base DN must be specified using entry similar to |
| | | # cn=example, cn=domains, cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config. |
| | | # Each server must have its own unique server ID defined in ds-cfg-server-id. |
| | | # Each replication server must be enabled using the |
| | | # cn=Replication Server, cn=Multimaster Synchronization, cn=Synchronization Providers, cn=config |
| | | # entry. |
| | | |
| | | |
| | | dn: cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config |
| | | objectClass: top |
| | | objectClass: ds-cfg-synchronization-provider |
| | | objectClass: ds-cfg-multimaster-synchronization-provider |
| | | ds-cfg-synchronization-provider-enabled: true |
| | | ds-cfg-synchronization-provider-class: org.opends.server.replication.plugin.MultimasterReplication |
| | | |
| | | dn: cn=domains, cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config |
| | | objectClass: top |
| | | objectClass: ds-cfg-branch |
| | | cn: domains |
| | | |
| | | dn: cn=example, cn=domains, cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config |
| | | objectClass: top |
| | | objectClass: ds-cfg-replication-domain-config |
| | | cn: example |
| | | ds-cfg-replication-dn: dc=example,dc=com |
| | | ds-cfg-replication-server: localhost:8989 |
| | | ds-cfg-replication-server: localhost:8990 |
| | | ds-cfg-directory-server-id: 1 |
| | | ds-cfg-receive-status: true |
| | | |
| | | dn: cn=Replication Server, cn=Multimaster Synchronization, cn=Synchronization Providers, cn=config |
| | | objectClass: top |
| | | objectClass: ds-cfg-replication-server-config |
| | | cn: Replication Server |
| | | ds-cfg-replication-server-port: 8989 |
| | | ds-cfg-replication-server: localhost:8989 |
| | | ds-cfg-replication-server: localhost:8990 |
| | | ds-cfg-replication-server-id: 1 |
| | | |
| | |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.158 |
| | | NAME 'ds-cfg-changelog-port' |
| | | NAME ( 'ds-cfg-replication-server-port' 'ds-cfg-changelog-port' ) |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.290 |
| | | NAME 'ds-cfg-changelog-max-queue-size' |
| | | NAME ( 'ds-cfg-replication-max-queue-size' 'ds-cfg-changelog-max-queue-size' ) |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | SINGLE-VALUE X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.278 |
| | | NAME 'ds-cfg-changelog-server-id' |
| | | NAME ( 'ds-cfg-replication-server-id' 'ds-cfg-changelog-server-id' ) |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.279 |
| | |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.160 |
| | | NAME 'ds-cfg-changelog-server' |
| | | NAME ( 'ds-cfg-replication-server' 'ds-cfg-changelog-server' ) |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.161 |
| | |
| | | NAME 'ds-task-restart-server' SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 |
| | | SINGLE-VALUE X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.226 |
| | | NAME 'ds-cfg-synchronization-dn' |
| | | NAME ( 'ds-cfg-replication-dn' 'ds-cfg-synchronization-dn' ) |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 |
| | | SINGLE-VALUE X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.227 NAME 'ds-sync-state' |
| | |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.306 |
| | | NAME 'ds-cfg-changelog-db-directory' |
| | | NAME ( 'ds-cfg-replication-db-directory' |
| | | 'ds-cfg-changelog-db-directory' ) |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.307 |
| | |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.319 |
| | | NAME 'ds-cfg-changelog-purge-delay' |
| | | NAME ( 'ds-cfg-replication-purge-delay' 'ds-cfg-changelog-purge-delay' ) |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.321 |
| | |
| | | MUST ( ds-cfg-synchronization-provider-class $ |
| | | ds-cfg-synchronization-provider-enabled ) X-ORIGIN 'OpenDS Directory Server' ) |
| | | objectClasses: ( 1.3.6.1.4.1.26027.1.2.58 NAME |
| | | 'ds-cfg-synchronization-provider-config' SUP top |
| | | STRUCTURAL MUST ( ds-cfg-changelog-server $ ds-cfg-directory-server-id |
| | | $ ds-cfg-synchronization-dn ) |
| | | ( 'ds-cfg-replication-domain-config' |
| | | 'ds-cfg-synchronization-provider-config' ) SUP top |
| | | STRUCTURAL MUST ( ds-cfg-replication-server $ ds-cfg-directory-server-id |
| | | $ ds-cfg-replication-dn ) |
| | | MAY ( cn $ ds-cfg-receive-status $ ds-cfg-max-receive-queue $ |
| | | ds-cfg-max-receive-delay $ ds-cfg-max-send-queue $ ds-cfg-max-send-delay $ |
| | | ds-cfg-window-size $ ds-cfg-heartbeat-interval ) |
| | |
| | | ds-task-import-is-encrypted ) |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | objectClasses: ( 1.3.6.1.4.1.26027.1.2.65 NAME |
| | | 'ds-cfg-synchronization-changelog-server-config' SUP top |
| | | STRUCTURAL MUST (ds-cfg-changelog-server-id $ ds-cfg-changelog-port ) |
| | | MAY ( ds-cfg-changelog-server $ cn $ ds-cfg-window-size $ |
| | | ds-cfg-changelog-max-queue-size $ds-cfg-changelog-db-directory ) |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | ( 'ds-cfg-replication-server-config' |
| | | 'ds-cfg-synchronization-changelog-server-config' ) SUP top STRUCTURAL |
| | | MUST (ds-cfg-replication-server-id $ ds-cfg-replication-server-port ) |
| | | MAY ( ds-cfg-replication-server $ cn $ ds-cfg-window-size $ |
| | | ds-cfg-replication-max-queue-size $ ds-cfg-replication-db-directory ) |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | objectClasses: ( 1.3.6.1.4.1.26027.1.2.66 NAME 'ds-backup-directory' |
| | | SUP top STRUCTURAL MUST ( ds-backup-directory-path $ ds-backup-backend-dn ) |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | |
| | | <adm:profile name="ldap"> |
| | | <ldap:object-class> |
| | | <ldap:oid>1.3.6.1.4.1.26027.1.2.58</ldap:oid> |
| | | <ldap:name>ds-cfg-synchronization-provider-config</ldap:name> |
| | | <ldap:name>ds-cfg-replication-domain-config</ldap:name> |
| | | <ldap:superior>top</ldap:superior> |
| | | </ldap:object-class> |
| | | </adm:profile> |
| | | <adm:property name="changelog-server" multi-valued="true" |
| | | <adm:property name="replication-server" multi-valued="true" |
| | | mandatory="true"> |
| | | <adm:synopsis> |
| | | Specifies the addresses of the changelog server to which this |
| | | Specifies the addresses of the replication server to which this |
| | | <adm:user-friendly-name /> |
| | | should try to connect at startup time. |
| | | </adm:synopsis> |
| | |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:oid>1.3.6.1.4.1.26027.1.1.160</ldap:oid> |
| | | <ldap:name>ds-cfg-changelog-server</ldap:name> |
| | | <ldap:name>ds-cfg-replication-server</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="synchronization-dn" mandatory="true" |
| | | <adm:property name="replication-dn" mandatory="true" |
| | | multi-valued="false" read-only="true"> |
| | | <adm:synopsis> |
| | | Specifies the base dn of the Multimaster Domain |
| | |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:oid>1.3.6.1.4.1.26027.1.1.226</ldap:oid> |
| | | <ldap:name>ds-cfg-synchronization-dn</ldap:name> |
| | | <ldap:name>ds-cfg-replication-dn</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="max-receive-queue" mandatory="false" |
| | | multi-valued="false"> |
| | | <adm:synopsis> |
| | | Specifies the maximum length of the receive queue on the changelog |
| | | Specifies the maximum length of the receive queue on the replication |
| | | server before flow control must be activated. |
| | | </adm:synopsis> |
| | | <adm:default-behavior> |
| | |
| | | <adm:property name="max-receive-delay" mandatory="false" |
| | | multi-valued="false"> |
| | | <adm:synopsis> |
| | | Specifies the maximum delay on the changelog server before flow |
| | | Specifies the maximum delay on the replication server before flow |
| | | control must be activated. |
| | | </adm:synopsis> |
| | | <adm:default-behavior> |
| | |
| | | <adm:property name="max-send-queue" mandatory="false" |
| | | multi-valued="false"> |
| | | <adm:synopsis> |
| | | Specifies the maximum length of the send queue on the changelog |
| | | Specifies the maximum length of the send queue on the replication |
| | | server before flow control must be activated. |
| | | </adm:synopsis> |
| | | <adm:default-behavior> |
| | |
| | | <adm:property name="max-send-delay" mandatory="false" |
| | | multi-valued="false"> |
| | | <adm:synopsis> |
| | | Specifies the maximum send delay on the changelog server before |
| | | Specifies the maximum send delay on the replication server before |
| | | flow control must be activated. |
| | | </adm:synopsis> |
| | | <adm:default-behavior> |
| | |
| | | multi-valued="false"> |
| | | <adm:synopsis> |
| | | Specifies the window size that will this Domain must use when |
| | | communicating with changelog servers. |
| | | communicating with replication servers. |
| | | </adm:synopsis> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | |
| | | multi-valued="false"> |
| | | <adm:synopsis> |
| | | Specifies the heartbeat interval that this Domain must use when |
| | | communicating with changelog servers. The Domain will expect |
| | | regular heatbeat coming from the changelog server with this |
| | | communicating with replication servers. The Domain will expect |
| | | regular heatbeat coming from the replication server with this |
| | | interval if they are not received it will close its connection and |
| | | connect to another changelog server. |
| | | connect to another replication server. |
| | | </adm:synopsis> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>1000s</adm:value> |
| | | <adm:value>1000ms</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | |
| | | <ldap:rdn-sequence>cn=domains</ldap:rdn-sequence> |
| | | </adm:profile> |
| | | </adm:relation> |
| | | <adm:relation name="changelog-server"> |
| | | <adm:relation name="replication-server"> |
| | | <adm:one-to-zero-or-one /> |
| | | <adm:profile name="ldap"> |
| | | <ldap:rdn-sequence>cn=changelog server</ldap:rdn-sequence> |
| | | <ldap:rdn-sequence>cn=replication server</ldap:rdn-sequence> |
| | | </adm:profile> |
| | | </adm:relation> |
| | | </adm:managed-object> |
| File was renamed from opends/src/admin/defn/org/opends/server/admin/std/ChangelogServerConfiguration.xml |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <adm:managed-object name="changelog-server" |
| | | plural-name="changelog-servers" package="org.opends.server.admin.std" |
| | | <adm:managed-object name="replication-server" |
| | | plural-name="replication-servers" package="org.opends.server.admin.std" |
| | | xmlns:adm="http://www.opends.org/admin" |
| | | xmlns:ldap="http://www.opends.org/admin-ldap"> |
| | | <adm:synopsis> |
| | |
| | | <ldap:object-class> |
| | | <ldap:oid>1.3.6.1.4.1.26027.1.2.65</ldap:oid> |
| | | <ldap:name> |
| | | ds-cfg-synchronization-changelog-server-config |
| | | ds-cfg-replication-server-config |
| | | </ldap:name> |
| | | <ldap:superior>top</ldap:superior> |
| | | </ldap:object-class> |
| | | </adm:profile> |
| | | <adm:property name="changelog-server" multi-valued="true" |
| | | <adm:property name="replication-server" multi-valued="true" |
| | | mandatory="false"> |
| | | <adm:synopsis> |
| | | Specifies the addresses of the changelog server to which this |
| | | Specifies the addresses of the replication server to which this |
| | | <adm:user-friendly-name /> |
| | | should try to connect at startup time. |
| | | </adm:synopsis> |
| | |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:oid>1.3.6.1.4.1.26027.1.1.160</ldap:oid> |
| | | <ldap:name>ds-cfg-changelog-server</ldap:name> |
| | | <ldap:name>ds-cfg-replication-server</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="changelog-server-id" multi-valued="false" |
| | | <adm:property name="replication-server-id" multi-valued="false" |
| | | mandatory="true" read-only="true"> |
| | | <adm:synopsis> |
| | | Specifies the server ID of this Changelog Server |
| | | Specifies the server ID of this Replication Server |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | Each Changelog Server must have a different server ID. |
| | | Each Replication Server must have a different server ID. |
| | | </adm:description> |
| | | <adm:requires-admin-action> |
| | | <adm:none /> |
| | |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:oid>1.3.6.1.4.1.26027.1.1.278</ldap:oid> |
| | | <ldap:name>ds-cfg-changelog-server-id</ldap:name> |
| | | <ldap:name>ds-cfg-replication-server-id</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | |
| | | multi-valued="false"> |
| | | <adm:synopsis> |
| | | Specifies the window size that will this Domain must use when |
| | | communicating with changelog servers. |
| | | communicating with replication servers. |
| | | </adm:synopsis> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:oid>1.3.6.1.4.1.26027.1.1.290</ldap:oid> |
| | | <ldap:name>ds-cfg-changelog-max-queue-size</ldap:name> |
| | | <ldap:name>ds-cfg-replication-max-queue-size</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="changelog-db-directory" mandatory="false" |
| | | <adm:property name="replication-db-directory" mandatory="false" |
| | | hidden="false" multi-valued="false" read-only="true"> |
| | | <adm:synopsis> |
| | | The path where the |
| | |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:oid>1.3.6.1.4.1.26027.1.1.306</ldap:oid> |
| | | <ldap:name>ds-cfg-changelog-db-directory</ldap:name> |
| | | <ldap:name>ds-cfg-replication-db-directory</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="changelog-purge-delay" multi-valued="false"> |
| | | <adm:property name="replication-purge-delay" multi-valued="false"> |
| | | <adm:synopsis> |
| | | The time (in seconds) after which the |
| | | <adm:user-friendly-name /> |
| | |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:oid>1.3.6.1.4.1.26027.1.1.319</ldap:oid> |
| | | <ldap:name>ds-cfg-changelog-purge-delay</ldap:name> |
| | | <ldap:name>ds-cfg-replication-purge-delay</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="changelog-port" mandatory="true" |
| | | <adm:property name="replication-port" mandatory="true" |
| | | multi-valued="false"> |
| | | <adm:synopsis> |
| | | The port on which this |
| | | <adm:user-friendly-name></adm:user-friendly-name> |
| | | will wait for connections from other Changelog Servers or LDAP |
| | | will wait for connections from other Replication Servers or LDAP |
| | | Servers or from LDAP servers. |
| | | </adm:synopsis> |
| | | <adm:requires-admin-action> |
| | |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:oid>1.3.6.1.4.1.26027.1.1.158</ldap:oid> |
| | | <ldap:name>ds-cfg-changelog-port</ldap:name> |
| | | <ldap:name>ds-cfg-replication-server-port</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | MultimasterDomainCfg configuration) |
| | | { |
| | | DN dn = configuration.getSynchronizationDN(); |
| | | DN dn = configuration.getReplicationDN(); |
| | | ReplicationDomain domain = domains.remove(dn); |
| | | if (domain != null) |
| | | domain.shutdown(); |
| | |
| | | super("replication flush"); |
| | | |
| | | // Read the configuration parameters. |
| | | replicationServers = configuration.getChangelogServer(); |
| | | replicationServers = configuration.getReplicationServer(); |
| | | serverId = (short) configuration.getServerId(); |
| | | baseDN = configuration.getSynchronizationDN(); |
| | | baseDN = configuration.getReplicationDN(); |
| | | maxReceiveQueue = configuration.getMaxReceiveQueue(); |
| | | maxReceiveDelay = (int) configuration.getMaxReceiveDelay(); |
| | | maxSendQueue = configuration.getMaxSendQueue(); |
| | |
| | | { |
| | | // Check that there is not already a domain with the same DN |
| | | // TODO : Check that the server id is a short |
| | | DN dn = configuration.getSynchronizationDN(); |
| | | DN dn = configuration.getReplicationDN(); |
| | | if (MultimasterReplication.findDomain(dn,null) != null) |
| | | { |
| | | String message = getMessage(MSGID_SYNC_INVALID_DN, dn.toString()); |
| | |
| | | // server id and base dn are readonly. |
| | | // The other parameters needs to be renegociated with the ReplicationServer. |
| | | // so that requires restarting the session with the ReplicationServer. |
| | | replicationServers = configuration.getChangelogServer(); |
| | | replicationServers = configuration.getReplicationServer(); |
| | | maxReceiveQueue = configuration.getMaxReceiveQueue(); |
| | | maxReceiveDelay = (int) configuration.getMaxReceiveDelay(); |
| | | maxSendQueue = configuration.getMaxSendQueue(); |
| | |
| | | |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationDeleteListener; |
| | | import org.opends.server.admin.std.server.ChangelogServerCfg; |
| | | import org.opends.server.admin.std.server.MultimasterSynchronizationProviderCfg; |
| | | import org.opends.server.admin.std.server.ReplicationServerCfg; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.replication.server.ReplicationServer; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | |
| | | * |
| | | */ |
| | | public class ReplicationServerListener |
| | | implements ConfigurationAddListener<ChangelogServerCfg>, |
| | | ConfigurationDeleteListener<ChangelogServerCfg> |
| | | implements ConfigurationAddListener<ReplicationServerCfg>, |
| | | ConfigurationDeleteListener<ReplicationServerCfg> |
| | | { |
| | | ReplicationServer replicationServer = null; |
| | | |
| | |
| | | MultimasterSynchronizationProviderCfg configuration) |
| | | throws ConfigException |
| | | { |
| | | configuration.addChangelogServerAddListener(this); |
| | | configuration.addChangelogServerDeleteListener(this); |
| | | configuration.addReplicationServerAddListener(this); |
| | | configuration.addReplicationServerDeleteListener(this); |
| | | |
| | | if (configuration.hasChangelogServer()) |
| | | if (configuration.hasReplicationServer()) |
| | | { |
| | | ChangelogServerCfg server = configuration.getChangelogServer(); |
| | | ReplicationServerCfg server = configuration.getReplicationServer(); |
| | | replicationServer = new ReplicationServer(server); |
| | | } |
| | | } |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | ChangelogServerCfg configuration) |
| | | ReplicationServerCfg configuration) |
| | | { |
| | | try |
| | | { |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isConfigurationAddAcceptable( |
| | | ChangelogServerCfg configuration, List<String> unacceptableReasons) |
| | | ReplicationServerCfg configuration, List<String> unacceptableReasons) |
| | | { |
| | | return ReplicationServer.isConfigurationAcceptable( |
| | | configuration, unacceptableReasons); |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | ChangelogServerCfg configuration) |
| | | ReplicationServerCfg configuration) |
| | | { |
| | | // There can be only one replicationServer, just shutdown the |
| | | // replicationServer currently configured. |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | ChangelogServerCfg configuration, List<String> unacceptableReasons) |
| | | ReplicationServerCfg configuration, List<String> unacceptableReasons) |
| | | { |
| | | return true; |
| | | } |
| | |
| | | import static org.opends.server.loggers.Error.logError; |
| | | import static org.opends.server.messages.MessageHandler.getMessage; |
| | | import static org.opends.server.messages.ReplicationMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.getFileForPath; |
| | | |
| | | import java.io.File; |
| | |
| | | import java.util.Set; |
| | | |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.ChangelogServerCfg; |
| | | import org.opends.server.admin.std.server.ReplicationServerCfg; |
| | | import org.opends.server.api.ConfigurableComponent; |
| | | import org.opends.server.api.DirectoryThread; |
| | | import org.opends.server.config.ConfigAttribute; |
| | |
| | | */ |
| | | public class ReplicationServer |
| | | implements Runnable, ConfigurableComponent, |
| | | ConfigurationChangeListener<ChangelogServerCfg> |
| | | ConfigurationChangeListener<ReplicationServerCfg> |
| | | { |
| | | private short serverId; |
| | | private String serverURL; |
| | |
| | | |
| | | private String localURL = "null"; |
| | | private boolean shutdown = false; |
| | | private short changelogServerId; |
| | | private short replicationServerId; |
| | | private DN configDn; |
| | | private List<ConfigAttribute> configAttributes = |
| | | new ArrayList<ConfigAttribute>(); |
| | |
| | | * @param configuration The configuration of this replication server. |
| | | * @throws ConfigException When Configuration is invalid. |
| | | */ |
| | | public ReplicationServer(ChangelogServerCfg configuration) |
| | | public ReplicationServer(ReplicationServerCfg configuration) |
| | | throws ConfigException |
| | | { |
| | | shutdown = false; |
| | | runListen = true; |
| | | int changelogPort = configuration.getChangelogPort(); |
| | | changelogServerId = (short) configuration.getChangelogServerId(); |
| | | replicationServers = configuration.getChangelogServer(); |
| | | int replicationPort = configuration.getReplicationPort(); |
| | | replicationServerId = (short) configuration.getReplicationServerId(); |
| | | replicationServers = configuration.getReplicationServer(); |
| | | if (replicationServers == null) |
| | | replicationServers = new ArrayList<String>(); |
| | | queueSize = configuration.getQueueSize(); |
| | | trimAge = configuration.getChangelogPurgeDelay(); |
| | | dbDirname = configuration.getChangelogDbDirectory(); |
| | | trimAge = configuration.getReplicationPurgeDelay(); |
| | | dbDirname = configuration.getReplicationDbDirectory(); |
| | | rcvWindow = configuration.getWindowSize(); |
| | | if (dbDirname == null) |
| | | { |
| | |
| | | e.getMessage() + " " + getFileForPath(dbDirname)); |
| | | } |
| | | |
| | | initialize(changelogServerId, changelogPort); |
| | | initialize(replicationServerId, replicationPort); |
| | | configuration.addChangeListener(this); |
| | | } |
| | | |
| | |
| | | */ |
| | | for (ReplicationCache replicationCache: baseDNs.values()) |
| | | { |
| | | Set<String> connectedChangelogs = replicationCache.getChangelogs(); |
| | | Set<String> connectedReplServers = replicationCache.getChangelogs(); |
| | | /* |
| | | * check that all replication server in the config are in the connected |
| | | * Set. If not create the connection |
| | |
| | | for (String serverURL : replicationServers) |
| | | { |
| | | if ((serverURL.compareTo(this.serverURL) != 0) && |
| | | (!connectedChangelogs.contains(serverURL))) |
| | | (!connectedReplServers.contains(serverURL))) |
| | | { |
| | | this.connect(serverURL, replicationCache.getBaseDn()); |
| | | } |
| | |
| | | * @return true if the configuration is acceptable, false other wise. |
| | | */ |
| | | public static boolean isConfigurationAcceptable( |
| | | ChangelogServerCfg configuration, List<String> unacceptableReasons) |
| | | ReplicationServerCfg configuration, List<String> unacceptableReasons) |
| | | { |
| | | int port = configuration.getChangelogPort(); |
| | | int port = configuration.getReplicationPort(); |
| | | |
| | | try |
| | | { |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | ChangelogServerCfg configuration) |
| | | ReplicationServerCfg configuration) |
| | | { |
| | | // TODO : implement this |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isConfigurationChangeAcceptable( |
| | | ChangelogServerCfg configuration, List<String> unacceptableReasons) |
| | | ReplicationServerCfg configuration, List<String> unacceptableReasons) |
| | | { |
| | | // TODO : implement this |
| | | return true; |
| | |
| | | // Add config entries to the current DS server based on : |
| | | // Add the replication plugin: synchroPluginEntry & synchroPluginStringDN |
| | | // Add synchroServerEntry |
| | | // Add changeLogEntry |
| | | // Add replServerEntry |
| | | configureReplication(); |
| | | |
| | | taskInitFromS2 = TestCaseUtils.makeEntry( |
| | |
| | | + "ds-cfg-changelog-server-id: 1\n" |
| | | + "ds-cfg-window-size: " + WINDOW_SIZE + "\n" |
| | | + "ds-cfg-changelog-max-queue-size: " + CHANGELOG_QUEUE_SIZE; |
| | | changeLogEntry = TestCaseUtils.entryFromLdifString(changeLogLdif); |
| | | changeLogEntry = null; |
| | | replServerEntry = TestCaseUtils.entryFromLdifString(changeLogLdif); |
| | | replServerEntry = null; |
| | | |
| | | } |
| | | |
| | |
| | | connectServer1ToChangelog(changelog1ID); |
| | | |
| | | if (server2 == null) |
| | | server2 = openChangelogSession(DN.decode("dc=example,dc=com"), |
| | | server2 = openReplicationSession(DN.decode("dc=example,dc=com"), |
| | | server2ID, 100, getChangelogPort(changelog1ID), 1000, emptyOldChanges); |
| | | |
| | | Thread.sleep(2000); |
| | |
| | | addTestEntriesToDB(); |
| | | |
| | | if (server2 == null) |
| | | server2 = openChangelogSession(DN.decode("dc=example,dc=com"), |
| | | server2 = openReplicationSession(DN.decode("dc=example,dc=com"), |
| | | server2ID, 100, getChangelogPort(changelog1ID), 1000, emptyOldChanges); |
| | | |
| | | Thread.sleep(3000); |
| | |
| | | |
| | | // S1 is the server we are running in, S2 is simulated by a broker |
| | | if (server2 == null) |
| | | server2 = openChangelogSession(DN.decode("dc=example,dc=com"), |
| | | server2 = openReplicationSession(DN.decode("dc=example,dc=com"), |
| | | server2ID, 100, getChangelogPort(changelog1ID), 1000, emptyOldChanges); |
| | | |
| | | Thread.sleep(1000); |
| | |
| | | |
| | | // S1 is the server we are running in, S2 and S3 are simulated by brokers |
| | | if (server2==null) |
| | | server2 = openChangelogSession(DN.decode("dc=example,dc=com"), |
| | | server2 = openReplicationSession(DN.decode("dc=example,dc=com"), |
| | | server2ID, 100, getChangelogPort(changelog1ID), 1000, emptyOldChanges); |
| | | |
| | | ReplicationBroker server3 = openChangelogSession(DN.decode("dc=example,dc=com"), |
| | | ReplicationBroker server3 = openReplicationSession(DN.decode("dc=example,dc=com"), |
| | | server3ID, 100, getChangelogPort(changelog1ID), 1000, emptyOldChanges); |
| | | |
| | | Thread.sleep(1000); |
| | |
| | | |
| | | // S1 is the server we are running in, S2 is simulated by a broker |
| | | if (server2==null) |
| | | server2 = openChangelogSession(DN.decode("dc=example,dc=com"), |
| | | server2 = openReplicationSession(DN.decode("dc=example,dc=com"), |
| | | server2ID, 100, getChangelogPort(changelog1ID), 1000, emptyOldChanges); |
| | | |
| | | // Creates config to synchronize suffix |
| | |
| | | // connected to changelog2 |
| | | if (server2 == null) |
| | | { |
| | | server2 = openChangelogSession(DN.decode("dc=example,dc=com"), |
| | | server2 = openReplicationSession(DN.decode("dc=example,dc=com"), |
| | | server2ID, 100, getChangelogPort(changelog2ID), 1000, emptyOldChanges); |
| | | } |
| | | |
| | |
| | | // Connect a broker acting as server 2 to changelog2 |
| | | if (server2 == null) |
| | | { |
| | | server2 = openChangelogSession(DN.decode("dc=example,dc=com"), |
| | | server2 = openReplicationSession(DN.decode("dc=example,dc=com"), |
| | | server2ID, 100, getChangelogPort(changelog2ID), |
| | | 1000, emptyOldChanges); |
| | | } |
| | |
| | | // Connect a broker acting as server 2 to changelog2 |
| | | if (server2 == null) |
| | | { |
| | | server2 = openChangelogSession(DN.decode("dc=example,dc=com"), |
| | | server2 = openReplicationSession(DN.decode("dc=example,dc=com"), |
| | | server2ID, 100, getChangelogPort(changelog1ID), |
| | | 1000, emptyOldChanges); |
| | | } |
| | |
| | | import static org.opends.server.loggers.Error.logError; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.net.ServerSocket; |
| | | import java.net.SocketTimeoutException; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashSet; |
| | |
| | | public class ProtocolWindowTest extends ReplicationTestCase |
| | | { |
| | | private static final int WINDOW_SIZE = 10; |
| | | private static final int CHANGELOG_QUEUE_SIZE = 100; |
| | | private static final int REPLICATION_QUEUE_SIZE = 100; |
| | | |
| | | private static final String REPLICATION_STRESS_TEST = |
| | | "Replication Stress Test"; |
| | |
| | | * A "person" entry |
| | | */ |
| | | protected Entry personEntry; |
| | | private int replServerPort; |
| | | |
| | | /** |
| | | * Test the window mechanism by : |
| | |
| | | |
| | | final DN baseDn = DN.decode("ou=People,dc=example,dc=com"); |
| | | |
| | | ReplicationBroker broker = openChangelogSession(baseDn, (short) 13, |
| | | WINDOW_SIZE, 8989, 1000, true); |
| | | ReplicationBroker broker = openReplicationSession(baseDn, (short) 13, |
| | | WINDOW_SIZE, replServerPort, 1000, true); |
| | | |
| | | try { |
| | | |
| | |
| | | */ |
| | | Thread.sleep(1500); |
| | | assertTrue(checkWindows(WINDOW_SIZE)); |
| | | assertTrue(checkChangelogQueueSize(CHANGELOG_QUEUE_SIZE)); |
| | | assertTrue(checkChangelogQueueSize(REPLICATION_QUEUE_SIZE)); |
| | | |
| | | // Create an Entry (add operation) that will be later used in the test. |
| | | Entry tmp = personEntry.duplicate(false); |
| | |
| | | |
| | | // send (2 * window + replicationServer queue) modify operations |
| | | // so that window + replicationServer queue get stuck in the replicationServer queue |
| | | int count = WINDOW_SIZE * 2 + CHANGELOG_QUEUE_SIZE; |
| | | int count = WINDOW_SIZE * 2 + REPLICATION_QUEUE_SIZE; |
| | | processModify(count); |
| | | |
| | | // let some time to the message to reach the replicationServer client |
| | |
| | | new ASN1OctetString("cn=monitor"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | LDAPFilter.decode("(waiting-changes=" + |
| | | (CHANGELOG_QUEUE_SIZE + WINDOW_SIZE) + ")")); |
| | | (REPLICATION_QUEUE_SIZE + WINDOW_SIZE) + ")")); |
| | | assertEquals(op.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | return (op.getEntriesSent() == 1); |
| | |
| | | synchroPluginStringDN = "cn=Multimaster Synchronization, " |
| | | + synchroStringDN; |
| | | |
| | | // find a free port for the replicationServer |
| | | ServerSocket socket = TestCaseUtils.bindFreePort(); |
| | | replServerPort = socket.getLocalPort(); |
| | | socket.close(); |
| | | |
| | | // Change log |
| | | String changeLogStringDN = "cn=Changelog Server, " + synchroPluginStringDN; |
| | | String changeLogLdif = "dn: " + changeLogStringDN + "\n" |
| | | String replServerLdif = |
| | | "dn: " + "cn=Replication Server, " + synchroPluginStringDN + "\n" |
| | | + "objectClass: top\n" |
| | | + "objectClass: ds-cfg-synchronization-changelog-server-config\n" |
| | | + "cn: Changelog Server\n" + "ds-cfg-changelog-port: 8989\n" |
| | | + "ds-cfg-changelog-server-id: 1\n" |
| | | + "objectClass: ds-cfg-replication-server-config\n" |
| | | + "cn: Replication Server\n" |
| | | + "ds-cfg-replication-server-port: " + replServerPort + "\n" |
| | | + "ds-cfg-replication-server-id: 1\n" |
| | | + "ds-cfg-window-size: " + WINDOW_SIZE + "\n" |
| | | + "ds-cfg-changelog-max-queue-size: " + CHANGELOG_QUEUE_SIZE; |
| | | changeLogEntry = TestCaseUtils.entryFromLdifString(changeLogLdif); |
| | | + "ds-cfg-replication-max-queue-size: " + REPLICATION_QUEUE_SIZE; |
| | | replServerEntry = TestCaseUtils.entryFromLdifString(replServerLdif); |
| | | |
| | | // suffix synchronized |
| | | String synchroServerStringDN = |
| | | "cn=example, cn=domains, " + synchroPluginStringDN; |
| | | String synchroServerLdif = "dn: " + synchroServerStringDN + "\n" |
| | | String synchroServerLdif = |
| | | "dn: " + "cn=example, cn=domains, " + synchroPluginStringDN + "\n" |
| | | + "objectClass: top\n" |
| | | + "objectClass: ds-cfg-synchronization-provider-config\n" |
| | | + "objectClass: ds-cfg-replication-domain-config\n" |
| | | + "cn: example\n" |
| | | + "ds-cfg-synchronization-dn: ou=People,dc=example,dc=com\n" |
| | | + "ds-cfg-changelog-server: localhost:8989\n" |
| | | + "ds-cfg-replication-dn: ou=People,dc=example,dc=com\n" |
| | | + "ds-cfg-replication-server: localhost:" + replServerPort + "\n" |
| | | + "ds-cfg-directory-server-id: 1\n" |
| | | + "ds-cfg-receive-status: true\n" |
| | | + "ds-cfg-window-size: " + WINDOW_SIZE; |
| | |
| | | |
| | | // find a free port for the replicationServer |
| | | ServerSocket socket = TestCaseUtils.bindFreePort(); |
| | | int changelogPort = socket.getLocalPort(); |
| | | int replServerPort = socket.getLocalPort(); |
| | | socket.close(); |
| | | |
| | | // Create an internal connection |
| | |
| | | + synchroStringDN; |
| | | |
| | | // Change log |
| | | String changeLogStringDN = "cn=Changelog Server, " + synchroPluginStringDN; |
| | | String changeLogLdif = "dn: " + changeLogStringDN + "\n" |
| | | String replServerLdif = |
| | | "dn: " + "cn=Replication Server, " + synchroPluginStringDN + "\n" |
| | | + "objectClass: top\n" |
| | | + "objectClass: ds-cfg-synchronization-changelog-server-config\n" |
| | | + "cn: Changelog Server\n" |
| | | + "ds-cfg-changelog-port:" + changelogPort + "\n" |
| | | + "ds-cfg-changelog-server-id: 1\n"; |
| | | changeLogEntry = TestCaseUtils.entryFromLdifString(changeLogLdif); |
| | | + "objectClass: ds-cfg-replication-server-config\n" |
| | | + "cn: Replication Server\n" |
| | | + "ds-cfg-replication-server-port:" + replServerPort + "\n" |
| | | + "ds-cfg-replication-server-id: 1\n"; |
| | | replServerEntry = TestCaseUtils.entryFromLdifString(replServerLdif); |
| | | |
| | | // suffix synchronized |
| | | String synchroServerLdif = |
| | | String domainLdif = |
| | | "dn: cn=example, cn=domains, " + synchroPluginStringDN + "\n" |
| | | + "objectClass: top\n" |
| | | + "objectClass: ds-cfg-synchronization-provider-config\n" |
| | | + "objectClass: ds-cfg-replication-domain-config\n" |
| | | + "cn: example\n" |
| | | + "ds-cfg-synchronization-dn: dc=example,dc=com\n" |
| | | + "ds-cfg-changelog-server: localhost:"+ changelogPort + "\n" |
| | | + "ds-cfg-replication-dn: dc=example,dc=com\n" |
| | | + "ds-cfg-replication-server: localhost:"+ replServerPort + "\n" |
| | | + "ds-cfg-directory-server-id: 123\n"; |
| | | synchroServerEntry = TestCaseUtils.entryFromLdifString(synchroServerLdif); |
| | | synchroServerEntry = TestCaseUtils.entryFromLdifString(domainLdif); |
| | | |
| | | configureReplication(); |
| | | |
| | |
| | | |
| | | protected Entry synchroServerEntry; |
| | | |
| | | protected Entry changeLogEntry; |
| | | protected Entry replServerEntry; |
| | | |
| | | /** |
| | | * schema check flag |
| | |
| | | * Open a replicationServer session to the local ReplicationServer. |
| | | * |
| | | */ |
| | | protected ReplicationBroker openChangelogSession( |
| | | protected ReplicationBroker openReplicationSession( |
| | | final DN baseDn, short serverId, int window_size, |
| | | int port, int timeout, boolean emptyOldChanges) |
| | | throws Exception, SocketException |
| | |
| | | * Open a new session to the ReplicationServer |
| | | * starting with a given ServerState. |
| | | */ |
| | | protected ReplicationBroker openChangelogSession( |
| | | protected ReplicationBroker openReplicationSession( |
| | | final DN baseDn, short serverId, int window_size, |
| | | int port, int timeout, ServerState state) |
| | | throws Exception, SocketException |
| | |
| | | * ReplicationServer. |
| | | * |
| | | */ |
| | | protected ReplicationBroker openChangelogSession( |
| | | protected ReplicationBroker openReplicationSession( |
| | | final DN baseDn, short serverId, int window_size, |
| | | int port, int timeout, int maxSendQueue, int maxRcvQueue, |
| | | boolean emptyOldChanges) |
| | |
| | | |
| | | |
| | | // Add the replication server |
| | | DirectoryServer.getConfigHandler().addEntry(changeLogEntry, null); |
| | | assertNotNull(DirectoryServer.getConfigEntry(changeLogEntry.getDN()), |
| | | "Unable to add the changeLog server"); |
| | | configEntryList.add(changeLogEntry.getDN()); |
| | | DirectoryServer.getConfigHandler().addEntry(replServerEntry, null); |
| | | assertNotNull(DirectoryServer.getConfigEntry(replServerEntry.getDN()), |
| | | "Unable to add the replication server"); |
| | | configEntryList.add(replServerEntry.getDN()); |
| | | |
| | | // We also have a replicated suffix (replication domain) |
| | | DirectoryServer.getConfigHandler().addEntry(synchroServerEntry, null); |
| | |
| | | |
| | | private ArrayList<Modification> rcvdMods = null; |
| | | |
| | | private int changelogPort; |
| | | private int replServerPort; |
| | | |
| | | /** |
| | | * Set up the environment for performing the tests in this Class. |
| | |
| | | |
| | | // find a free port for the replicationServer |
| | | ServerSocket socket = TestCaseUtils.bindFreePort(); |
| | | changelogPort = socket.getLocalPort(); |
| | | replServerPort = socket.getLocalPort(); |
| | | socket.close(); |
| | | |
| | | // Create an internal connection |
| | |
| | | + synchroStringDN; |
| | | |
| | | // Change log |
| | | String changeLogStringDN = "cn=Changelog Server, " + synchroPluginStringDN; |
| | | String changeLogLdif = "dn: " + changeLogStringDN + "\n" |
| | | String replServerLdif = |
| | | "dn: " + "cn=Replication Server, " + synchroPluginStringDN + "\n" |
| | | + "objectClass: top\n" |
| | | + "objectClass: ds-cfg-synchronization-changelog-server-config\n" |
| | | + "cn: Changelog Server\n" |
| | | + "ds-cfg-changelog-port: " + changelogPort + "\n" |
| | | + "ds-cfg-changelog-server-id: 1\n"; |
| | | changeLogEntry = TestCaseUtils.entryFromLdifString(changeLogLdif); |
| | | + "objectClass: ds-cfg-replication-server-config\n" |
| | | + "cn: Replication Server\n" |
| | | + "ds-cfg-replication-server-port: " + replServerPort + "\n" |
| | | + "ds-cfg-replication-server-id: 1\n"; |
| | | replServerEntry = TestCaseUtils.entryFromLdifString(replServerLdif); |
| | | |
| | | // suffix synchronized |
| | | String synchroServerLdif = |
| | | String domainLdif = |
| | | "dn: cn=example, cn=domains, " + synchroPluginStringDN + "\n" |
| | | + "objectClass: top\n" |
| | | + "objectClass: ds-cfg-synchronization-provider-config\n" |
| | | + "objectClass: ds-cfg-replication-domain-config\n" |
| | | + "cn: example\n" |
| | | + "ds-cfg-synchronization-dn: cn=schema\n" |
| | | + "ds-cfg-changelog-server: localhost:" + changelogPort + "\n" |
| | | + "ds-cfg-replication-server: localhost:" + replServerPort + "\n" |
| | | + "ds-cfg-directory-server-id: 1\n"; |
| | | synchroServerEntry = TestCaseUtils.entryFromLdifString(synchroServerLdif); |
| | | synchroServerEntry = TestCaseUtils.entryFromLdifString(domainLdif); |
| | | |
| | | configureReplication(); |
| | | } |
| | |
| | | final DN baseDn = DN.decode("cn=schema"); |
| | | |
| | | ReplicationBroker broker = |
| | | openChangelogSession(baseDn, (short) 2, 100, changelogPort, 5000, true); |
| | | openReplicationSession(baseDn, (short) 2, 100, replServerPort, 5000, true); |
| | | |
| | | try |
| | | { |
| | |
| | | final DN baseDn = DN.decode("cn=schema"); |
| | | |
| | | ReplicationBroker broker = |
| | | openChangelogSession(baseDn, (short) 2, 100, changelogPort, 5000, true); |
| | | openReplicationSession(baseDn, (short) 2, 100, replServerPort, 5000, true); |
| | | |
| | | ChangeNumberGenerator gen = new ChangeNumberGenerator((short)2, 0); |
| | | |
| | |
| | | final DN baseDn = DN.decode("cn=schema"); |
| | | |
| | | ReplicationBroker broker = |
| | | openChangelogSession(baseDn, (short) 3, 100, changelogPort, 5000, true); |
| | | openReplicationSession(baseDn, (short) 3, 100, replServerPort, 5000, true); |
| | | |
| | | // create a schema change Notification |
| | | AttributeType attrType = |
| | |
| | | import static org.testng.Assert.assertTrue; |
| | | import static org.testng.Assert.fail; |
| | | |
| | | import java.net.ServerSocket; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.LinkedList; |
| | |
| | | private static final String REPLICATION_STRESS_TEST = |
| | | "Replication Stress Test"; |
| | | |
| | | /** |
| | | * The replication config manager entry |
| | | */ |
| | | private String synchroStringDN; |
| | | |
| | | /** |
| | | * The Server synchro entry |
| | | */ |
| | | private String synchroServerStringDN; |
| | | |
| | | /** |
| | | * The Change log entry |
| | | */ |
| | | private String changeLogStringDN; |
| | | |
| | | private BrokerReader reader = null; |
| | | |
| | | /** |
| | |
| | | */ |
| | | protected Entry personEntry; |
| | | |
| | | // WORKAROUND FOR BUG #639 - END - |
| | | private int replServerPort; |
| | | |
| | | |
| | | /** |
| | | * Stress test from LDAP server to client using the ReplicationBroker API. |
| | |
| | | final int TOTAL_MESSAGES = 1000; |
| | | |
| | | ReplicationBroker broker = |
| | | openChangelogSession(baseDn, (short) 18, 100, 8989, 5000, true); |
| | | openReplicationSession(baseDn, (short) 18, 100, replServerPort, 5000, true); |
| | | Monitor monitor = new Monitor("stress test monitor"); |
| | | DirectoryServer.registerMonitorProvider(monitor); |
| | | |
| | |
| | | } |
| | | |
| | | // top level synchro provider |
| | | synchroStringDN = "cn=Synchronization Providers,cn=config"; |
| | | String synchroStringDN = "cn=Synchronization Providers,cn=config"; |
| | | |
| | | // Multimaster Synchro plugin |
| | | synchroPluginStringDN = "cn=Multimaster Synchronization, " |
| | | + synchroStringDN; |
| | | |
| | | // find a free port for the replicationServer |
| | | ServerSocket socket = TestCaseUtils.bindFreePort(); |
| | | replServerPort = socket.getLocalPort(); |
| | | socket.close(); |
| | | |
| | | // Change log |
| | | changeLogStringDN = "cn=Changelog Server, " + synchroPluginStringDN; |
| | | String changeLogLdif = "dn: " + changeLogStringDN + "\n" |
| | | String replServerLdif = |
| | | "dn: cn=Replication Server, " + synchroPluginStringDN + "\n" |
| | | + "objectClass: top\n" |
| | | + "objectClass: ds-cfg-synchronization-changelog-server-config\n" |
| | | + "cn: Changelog Server\n" + "ds-cfg-changelog-port: 8989\n" |
| | | + "ds-cfg-changelog-server-id: 1\n"; |
| | | changeLogEntry = TestCaseUtils.entryFromLdifString(changeLogLdif); |
| | | + "objectClass: ds-cfg-replication-server-config\n" |
| | | + "cn: Replication Server\n" |
| | | + "ds-cfg-replication-server-port: " + replServerPort + "\n" |
| | | + "ds-cfg-replication-server-id: 1\n"; |
| | | replServerEntry = TestCaseUtils.entryFromLdifString(replServerLdif); |
| | | |
| | | // suffix synchronized |
| | | synchroServerStringDN = "cn=example, cn=domains, " + synchroPluginStringDN; |
| | | String synchroServerLdif = "dn: " + synchroServerStringDN + "\n" |
| | | String synchroServerLdif = |
| | | "dn: " + "cn=example, cn=domains, " + synchroPluginStringDN + "\n" |
| | | + "objectClass: top\n" |
| | | + "objectClass: ds-cfg-synchronization-provider-config\n" |
| | | + "objectClass: ds-cfg-replication-domain-config\n" |
| | | + "cn: example\n" |
| | | + "ds-cfg-synchronization-dn: ou=People,dc=example,dc=com\n" |
| | | + "ds-cfg-changelog-server: localhost:8989\n" |
| | | + "ds-cfg-replication-dn: ou=People,dc=example,dc=com\n" |
| | | + "ds-cfg-replication-server: localhost:" + replServerPort + "\n" |
| | | + "ds-cfg-directory-server-id: 1\n" + "ds-cfg-receive-status: true\n"; |
| | | synchroServerEntry = TestCaseUtils.entryFromLdifString(synchroServerLdif); |
| | | |
| | |
| | | import static org.opends.server.loggers.Error.logError; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.net.ServerSocket; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | |
| | | * A "person" entry |
| | | */ |
| | | protected Entry personEntry; |
| | | private int replServerPort; |
| | | |
| | | /** |
| | | * Set up the environment for performing the tests in this Class. |
| | |
| | | synchroPluginStringDN = "cn=Multimaster Synchronization, " |
| | | + synchroStringDN; |
| | | |
| | | // Change log |
| | | String changeLogStringDN = "cn=Changelog Server, " + synchroPluginStringDN; |
| | | String changeLogLdif = "dn: " + changeLogStringDN + "\n" |
| | | // find a free port for the replicationServer |
| | | ServerSocket socket = TestCaseUtils.bindFreePort(); |
| | | replServerPort = socket.getLocalPort(); |
| | | socket.close(); |
| | | |
| | | // replication server |
| | | String replServerLdif = |
| | | "dn: cn=Replication Server, " + synchroPluginStringDN + "\n" |
| | | + "objectClass: top\n" |
| | | + "objectClass: ds-cfg-synchronization-changelog-server-config\n" |
| | | + "cn: Changelog Server\n" + "ds-cfg-changelog-port: 8989\n" |
| | | + "ds-cfg-changelog-server-id: 1\n"; |
| | | changeLogEntry = TestCaseUtils.entryFromLdifString(changeLogLdif); |
| | | + "objectClass: ds-cfg-replication-server-config\n" |
| | | + "cn: Replication Server\n" |
| | | + "ds-cfg-replication-server-port: " + replServerPort + "\n" |
| | | + "ds-cfg-replication-server-id: 1\n"; |
| | | replServerEntry = TestCaseUtils.entryFromLdifString(replServerLdif); |
| | | |
| | | // suffix synchronized |
| | | String synchroServerStringDN = |
| | | "cn=example, cn=domains, " + synchroPluginStringDN; |
| | | String synchroServerLdif = "dn: " + synchroServerStringDN + "\n" |
| | | String synchroServerLdif = |
| | | "dn: cn=example, cn=domains, " + synchroPluginStringDN + "\n" |
| | | + "objectClass: top\n" |
| | | + "objectClass: ds-cfg-synchronization-provider-config\n" |
| | | + "objectClass: ds-cfg-replication-domain-config\n" |
| | | + "cn: example\n" |
| | | + "ds-cfg-synchronization-dn: ou=People,dc=example,dc=com\n" |
| | | + "ds-cfg-changelog-server: localhost:8989\n" |
| | | + "ds-cfg-replication-server: localhost:" + replServerPort + "\n" |
| | | + "ds-cfg-directory-server-id: 1\n" + "ds-cfg-receive-status: true\n"; |
| | | synchroServerEntry = TestCaseUtils.entryFromLdifString(synchroServerLdif); |
| | | |
| | |
| | | * This must use a different serverId to that of the directory server. |
| | | */ |
| | | ReplicationBroker broker = |
| | | openChangelogSession(baseDn, (short) 2, 100, 8989, 1000, true); |
| | | openReplicationSession(baseDn, (short)2, 100, replServerPort, 1000, true); |
| | | |
| | | |
| | | /* |
| | |
| | | * This must use a different serverId to that of the directory server. |
| | | */ |
| | | ReplicationBroker broker = |
| | | openChangelogSession(baseDn, (short) 2, 100, 8989, 1000, true); |
| | | openReplicationSession(baseDn, (short)2, 100, replServerPort, 1000, true); |
| | | |
| | | |
| | | /* |
| | |
| | | * This must use a serverId different from the LDAP server ID |
| | | */ |
| | | ReplicationBroker broker = |
| | | openChangelogSession(baseDn, (short) 2, 100, 8989, 1000, true); |
| | | openReplicationSession(baseDn, (short)2, 100, replServerPort, 1000, true); |
| | | |
| | | /* |
| | | * Create a Change number generator to generate new changenumbers |
| | |
| | | cleanRealEntries(); |
| | | |
| | | ReplicationBroker broker = |
| | | openChangelogSession(baseDn, (short) 27, 100, 8989, 1000, true); |
| | | openReplicationSession(baseDn, (short) 27, 100, 8989, 1000, true); |
| | | try { |
| | | ChangeNumberGenerator gen = new ChangeNumberGenerator((short) 27, 0); |
| | | |
| | |
| | | |
| | | Thread.sleep(2000); |
| | | ReplicationBroker broker = |
| | | openChangelogSession(baseDn, (short) 11, 100, 8989, 1000, true); |
| | | openReplicationSession(baseDn, (short) 11, 100, 8989, 1000, true); |
| | | try |
| | | { |
| | | ChangeNumberGenerator gen = new ChangeNumberGenerator((short) 11, 0); |
| | |
| | | import org.testng.annotations.BeforeClass; |
| | | import static org.testng.Assert.assertEquals; |
| | | |
| | | import java.net.ServerSocket; |
| | | import java.util.List; |
| | | import java.util.ArrayList; |
| | | |
| | |
| | | public class HistoricalTest |
| | | extends ReplicationTestCase |
| | | { |
| | | private int replServerPort; |
| | | |
| | | /** |
| | | * Set up replication on the test backend. |
| | | * @throws Exception If an error occurs. |
| | |
| | | |
| | | // Create an internal connection. |
| | | connection = InternalClientConnection.getRootConnection(); |
| | | |
| | | // find a free port for the replicationServer |
| | | ServerSocket socket = TestCaseUtils.bindFreePort(); |
| | | replServerPort = socket.getLocalPort(); |
| | | socket.close(); |
| | | |
| | | // The replication server. |
| | | String changeLogStringDN = "cn=Changelog Server, " + synchroPluginStringDN; |
| | | String changeLogLdif = "dn: " + changeLogStringDN + "\n" |
| | | String replServerStringDN = "cn=Replication Server, " + synchroPluginStringDN; |
| | | String replServerLdif = "dn: " + replServerStringDN + "\n" |
| | | + "objectClass: top\n" |
| | | + "objectClass: ds-cfg-synchronization-changelog-server-config\n" |
| | | + "cn: Changelog Server\n" + "ds-cfg-changelog-port: 8989\n" |
| | | + "ds-cfg-changelog-server-id: 1\n"; |
| | | changeLogEntry = TestCaseUtils.entryFromLdifString(changeLogLdif); |
| | | + "objectClass: ds-cfg-replication-server-config\n" |
| | | + "cn: replication Server\n" |
| | | + "ds-cfg-replication-server-port: " + replServerPort + "\n" |
| | | + "ds-cfg-replication-server-id: 1\n"; |
| | | replServerEntry = TestCaseUtils.entryFromLdifString(replServerLdif); |
| | | |
| | | // The suffix to be synchronized. |
| | | String synchroServerStringDN = "o=test, cn=domains, " + synchroPluginStringDN; |
| | | String synchroServerLdif = "dn: " + synchroServerStringDN + "\n" |
| | | + "objectClass: top\n" |
| | | + "objectClass: ds-cfg-synchronization-provider-config\n" |
| | | + "objectClass: ds-cfg-replication-domain-config\n" |
| | | + "cn: example\n" |
| | | + "ds-cfg-synchronization-dn: o=test\n" |
| | | + "ds-cfg-changelog-server: localhost:8989\n" |
| | | + "ds-cfg-replication-dn: o=test\n" |
| | | + "ds-cfg-replication-server: localhost:" + replServerPort + "\n" |
| | | + "ds-cfg-directory-server-id: 1\n" |
| | | + "ds-cfg-receive-status: true\n"; |
| | | synchroServerEntry = TestCaseUtils.entryFromLdifString(synchroServerLdif); |
| | |
| | | * This must use a different serverId to that of the directory server. |
| | | */ |
| | | ReplicationBroker broker = |
| | | openChangelogSession(baseDn, (short) 2, 100, 8989, 1000, true); |
| | | openReplicationSession(baseDn, (short)2, 100, replServerPort, 1000, true); |
| | | |
| | | |
| | | // Clear the backend. |
| File was renamed from opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/dbHandlerTest.java |
| | |
| | | /** |
| | | * Test the dbHandler class |
| | | */ |
| | | public class dbHandlerTest extends ReplicationTestCase |
| | | public class DbHandlerTest extends ReplicationTestCase |
| | | { |
| | | @Test() |
| | | void testDbHandlerTrim() throws Exception |
| | |
| | | import org.opends.server.admin.ManagedObjectDefinition; |
| | | import org.opends.server.admin.PropertyProvider; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.client.ChangelogServerCfgClient; |
| | | import org.opends.server.admin.std.server.ChangelogServerCfg; |
| | | import org.opends.server.admin.std.client.ReplicationServerCfgClient; |
| | | import org.opends.server.admin.std.server.ReplicationServerCfg; |
| | | import org.opends.server.types.DN; |
| | | |
| | | /** |
| | | * This Class implements an object that can be used to instantiate |
| | | * The ReplicationServer class for tests purpose. |
| | | */ |
| | | public class ReplServerFakeConfiguration implements ChangelogServerCfg |
| | | public class ReplServerFakeConfiguration implements ReplicationServerCfg |
| | | { |
| | | int port; |
| | | String dirName; |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | public void addChangeListener( |
| | | ConfigurationChangeListener<ChangelogServerCfg> listener) |
| | | ConfigurationChangeListener<ReplicationServerCfg> listener) |
| | | { |
| | | |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ManagedObjectDefinition<? extends ChangelogServerCfgClient, |
| | | ? extends ChangelogServerCfg> definition() |
| | | public ManagedObjectDefinition<? extends ReplicationServerCfgClient, |
| | | ? extends ReplicationServerCfg> definition() |
| | | { |
| | | return null; |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public String getChangelogDbDirectory() |
| | | public String getReplicationDbDirectory() |
| | | { |
| | | return dirName; |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int getChangelogPort() |
| | | public int getReplicationPort() |
| | | { |
| | | return port; |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public long getChangelogPurgeDelay() |
| | | public long getReplicationPurgeDelay() |
| | | { |
| | | return purgeDelay; |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public SortedSet<String> getChangelogServer() |
| | | public SortedSet<String> getReplicationServer() |
| | | { |
| | | return servers; |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int getChangelogServerId() |
| | | public int getReplicationServerId() |
| | | { |
| | | return serverId; |
| | | } |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | public void removeChangeListener( |
| | | ConfigurationChangeListener<ChangelogServerCfg> listener) |
| | | ConfigurationChangeListener<ReplicationServerCfg> listener) |
| | | { |
| | | |
| | | } |
| | |
| | | /* |
| | | * Open a sender session and a receiver session to the replicationServer |
| | | */ |
| | | server1 = openChangelogSession( |
| | | server1 = openReplicationSession( |
| | | DN.decode("dc=example,dc=com"), (short) 1, 100, changelogPort, |
| | | 1000, true); |
| | | server2 = openChangelogSession( |
| | | server2 = openReplicationSession( |
| | | DN.decode("dc=example,dc=com"), (short) 2, 100, changelogPort, |
| | | 1000, true); |
| | | |
| | |
| | | |
| | | try { |
| | | broker = |
| | | openChangelogSession(DN.decode("dc=example,dc=com"), (short) 3, |
| | | openReplicationSession(DN.decode("dc=example,dc=com"), (short) 3, |
| | | 100, changelogPort, 1000, false); |
| | | |
| | | ReplicationMessage msg2 = broker.receive(); |
| | |
| | | */ |
| | | try { |
| | | broker = |
| | | openChangelogSession(DN.decode("dc=example,dc=com"), (short) 3, |
| | | openReplicationSession(DN.decode("dc=example,dc=com"), (short) 3, |
| | | 100, changelogPort, 1000, state); |
| | | |
| | | ReplicationMessage msg2 = broker.receive(); |
| | |
| | | /* |
| | | * Open a sender session |
| | | */ |
| | | server = openChangelogSession( |
| | | server = openReplicationSession( |
| | | DN.decode("dc=example,dc=com"), (short) 5, 100, changelogPort, |
| | | 1000, 1000, 0, true); |
| | | |
| | |
| | | */ |
| | | for (int i =0; i< CLIENT_THREADS; i++) |
| | | { |
| | | clientBroker[i] = openChangelogSession( |
| | | clientBroker[i] = openReplicationSession( |
| | | DN.decode("dc=example,dc=com"), (short) (100+i), 100, changelogPort, |
| | | 1000, true); |
| | | client[i] = new BrokerReader(clientBroker[i]); |
| | |
| | | ChangeNumberGenerator gen = |
| | | new ChangeNumberGenerator(serverId , (long) 0); |
| | | ReplicationBroker broker = |
| | | openChangelogSession( DN.decode("dc=example,dc=com"), serverId, |
| | | openReplicationSession( DN.decode("dc=example,dc=com"), serverId, |
| | | 100, changelogPort, 1000, 1000, 0, true); |
| | | |
| | | producer[i] = new BrokerWriter(broker, gen, TOTAL_MSG/THREADS); |
| | |
| | | // and client2 to changelog2 |
| | | // For itest=1, only create and connect client1 to changelog1 |
| | | // client2 will be created later |
| | | broker1 = openChangelogSession(DN.decode("dc=example,dc=com"), |
| | | broker1 = openReplicationSession(DN.decode("dc=example,dc=com"), |
| | | brokerIds[0], 100, changelogPorts[0], 1000, !emptyOldChanges); |
| | | |
| | | if (itest == 0) |
| | | { |
| | | broker2 = openChangelogSession(DN.decode("dc=example,dc=com"), |
| | | broker2 = openReplicationSession(DN.decode("dc=example,dc=com"), |
| | | brokerIds[1], 100, changelogPorts[0], 1000, !emptyOldChanges); |
| | | } |
| | | |
| | |
| | | changelogs[1] = new ReplicationServer(conf); |
| | | |
| | | // Connect broker 2 to changelog2 |
| | | broker2 = openChangelogSession(DN.decode("dc=example,dc=com"), |
| | | broker2 = openReplicationSession(DN.decode("dc=example,dc=com"), |
| | | brokerIds[1], 100, changelogPorts[1], 2000, !emptyOldChanges); |
| | | } |
| | | |