You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2018/10/25 11:49:28 UTC
ignite git commit: IGNITE-9447: Yardstick: fixed logic which waits
for necessary number of server nodes to be available which otherwise led to
benchmark hangs. This closes #4879.
Repository: ignite
Updated Branches:
refs/heads/master 67d4941f3 -> 0a92c25e6
IGNITE-9447: Yardstick: fixed logic which waits for necessary number of server nodes to be available which otherwise led to benchmark hangs. This closes #4879.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0a92c25e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0a92c25e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0a92c25e
Branch: refs/heads/master
Commit: 0a92c25e66b363db26c6b5681188cdf6384bb66a
Parents: 67d4941
Author: Pavel Kuznetsov <pa...@gmail.com>
Authored: Thu Oct 25 14:49:23 2018 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Oct 25 14:49:23 2018 +0300
----------------------------------------------------------------------
.../yardstick/IgniteAbstractBenchmark.java | 40 +++++++++++++++++++-
1 file changed, 38 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0a92c25e/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteAbstractBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteAbstractBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteAbstractBenchmark.java
index 5aec308..e541bff 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteAbstractBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteAbstractBenchmark.java
@@ -17,12 +17,16 @@
package org.apache.ignite.yardstick;
+import java.util.Collection;
+import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadLocalRandom;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCluster;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteState;
import org.apache.ignite.Ignition;
+import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.events.Event;
import org.apache.ignite.lang.IgnitePredicate;
import org.yardstickframework.BenchmarkConfiguration;
@@ -138,17 +142,49 @@ public abstract class IgniteAbstractBenchmark extends BenchmarkDriverAdapter {
}, EVT_NODE_JOINED);
if (!nodesStarted()) {
- println(cfg, "Waiting for " + (args.nodes() - 1) + " nodes to start...");
+ println(cfg, "Waiting for the cluster to contain at least " + args.nodes() + " nodes...");
nodesStartedLatch.await();
}
+
+ println("Cluster is ready");
}
/**
+ * Determine if all required nodes are started. Since nodes can close their local ignite instances, this method
+ * seeks in the history topology containing: 1) driver's local node; 2) right number of nodes.
+ *
* @return {@code True} if all nodes are started, {@code false} otherwise.
*/
private boolean nodesStarted() {
- return ignite().cluster().nodes().size() >= args.nodes();
+ IgniteCluster cluster = ignite().cluster();
+
+ UUID locNodeId = cluster.localNode().id();
+
+ long curTop = cluster.topologyVersion();
+
+ for (long top = curTop; top >= 1; top--) {
+ Collection<ClusterNode> nodes = cluster.topology(top);
+
+ if (topologyContainsId(nodes, locNodeId) && nodes.size() >= args.nodes())
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @param top topology (collection of cluster nodes).
+ * @param nodeId id of the node to find.
+ * @return {@code True} if topology contains node with specified id, {@code false} otherwise.
+ */
+ private static boolean topologyContainsId(Collection<? extends ClusterNode> top, UUID nodeId) {
+ for (ClusterNode node : top) {
+ if (node.id().equals(nodeId))
+ return true;
+ }
+
+ return false;
}
/**