use of org.apache.ignite.internal.TestRecordingCommunicationSpi in project ignite by apache.
the class IgniteDiagnosticMessagesTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
if (testSpi)
cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());
if (connectionsPerNode != null)
((TcpCommunicationSpi) cfg.getCommunicationSpi()).setConnectionsPerNode(connectionsPerNode);
cfg.setClientMode(client);
if (strLog != null) {
cfg.setGridLogger(strLog);
strLog = null;
}
return cfg;
}
use of org.apache.ignite.internal.TestRecordingCommunicationSpi in project ignite by apache.
the class CacheLateAffinityAssignmentTest method testDelayAssignmentClientLeave.
/**
* Wait for rebalance, client node leaves.
*
* @throws Exception If failed.
*/
public void testDelayAssignmentClientLeave() throws Exception {
Ignite ignite0 = startServer(0, 1);
startClient(1, 2);
checkAffinity(2, topVer(2, 0), true);
TestRecordingCommunicationSpi spi = (TestRecordingCommunicationSpi) ignite0.configuration().getCommunicationSpi();
blockSupplySend(spi, CACHE_NAME1);
startServer(2, 3);
checkAffinity(3, topVer(3, 0), false);
stopNode(1, 4);
checkAffinity(2, topVer(4, 0), false);
spi.stopBlock();
checkAffinity(2, topVer(4, 1), true);
}
use of org.apache.ignite.internal.TestRecordingCommunicationSpi in project ignite by apache.
the class CacheLateAffinityAssignmentTest method nodeLeftExchangeCoordinatorLeave.
/**
* @param nodes Number of nodes.
* @throws Exception If failed.
*/
private void nodeLeftExchangeCoordinatorLeave(int nodes) throws Exception {
System.setProperty(IGNITE_EXCHANGE_COMPATIBILITY_VER_1, "true");
try {
assert nodes > 2 : nodes;
long topVer = 0;
for (int i = 0; i < nodes; i++) startServer(i, ++topVer);
Ignite ignite1 = grid(1);
checkAffinity(nodes, topVer(nodes, 1), true);
TestRecordingCommunicationSpi spi1 = (TestRecordingCommunicationSpi) ignite1.configuration().getCommunicationSpi();
// Prevent exchange finish while node0 is coordinator.
spi1.blockMessages(GridDhtPartitionsSingleMessage.class, ignite(0).name());
// New exchange started.
stopNode(2, ++topVer);
// Stop coordinator while exchange in progress.
stopGrid(0);
Map<String, List<List<ClusterNode>>> aff = checkAffinity(nodes - 2, topVer(topVer, 0), false);
topVer++;
boolean primaryChanged = calculateAffinity(nodes + 2, false, aff);
checkAffinity(nodes - 2, topVer(topVer, 0), !primaryChanged);
if (primaryChanged)
checkAffinity(nodes - 2, topVer(topVer, 1), true);
awaitPartitionMapExchange();
} finally {
System.clearProperty(IGNITE_EXCHANGE_COMPATIBILITY_VER_1);
}
}
use of org.apache.ignite.internal.TestRecordingCommunicationSpi in project ignite by apache.
the class CacheLateAffinityAssignmentTest method testDelayAssignmentCoordinatorLeave2.
/**
* Wait for rebalance, coordinator leaves, 3 nodes.
*
* @throws Exception If failed.
*/
public void testDelayAssignmentCoordinatorLeave2() throws Exception {
Ignite ignite0 = startServer(0, 1);
Ignite ignite1 = startServer(1, 2);
checkAffinity(2, topVer(2, 1), true);
TestRecordingCommunicationSpi spi0 = (TestRecordingCommunicationSpi) ignite0.configuration().getCommunicationSpi();
TestRecordingCommunicationSpi spi1 = (TestRecordingCommunicationSpi) ignite1.configuration().getCommunicationSpi();
blockSupplySend(spi0, CACHE_NAME1);
blockSupplySend(spi1, CACHE_NAME1);
startServer(2, 3);
stopNode(0, 4);
checkAffinity(2, topVer(4, 0), false);
spi1.stopBlock();
checkAffinity(2, topVer(4, 1), true);
}
use of org.apache.ignite.internal.TestRecordingCommunicationSpi in project ignite by apache.
the class CacheLateAffinityAssignmentTest method delayAssignmentMultipleJoin.
/**
* @param joinCnt Number of joining nodes.
* @throws Exception If failed.
*/
private void delayAssignmentMultipleJoin(int joinCnt) throws Exception {
Ignite ignite0 = startServer(0, 1);
TestRecordingCommunicationSpi spi = (TestRecordingCommunicationSpi) ignite0.configuration().getCommunicationSpi();
blockSupplySend(spi, CACHE_NAME1);
int majorVer = 1;
for (int i = 0; i < joinCnt; i++) {
majorVer++;
startServer(i + 1, majorVer);
checkAffinity(majorVer, topVer(majorVer, 0), false);
}
List<IgniteInternalFuture<?>> futs = affFutures(majorVer, topVer(majorVer, 1));
U.sleep(1000);
for (IgniteInternalFuture<?> fut : futs) assertFalse(fut.isDone());
spi.stopBlock();
checkAffinity(majorVer, topVer(majorVer, 1), true);
for (IgniteInternalFuture<?> fut : futs) assertTrue(fut.isDone());
awaitPartitionMapExchange();
}
Aggregations