Skip to content

Commit

Permalink
GG-21055 Fix IgniteClusterActivateDeactivateTest.testDeactivateSimple…
Browse files Browse the repository at this point in the history
…_5_Servers_5_Clients_FromClient flaky failed on TC
  • Loading branch information
dgovorukhin committed Jul 8, 2019
1 parent 592d4af commit 2578931
Showing 1 changed file with 30 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,18 @@ private void rolloverSegmentAtLeastTwice(int activateFrom) {
* @param nodes Number of nodes.
* @param caches Number of caches.
*/
final void checkCaches(int nodes, int caches) {
final void checkCaches(int nodes, int caches) throws InterruptedException {
checkCaches(nodes, caches, true);
}

/**
* @param nodes Number of nodes.
* @param caches Number of caches.
*/
final void checkCaches(int nodes, int caches, boolean awaitExchange) throws InterruptedException {
if (awaitExchange)
awaitPartitionMapExchange();

for (int i = 0; i < nodes; i++) {
for (int c = 0; c < caches; c++) {
IgniteCache<Integer, Integer> cache = ignite(i).cache(CACHE_NAME_PREFIX + c);
Expand Down Expand Up @@ -682,9 +693,6 @@ private void deactivateSimple(int srvs, int clients, int deactivateFrom) throws
startGrid(i);
}

if (persistenceEnabled())
ignite(deactivateFrom).cluster().active(true);

ignite(deactivateFrom).cluster().active(true); // Should be no-op.

checkCaches(srvs + clients, CACHES);
Expand Down Expand Up @@ -727,7 +735,7 @@ private void deactivateSimple(int srvs, int clients, int deactivateFrom) throws
checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
}

checkCaches1(srvs + clients + 2);
checkCaches(srvs + clients + 2);
}

/**
Expand Down Expand Up @@ -767,11 +775,11 @@ public void testClientReconnectClusterActive() throws Exception {

checkCache(client, CU.UTILITY_CACHE_NAME, true);

checkCaches1(SRVS + CLIENTS);
checkCaches(SRVS + CLIENTS);

IgniteClientReconnectAbstractTest.reconnectClientNode(log, client, srv, null);

checkCaches1(SRVS + CLIENTS);
checkCaches(SRVS + CLIENTS);

this.client = false;

Expand All @@ -781,7 +789,7 @@ public void testClientReconnectClusterActive() throws Exception {

startGrid(SRVS + CLIENTS + 1);

checkCaches1(SRVS + CLIENTS + 2);
checkCaches(SRVS + CLIENTS + 2);
}

/**
Expand Down Expand Up @@ -811,7 +819,7 @@ public void testClientReconnectClusterInactive() throws Exception {

checkCache(client, CU.UTILITY_CACHE_NAME, true);

checkCaches1(SRVS + CLIENTS);
checkCaches(SRVS + CLIENTS);

this.client = false;

Expand All @@ -821,7 +829,7 @@ public void testClientReconnectClusterInactive() throws Exception {

startGrid(SRVS + CLIENTS + 1);

checkCaches1(SRVS + CLIENTS);
checkCaches(SRVS + CLIENTS);
}

/**
Expand Down Expand Up @@ -861,7 +869,7 @@ private void clientReconnectClusterDeactivated(final boolean transition) throws

checkCache(client, CU.UTILITY_CACHE_NAME, true);

checkCaches1(SRVS + CLIENTS);
checkCaches(SRVS + CLIENTS);

// Wait for late affinity assignment to finish.
awaitPartitionMapExchange();
Expand Down Expand Up @@ -911,7 +919,7 @@ private void clientReconnectClusterDeactivated(final boolean transition) throws

assertTrue(client.cluster().active());

checkCaches1(SRVS + CLIENTS);
checkCaches(SRVS + CLIENTS);

checkCache(client, CACHE_NAME_PREFIX + 0, true);

Expand All @@ -923,7 +931,7 @@ private void clientReconnectClusterDeactivated(final boolean transition) throws

startGrid(SRVS + CLIENTS + 1);

checkCaches1(SRVS + CLIENTS + 2);
checkCaches(SRVS + CLIENTS + 2);
}

/**
Expand Down Expand Up @@ -1000,7 +1008,7 @@ private void clientReconnectClusterActivated(final boolean transition) throws Ex

checkCache(client, CU.UTILITY_CACHE_NAME, true);

checkCaches1(SRVS + CLIENTS);
checkCaches(SRVS + CLIENTS);

checkCache(client, CACHE_NAME_PREFIX + 0, true);

Expand All @@ -1012,7 +1020,7 @@ private void clientReconnectClusterActivated(final boolean transition) throws Ex

startGrid(SRVS + CLIENTS + 1);

checkCaches1(SRVS + CLIENTS + 2);
checkCaches(SRVS + CLIENTS + 2);
}

/**
Expand Down Expand Up @@ -1055,7 +1063,7 @@ public void testInactiveTopologyChanges() throws Exception {

ignite(0).cluster().active(true);

checkCaches1(SRVS + CLIENTS);
checkCaches(SRVS + CLIENTS);

checkRecordedMessages(true);

Expand All @@ -1069,7 +1077,7 @@ public void testInactiveTopologyChanges() throws Exception {

checkRecordedMessages(true);

checkCaches1(SRVS + CLIENTS + 2);
checkCaches(SRVS + CLIENTS + 2);
}

/**
Expand Down Expand Up @@ -1128,7 +1136,7 @@ private void stateChangeFailover1(boolean activate) throws Exception {
ignite(0).cluster().active(true);
}

checkCaches1(9);
checkCaches(9);
}

/**
Expand Down Expand Up @@ -1198,7 +1206,7 @@ private void stateChangeFailover2(boolean activate) throws Exception {
ignite(0).cluster().active(true);
}

checkCaches1(10);
checkCaches(10);
}

/**
Expand Down Expand Up @@ -1267,7 +1275,7 @@ protected void doFinalChecks() throws Exception {
for (int i = 0; i < 4; i++)
startGrid(i);

checkCaches1(6);
checkCaches(6);
}

/**
Expand Down Expand Up @@ -1335,8 +1343,8 @@ private void checkRecordedMessages(boolean exp) {
/**
* @param nodes Expected nodes number.
*/
private void checkCaches1(int nodes) {
checkCaches(nodes, 2);
private void checkCaches(int nodes) throws InterruptedException {
checkCaches(nodes, 2, false);
}

/**
Expand Down

0 comments on commit 2578931

Please sign in to comment.