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)