Skip to content
Permalink
Browse files
IGNITE-16718 ItIgniteNodeRestartTest#testCfgGap is flaky (#810)
  • Loading branch information
sanpwc committed May 17, 2022
1 parent 7bcd7ca commit c508162db66e60e4c4dc7a4a19695b29f4deb799
Showing 2 changed files with 20 additions and 4 deletions.
@@ -898,12 +898,17 @@ public void testMetastorageStop(TestInfo testInfo) throws NodeStoppingException
* @param testInfo Test info.
*/
@Test
@Disabled("IGNITE-16718")
public void testCfgGap(TestInfo testInfo) {
final int nodes = 4;

String nodeFinderConfig = IntStream.range(0, nodes)
.mapToObj(i -> "\"localhost:" + (DEFAULT_NODE_PORT + i) + "\"")
.collect(joining(",", "[", "]"));

for (int i = 0; i < nodes; i++) {
startNode(testInfo, i);
String cfg = IgniteStringFormatter.format(NODE_BOOTSTRAP_CFG, DEFAULT_NODE_PORT + i, nodeFinderConfig);

startNode(testInfo, i, null, null, cfg);
}

createTableWithData(CLUSTER_NODES.get(0), "t1", nodes);
@@ -920,7 +925,9 @@ public void testCfgGap(TestInfo testInfo) {

log.info("Starting the node.");

Ignite newNode = startNode(nodes - 1, igniteName, null, workDir);
String nodeCfg = IgniteStringFormatter.format(NODE_BOOTSTRAP_CFG, DEFAULT_NODE_PORT + nodes - 1, nodeFinderConfig);

startNode(nodes - 1, igniteName, nodeCfg, workDir);

checkTableWithData(CLUSTER_NODES.get(0), "t1");
checkTableWithData(CLUSTER_NODES.get(0), "t2");
@@ -31,6 +31,7 @@
import org.apache.ignite.internal.tx.TxState;
import org.apache.ignite.lang.IgniteLogger;
import org.apache.ignite.network.NetworkAddress;
import org.apache.ignite.raft.client.Peer;
import org.apache.ignite.raft.client.service.RaftGroupService;
import org.apache.ignite.tx.TransactionException;
import org.jetbrains.annotations.NotNull;
@@ -169,8 +170,16 @@ private CompletableFuture<Void> finish(boolean commit) {
address, commit, timestamp, local, entry.getValue());
}

Set<NetworkAddress> allEnlistedNodes = new HashSet<>();

for (RaftGroupService svc : enlisted) {
for (Peer peer : svc.peers()) {
allEnlistedNodes.add(peer.address());
}
}

// Handle coordinator's tx.
futs[i] = tmp.containsKey(address) ? CompletableFuture.completedFuture(null) :
futs[i] = allEnlistedNodes.contains(address) ? CompletableFuture.completedFuture(null) :
commit ? txManager.commitAsync(timestamp) : txManager.rollbackAsync(timestamp);

return CompletableFuture.allOf(futs);

0 comments on commit c508162

Please sign in to comment.