mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
06.51.2013 a99b6018b992a68aeba8be36ca7891f31543847e
refs
author Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Wednesday, November 6, 2013 16:51 +0100
committer Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Wednesday, November 6, 2013 16:51 +0100
commita99b6018b992a68aeba8be36ca7891f31543847e
tree 7218ee99cebf2829c7ebd1ed0b979ecdc6091a45 tree | zip | gz
parent 7184a1d5dde1f792a32e649f5db0991db0c2864a view | diff
OPENDJ-1053 Improve logging of replication load balancing and fail-over in order to diagnose the causes of these events



Functional tests found a ConcurrentModificationException with r9753 (see at the end of the commit message):
The code was removing elements from a Collection while it was iterating on the exact same Collection.



ReplicationBroker.java:
In inner class LocalEvaluation:
- Renamed "filteredRSs" to "accepted".
- Added getAcceptedRSInfos() to allow iterating on them without triggering ConcurrentModificationException.
In rejectAll*(), called getAcceptedRSInfos().
In getCSN(), renamed parameters.

Fixed ConcurrentModificationException.

ComputeBestServerTest.java:
Added a test2ServersUpToDateAnd1EvenMoreUpToDate() to exhibit the ConcurrentModificationException.
Extracted method newServerState() and used it in all tests.
In all test methods but one, do not update the ServerState with unused CSNs because they make the tests harder to read. Did not change test3Servers() because I believe it is good to keep one test testing the unneded CSNs do not impact the test results.




java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
at java.util.HashMap$ValueIterator.next(HashMap.java:822)
at org.opends.server.replication.service.ReplicationBroker.rejectAllWithRSOnDifferentVMThanDS(ReplicationBroker.java:1908)
at org.opends.server.replication.service.ReplicationBroker.filterServersOnSameHost(ReplicationBroker.java:1878)
at org.opends.server.replication.service.ReplicationBroker.computeBestReplicationServer(ReplicationBroker.java:1600)
at org.opends.server.replication.service.ReplicationBroker.connectAsDataServer(ReplicationBroker.java:820)
at org.opends.server.replication.service.ReplicationBroker.connect(ReplicationBroker.java:691)
at org.opends.server.replication.service.ReplicationBroker.start(ReplicationBroker.java:221)
at org.opends.server.replication.service.ReplicationDomain.enableService(ReplicationDomain.java:3024)
at org.opends.server.replication.service.ReplicationDomain.changeConfig(ReplicationDomain.java:3054)
at org.opends.server.replication.plugin.LDAPReplicationDomain.applyConfigurationChange(LDAPReplicationDomain.java:4089)
at org.opends.server.replication.plugin.LDAPReplicationDomain.applyConfigurationChange(LDAPReplicationDomain.java:96)
at org.opends.server.admin.server.ServerManagedObjectChangeListenerAdaptor.applyConfigurationChange(ServerManagedObjectChangeListenerAdaptor.java:74)
at org.opends.server.admin.server.ConfigChangeListenerAdaptor.applyConfigurationChange(ConfigChangeListenerAdaptor.java:342)
at org.opends.server.extensions.ConfigFileHandler.replaceEntry(ConfigFileHandler.java:1610)
at org.opends.server.workflowelement.localbackend.LocalBackendModifyOperation.processModify(LocalBackendModifyOperation.java:599)
at org.opends.server.workflowelement.localbackend.LocalBackendModifyOperation.processLocalModify(LocalBackendModifyOperation.java:299)
at org.opends.server.workflowelement.localbackend.LocalBackendWorkflowElement.execute(LocalBackendWorkflowElement.java:690)
at org.opends.server.core.WorkflowImpl.execute(WorkflowImpl.java:197)
at org.opends.server.core.WorkflowTopologyNode.execute(WorkflowTopologyNode.java:100)
at org.opends.server.core.ModifyOperationBasis.run(ModifyOperationBasis.java:451)
at org.opends.server.core.SynchronousStrategy.enqueueRequest(SynchronousStrategy.java:49)
at org.opends.server.protocols.ldap.LDAPClientConnection.addOperationInProgress(LDAPClientConnection.java:1276)
at org.opends.server.protocols.ldap.LDAPClientConnection.processModifyRequest(LDAPClientConnection.java:2268)
at org.opends.server.protocols.ldap.LDAPClientConnection.processLDAPMessage(LDAPClientConnection.java:1745)
at org.opends.server.protocols.ldap.LDAPRequestHandler.run(LDAPRequestHandler.java:194)
2 files modified
299 ■■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java 29 ●●●●● diff | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ComputeBestServerTest.java 270 ●●●●● diff | view | raw | blame | history