use of org.apache.ignite.internal.processors.cache.mvcc.msg.MvccRecoveryFinishedMessage in project ignite by apache.
the class MvccStructuresOverheadTest method restartClients.
/**
* Starts cluster and restarts several clients over it.
*
* @throws Exception If failed.
*/
private void restartClients() throws Exception {
IgniteEx ignite = startGrid(0);
AtomicBoolean mvccMessageTranslated = new AtomicBoolean();
ignite.context().io().addMessageListener(GridTopic.TOPIC_CACHE_COORDINATOR, (nodeId, msg, plc) -> {
if (msg instanceof MvccRecoveryFinishedMessage)
mvccMessageTranslated.set(true);
});
Map recoveryBallotBoxes = U.field(ignite.context().coordinators(), "recoveryBallotBoxes");
for (int i = 0; i < CLIENT_RESTARTS; i++) {
IgniteEx client = startClientGrid(1);
IgniteCache cache = client.cache(DEFAULT_CACHE_NAME);
cache.put(i, i);
client.close();
if (isMvccCache) {
assertTrue(GridTestUtils.waitForCondition(mvccMessageTranslated::get, 10_000));
assertTrue("Size of recoveryBallotBoxes " + recoveryBallotBoxes.size(), recoveryBallotBoxes.isEmpty());
mvccMessageTranslated.compareAndSet(true, false);
} else {
assertFalse(mvccMessageTranslated.get());
assertTrue("Size of recoveryBallotBoxes " + recoveryBallotBoxes.size(), recoveryBallotBoxes.isEmpty());
}
}
}
Aggregations