You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/09/09 08:39:41 UTC
ignite git commit: Fixed
GridCommonAbstractTest.awaitPartitionMapExchange.
Repository: ignite
Updated Branches:
refs/heads/ignite-1.4 e4e39af68 -> b295bc5bc
Fixed GridCommonAbstractTest.awaitPartitionMapExchange.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b295bc5b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b295bc5b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b295bc5b
Branch: refs/heads/ignite-1.4
Commit: b295bc5bc1a0e98bf4a9fb6c28d7db32ff75aa6f
Parents: e4e39af
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 9 09:39:27 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 9 09:39:27 2015 +0300
----------------------------------------------------------------------
.../junits/common/GridCommonAbstractTest.java | 59 +++++++++++++-------
1 file changed, 40 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b295bc5b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 13ec665..44ca051 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -284,6 +284,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
* @param replaceExistingValues Replace existing values.
* @throws Exception If failed.
*/
+ @SuppressWarnings("unchecked")
protected static <K> void loadAll(Cache<K, ?> cache, final Set<K> keys, final boolean replaceExistingValues) throws Exception {
IgniteCache<K, Object> cacheCp = (IgniteCache<K, Object>)cache;
@@ -425,33 +426,54 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
long start = 0;
for (int i = 0; ; i++) {
- // Must map on updated version of topology.
- Collection<ClusterNode> affNodes =
- g0.affinity(cfg.getName()).mapPartitionToPrimaryAndBackups(p);
+ boolean match = false;
+
+ AffinityTopologyVersion readyVer = dht.context().shared().exchange().readyAffinityVersion();
+
+ if (readyVer.topologyVersion() > 0 && dht.context().started()) {
+ // Must map on updated version of topology.
+ Collection<ClusterNode> affNodes =
+ g0.affinity(cfg.getName()).mapPartitionToPrimaryAndBackups(p);
- int exp = affNodes.size();
+ int exp = affNodes.size();
- GridDhtTopologyFuture topFut = top.topologyVersionFuture();
+ GridDhtTopologyFuture topFut = top.topologyVersionFuture();
- Collection<ClusterNode> owners = (topFut != null && topFut.isDone()) ?
- top.nodes(p, AffinityTopologyVersion.NONE) : Collections.<ClusterNode>emptyList();
+ Collection<ClusterNode> owners = (topFut != null && topFut.isDone()) ?
+ top.nodes(p, AffinityTopologyVersion.NONE) : Collections.<ClusterNode>emptyList();
- int actual = owners.size();
+ int actual = owners.size();
- if (affNodes.size() != owners.size() || !affNodes.containsAll(owners)) {
+ if (affNodes.size() != owners.size() || !affNodes.containsAll(owners)) {
+ LT.warn(log(), null, "Waiting for topology map update [" +
+ "grid=" + g.name() +
+ ", cache=" + cfg.getName() +
+ ", cacheId=" + dht.context().cacheId() +
+ ", topVer=" + top.topologyVersion() +
+ ", topFut=" + topFut +
+ ", p=" + p +
+ ", affNodesCnt=" + exp +
+ ", ownersCnt=" + actual +
+ ", affNodes=" + affNodes +
+ ", owners=" + owners +
+ ", locNode=" + g.cluster().localNode() + ']');
+ }
+ else
+ match = true;
+ }
+ else {
LT.warn(log(), null, "Waiting for topology map update [" +
"grid=" + g.name() +
", cache=" + cfg.getName() +
", cacheId=" + dht.context().cacheId() +
", topVer=" + top.topologyVersion() +
- ", topFut=" + topFut +
+ ", started=" + dht.context().started() +
", p=" + p +
- ", affNodesCnt=" + exp +
- ", ownersCnt=" + actual +
- ", affNodes=" + affNodes +
- ", owners=" + owners +
+ ", readVer=" + readyVer +
", locNode=" + g.cluster().localNode() + ']');
+ }
+ if (!match) {
if (i == 0)
start = System.currentTimeMillis();
@@ -461,12 +483,8 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
", cache=" + cfg.getName() +
", cacheId=" + dht.context().cacheId() +
", topVer=" + top.topologyVersion() +
- ", topFut=" + topFut +
", p=" + p +
- ", affNodesCnt=" + exp +
- ", ownersCnt=" + actual +
- ", affNodes=" + affNodes +
- ", owners=" + owners +
+ ", readVer=" + readyVer +
", locNode=" + g.cluster().localNode() + ']');
Thread.sleep(200); // Busy wait.
@@ -540,6 +558,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
* @param startFrom Start value for keys search.
* @return Collection of keys for which given cache is primary.
*/
+ @SuppressWarnings("unchecked")
protected List<Integer> primaryKeys(IgniteCache<?, ?> cache, int cnt, int startFrom) {
assert cnt > 0 : cnt;
@@ -591,6 +610,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
* @param startFrom Start value for keys search.
* @return Collection of keys for which given cache is backup.
*/
+ @SuppressWarnings("unchecked")
protected List<Integer> backupKeys(IgniteCache<?, ?> cache, int cnt, int startFrom) {
assert cnt > 0 : cnt;
@@ -621,6 +641,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
* @return Collection of keys for which given cache is neither primary nor backup.
* @throws IgniteCheckedException If failed.
*/
+ @SuppressWarnings("unchecked")
protected List<Integer> nearKeys(IgniteCache<?, ?> cache, int cnt, int startFrom)
throws IgniteCheckedException {
assert cnt > 0 : cnt;