You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dm...@apache.org on 2015/11/04 16:03:33 UTC
[01/13] ignite git commit: ignite-1758 Fixed client reconnect issues
Repository: ignite
Updated Branches:
refs/heads/master dca9e5726 -> ad60979f1
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java
index ea9531a..1c258a4 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java
@@ -29,7 +29,7 @@ import org.yardstickframework.BenchmarkConfiguration;
/**
* Ignite benchmark that performs put and query operations.
*/
-public class IgniteSqlQueryPutBenchmark extends IgniteCacheAbstractBenchmark {
+public class IgniteSqlQueryPutBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
/** {@inheritDoc} */
@Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
super.setUp(cfg);
@@ -81,4 +81,4 @@ public class IgniteSqlQueryPutBenchmark extends IgniteCacheAbstractBenchmark {
@Override protected IgniteCache<Integer, Object> cache() {
return ignite().cache("query");
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicInvokeRetryBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicInvokeRetryBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicInvokeRetryBenchmark.java
new file mode 100644
index 0000000..c0567ef
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicInvokeRetryBenchmark.java
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.failover;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.yardstickframework.BenchmarkConfiguration;
+
+import static org.yardstickframework.BenchmarkUtils.println;
+
+/**
+ * Invoke retry failover benchmark. <p> Each client maintains a local map that it updates together with cache. Client
+ * invokes an increment closure for all generated keys and atomically increments value for corresponding keys in the
+ * local map. To validate cache contents, all writes from the client are stopped, values in the local map are compared
+ * to the values in the cache.
+ */
+public class IgniteAtomicInvokeRetryBenchmark extends IgniteFailoverAbstractBenchmark<String, Set> {
+ /** */
+ private final ConcurrentMap<String, AtomicLong> nextValMap = new ConcurrentHashMap<>();
+
+ /** */
+ private final ReadWriteLock rwl = new ReentrantReadWriteLock(true);
+
+ /** */
+ private volatile Exception ex;
+
+ /** {@inheritDoc} */
+ @Override public void setUp(final BenchmarkConfiguration cfg) throws Exception {
+ super.setUp(cfg);
+
+ Thread thread = new Thread(new Runnable() {
+ @Override public void run() {
+ try {
+ final int timeout = args.cacheOperationTimeoutMillis();
+ final int range = args.range();
+
+ while (!Thread.currentThread().isInterrupted()) {
+ Thread.sleep(args.cacheConsistencyCheckingPeriod() * 1000);
+
+ rwl.writeLock().lock();
+
+ try {
+ println("Start cache validation.");
+
+ long startTime = U.currentTimeMillis();
+
+ Map<String, Set> badCacheEntries = new HashMap<>();
+
+ for (Map.Entry<String, AtomicLong> e : nextValMap.entrySet()) {
+ String key = e.getKey();
+
+ asyncCache.get(key);
+ Set set = asyncCache.<Set>future().get(timeout);
+
+ if (set == null || e.getValue() == null || !Objects.equals(e.getValue().get(), (long)set.size()))
+ badCacheEntries.put(key, set);
+ }
+
+ if (!badCacheEntries.isEmpty()) {
+ // Print all usefull information and finish.
+ for (Map.Entry<String, Set> e : badCacheEntries.entrySet()) {
+ String key = e.getKey();
+
+ println("Got unexpected set size [key='" + key + "', expSize=" + nextValMap.get(key)
+ + ", cacheVal=" + e.getValue() + "]");
+ }
+
+ println("Next values map contant:");
+ for (Map.Entry<String, AtomicLong> e : nextValMap.entrySet())
+ println("Map Entry [key=" + e.getKey() + ", val=" + e.getValue() + "]");
+
+ println("Cache content:");
+
+ for (int k2 = 0; k2 < range; k2++) {
+ String key2 = "key-" + k2;
+
+ asyncCache.get(key2);
+ Object val = asyncCache.future().get(timeout);
+
+ if (val != null)
+ println("Cache Entry [key=" + key2 + ", val=" + val + "]");
+
+ }
+
+ throw new IllegalStateException("Cache and local map are in inconsistent state " +
+ "[badKeys=" + badCacheEntries.keySet() + ']');
+ }
+
+ println("Clearing all data.");
+
+ asyncCache.removeAll();
+ asyncCache.future().get(timeout);
+
+ nextValMap.clear();
+
+ println("Cache validation successfully finished in "
+ + (U.currentTimeMillis() - startTime) / 1000 + " sec.");
+ }
+ finally {
+ rwl.writeLock().unlock();
+ }
+ }
+ }
+ catch (Throwable e) {
+ ex = new Exception(e);
+
+ println("Got exception: " + e);
+
+ e.printStackTrace();
+
+ if (e instanceof Error)
+ throw (Error)e;
+ }
+ }
+ }, "cache-" + cacheName() + "-validator");
+
+ thread.setDaemon(true);
+
+ thread.start();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ final int k = nextRandom(args.range());
+
+ String key = "key-" + k;
+
+ rwl.readLock().lock();
+
+ try {
+ if (ex != null)
+ throw ex;
+
+ AtomicLong nextAtomicVal = nextValMap.putIfAbsent(key, new AtomicLong(1));
+
+ Long nextVal = 1L;
+
+ if (nextAtomicVal != null)
+ nextVal = nextAtomicVal.incrementAndGet();
+
+ asyncCache.invoke(key, new AddInSetEntryProcessor(), nextVal);
+ asyncCache.future().get(args.cacheOperationTimeoutMillis());
+ }
+ finally {
+ rwl.readLock().unlock();
+ }
+
+ if (ex != null)
+ throw ex;
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected String cacheName() {
+ return "atomic-invoke-retry";
+ }
+
+ /**
+ */
+ private static class AddInSetEntryProcessor implements CacheEntryProcessor<String, Set, Object> {
+ /** */
+ private static final long serialVersionUID = 0;
+
+ /** {@inheritDoc} */
+ @Override public Object process(MutableEntry<String, Set> entry,
+ Object... arguments) throws EntryProcessorException {
+ assert !F.isEmpty(arguments);
+
+ Object val = arguments[0];
+
+ Set set;
+
+ if (!entry.exists())
+ set = new HashSet<>();
+ else
+ set = entry.getValue();
+
+ set.add(val);
+
+ entry.setValue(set);
+
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicOffHeapInvokeRetryBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicOffHeapInvokeRetryBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicOffHeapInvokeRetryBenchmark.java
new file mode 100644
index 0000000..c8b0b1d
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicOffHeapInvokeRetryBenchmark.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.failover;
+
+/**
+ * Invoke retry failover benchmark. <p> Each client maintains a local map that it updates together with cache. Client
+ * invokes an increment closure for all generated keys and atomically increments value for corresponding keys in the
+ * local map. To validate cache contents, all writes from the client are stopped, values in the local map are compared
+ * to the values in the cache.
+ */
+public class IgniteAtomicOffHeapInvokeRetryBenchmark extends IgniteAtomicInvokeRetryBenchmark {
+ /** {@inheritDoc} */
+ @Override protected String cacheName() {
+ return "atomic-offheap-invoke-retry";
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicOffHeapRetriesBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicOffHeapRetriesBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicOffHeapRetriesBenchmark.java
new file mode 100644
index 0000000..ebb9eac
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicOffHeapRetriesBenchmark.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.failover;
+
+/**
+ * Atomic retries failover benchmark.
+ * <p>
+ * Client generates continuous load to the cluster (random get, put, invoke, remove
+ * operations).
+ */
+public class IgniteAtomicOffHeapRetriesBenchmark extends IgniteAtomicRetriesBenchmark {
+ /** {@inheritDoc} */
+ @Override protected String cacheName() {
+ return "atomic-offheap-reties";
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicRetriesBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicRetriesBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicRetriesBenchmark.java
new file mode 100644
index 0000000..4e60698
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteAtomicRetriesBenchmark.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.failover;
+
+import java.util.Map;
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.cache.CacheEntryProcessor;
+
+/**
+ * Atomic retries failover benchmark.
+ * <p>
+ * Client generates continuous load to the cluster (random get, put, invoke, remove
+ * operations).
+ */
+public class IgniteAtomicRetriesBenchmark extends IgniteFailoverAbstractBenchmark<Integer, String> {
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ final int key = nextRandom(args.range());
+
+ int opNum = nextRandom(4);
+
+ final int timeout = args.cacheOperationTimeoutMillis();
+
+ switch (opNum) {
+ case 0:
+ asyncCache.get(key);
+ asyncCache.future().get(timeout);
+
+ break;
+
+ case 1:
+ asyncCache.put(key, String.valueOf(key));
+ asyncCache.future().get(timeout);
+
+ break;
+
+ case 2:
+ asyncCache.invoke(key, new TestCacheEntryProcessor());
+ asyncCache.future().get(timeout);
+
+ break;
+
+ case 3:
+ asyncCache.remove(key);
+ asyncCache.future().get(timeout);
+
+ break;
+
+ default:
+ throw new IllegalStateException("Got invalid operation number: " + opNum);
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected String cacheName() {
+ return "atomic-reties";
+ }
+
+ /**
+ */
+ private static class TestCacheEntryProcessor implements CacheEntryProcessor<Integer, String, String> {
+ /** Serial version uid. */
+ private static final long serialVersionUID = 0;
+
+ /** {@inheritDoc} */
+ @Override public String process(MutableEntry<Integer, String> entry,
+ Object... arguments) throws EntryProcessorException {
+ return "key";
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java
new file mode 100644
index 0000000..83fc58f
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverAbstractBenchmark.java
@@ -0,0 +1,320 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.failover;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicBoolean;
+import javax.cache.Cache;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCompute;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterGroup;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
+import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.mxbean.IgniteMXBean;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.yardstick.cache.IgniteCacheAbstractBenchmark;
+import org.yardstickframework.BenchmarkConfiguration;
+import org.yardstickframework.BenchmarkUtils;
+import org.yardstickframework.BenchmarkUtils.ProcessExecutionResult;
+
+import static org.yardstickframework.BenchmarkUtils.println;
+
+/**
+ * Ignite benchmark that performs long running failover tasks.
+ */
+public abstract class IgniteFailoverAbstractBenchmark<K, V> extends IgniteCacheAbstractBenchmark<K, V> {
+ /** */
+ private static final AtomicBoolean restarterStarted = new AtomicBoolean();
+
+ /** Async Cache. */
+ protected IgniteCache<K, V> asyncCache;
+
+ /** */
+ private final AtomicBoolean firtsExProcessed = new AtomicBoolean();
+
+ /** {@inheritDoc} */
+ @Override public void setUp(final BenchmarkConfiguration cfg) throws Exception {
+ super.setUp(cfg);
+
+ asyncCache = cache.withAsync();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onWarmupFinished() {
+ if (cfg.memberId() == 0 && restarterStarted.compareAndSet(false, true)) {
+ Thread restarterThread = new Thread(new Runnable() {
+ @Override public void run() {
+ try {
+ println("Servers restarter started on driver: "
+ + IgniteFailoverAbstractBenchmark.this.getClass().getSimpleName());
+
+ Ignite ignite = ignite();
+
+ // Read servers configs from cache to local map.
+ IgniteCache<Integer, BenchmarkConfiguration> srvsCfgsCache = ignite.
+ getOrCreateCache(new CacheConfiguration<Integer, BenchmarkConfiguration>().
+ setName("serversConfigs"));
+
+ final Map<Integer, BenchmarkConfiguration> srvsCfgs = new HashMap<>();
+
+ for (Cache.Entry<Integer, BenchmarkConfiguration> e : srvsCfgsCache) {
+ println("Read entry from 'serversConfigs' cache : " + e);
+
+ srvsCfgs.put(e.getKey(), e.getValue());
+ }
+
+ assert ignite.cluster().forServers().nodes().size() == srvsCfgs.size();
+
+ final int backupsCnt = args.backups();
+
+ assert backupsCnt >= 1 : "Backups: " + backupsCnt;
+
+ final boolean isDebug = ignite.log().isDebugEnabled();
+
+ // Main logic.
+ while (!Thread.currentThread().isInterrupted()) {
+ Thread.sleep(args.restartDelay() * 1000);
+
+ int numNodesToRestart = nextRandom(1, backupsCnt + 1);
+
+ List<Integer> ids = new ArrayList<>();
+
+ ids.addAll(srvsCfgs.keySet());
+
+ Collections.shuffle(ids);
+
+ println("Waiting for partitioned map exchage of all nodes");
+
+ IgniteCompute asyncCompute = ignite.compute().withAsync();
+
+ asyncCompute.broadcast(new AwaitPartitionMapExchangeTask());
+
+ asyncCompute.future().get(args.cacheOperationTimeoutMillis());
+
+ println("Start servers restarting [numNodesToRestart=" + numNodesToRestart
+ + ", shuffledIds=" + ids + "]");
+
+ for (int i = 0; i < numNodesToRestart; i++) {
+ Integer id = ids.get(i);
+
+ BenchmarkConfiguration bc = srvsCfgs.get(id);
+
+ ProcessExecutionResult res = BenchmarkUtils.kill9Server(bc, isDebug);
+
+ println("Server with id " + id + " has been killed."
+ + (isDebug ? " Process execution result:\n" + res : ""));
+ }
+
+ Thread.sleep(args.restartSleep() * 1000);
+
+ for (int i = 0; i < numNodesToRestart; i++) {
+ Integer id = ids.get(i);
+
+ BenchmarkConfiguration bc = srvsCfgs.get(id);
+
+ ProcessExecutionResult res = BenchmarkUtils.startServer(bc, isDebug);
+
+ println("Server with id " + id + " has been started."
+ + (isDebug ? " Process execution result:\n" + res : ""));
+ }
+ }
+ }
+ catch (Throwable e) {
+ println("Got exception: " + e);
+ e.printStackTrace();
+
+ U.dumpThreads(null);
+
+ if (e instanceof Error)
+ throw (Error)e;
+ }
+ }
+ }, "servers-restarter");
+
+ restarterThread.setDaemon(true);
+ restarterThread.start();
+ }
+ }
+
+ /**
+ * Awaits for partitiona map exchage.
+ *
+ * @param ignite Ignite.
+ * @throws Exception If failed.
+ */
+ @SuppressWarnings("BusyWait")
+ protected static void awaitPartitionMapExchange(Ignite ignite) throws Exception {
+ IgniteLogger log = ignite.log();
+
+ log.info("Waiting for finishing of a partition exchange on node: " + ignite);
+
+ IgniteKernal kernal = (IgniteKernal)ignite;
+
+ while (true) {
+ boolean partitionsExchangeFinished = true;
+
+ for (IgniteInternalCache<?, ?> cache : kernal.cachesx(null)) {
+ log.info("Checking cache: " + cache.name());
+
+ GridCacheAdapter<?, ?> c = kernal.internalCache(cache.name());
+
+ if (!(c instanceof GridDhtCacheAdapter))
+ break;
+
+ GridDhtCacheAdapter<?, ?> dht = (GridDhtCacheAdapter<?, ?>)c;
+
+ GridDhtPartitionFullMap partMap = dht.topology().partitionMap(true);
+
+ for (Map.Entry<UUID, GridDhtPartitionMap> e : partMap.entrySet()) {
+ log.info("Checking node: " + e.getKey());
+
+ for (Map.Entry<Integer, GridDhtPartitionState> e1 : e.getValue().entrySet()) {
+ if (e1.getValue() != GridDhtPartitionState.OWNING) {
+ log.info("Undesired state [id=" + e1.getKey() + ", state=" + e1.getValue() + ']');
+
+ partitionsExchangeFinished = false;
+
+ break;
+ }
+ }
+
+ if (!partitionsExchangeFinished)
+ break;
+ }
+
+ if (!partitionsExchangeFinished)
+ break;
+ }
+
+ if (partitionsExchangeFinished)
+ return;
+
+ Thread.sleep(100);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onException(Throwable e) {
+ // Proceess only the first exception to prevent a multiple printing of a full thread dump.
+ if (firtsExProcessed.compareAndSet(false, true)) {
+ // Debug info on current client.
+ println("Full thread dump of the current node below.");
+
+ U.dumpThreads(null);
+
+ println("");
+
+ ((IgniteMXBean)ignite()).dumpDebugInfo();
+
+ // Debug info on servers.
+ Ignite ignite = ignite();
+
+ ClusterGroup srvs = ignite.cluster().forServers();
+
+ IgniteCompute asyncCompute = ignite.compute(srvs).withAsync();
+
+ asyncCompute.broadcast(new ThreadDumpPrinterTask(ignite.cluster().localNode().id(), e));
+ asyncCompute.future().get(10_000);
+ }
+ }
+
+ /**
+ * @return Cache name.
+ */
+ protected abstract String cacheName();
+
+ /** {@inheritDoc} */
+ @Override protected IgniteCache<K, V> cache() {
+ return ignite().cache(cacheName());
+ }
+
+ /**
+ */
+ private static class ThreadDumpPrinterTask implements IgniteRunnable {
+ /** */
+ private static final long serialVersionUID = 0;
+
+ /** */
+ @IgniteInstanceResource
+ private Ignite ignite;
+
+ /** */
+ private final UUID id;
+
+ /** */
+ private final Throwable e;
+
+ /**
+ * @param id Benchmark node id.
+ * @param e Exception.
+ */
+ ThreadDumpPrinterTask(UUID id, Throwable e) {
+ this.id = id;
+ this.e = e;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void run() {
+ println("Driver finished with exception [driverNodeId=" + id + ", e=" + e + "]");
+ println("Full thread dump of the current server node below.");
+
+ U.dumpThreads(null);
+
+ println("");
+
+ ((IgniteMXBean)ignite).dumpDebugInfo();
+ }
+ }
+
+ /**
+ */
+ private static class AwaitPartitionMapExchangeTask implements IgniteRunnable {
+ /** */
+ private static final long serialVersionUID = 0;
+
+ /** */
+ @IgniteInstanceResource
+ private Ignite ignite;
+
+ /** {@inheritDoc} */
+ @Override public void run() {
+ try {
+ awaitPartitionMapExchange(ignite);
+ }
+ catch (Exception e) {
+ throw new IgniteException(e);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverNode.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverNode.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverNode.java
new file mode 100644
index 0000000..29405de
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteFailoverNode.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.failover;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
+import java.util.List;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.yardstick.IgniteNode;
+import org.yardstickframework.BenchmarkConfiguration;
+
+import static org.yardstickframework.BenchmarkUtils.println;
+
+/**
+ * Ignite failover node.
+ */
+public class IgniteFailoverNode extends IgniteNode {
+ /** {@inheritDoc} */
+ @Override public void start(BenchmarkConfiguration cfg) throws Exception {
+ super.start(cfg);
+
+ // Put server configuration at special cache.
+ RuntimeMXBean mxBean = ManagementFactory.getRuntimeMXBean();
+
+ List<String> jvmOpts = mxBean.getInputArguments();
+
+ StringBuilder jvmOptsStr = new StringBuilder();
+
+ for (String opt : jvmOpts)
+ jvmOptsStr.append(opt).append(' ');
+
+ cfg.customProperties().put("JVM_OPTS", jvmOptsStr.toString());
+ cfg.customProperties().put("PROPS_ENV", System.getenv("PROPS_ENV"));
+ cfg.customProperties().put("CLASSPATH", mxBean.getClassPath());
+ cfg.customProperties().put("JAVA", System.getenv("JAVA"));
+
+ IgniteCache<Integer, BenchmarkConfiguration> srvsCfgsCache = ignite().
+ getOrCreateCache(new CacheConfiguration<Integer, BenchmarkConfiguration>().setName("serversConfigs"));
+
+ srvsCfgsCache.put(cfg.memberId(), cfg);
+
+ println("Put at cache [" + cfg.memberId() + "=" + cfg + "]");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalInvokeRetryBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalInvokeRetryBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalInvokeRetryBenchmark.java
new file mode 100644
index 0000000..f8a1689
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalInvokeRetryBenchmark.java
@@ -0,0 +1,212 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.failover;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.yardstickframework.BenchmarkConfiguration;
+
+import static org.yardstickframework.BenchmarkUtils.println;
+
+/**
+ * Invoke retry failover benchmark. <p> Each client maintains a local map that it updates together with cache. Client
+ * invokes an increment closure for all generated keys and atomically increments value for corresponding keys in the
+ * local map. To validate cache contents, all writes from the client are stopped, values in the local map are compared
+ * to the values in the cache.
+ */
+public class IgniteTransactionalInvokeRetryBenchmark extends IgniteFailoverAbstractBenchmark<String, Long> {
+ /** */
+ private final ConcurrentMap<String, AtomicLong> map = new ConcurrentHashMap<>();
+
+ /** */
+ private final ReadWriteLock rwl = new ReentrantReadWriteLock(true);
+
+ /** */
+ private volatile Exception ex;
+
+ /** {@inheritDoc} */
+ @Override public void setUp(final BenchmarkConfiguration cfg) throws Exception {
+ super.setUp(cfg);
+
+ Thread thread = new Thread(new Runnable() {
+ @Override public void run() {
+ try {
+ final int timeout = args.cacheOperationTimeoutMillis();
+ final int keysCnt = args.keysCount();
+
+ while (!Thread.currentThread().isInterrupted()) {
+ Thread.sleep(args.cacheConsistencyCheckingPeriod() * 1000);
+
+ rwl.writeLock().lock();
+
+ try {
+ println("Start cache validation.");
+
+ long startTime = U.currentTimeMillis();
+
+ Map<String, Long> notEqualsCacheVals = new HashMap<>();
+ Map<String, Long> notEqualsLocMapVals = new HashMap<>();
+
+ for (int k = 0; k < args.range(); k++) {
+ if (k % 10_000 == 0)
+ println("Start validation for keys like 'key-" + k + "-*'");
+
+ for (int i = 0; i < keysCnt; i++) {
+ String key = "key-" + k + "-" + cfg.memberId() + "-" + i;
+
+ asyncCache.get(key);
+ Long cacheVal = asyncCache.<Long>future().get(timeout);
+
+ AtomicLong aVal = map.get(key);
+ Long mapVal = aVal != null ? aVal.get() : null;
+
+ if (!Objects.equals(cacheVal, mapVal)) {
+ notEqualsCacheVals.put(key, cacheVal);
+ notEqualsLocMapVals.put(key, mapVal);
+ }
+ }
+ }
+
+ assert notEqualsCacheVals.size() == notEqualsLocMapVals.size() : "Invalid state " +
+ "[cacheMapVals=" + notEqualsCacheVals + ", mapVals=" + notEqualsLocMapVals + "]";
+
+ if (!notEqualsCacheVals.isEmpty()) {
+ // Print all usefull information and finish.
+ for (Map.Entry<String, Long> eLocMap : notEqualsLocMapVals.entrySet()) {
+ String key = eLocMap.getKey();
+ Long mapVal = eLocMap.getValue();
+ Long cacheVal = notEqualsCacheVals.get(key);
+
+ println(cfg, "Got different values [key='" + key
+ + "', cacheVal=" + cacheVal + ", localMapVal=" + mapVal + "]");
+ }
+
+ println(cfg, "Local driver map contant:\n " + map);
+
+ println(cfg, "Cache content:");
+
+ for (int k2 = 0; k2 < args.range(); k2++) {
+ for (int i2 = 0; i2 < keysCnt; i2++) {
+ String key2 = "key-" + k2 + "-" + cfg.memberId() + "-" + i2;
+
+ asyncCache.get(key2);
+ Long val = asyncCache.<Long>future().get(timeout);
+
+ if (val != null)
+ println(cfg, "Entry [key=" + key2 + ", val=" + val + "]");
+ }
+ }
+
+ throw new IllegalStateException("Cache and local map are in inconsistent state.");
+ }
+
+ println("Cache validation successfully finished in "
+ + (U.currentTimeMillis() - startTime) / 1000 + " sec.");
+ }
+ finally {
+ rwl.writeLock().unlock();
+ }
+ }
+ }
+ catch (Throwable e) {
+ ex = new Exception(e);
+
+ println("Got exception: " + e);
+
+ e.printStackTrace();
+
+ if (e instanceof Error)
+ throw (Error)e;
+ }
+ }
+ }, "cache-" + cacheName() + "-validator");
+
+ thread.setDaemon(true);
+
+ thread.start();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ final int k = nextRandom(args.range());
+
+ final String[] keys = new String[args.keysCount()];
+
+ assert keys.length > 0 : "Count of keys: " + keys.length;
+
+ for (int i = 0; i < keys.length; i++)
+ keys[i] = "key-" + k + "-" + cfg.memberId() + "-" + i;
+
+ for (String key : keys) {
+ rwl.readLock().lock();
+
+ try {
+ if (ex != null)
+ throw ex;
+
+ asyncCache.invoke(key, new IncrementCacheEntryProcessor());
+ asyncCache.future().get(args.cacheOperationTimeoutMillis());
+
+ AtomicLong prevVal = map.putIfAbsent(key, new AtomicLong(0));
+
+ if (prevVal != null)
+ prevVal.incrementAndGet();
+ }
+ finally {
+ rwl.readLock().unlock();
+ }
+ }
+
+ if (ex != null)
+ throw ex;
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected String cacheName() {
+ return "tx-invoke-retry";
+ }
+
+ /**
+ */
+ private static class IncrementCacheEntryProcessor implements CacheEntryProcessor<String, Long, Long> {
+ /** */
+ private static final long serialVersionUID = 0;
+
+ /** {@inheritDoc} */
+ @Override public Long process(MutableEntry<String, Long> entry,
+ Object... arguments) throws EntryProcessorException {
+ long newVal = entry.getValue() == null ? 0 : entry.getValue() + 1;
+
+ entry.setValue(newVal);
+
+ return newVal;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalOffHeapInvokeRetryBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalOffHeapInvokeRetryBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalOffHeapInvokeRetryBenchmark.java
new file mode 100644
index 0000000..4cbcf67
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalOffHeapInvokeRetryBenchmark.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.failover;
+
+/**
+ * Invoke retry failover benchmark.
+ * <p>
+ * Each client maintains a local map that it updates together with cache.
+ * Client invokes an increment closure for all generated keys and atomically increments value for corresponding
+ * keys in the local map. To validate cache contents, all writes from the client are stopped, values in
+ * the local map are compared to the values in the cache.
+ */
+public class IgniteTransactionalOffHeapInvokeRetryBenchmark extends IgniteTransactionalInvokeRetryBenchmark {
+ /** {@inheritDoc} */
+ @Override protected String cacheName() {
+ return "tx-offheap-invoke-retry";
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalOffHeapWriteInvokeBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalOffHeapWriteInvokeBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalOffHeapWriteInvokeBenchmark.java
new file mode 100644
index 0000000..7fa2d1a
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalOffHeapWriteInvokeBenchmark.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.failover;
+
+/**
+ * Transactional write invoke failover benchmark.
+ * <p>
+ * Each client generates a random integer K in a limited range and creates keys in the form 'key-' + K + 'master',
+ * 'key-' + K + '-1', 'key-' + K + '-2', ... Then client starts a pessimistic repeatable read transaction
+ * and randomly chooses between read and write scenarios:
+ * <ul>
+ * <li>Reads value associated with the master key and child keys. Values must be equal.</li>
+ * <li>Reads value associated with the master key, increments it by 1 and puts the value, then invokes increment
+ * closure on child keys. No validation is performed.</li>
+ * </ul>
+ */
+public class IgniteTransactionalOffHeapWriteInvokeBenchmark extends IgniteTransactionalWriteInvokeBenchmark {
+ /** {@inheritDoc} */
+ @Override protected String cacheName() {
+ return "tx-offheap-write-invoke";
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalOffHeapWriteReadBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalOffHeapWriteReadBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalOffHeapWriteReadBenchmark.java
new file mode 100644
index 0000000..bdecca7
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalOffHeapWriteReadBenchmark.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.failover;
+
+/**
+ * Transactional write read failover benchmark.
+ * <p>
+ * Each client generates a random integer K in a limited range and creates keys in the form 'key-' + K + '-1',
+ * 'key-' + K + '-2', ... Then client starts a pessimistic repeatable read transaction, reads value associated with
+ * each key. Values must be equal. Client increments value by 1, commits the transaction.
+ */
+public class IgniteTransactionalOffHeapWriteReadBenchmark extends IgniteTransactionalWriteReadBenchmark {
+ /** {@inheritDoc} */
+ @Override protected String cacheName() {
+ return "tx-offheap-write-read";
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java
new file mode 100644
index 0000000..1a8ee14
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteInvokeBenchmark.java
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.failover;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import javax.cache.CacheException;
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.cluster.ClusterTopologyException;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionRollbackException;
+
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
+import static org.yardstickframework.BenchmarkUtils.println;
+
+/**
+ * Transactional write invoke failover benchmark.
+ * <p>
+ * Each client generates a random integer K in a limited range and creates keys in the form 'key-' + K + 'master',
+ * 'key-' + K + '-1', 'key-' + K + '-2', ... Then client starts a pessimistic repeatable read transaction
+ * and randomly chooses between read and write scenarios:
+ * <ul>
+ * <li>Reads value associated with the master key and child keys. Values must be equal.</li>
+ * <li>Reads value associated with the master key, increments it by 1 and puts the value, then invokes increment
+ * closure on child keys. No validation is performed.</li>
+ * </ul>
+ */
+public class IgniteTransactionalWriteInvokeBenchmark extends IgniteFailoverAbstractBenchmark<String, Long> {
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ final int k = nextRandom(args.range());
+
+ assert args.keysCount() > 0 : "Count of keys: " + args.keysCount();
+
+ final String[] keys = new String[args.keysCount()];
+
+ final String masterKey = "key-" + k + "-master";
+
+ for (int i = 0; i < keys.length; i++)
+ keys[i] = "key-" + k + "-" + i;
+
+ final int scenario = nextRandom(2);
+
+ return doInTransaction(ignite(), new Callable<Boolean>() {
+ @Override public Boolean call() throws Exception {
+ final int timeout = args.cacheOperationTimeoutMillis();
+
+ switch (scenario) {
+ case 0: // Read scenario.
+ Map<String, Long> map = new HashMap<>();
+
+ asyncCache.get(masterKey);
+ Long cacheVal = asyncCache.<Long>future().get(timeout);
+
+ map.put(masterKey, cacheVal);
+
+ for (String key : keys) {
+ asyncCache.get(key);
+ cacheVal = asyncCache.<Long>future().get(timeout);
+
+ map.put(key, cacheVal);
+ }
+
+ Set<Long> values = new HashSet<>(map.values());
+
+ if (values.size() != 1) {
+ // Print all usefull information and finish.
+ println(cfg, "Got different values for keys [map=" + map + "]");
+
+ println(cfg, "Cache content:");
+
+ for (int k = 0; k < args.range(); k++) {
+ for (int i = 0; i < args.keysCount(); i++) {
+ String key = "key-" + k + "-" + i;
+
+ asyncCache.get(key);
+ Long val = asyncCache.<Long>future().get(timeout);
+
+ if (val != null)
+ println(cfg, "Entry [key=" + key + ", val=" + val + "]");
+ }
+ }
+
+ throw new IllegalStateException("Found different values for keys (see above information).");
+ }
+
+ break;
+ case 1: // Invoke scenario.
+ asyncCache.get(masterKey);
+ Long val = asyncCache.<Long>future().get(timeout);
+
+ asyncCache.put(masterKey, val == null ? 0 : val + 1);
+ asyncCache.future().get(timeout);
+
+ for (String key : keys) {
+ asyncCache.invoke(key, new IncrementCacheEntryProcessor());
+ asyncCache.future().get(timeout);
+ }
+
+ break;
+ }
+
+ return true;
+ }
+ });
+ }
+
+ /**
+ * @param ignite Ignite instance.
+ * @param clo Closure.
+ * @return Result of closure execution.
+ * @throws Exception
+ */
+ public static <T> T doInTransaction(Ignite ignite, Callable<T> clo) throws Exception {
+ while (true) {
+ try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
+ T res = clo.call();
+
+ tx.commit();
+
+ return res;
+ }
+ catch (CacheException e) {
+ if (e.getCause() instanceof ClusterTopologyException) {
+ ClusterTopologyException topEx = (ClusterTopologyException)e.getCause();
+
+ topEx.retryReadyFuture().get();
+ }
+ else
+ throw e;
+ }
+ catch (ClusterTopologyException e) {
+ e.retryReadyFuture().get();
+ }
+ catch (TransactionRollbackException ignore) {
+ // Safe to retry right away.
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected String cacheName() {
+ return "tx-write-invoke";
+ }
+
+ /**
+ */
+ private static class IncrementCacheEntryProcessor implements CacheEntryProcessor<String, Long, Void> {
+ /** */
+ private static final long serialVersionUID = 0;
+
+ /** {@inheritDoc} */
+ @Override public Void process(MutableEntry<String, Long> entry,
+ Object... arguments) throws EntryProcessorException {
+ entry.setValue(entry.getValue() == null ? 0 : entry.getValue() + 1);
+
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteReadBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteReadBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteReadBenchmark.java
new file mode 100644
index 0000000..c962749
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/failover/IgniteTransactionalWriteReadBenchmark.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.failover;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import javax.cache.CacheException;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.cluster.ClusterTopologyException;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionRollbackException;
+
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
+import static org.yardstickframework.BenchmarkUtils.println;
+
+/**
+ * Transactional write read failover benchmark.
+ * <p>
+ * Each client generates a random integer K in a limited range and creates keys in the form 'key-' + K + '-1',
+ * 'key-' + K + '-2', ... Then client starts a pessimistic repeatable read transaction, reads value associated with
+ * each key. Values must be equal. Client increments value by 1, commits the transaction.
+ */
+public class IgniteTransactionalWriteReadBenchmark extends IgniteFailoverAbstractBenchmark<String, Long> {
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ final int k = nextRandom(args.range());
+
+ assert args.keysCount() > 0 : "Count of keys: " + args.keysCount();
+
+ final String[] keys = new String[args.keysCount()];
+
+ for (int i = 0; i < keys.length; i++)
+ keys[i] = "key-" + k + "-" + i;
+
+ return doInTransaction(ignite(), new Callable<Boolean>() {
+ @Override public Boolean call() throws Exception {
+ Map<String, Long> map = new HashMap<>();
+
+ final int timeout = args.cacheOperationTimeoutMillis();
+
+ for (String key : keys) {
+ asyncCache.get(key);
+ Long val = asyncCache.<Long>future().get(timeout);
+
+ map.put(key, val);
+ }
+
+ Set<Long> values = new HashSet<>(map.values());
+
+ if (values.size() != 1) {
+ // Print all usefull information and finish.
+ println(cfg, "Got different values for keys [map=" + map + "]");
+
+ println(cfg, "Cache content:");
+
+ for (int k = 0; k < args.range(); k++) {
+ for (int i = 0; i < args.keysCount(); i++) {
+ String key = "key-" + k + "-" + i;
+
+ asyncCache.get(key);
+ Long val = asyncCache.<Long>future().get(timeout);
+
+ if (val != null)
+ println(cfg, "Entry [key=" + key + ", val=" + val + "]");
+ }
+ }
+
+ throw new IllegalStateException("Found different values for keys (see above information).");
+ }
+
+ final Long oldVal = map.get(keys[0]);
+
+ final Long newVal = oldVal == null ? 0 : oldVal + 1;
+
+ for (String key : keys) {
+ asyncCache.put(key, newVal);
+ asyncCache.future().get(timeout);
+ }
+
+ return true;
+ }
+ });
+ }
+
+ /**
+ * @param ignite Ignite instance.
+ * @param clo Closure.
+ * @return Result of closure execution.
+ * @throws Exception
+ */
+ public static <T> T doInTransaction(Ignite ignite, Callable<T> clo) throws Exception {
+ while (true) {
+ try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
+ T res = clo.call();
+
+ tx.commit();
+
+ return res;
+ }
+ catch (CacheException e) {
+ if (e.getCause() instanceof ClusterTopologyException) {
+ ClusterTopologyException topEx = (ClusterTopologyException)e.getCause();
+
+ topEx.retryReadyFuture().get();
+ }
+ else
+ throw e;
+ }
+ catch (ClusterTopologyException e) {
+ e.retryReadyFuture().get();
+ }
+ catch (TransactionRollbackException ignore) {
+ // Safe to retry right away.
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected String cacheName() {
+ return "tx-write-read";
+ }
+}
[05/13] ignite git commit: ignite-1395: REST HTTP module prints out
unnecessary message
Posted by dm...@apache.org.
ignite-1395: REST HTTP module prints out unnecessary message
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/73c2db5c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/73c2db5c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/73c2db5c
Branch: refs/heads/master
Commit: 73c2db5cb55dce46ed98564cbf9a8842f09bb413
Parents: fec2450
Author: Roman Shtykh <ap...@gmail.com>
Authored: Wed Nov 4 12:35:31 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Nov 4 12:35:31 2015 +0300
----------------------------------------------------------------------
modules/rest-http/pom.xml | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/73c2db5c/modules/rest-http/pom.xml
----------------------------------------------------------------------
diff --git a/modules/rest-http/pom.xml b/modules/rest-http/pom.xml
index 58eb1ed..730e28a 100644
--- a/modules/rest-http/pom.xml
+++ b/modules/rest-http/pom.xml
@@ -113,5 +113,11 @@
<artifactId>commons-beanutils</artifactId>
<version>1.8.3</version>
</dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.7.7</version>
+ </dependency>
</dependencies>
</project>
[04/13] ignite git commit: IGNITE-1545: Java8 MessagingExample should
be optimized
Posted by dm...@apache.org.
IGNITE-1545: Java8 MessagingExample should be optimized
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fec2450f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fec2450f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fec2450f
Branch: refs/heads/master
Commit: fec2450fd1f024696ae60ba3c67e6c7de4dbeca6
Parents: 51c0d80
Author: Roman Shtykh <ap...@gmail.com>
Authored: Wed Nov 4 12:25:55 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Nov 4 12:28:49 2015 +0300
----------------------------------------------------------------------
.../ignite/examples/java8/messaging/MessagingExample.java | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fec2450f/examples/src/main/java8/org/apache/ignite/examples/java8/messaging/MessagingExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/messaging/MessagingExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/messaging/MessagingExample.java
index 97ec58e..de060a7 100644
--- a/examples/src/main/java8/org/apache/ignite/examples/java8/messaging/MessagingExample.java
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/messaging/MessagingExample.java
@@ -54,13 +54,8 @@ public final class MessagingExample {
*/
public static void main(String[] args) throws Exception {
try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
- if (!ExamplesUtils.checkMinTopologySize(ignite.cluster(), 2)) {
- System.out.println();
- System.out.println(">>> Please start at least 2 cluster nodes to run example.");
- System.out.println();
-
+ if (!ExamplesUtils.checkMinTopologySize(ignite.cluster(), 2))
return;
- }
System.out.println();
System.out.println(">>> Messaging example started.");
[07/13] ignite git commit: ignite-1843 Avoid discovery thread
blocking in GridJobProcessor.
Posted by dm...@apache.org.
ignite-1843 Avoid discovery thread blocking in GridJobProcessor.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0354db12
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0354db12
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0354db12
Branch: refs/heads/master
Commit: 0354db124cbfa356d7b27556cbc53978a322f471
Parents: 2501c3a
Author: sboikov <sb...@gridgain.com>
Authored: Wed Nov 4 12:52:20 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Nov 4 12:52:20 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/IgniteKernal.java | 1 +
.../affinity/GridAffinityAssignmentCache.java | 13 +++
.../cache/GridCacheAffinityManager.java | 10 ++
.../GridCachePartitionExchangeManager.java | 24 +++++
.../processors/cache/GridCachePreloader.java | 5 +
.../cache/GridCachePreloaderAdapter.java | 5 +
.../dht/preloader/GridDhtForceKeysFuture.java | 14 +++
.../dht/preloader/GridDhtPreloader.java | 37 ++++++++
.../processors/job/GridJobProcessor.java | 96 +++++++++-----------
.../GridTaskFailoverAffinityRunTest.java | 3 +
...niteCacheClientNodeChangingTopologyTest.java | 4 +-
11 files changed, 158 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0354db12/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 5a0fe16..f75f118 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -3168,6 +3168,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
U.warn(log, "Dumping debug info for node [id=" + locNode.id() +
", name=" + ctx.gridName() +
", order=" + locNode.order() +
+ ", topVer=" + ctx.discovery().topologyVersion() +
", client=" + client +
(client && routerId != null ? ", routerId=" + routerId : "") + ']');
http://git-wip-us.apache.org/repos/asf/ignite/blob/0354db12/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
index 18776a4..8bc40cd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
@@ -41,6 +41,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMa
import org.apache.ignite.internal.processors.cache.GridCacheInternal;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
import org.jsr166.ConcurrentLinkedHashMap;
@@ -409,6 +410,18 @@ public class GridAffinityAssignmentCache {
}
/**
+ * Dumps debug information.
+ */
+ public void dumpDebugInfo() {
+ if (!readyFuts.isEmpty()) {
+ U.warn(log, "Pending affinity ready futures [cache=" + cacheName + "]:");
+
+ for (AffinityReadyFuture fut : readyFuts.values())
+ U.warn(log, ">>> " + fut);
+ }
+ }
+
+ /**
* Get cached affinity for specified topology version.
*
* @param topVer Topology version.
http://git-wip-us.apache.org/repos/asf/ignite/blob/0354db12/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
index 5c43205..eddffea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
@@ -384,4 +384,14 @@ public class GridCacheAffinityManager extends GridCacheManagerAdapter {
public AffinityTopologyVersion affinityTopologyVersion() {
return aff.lastVersion();
}
+
+ /**
+ * Dumps debug information.
+ */
+ public void dumpDebugInfo() {
+ GridAffinityAssignmentCache aff0 = aff;
+
+ if (aff0 != null)
+ aff0.dumpDebugInfo();
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0354db12/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index adc2174..c8ee6e3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -992,6 +992,13 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
for (GridDhtPartitionsExchangeFuture fut : exchWorker.futQ)
U.warn(log, ">>> " + fut);
+ if (!readyFuts.isEmpty()) {
+ U.warn(log, "Pending affinity ready futures:");
+
+ for (AffinityReadyFuture fut : readyFuts.values())
+ U.warn(log, ">>> " + fut);
+ }
+
ExchangeFutureSet exchFuts = this.exchFuts;
if (exchFuts != null) {
@@ -1041,6 +1048,23 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
for (GridCacheFuture<?> fut : mvcc.atomicFutures())
U.warn(log, ">>> " + fut);
}
+
+ for (GridCacheContext ctx : cctx.cacheContexts()) {
+ if (ctx.isLocal())
+ continue;
+
+ GridCacheContext ctx0 = ctx.isNear() ? ctx.near().dht().context() : ctx;
+
+ GridCachePreloader preloader = ctx0.preloader();
+
+ if (preloader != null)
+ preloader.dumpDebugInfo();
+
+ GridCacheAffinityManager affMgr = ctx0.affinity();
+
+ if (affMgr != null)
+ affMgr.dumpDebugInfo();
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/0354db12/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
index 755958e..1edaef2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
@@ -132,4 +132,9 @@ public interface GridCachePreloader {
* Unwinds undeploys.
*/
public void unwindUndeploys();
+
+ /**
+ * Dumps debug information.
+ */
+ public void dumpDebugInfo();
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/0354db12/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
index 5405449..4ec6749 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
@@ -146,4 +146,9 @@ public class GridCachePreloaderAdapter implements GridCachePreloader {
@Override public void addAssignments(GridDhtPreloaderAssignments assignments, boolean forcePreload) {
// No-op.
}
+
+ /** {@inheritDoc} */
+ @Override public void dumpDebugInfo() {
+ // No-op.
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/0354db12/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
index bb78748..db0e780 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
@@ -47,6 +47,7 @@ import org.apache.ignite.internal.util.F0;
import org.apache.ignite.internal.util.GridLeanSet;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.C1;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -394,6 +395,19 @@ public final class GridDhtForceKeysFuture<K, V> extends GridCompoundFuture<Objec
return mappings;
}
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ Collection<String> futs = F.viewReadOnly(futures(), new C1<IgniteInternalFuture<?>, String>() {
+ @Override public String apply(IgniteInternalFuture<?> f) {
+ return f.toString();
+ }
+ });
+
+ return S.toString(GridDhtForceKeysFuture.class, this,
+ "innerFuts", futs,
+ "super", super.toString());
+ }
+
/**
* Mini-future for get operations. Mini-futures are only waiting on a single
* node as opposed to multiple nodes.
http://git-wip-us.apache.org/repos/asf/ignite/blob/0354db12/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index 356a85b..fe85968 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -96,6 +96,9 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
private ConcurrentMap<AffinityTopologyVersion, GridDhtAssignmentFetchFuture> pendingAssignmentFetchFuts =
new ConcurrentHashMap8<>();
+ /** Stop flag. */
+ private volatile boolean stopping;
+
/** Discovery listener. */
private final GridLocalEventListener discoLsnr = new GridLocalEventListener() {
@Override public void onEvent(Event evt) {
@@ -218,6 +221,8 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
if (log.isDebugEnabled())
log.debug("DHT rebalancer onKernalStop callback.");
+ stopping = true;
+
cctx.events().removeListener(discoLsnr);
// Acquire write busy lock.
@@ -229,6 +234,11 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
if (demandPool != null)
demandPool.stop();
+ IgniteCheckedException err = stopError();
+
+ for (GridDhtForceKeysFuture fut : forceKeyFuts.values())
+ fut.onDone(err);
+
top = null;
}
@@ -595,6 +605,9 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
*/
void addFuture(GridDhtForceKeysFuture<?, ?> fut) {
forceKeyFuts.put(fut.futureId(), fut);
+
+ if (stopping)
+ fut.onDone(stopError());
}
/**
@@ -607,6 +620,30 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
}
/**
+ * @return Node stop exception.
+ */
+ private IgniteCheckedException stopError() {
+ return new IgniteCheckedException("Operation has been cancelled (cache or node is stopping).");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void dumpDebugInfo() {
+ if (!forceKeyFuts.isEmpty()) {
+ U.warn(log, "Pending force key futures [cache=" + cctx.name() +"]:");
+
+ for (GridDhtForceKeysFuture fut : forceKeyFuts.values())
+ U.warn(log, ">>> " + fut);
+ }
+
+ if (!pendingAssignmentFetchFuts.isEmpty()) {
+ U.warn(log, "Pending assignment fetch futures [cache=" + cctx.name() +"]:");
+
+ for (GridDhtAssignmentFetchFuture fut : pendingAssignmentFetchFuts.values())
+ U.warn(log, ">>> " + fut);
+ }
+ }
+
+ /**
*
*/
private abstract class MessageHandler<M> implements IgniteBiInClosure<UUID, M> {
http://git-wip-us.apache.org/repos/asf/ignite/blob/0354db12/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
index 4d6d0bf..20bf58c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
@@ -202,7 +202,7 @@ public class GridJobProcessor extends GridProcessorAdapter {
};
/** Current session. */
- private final ThreadLocal<ComputeTaskSession> currentSess = new ThreadLocal<>();
+ private final ThreadLocal<ComputeTaskSession> currSess = new ThreadLocal<>();
/**
* @param ctx Kernal context.
@@ -448,18 +448,19 @@ public class GridJobProcessor extends GridProcessorAdapter {
else if (!nodeId.equals(taskNodeId))
err = "Received job siblings response from unexpected node [taskNodeId=" + taskNodeId +
", nodeId=" + nodeId + ']';
- else
+ else {
// Sender and message type are fine.
res = (GridJobSiblingsResponse)msg;
- if (res.jobSiblings() == null) {
- try {
- res.unmarshalSiblings(marsh);
- }
- catch (IgniteCheckedException e) {
- U.error(log, "Failed to unmarshal job siblings.", e);
+ if (res.jobSiblings() == null) {
+ try {
+ res.unmarshalSiblings(marsh);
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to unmarshal job siblings.", e);
- err = e.getMessage();
+ err = e.getMessage();
+ }
}
}
@@ -830,7 +831,8 @@ public class GridJobProcessor extends GridProcessorAdapter {
if (w == null)
throw new NoSuchElementException();
- org.apache.ignite.spi.collision.CollisionJobContext ret = new CollisionJobContext(w, false);
+ org.apache.ignite.spi.collision.CollisionJobContext ret =
+ new CollisionJobContext(w, false);
w = null;
@@ -953,16 +955,14 @@ public class GridJobProcessor extends GridProcessorAdapter {
GridJobWorker job = null;
- rwLock.readLock();
-
- try {
- if (stopping) {
- if (log.isDebugEnabled())
- log.debug("Received job execution request while stopping this node (will ignore): " + req);
+ if (!rwLock.tryReadLock()) {
+ if (log.isDebugEnabled())
+ log.debug("Received job execution request while stopping this node (will ignore): " + req);
- return;
- }
+ return;
+ }
+ try {
long endTime = req.getCreateTime() + req.getTimeout();
// Account for overflow.
@@ -1172,7 +1172,7 @@ public class GridJobProcessor extends GridProcessorAdapter {
* @param ses Session.
*/
public void currentTaskSession(ComputeTaskSession ses) {
- currentSess.set(ses);
+ currSess.set(ses);
}
/**
@@ -1195,7 +1195,7 @@ public class GridJobProcessor extends GridProcessorAdapter {
if (!ctx.security().enabled())
return null;
- ComputeTaskSession ses = currentSess.get();
+ ComputeTaskSession ses = currSess.get();
if (ses == null)
return null;
@@ -1404,16 +1404,14 @@ public class GridJobProcessor extends GridProcessorAdapter {
*/
@SuppressWarnings({"SynchronizationOnLocalVariableOrMethodParameter", "RedundantCast"})
private void processTaskSessionRequest(UUID nodeId, GridTaskSessionRequest req) {
- rwLock.readLock();
-
- try {
- if (stopping) {
- if (log.isDebugEnabled())
- log.debug("Received job session request while stopping grid (will ignore): " + req);
+ if (!rwLock.tryReadLock()) {
+ if (log.isDebugEnabled())
+ log.debug("Received job session request while stopping grid (will ignore): " + req);
- return;
- }
+ return;
+ }
+ try {
GridTaskSessionImpl ses = ctx.session().getSession(req.getSessionId());
if (ses == null) {
@@ -1557,16 +1555,14 @@ public class GridJobProcessor extends GridProcessorAdapter {
if (log.isDebugEnabled())
log.debug("Received external collision event.");
- rwLock.readLock();
-
- try {
- if (stopping) {
- if (log.isDebugEnabled())
- log.debug("Received external collision notification while stopping grid (will ignore).");
+ if (!rwLock.tryReadLock()) {
+ if (log.isDebugEnabled())
+ log.debug("Received external collision notification while stopping grid (will ignore).");
- return;
- }
+ return;
+ }
+ try {
handleCollisions();
}
finally {
@@ -1653,16 +1649,14 @@ public class GridJobProcessor extends GridProcessorAdapter {
updateJobMetrics();
}
else {
- rwLock.readLock();
-
- try {
- if (stopping) {
- if (log.isDebugEnabled())
- log.debug("Skipping collision handling on job finish (node is stopping).");
+ if (!rwLock.tryReadLock()) {
+ if (log.isDebugEnabled())
+ log.debug("Skipping collision handling on job finish (node is stopping).");
- return;
- }
+ return;
+ }
+ try {
handleCollisions();
}
finally {
@@ -1851,16 +1845,14 @@ public class GridJobProcessor extends GridProcessorAdapter {
}
if (handleCollisions) {
- rwLock.readLock();
-
- try {
- if (stopping) {
- if (log.isDebugEnabled())
- log.debug("Skipped collision handling on discovery event (node is stopping): " + evt);
+ if (!rwLock.tryReadLock()) {
+ if (log.isDebugEnabled())
+ log.debug("Skipped collision handling on discovery event (node is stopping): " + evt);
- return;
- }
+ return;
+ }
+ try {
if (!jobAlwaysActivate)
handleCollisions();
else if (metricsUpdateFreq > -1L)
http://git-wip-us.apache.org/repos/asf/ignite/blob/0354db12/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java
index f1ae478..3b33b83 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java
@@ -28,6 +28,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
@@ -54,6 +55,8 @@ public class GridTaskFailoverAffinityRunTest extends GridCommonAbstractTest {
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+ ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
+
boolean client = clientMode && gridName.equals(getTestGridName(0));
if (client) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/0354db12/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
index 8f90dbd..1e3382d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
@@ -1761,7 +1761,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
log.error("Failed to wait for update.");
for (Ignite ignite : G.allGrids())
- dumpCacheDebugInfo(ignite);
+ ((IgniteKernal)ignite).dumpDebugInfo();
U.dumpThreads(log);
@@ -1801,7 +1801,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
log.error("Failed to wait for update.");
for (Ignite ignite : G.allGrids())
- dumpCacheDebugInfo(ignite);
+ ((IgniteKernal)ignite).dumpDebugInfo();
U.dumpThreads(log);
[02/13] ignite git commit: ignite-1758 Fixed client reconnect issues
Posted by dm...@apache.org.
ignite-1758 Fixed client reconnect issues
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2501c3a5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2501c3a5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2501c3a5
Branch: refs/heads/master
Commit: 2501c3a52034a7e8d419eb335eab1fe7f2efb2f1
Parents: be6e439
Author: sboikov <sb...@gridgain.com>
Authored: Tue Nov 3 17:42:01 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Nov 3 17:42:01 2015 +0300
----------------------------------------------------------------------
.../GridDhtPartitionsExchangeFuture.java | 6 +
.../ignite/spi/discovery/tcp/ServerImpl.java | 21 +-
.../TcpDiscoveryClientReconnectMessage.java | 1 +
.../messages/TcpDiscoveryDiscardMessage.java | 1 +
.../cache/GridCacheAbstractFullApiSelfTest.java | 2 +
.../GridCacheAbstractRemoveFailureTest.java | 4 +-
.../CacheGetFutureHangsSelfTest.java | 3 +-
...niteCacheClientNodeChangingTopologyTest.java | 2 +
.../IgniteCacheCrossCacheTxFailoverTest.java | 4 +-
.../IgniteCachePutRetryAbstractSelfTest.java | 4 +-
...ledFairAffinityMultiNodeFullApiSelfTest.java | 5 -
...omicNearEnabledMultiNodeFullApiSelfTest.java | 5 -
...icOffHeapTieredMultiNodeFullApiSelfTest.java | 5 -
.../near/GridCacheNearTxExceptionSelfTest.java | 4 +
...gniteClientReconnectMassiveShutdownTest.java | 84 +++--
.../tcp/TcpDiscoveryMultiThreadedTest.java | 5 +-
.../ignite/testframework/GridTestUtils.java | 4 +-
.../processors/query/h2/IgniteH2Indexing.java | 2 +-
.../cache/SqlFieldsQuerySelfTest.java | 2 -
.../config/benchmark-client-mode.properties | 4 +-
.../config/benchmark-failover.properties | 107 +++++++
.../config/benchmark-multicast.properties | 71 ++--
.../yardstick/config/benchmark-store.properties | 4 +-
modules/yardstick/config/benchmark.properties | 4 +-
.../config/ignite-failover-base-config.xml | 126 ++++++++
.../config/ignite-failover-localhost-config.xml | 56 ++++
modules/yardstick/pom.xml | 3 +-
.../yardstick/IgniteAbstractBenchmark.java | 2 +-
.../yardstick/IgniteBenchmarkArguments.java | 66 +++-
.../cache/IgniteCacheAbstractBenchmark.java | 8 +-
.../yardstick/cache/IgniteGetBenchmark.java | 4 +-
.../cache/IgniteJdbcSqlQueryBenchmark.java | 4 +-
.../yardstick/cache/IgnitePutAllBenchmark.java | 4 +-
.../cache/IgnitePutAllTxBenchmark.java | 4 +-
.../yardstick/cache/IgnitePutBenchmark.java | 4 +-
.../yardstick/cache/IgnitePutGetBenchmark.java | 4 +-
.../cache/IgnitePutGetTxBenchmark.java | 4 +-
.../cache/IgnitePutIndexedValue1Benchmark.java | 4 +-
.../cache/IgnitePutIndexedValue2Benchmark.java | 4 +-
.../cache/IgnitePutIndexedValue8Benchmark.java | 4 +-
.../yardstick/cache/IgnitePutTxBenchmark.java | 4 +-
.../cache/IgniteSqlQueryBenchmark.java | 4 +-
.../cache/IgniteSqlQueryJoinBenchmark.java | 4 +-
.../cache/IgniteSqlQueryPutBenchmark.java | 4 +-
.../IgniteAtomicInvokeRetryBenchmark.java | 214 +++++++++++++
...IgniteAtomicOffHeapInvokeRetryBenchmark.java | 31 ++
.../IgniteAtomicOffHeapRetriesBenchmark.java | 31 ++
.../failover/IgniteAtomicRetriesBenchmark.java | 89 ++++++
.../IgniteFailoverAbstractBenchmark.java | 320 +++++++++++++++++++
.../cache/failover/IgniteFailoverNode.java | 60 ++++
...IgniteTransactionalInvokeRetryBenchmark.java | 212 ++++++++++++
...ransactionalOffHeapInvokeRetryBenchmark.java | 33 ++
...ransactionalOffHeapWriteInvokeBenchmark.java | 37 +++
...eTransactionalOffHeapWriteReadBenchmark.java | 32 ++
...IgniteTransactionalWriteInvokeBenchmark.java | 182 +++++++++++
.../IgniteTransactionalWriteReadBenchmark.java | 141 ++++++++
56 files changed, 1919 insertions(+), 134 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 77e47a7..cef38e8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -1447,6 +1447,12 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
", old=" + oldest.id() + ", new=" + newOldest.id() + ']');
}
}
+ else {
+ ClusterTopologyCheckedException err = new ClusterTopologyCheckedException("Failed to " +
+ "wait for exchange future, all server nodes left.");
+
+ onDone(err);
+ }
if (set) {
// If received any messages, process them.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index ee9f818..0fe2881 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -1454,18 +1454,18 @@ class ServerImpl extends TcpDiscoveryImpl {
tmp = U.arrayList(readers);
}
- for (ClientMessageWorker msgWorker : clientMsgWorkers.values()) {
- U.interrupt(msgWorker);
-
- U.join(msgWorker, log);
- }
-
U.interrupt(tmp);
U.joinThreads(tmp, log);
U.interrupt(msgWorker);
U.join(msgWorker, log);
+ for (ClientMessageWorker msgWorker : clientMsgWorkers.values()) {
+ U.interrupt(msgWorker);
+
+ U.join(msgWorker, log);
+ }
+
U.interrupt(statsPrinter);
U.join(statsPrinter, log);
}
@@ -1778,7 +1778,9 @@ class ServerImpl extends TcpDiscoveryImpl {
Collection<TcpDiscoveryNode> top = new ArrayList<>(allNodes.size());
for (TcpDiscoveryNode n0 : allNodes) {
- if (n0.internalOrder() != 0 && n0.internalOrder() < node.internalOrder())
+ assert n0.internalOrder() > 0 : n0;
+
+ if (n0.internalOrder() < node.internalOrder())
top.add(n0);
}
@@ -3239,6 +3241,9 @@ class ServerImpl extends TcpDiscoveryImpl {
}
}
else {
+ if (isLocalNodeCoordinator())
+ addMessage(new TcpDiscoveryDiscardMessage(locNodeId, msg.id(), false));
+
if (isLocNodeRouter) {
ClientMessageWorker wrk = clientMsgWorkers.get(nodeId);
@@ -3249,7 +3254,7 @@ class ServerImpl extends TcpDiscoveryImpl {
locNodeId + ", clientNodeId=" + nodeId + ']');
}
else {
- if (ring.hasRemoteNodes() && !locNodeId.equals(msg.verifierNodeId()))
+ if (ring.hasRemoteNodes() && !isLocalNodeCoordinator())
sendMessageAcrossRing(msg);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java
index c232e6c..7c0cd5d 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java
@@ -26,6 +26,7 @@ import org.apache.ignite.lang.IgniteUuid;
/**
* Message telling that client node is reconnecting to topology.
*/
+@TcpDiscoveryEnsureDelivery
public class TcpDiscoveryClientReconnectMessage extends TcpDiscoveryAbstractMessage {
/** */
private static final long serialVersionUID = 0L;
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java
index 145f19e..4b4eb9c 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java
@@ -40,6 +40,7 @@ public class TcpDiscoveryDiscardMessage extends TcpDiscoveryAbstractMessage {
*
* @param creatorNodeId Creator node ID.
* @param msgId Message ID.
+ * @param customMsgDiscard Flag indicating whether the ID to discard is for a custom message or not.
*/
public TcpDiscoveryDiscardMessage(UUID creatorNodeId, IgniteUuid msgId, boolean customMsgDiscard) {
super(creatorNodeId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 530ff61..3a530f2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -3997,6 +3997,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testIgniteCacheIterator() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-1756");
+
IgniteCache<String, Integer> cache = jcache(0);
Iterator<Cache.Entry<String, Integer>> it = cache.iterator();
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
index 5044516..6572d31 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
@@ -49,7 +49,7 @@ import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi;
+import org.apache.ignite.spi.swapspace.inmemory.GridTestSwapSpaceSpi;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
@@ -102,7 +102,7 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCommonAbstr
if (testClientNode() && getTestGridName(0).equals(gridName))
cfg.setClientMode(true);
- cfg.setSwapSpaceSpi(new FileSwapSpaceSpi());
+ cfg.setSwapSpaceSpi(new GridTestSwapSpaceSpi());
((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetFutureHangsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetFutureHangsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetFutureHangsSelfTest.java
index 659520b..53ac648 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetFutureHangsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetFutureHangsSelfTest.java
@@ -91,7 +91,7 @@ public class CacheGetFutureHangsSelfTest extends GridCommonAbstractTest {
/** {@inheritDoc} */
@Override protected long getTestTimeout() {
- return 5 * 60_000;
+ return 10 * 60_000;
}
/**
@@ -114,6 +114,7 @@ public class CacheGetFutureHangsSelfTest extends GridCommonAbstractTest {
/**
* Executes one test iteration.
+ *
* @throws Exception If failed.
*/
private void doTestFailover() throws Exception {
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
index cb83798..8f90dbd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
@@ -1555,6 +1555,8 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
* @throws Exception If failed.
*/
public void testAtomicPrimaryPutAllMultinode() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-1685");
+
multinode(PRIMARY, TestType.PUT_ALL);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
index 7fe0138..e46761b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
@@ -42,7 +42,7 @@ import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi;
+import org.apache.ignite.spi.swapspace.inmemory.GridTestSwapSpaceSpi;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
@@ -92,7 +92,7 @@ public class IgniteCacheCrossCacheTxFailoverTest extends GridCommonAbstractTest
if (gridName.equals(getTestGridName(GRID_CNT - 1)))
cfg.setClientMode(true);
- cfg.setSwapSpaceSpi(new FileSwapSpaceSpi());
+ cfg.setSwapSpaceSpi(new GridTestSwapSpaceSpi());
((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
index 76f12c4..ee28cf9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
@@ -49,7 +49,7 @@ import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi;
+import org.apache.ignite.spi.swapspace.inmemory.GridTestSwapSpaceSpi;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -120,7 +120,7 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
cfg.setAtomicConfiguration(acfg);
- cfg.setSwapSpaceSpi(new FileSwapSpaceSpi());
+ cfg.setSwapSpaceSpi(new GridTestSwapSpaceSpi());
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearEnabledFairAffinityMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearEnabledFairAffinityMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearEnabledFairAffinityMultiNodeFullApiSelfTest.java
index de4a53d..e4784f2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearEnabledFairAffinityMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearEnabledFairAffinityMultiNodeFullApiSelfTest.java
@@ -38,9 +38,4 @@ public class GridCacheAtomicNearEnabledFairAffinityMultiNodeFullApiSelfTest
@Override public void testWithSkipStore(){
fail("https://issues.apache.org/jira/browse/IGNITE-1582");
}
-
- /** {@inheritDoc} */
- @Override public void testIgniteCacheIterator() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-1756");
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearEnabledMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearEnabledMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearEnabledMultiNodeFullApiSelfTest.java
index e9251b6..5e128ac 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearEnabledMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearEnabledMultiNodeFullApiSelfTest.java
@@ -27,9 +27,4 @@ public class GridCacheAtomicNearEnabledMultiNodeFullApiSelfTest extends GridCach
@Override protected NearCacheConfiguration nearConfiguration() {
return new NearCacheConfiguration();
}
-
- /** {@inheritDoc} */
- @Override public void testIgniteCacheIterator() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-1756");
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapTieredMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapTieredMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapTieredMultiNodeFullApiSelfTest.java
index 608729a..472ad16 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapTieredMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapTieredMultiNodeFullApiSelfTest.java
@@ -30,9 +30,4 @@ public class GridCacheAtomicOffHeapTieredMultiNodeFullApiSelfTest extends
@Override protected CacheMemoryMode memoryMode() {
return OFFHEAP_TIERED;
}
-
- /** {@inheritDoc} */
- @Override public void testIgniteCacheIterator() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-1756");
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
index 02aa824..270af25 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
@@ -35,4 +35,8 @@ public class GridCacheNearTxExceptionSelfTest extends IgniteTxExceptionAbstractS
@Override public void testTransformBackup(){
fail("https://issues.apache.org/jira/browse/IGNITE-1601");
}
+
+ @Override public void testRemoveBackup() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-1839");
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/IgniteClientReconnectMassiveShutdownTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/IgniteClientReconnectMassiveShutdownTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/IgniteClientReconnectMassiveShutdownTest.java
index 6f0e887..5282cf2 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/IgniteClientReconnectMassiveShutdownTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/IgniteClientReconnectMassiveShutdownTest.java
@@ -22,6 +22,7 @@ import java.util.Random;
import java.util.UUID;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.cache.CacheException;
@@ -35,12 +36,14 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
+import static java.util.concurrent.TimeUnit.SECONDS;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMemoryMode.OFFHEAP_TIERED;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -131,7 +134,7 @@ public class IgniteClientReconnectMassiveShutdownTest extends GridCommonAbstract
assertTrue(client.configuration().isClientMode());
- CacheConfiguration<String, Integer> cfg = new CacheConfiguration<>();
+ final CacheConfiguration<String, Integer> cfg = new CacheConfiguration<>();
cfg.setCacheMode(PARTITIONED);
cfg.setAtomicityMode(TRANSACTIONAL);
@@ -141,6 +144,8 @@ public class IgniteClientReconnectMassiveShutdownTest extends GridCommonAbstract
IgniteCache<String, Integer> cache = client.getOrCreateCache(cfg);
+ assertNotNull(cache);
+
HashMap<String, Integer> put = new HashMap<>();
// Load some data.
@@ -155,59 +160,80 @@ public class IgniteClientReconnectMassiveShutdownTest extends GridCommonAbstract
for (int i = GRID_CNT; i < GRID_CNT + CLIENT_GRID_CNT; i++)
clientIdx.add(i);
+ final CountDownLatch latch = new CountDownLatch(CLIENT_GRID_CNT);
+
IgniteInternalFuture<?> clientsFut = multithreadedAsync(
new Callable<Object>() {
@Override public Object call() throws Exception {
- int idx = clientIdx.take();
+ try {
+ int idx = clientIdx.take();
- Ignite ignite = grid(idx);
+ Ignite ignite = grid(idx);
- Thread.currentThread().setName("client-thread-" + ignite.name());
+ Thread.currentThread().setName("client-thread-" + ignite.name());
- assertTrue(ignite.configuration().isClientMode());
+ assertTrue(ignite.configuration().isClientMode());
- IgniteCache<String, Integer> cache = ignite.cache(null);
+ IgniteCache<String, Integer> cache = ignite.getOrCreateCache(cfg);
- IgniteTransactions txs = ignite.transactions();
+ assertNotNull(cache);
- Random rand = new Random();
+ IgniteTransactions txs = ignite.transactions();
- while (!done.get()) {
- try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) {
- cache.put(String.valueOf(rand.nextInt(10_000)), rand.nextInt(50_000));
+ Random rand = new Random();
- tx.commit();
- }
- catch (ClusterTopologyException ex) {
- ex.retryReadyFuture().get();
- }
- catch (IgniteException | CacheException e) {
- if (X.hasCause(e, IgniteClientDisconnectedException.class)) {
- IgniteClientDisconnectedException cause = X.cause(e,
- IgniteClientDisconnectedException.class);
+ latch.countDown();
- assert cause != null;
+ while (!done.get()) {
+ try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) {
+ cache.put(String.valueOf(rand.nextInt(10_000)), rand.nextInt(50_000));
- cause.reconnectFuture().get();
+ tx.commit();
}
- else if (X.hasCause(e, ClusterTopologyException.class)) {
- ClusterTopologyException cause = X.cause(e, ClusterTopologyException.class);
+ catch (ClusterTopologyException ex) {
+ ex.retryReadyFuture().get();
+ }
+ catch (IgniteException | CacheException e) {
+ if (X.hasCause(e, IgniteClientDisconnectedException.class)) {
+ IgniteClientDisconnectedException cause = X.cause(e,
+ IgniteClientDisconnectedException.class);
+
+ assert cause != null;
+
+ cause.reconnectFuture().get();
+ }
+ else if (X.hasCause(e, ClusterTopologyException.class)) {
+ ClusterTopologyException cause = X.cause(e, ClusterTopologyException.class);
- assert cause != null;
+ assert cause != null;
- cause.retryReadyFuture().get();
+ cause.retryReadyFuture().get();
+ }
+ else
+ throw e;
}
- else
- throw e;
}
+
+ return null;
}
+ catch (Throwable e) {
+ log.error("Unexpected error: " + e, e);
- return null;
+ throw e;
+ }
}
},
CLIENT_GRID_CNT, "client-thread");
try {
+ if (!latch.await(30, SECONDS)) {
+ log.warning("Failed to wait for for clients start.");
+
+ U.dumpThreads(log);
+
+ fail("Failed to wait for for clients start.");
+ }
+
// Killing a half of server nodes.
final int srvsToKill = GRID_CNT / 2;
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
index 09b3ef8..55474dc 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
@@ -37,6 +37,7 @@ import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.client.util.GridConcurrentHashSet;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -161,8 +162,6 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
* @throws Exception If any error occurs.
*/
public void testMultiThreadedClientsRestart() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-1123");
-
final AtomicBoolean done = new AtomicBoolean();
try {
@@ -271,6 +270,8 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
if (X.hasCause(e, IgniteClientDisconnectedCheckedException.class) ||
X.hasCause(e, IgniteClientDisconnectedException.class))
log.info("Client disconnected: " + e);
+ else if (X.hasCause(e, ClusterTopologyCheckedException.class))
+ log.info("Client failed to start: " + e);
else {
if (failedNodes.contains(id) && X.hasCause(e, IgniteSpiException.class))
log.info("Client failed: " + e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index ea3bbe0..d1c3d9f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
@@ -88,7 +88,7 @@ import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgnitePredicate;
-import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi;
+import org.apache.ignite.spi.swapspace.inmemory.GridTestSwapSpaceSpi;
import org.apache.ignite.ssl.SslContextFactory;
import org.apache.ignite.testframework.config.GridTestProperties;
import org.jetbrains.annotations.NotNull;
@@ -1698,7 +1698,7 @@ public final class GridTestUtils {
ccfg.setSwapEnabled(swap);
if (swap && cfg != null)
- cfg.setSwapSpaceSpi(new FileSwapSpaceSpi());
+ cfg.setSwapSpaceSpi(new GridTestSwapSpaceSpi());
if (evictionPlc) {
LruEvictionPolicy plc = new LruEvictionPolicy();
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 8595187..4c07132 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -1474,7 +1474,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
@Nullable @Override public <K, V> IgniteBiPredicate<K, V> forSpace(String spaceName) {
final GridCacheAdapter<Object, Object> cache = ctx.cache().internalCache(spaceName);
- if (cache.context().isReplicated() || (cache.configuration().getBackups() == 0 && parts == null))
+ if (cache.context().isReplicated())
return null;
final GridCacheAffinityManager aff = cache.context().affinity();
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java
index 26d87a9..a8c8388 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java
@@ -74,8 +74,6 @@ public class SqlFieldsQuerySelfTest extends GridCommonAbstractTest {
* @throws Exception If error.
*/
public void testSqlFieldsQueryWithTopologyChanges() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-1698");
-
startGrid(0);
createAndFillCache();
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/config/benchmark-client-mode.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-client-mode.properties b/modules/yardstick/config/benchmark-client-mode.properties
index 8941417..ba5525f 100644
--- a/modules/yardstick/config/benchmark-client-mode.properties
+++ b/modules/yardstick/config/benchmark-client-mode.properties
@@ -17,12 +17,14 @@
# Contains all multicast benchmarks
#
+now0=`date +'%H%M%S'`
+
# JVM options.
JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
JVM_OPTS=${JVM_OPTS}" \
--Xloggc:./gc.log \
+-Xloggc:./gc${now0}.log \
-XX:+PrintGCDetails \
-verbose:gc \
-XX:+UseParNewGC \
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/config/benchmark-failover.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-failover.properties b/modules/yardstick/config/benchmark-failover.properties
new file mode 100644
index 0000000..7ed464c
--- /dev/null
+++ b/modules/yardstick/config/benchmark-failover.properties
@@ -0,0 +1,107 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Contains failover benchmarks.
+#
+
+now0=`date +'%H%M%S'`
+
+# JVM options.
+#JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false -Xms15g -Xmx15g"
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false -ea"
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+JVM_OPTS=${JVM_OPTS}" \
+ -Xloggc:./gc${now0}.log \
+ -XX:+PrintGCDetails \
+ -verbose:gc \
+ -XX:+UseParNewGC \
+ -XX:+UseConcMarkSweepGC \
+ -XX:+UseTLAB \
+ -XX:NewSize=128m \
+ -XX:MaxNewSize=128m \
+ -XX:MaxTenuringThreshold=0 \
+ -XX:SurvivorRatio=1024 \
+ -XX:+UseCMSInitiatingOccupancyOnly \
+ -XX:CMSInitiatingOccupancyFraction=60 \
+"
+
+#Ignite version
+ver="RELEASE-"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+RESTART_SERVERS=true
+
+# Probe point writer class name.
+# BENCHMARK_WRITER=
+
+# Comma-separated list of the hosts to run BenchmarkServers on.
+SERVER_HOSTS=localhost,localhost
+
+# Comma-separated list of the hosts to run BenchmarkDrivers on.
+DRIVER_HOSTS=localhost
+
+# Remote username.
+# REMOTE_USER=
+
+# Number of nodes, used to wait for the specified number of nodes to start.
+nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
+
+# Space-separated list of Benchmark driver names (required)
+dn="\
+ IgniteAtomicRetriesBenchmark \
+ IgniteAtomicInvokeRetryBenchmark \
+ IgniteTransactionalWriteReadBenchmark \
+ IgniteTransactionalWriteInvokeBenchmark \
+ IgniteTransactionalInvokeRetryBenchmark \
+ IgniteAtomicOffHeapRetriesBenchmark \
+ IgniteAtomicOffHeapInvokeRetryBenchmark \
+ IgniteTransactionalOffHeapWriteReadBenchmark \
+ IgniteTransactionalOffHeapWriteInvokeBenchmark \
+ IgniteTransactionalOffHeapInvokeRetryBenchmark \
+"
+
+# Warmup 1 min.
+w=60
+
+# Duration 2h = 2*60*60 = 7200 sec.
+d=7200
+
+# Restart delay 10 min = 10 * 60 sec = 600 sec.
+rd=600
+
+# Restart sleep 2 min = 120 sec.
+rs=120
+
+# Keys rang.
+r=100000
+
+# Thread count.
+t=128
+
+# Run configuration which contains all benchmarks.
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-failover-localhost-config.xml -nn ${nodesNum} -b 1 -w ${w} -d ${d} -rd ${rd} -rs ${rs} -r ${r} -t ${t} --client -sm PRIMARY_SYNC -dn ${dn} -sn IgniteFailoverNode -ds failover-1b,\
+-cfg ${SCRIPT_DIR}/../config/ignite-failover-localhost-config.xml -nn ${nodesNum} -b 2 -w ${w} -d ${d} -rd ${rd} -rs ${rs} -r ${r} -t ${t} --client -sm PRIMARY_SYNC -dn ${dn} -sn IgniteFailoverNode -ds failover-2b,\
+"
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/config/benchmark-multicast.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-multicast.properties b/modules/yardstick/config/benchmark-multicast.properties
index 82fc3f8..536ccf4 100644
--- a/modules/yardstick/config/benchmark-multicast.properties
+++ b/modules/yardstick/config/benchmark-multicast.properties
@@ -17,12 +17,14 @@
# Contains all multicast benchmarks
#
+now0=`date +'%H%M%S'`
+
# JVM options.
JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
JVM_OPTS=${JVM_OPTS}" \
--Xloggc:./gc.log \
+-Xloggc:./gc${now0}.log \
-XX:+PrintGCDetails \
-verbose:gc \
-XX:+UseParNewGC \
@@ -35,6 +37,7 @@ JVM_OPTS=${JVM_OPTS}" \
-XX:+UseCMSInitiatingOccupancyOnly \
-XX:CMSInitiatingOccupancyFraction=60 \
"
+
#Ignite version
ver="RELEASE-"
@@ -63,31 +66,49 @@ DRIVER_HOSTS=localhost
# Number of nodes, used to wait for the specified number of nodes to start.
nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
+# Backups count.
+b=1
+
+# Warmup.
+w=60
+
+# Duration.
+d=300
+
+# Threads count.
+t=64
+
+# Sync mode.
+sm=PRIMARY_SYNC
+
+# Jobs.
+j=10
+
# Run configuration which contains all benchmarks.
# Note that each benchmark is set to run for 300 seconds (5 mins) with warm-up set to 60 seconds (1 minute).
CONFIGS="\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutBenchmark -sn IgniteNode -ds ${ver}atomic-put-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutGetBenchmark -sn IgniteNode -ds ${ver}atomic-put-get-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutTxBenchmark -sn IgniteNode -ds ${ver}tx-put-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutGetTxBenchmark -sn IgniteNode -ds ${ver}tx-put-get-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryBenchmark -sn IgniteNode -ds ${ver}sql-query-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryJoinBenchmark -sn IgniteNode -ds ${ver}sql-query-join-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryPutBenchmark -sn IgniteNode -ds ${ver}sql-query-put-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -j 10 -dn IgniteAffinityCallBenchmark -sn IgniteNode -ds ${ver}affcall-compute-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -j 10 -dn IgniteApplyBenchmark -sn IgniteNode -ds ${ver}apply-compute-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -j 10 -dn IgniteBroadcastBenchmark -sn IgniteNode -ds ${ver}broad-compute-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -j 10 -dn IgniteExecuteBenchmark -sn IgniteNode -ds ${ver}exec-compute-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -j 10 -dn IgniteRunBenchmark -sn IgniteNode -ds ${ver}run-compute-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutGetOffHeapBenchmark -sn IgniteNode -ds ${ver}atomic-put-get-offheap-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutGetOffHeapValuesBenchmark -sn IgniteNode -ds ${ver}atomic-put-get-offheap-val-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutOffHeapBenchmark -sn IgniteNode -ds ${ver}atomic-put-offheap-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutOffHeapValuesBenchmark -sn IgniteNode -ds ${ver}atomic-put-offheap-val-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutTxOffHeapBenchmark -sn IgniteNode -ds ${ver}tx-put-offheap-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutTxOffHeapValuesBenchmark -sn IgniteNode -ds ${ver}tx-put-offheap-val-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryOffHeapBenchmark -sn IgniteNode -ds ${ver}sql-query-offheap-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryJoinOffHeapBenchmark -sn IgniteNode -ds ${ver}sql-query-join-offheap-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryPutOffHeapBenchmark -sn IgniteNode -ds ${ver}sql-query-put-offheap-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -bs 100 -dn IgnitePutAllBenchmark -sn IgniteNode -ds ${ver}atomic-putAll-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -bs 100 -dn IgnitePutAllTxBenchmark -sn IgniteNode -ds ${ver}tx-putAll-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -bs 100 -dn IgnitePutAllSerializableTxBenchmark -sn IgniteNode -ds ${ver}tx-putAllSerializable-1-backup\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgnitePutBenchmark -sn IgniteNode -ds ${ver}atomic-put-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgnitePutGetBenchmark -sn IgniteNode -ds ${ver}atomic-put-get-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgnitePutTxBenchmark -sn IgniteNode -ds ${ver}tx-put-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgnitePutGetTxBenchmark -sn IgniteNode -ds ${ver}tx-put-get-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteSqlQueryBenchmark -sn IgniteNode -ds ${ver}sql-query-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteSqlQueryJoinBenchmark -sn IgniteNode -ds ${ver}sql-query-join-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteSqlQueryPutBenchmark -sn IgniteNode -ds ${ver}sql-query-put-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -j ${j} -dn IgniteAffinityCallBenchmark -sn IgniteNode -ds ${ver}affcall-compute-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -j ${j} -dn IgniteApplyBenchmark -sn IgniteNode -ds ${ver}apply-compute-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -j ${j} -dn IgniteBroadcastBenchmark -sn IgniteNode -ds ${ver}broad-compute-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -j ${j} -dn IgniteExecuteBenchmark -sn IgniteNode -ds ${ver}exec-compute-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -j ${j} -dn IgniteRunBenchmark -sn IgniteNode -ds ${ver}run-compute-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgnitePutGetOffHeapBenchmark -sn IgniteNode -ds ${ver}atomic-put-get-offheap-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgnitePutGetOffHeapValuesBenchmark -sn IgniteNode -ds ${ver}atomic-put-get-offheap-val-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgnitePutOffHeapBenchmark -sn IgniteNode -ds ${ver}atomic-put-offheap-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgnitePutOffHeapValuesBenchmark -sn IgniteNode -ds ${ver}atomic-put-offheap-val-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgnitePutTxOffHeapBenchmark -sn IgniteNode -ds ${ver}tx-put-offheap-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgnitePutTxOffHeapValuesBenchmark -sn IgniteNode -ds ${ver}tx-put-offheap-val-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteSqlQueryOffHeapBenchmark -sn IgniteNode -ds ${ver}sql-query-offheap-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteSqlQueryJoinOffHeapBenchmark -sn IgniteNode -ds ${ver}sql-query-join-offheap-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteSqlQueryPutOffHeapBenchmark -sn IgniteNode -ds ${ver}sql-query-put-offheap-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 100 -dn IgnitePutAllBenchmark -sn IgniteNode -ds ${ver}atomic-putAll-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 100 -dn IgnitePutAllTxBenchmark -sn IgniteNode -ds ${ver}tx-putAll-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -bs 100 -dn IgnitePutAllSerializableTxBenchmark -sn IgniteNode -ds ${ver}tx-putAllSerializable-1-backup\
"
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/config/benchmark-store.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-store.properties b/modules/yardstick/config/benchmark-store.properties
index cb9e507..bda136e 100644
--- a/modules/yardstick/config/benchmark-store.properties
+++ b/modules/yardstick/config/benchmark-store.properties
@@ -21,12 +21,14 @@
# - TRANSACTIONAL cache
#
+now0=`date +'%H%M%S'`
+
# JVM options.
JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
JVM_OPTS=${JVM_OPTS}" \
- -Xloggc:./gc.log \
+ -Xloggc:./gc${now0}.log \
-XX:+PrintGCDetails \
-verbose:gc \
-XX:+UseParNewGC \
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/config/benchmark.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark.properties b/modules/yardstick/config/benchmark.properties
index d691f1e..67ef5ef 100644
--- a/modules/yardstick/config/benchmark.properties
+++ b/modules/yardstick/config/benchmark.properties
@@ -17,12 +17,14 @@
# Contains all benchmarks
#
+now0=`date +'%H%M%S'`
+
# JVM options.
JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
JVM_OPTS=${JVM_OPTS}" \
- -Xloggc:./gc.log \
+ -Xloggc:./gc${now0}.log \
-XX:+PrintGCDetails \
-verbose:gc \
-XX:+UseParNewGC \
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/config/ignite-failover-base-config.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/ignite-failover-base-config.xml b/modules/yardstick/config/ignite-failover-base-config.xml
new file mode 100644
index 0000000..1e1dcff
--- /dev/null
+++ b/modules/yardstick/config/ignite-failover-base-config.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!--
+ Ignite Spring configuration file to startup grid.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+ <bean id="base-ignite-failover.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" abstract="true">
+ <property name="peerClassLoadingEnabled" value="false"/>
+
+ <property name="metricsLogFrequency" value="5000"/>
+
+ <property name="failureDetectionTimeout" value="2000"/>
+
+ <property name="cacheConfiguration">
+ <list>
+ <bean class="org.apache.ignite.configuration.CacheConfiguration" parent="atomic">
+ <property name="name" value="atomic-reties"/>
+ </bean>
+
+ <bean class="org.apache.ignite.configuration.CacheConfiguration" parent="atomic-offheap">
+ <property name="name" value="atomic-offheap-reties"/>
+ </bean>
+
+ <bean class="org.apache.ignite.configuration.CacheConfiguration" parent="atomic">
+ <property name="name" value="atomic-invoke-retry"/>
+ </bean>
+
+ <bean class="org.apache.ignite.configuration.CacheConfiguration" parent="atomic-offheap">
+ <property name="name" value="atomic-offheap-invoke-retry"/>
+ </bean>
+
+ <bean class="org.apache.ignite.configuration.CacheConfiguration" parent="tx">
+ <property name="name" value="tx-invoke-retry"/>
+ </bean>
+
+ <bean class="org.apache.ignite.configuration.CacheConfiguration" parent="tx-offheap">
+ <property name="name" value="tx-offheap-invoke-retry"/>
+ </bean>
+
+ <bean class="org.apache.ignite.configuration.CacheConfiguration" parent="tx">
+ <property name="name" value="tx-write-read"/>
+ </bean>
+
+ <bean class="org.apache.ignite.configuration.CacheConfiguration" parent="tx-offheap">
+ <property name="name" value="tx-offheap-write-read"/>
+ </bean>
+
+ <bean class="org.apache.ignite.configuration.CacheConfiguration" parent="tx">
+ <property name="name" value="tx-write-invoke"/>
+ </bean>
+
+ <bean class="org.apache.ignite.configuration.CacheConfiguration" parent="tx-offheap">
+ <property name="name" value="tx-offheap-write-invoke"/>
+ </bean>
+ </list>
+ </property>
+
+ <property name="includeEventTypes">
+ <list/>
+ </property>
+
+ <property name="loadBalancingSpi">
+ <bean class="org.apache.ignite.spi.loadbalancing.roundrobin.RoundRobinLoadBalancingSpi">
+ <property name="perTask" value="false"/>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="atomic" class="org.apache.ignite.configuration.CacheConfiguration" abstract="true">
+ <property name="cacheMode" value="PARTITIONED"/>
+
+ <property name="atomicityMode" value="ATOMIC"/>
+
+ <property name="swapEnabled" value="false"/>
+ </bean>
+
+ <bean id="atomic-offheap" class="org.apache.ignite.configuration.CacheConfiguration" abstract="true">
+ <property name="name" value="atomic-offheap"/>
+
+ <property name="cacheMode" value="PARTITIONED"/>
+
+ <property name="atomicityMode" value="ATOMIC"/>
+
+ <property name="swapEnabled" value="false"/>
+
+ <property name="memoryMode" value="OFFHEAP_TIERED"/>
+ </bean>
+
+ <bean id="tx" class="org.apache.ignite.configuration.CacheConfiguration" abstract="true">
+ <property name="cacheMode" value="PARTITIONED"/>
+
+ <property name="atomicityMode" value="TRANSACTIONAL"/>
+
+ <property name="swapEnabled" value="false"/>
+ </bean>
+
+ <bean id="tx-offheap" class="org.apache.ignite.configuration.CacheConfiguration" abstract="true">
+ <property name="cacheMode" value="PARTITIONED"/>
+
+ <property name="atomicityMode" value="TRANSACTIONAL"/>
+
+ <property name="swapEnabled" value="false"/>
+
+ <property name="memoryMode" value="OFFHEAP_TIERED"/>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/config/ignite-failover-localhost-config.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/ignite-failover-localhost-config.xml b/modules/yardstick/config/ignite-failover-localhost-config.xml
new file mode 100644
index 0000000..a7c7ff8
--- /dev/null
+++ b/modules/yardstick/config/ignite-failover-localhost-config.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!--
+ Ignite Spring configuration file to startup grid.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+ <import resource="ignite-base-config.xml"/>
+ <import resource="ignite-failover-base-config.xml"/>
+
+ <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" parent="base-ignite-failover.cfg">
+ <property name="localHost" value="127.0.0.1"/>
+
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+ <property name="addresses">
+ <list>
+ <value>127.0.0.1:47500</value>
+ <value>127.0.0.1:47501</value>
+ <value>127.0.0.1:47502</value>
+ <value>127.0.0.1:47503</value>
+ <value>127.0.0.1:47504</value>
+ <value>127.0.0.1:47505</value>
+ <value>127.0.0.1:47506</value>
+ <value>127.0.0.1:47507</value>
+ <value>127.0.0.1:47508</value>
+ <value>127.0.0.1:47509</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/pom.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/pom.xml b/modules/yardstick/pom.xml
index c87ecbc..5bb41b3 100644
--- a/modules/yardstick/pom.xml
+++ b/modules/yardstick/pom.xml
@@ -37,10 +37,9 @@
<url>http://ignite.apache.org</url>
<properties>
- <yardstick.version>0.7.0</yardstick.version>
+ <yardstick.version>0.8.0</yardstick.version>
</properties>
-
<dependencies>
<dependency>
<groupId>org.apache.ignite</groupId>
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/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 c9d4b85..fa93f00 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
@@ -131,4 +131,4 @@ public abstract class IgniteAbstractBenchmark extends BenchmarkDriverAdapter {
protected int nextRandom(int min, int max) {
return ThreadLocalRandom.current().nextInt(max - min) + min;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
index 792d366..74b1da9 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
@@ -113,6 +113,26 @@ public class IgniteBenchmarkArguments {
private String jdbcUrl;
/** */
+ @Parameter(names = {"-rd", "--restartdelay"}, description = "Restart delay in seconds")
+ private int restartDelay = 20;
+
+ /** */
+ @Parameter(names = {"-rs", "--restartsleep"}, description = "Restart sleep in seconds")
+ private int restartSleep = 2;
+
+ /** */
+ @Parameter(names = {"-checkingPeriod", "--checkingPeriod"}, description = "Period to check cache consistency in seconds")
+ private int cacheConsistencyCheckingPeriod = 2 * 60;
+
+ /** */
+ @Parameter(names = {"-kc", "--keysCount"}, description = "Count of keys")
+ private int keysCnt = 5;
+
+ /** */
+ @Parameter(names = {"-cot", "--cacheOperationTimeout"}, description = "Max timeout for cache operations in seconds")
+ private int cacheOpTimeout = 30;
+
+ /** */
@Parameter(names = {"-kpt", "--keysPerThread"}, description = "Use not intersecting keys in putAll benchmark")
private boolean keysPerThread;
@@ -271,18 +291,54 @@ public class IgniteBenchmarkArguments {
}
/**
- * @return Description.
+ * @return Delay in second which used in nodes restart algorithm.
*/
- public String description() {
- return "-nn=" + nodes + "-b=" + backups + "-sm=" + syncMode + "-cl=" + clientOnly + "-nc=" + nearCacheFlag +
- (orderMode == null ? "" : "-wom=" + orderMode) + "-txc=" + txConcurrency;
+ public int restartDelay() {
+ return restartDelay;
+ }
+
+ /**
+ * @return Sleep in second which used in nodes restart algorithm.
+ */
+ public int restartSleep() {
+ return restartSleep;
+ }
+
+ /**
+ * @return Keys count.
+ */
+ public int keysCount() {
+ return keysCnt;
+ }
+
+ /**
+ * @return Period in seconds to check cache consistency.
+ */
+ public int cacheConsistencyCheckingPeriod() {
+ return cacheConsistencyCheckingPeriod;
+ }
+
+ /**
+ * @return Cache operation timeout in milliseconds.
+ */
+ public int cacheOperationTimeoutMillis() {
+ return cacheOpTimeout * 1000;
}
/**
* @return {@code True} if use not intersecting keys in putAll benchmark.
*/
public boolean keysPerThread() {
- return keysPerThread;
+ return keysPerThread;
+ }
+
+ /**
+ * @return Description.
+ */
+ public String description() {
+ return "-nn=" + nodes + "-b=" + backups + "-sm=" + syncMode + "-cl=" + clientOnly + "-nc=" + nearCacheFlag +
+ (orderMode == null ? "" : "-wom=" + orderMode) + "-txc=" + txConcurrency + "-rd=" + restartDelay +
+ "-rs=" + restartSleep;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteCacheAbstractBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteCacheAbstractBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteCacheAbstractBenchmark.java
index 22a9eac..3efa4a5 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteCacheAbstractBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteCacheAbstractBenchmark.java
@@ -27,9 +27,9 @@ import org.yardstickframework.BenchmarkUtils;
/**
* Abstract class for Ignite benchmarks which use cache.
*/
-public abstract class IgniteCacheAbstractBenchmark extends IgniteAbstractBenchmark {
+public abstract class IgniteCacheAbstractBenchmark<K, V> extends IgniteAbstractBenchmark {
/** Cache. */
- protected IgniteCache<Integer, Object> cache;
+ protected IgniteCache<K, V> cache;
/** */
private ThreadLocal<ThreadRange> threadRange = new ThreadLocal<>();
@@ -77,7 +77,7 @@ public abstract class IgniteCacheAbstractBenchmark extends IgniteAbstractBenchma
*
* @return IgniteCache Cache to use.
*/
- protected abstract IgniteCache<Integer, Object> cache();
+ protected abstract IgniteCache<K, V> cache();
/**
*
@@ -109,4 +109,4 @@ public abstract class IgniteCacheAbstractBenchmark extends IgniteAbstractBenchma
return rnd.nextInt(min, max);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetBenchmark.java
index e023c1d..8a86e2f 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetBenchmark.java
@@ -23,7 +23,7 @@ import org.apache.ignite.IgniteCache;
/**
* Ignite benchmark that performs get operations.
*/
-public class IgniteGetBenchmark extends IgniteCacheAbstractBenchmark {
+public class IgniteGetBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
/** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
int key = nextRandom(args.range());
@@ -37,4 +37,4 @@ public class IgniteGetBenchmark extends IgniteCacheAbstractBenchmark {
@Override protected IgniteCache<Integer, Object> cache() {
return ignite().cache("atomic");
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteJdbcSqlQueryBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteJdbcSqlQueryBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteJdbcSqlQueryBenchmark.java
index 63c274f..bbdd760 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteJdbcSqlQueryBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteJdbcSqlQueryBenchmark.java
@@ -37,7 +37,7 @@ import static org.yardstickframework.BenchmarkUtils.println;
/**
* Ignite benchmark that performs query operations.
*/
-public class IgniteJdbcSqlQueryBenchmark extends IgniteCacheAbstractBenchmark {
+public class IgniteJdbcSqlQueryBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
/** Statements for closing. */
Set<PreparedStatement> stms = Collections.synchronizedSet(new HashSet<PreparedStatement>());
@@ -136,4 +136,4 @@ public class IgniteJdbcSqlQueryBenchmark extends IgniteCacheAbstractBenchmark {
@Override protected IgniteCache<Integer, Object> cache() {
return ignite().cache("query");
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllBenchmark.java
index 2ce707c..8cd2347 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllBenchmark.java
@@ -28,7 +28,7 @@ import org.yardstickframework.BenchmarkConfiguration;
/**
* Ignite benchmark that performs putAll operations.
*/
-public class IgnitePutAllBenchmark extends IgniteCacheAbstractBenchmark {
+public class IgnitePutAllBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
/** Affinity mapper. */
private Affinity<Integer> aff;
@@ -65,4 +65,4 @@ public class IgnitePutAllBenchmark extends IgniteCacheAbstractBenchmark {
@Override protected IgniteCache<Integer, Object> cache() {
return ignite().cache("atomic");
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllTxBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllTxBenchmark.java
index 32d5b02..63faa2f 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllTxBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllTxBenchmark.java
@@ -28,7 +28,7 @@ import org.yardstickframework.BenchmarkConfiguration;
/**
* Ignite benchmark that performs transactional putAll operations.
*/
-public class IgnitePutAllTxBenchmark extends IgniteCacheAbstractBenchmark {
+public class IgnitePutAllTxBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
/** Affinity mapper. */
private Affinity<Integer> aff;
@@ -68,4 +68,4 @@ public class IgnitePutAllTxBenchmark extends IgniteCacheAbstractBenchmark {
@Override protected IgniteCache<Integer, Object> cache() {
return ignite().cache("tx");
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutBenchmark.java
index ba2d959..69db87f 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutBenchmark.java
@@ -24,7 +24,7 @@ import org.apache.ignite.yardstick.cache.model.SampleValue;
/**
* Ignite benchmark that performs put operations.
*/
-public class IgnitePutBenchmark extends IgniteCacheAbstractBenchmark {
+public class IgnitePutBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
/** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
int key = nextRandom(args.range());
@@ -38,4 +38,4 @@ public class IgnitePutBenchmark extends IgniteCacheAbstractBenchmark {
@Override protected IgniteCache<Integer, Object> cache() {
return ignite().cache("atomic");
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmark.java
index a92a35e..42f308c 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmark.java
@@ -24,7 +24,7 @@ import org.apache.ignite.yardstick.cache.model.SampleValue;
/**
* Ignite benchmark that performs put and get operations.
*/
-public class IgnitePutGetBenchmark extends IgniteCacheAbstractBenchmark {
+public class IgnitePutGetBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
/** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
int key = nextRandom(args.range());
@@ -43,4 +43,4 @@ public class IgnitePutGetBenchmark extends IgniteCacheAbstractBenchmark {
@Override protected IgniteCache<Integer, Object> cache() {
return ignite().cache("atomic");
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmark.java
index 07b80cc..5afe0b2 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmark.java
@@ -25,7 +25,7 @@ import org.apache.ignite.yardstick.cache.model.SampleValue;
/**
* Ignite benchmark that performs transactional put and get operations.
*/
-public class IgnitePutGetTxBenchmark extends IgniteCacheAbstractBenchmark {
+public class IgnitePutGetTxBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
/** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
int key = nextRandom(0, args.range() / 2);
@@ -48,4 +48,4 @@ public class IgnitePutGetTxBenchmark extends IgniteCacheAbstractBenchmark {
@Override protected IgniteCache<Integer, Object> cache() {
return ignite().cache("tx");
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue1Benchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue1Benchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue1Benchmark.java
index 47b6922..6f06015 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue1Benchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue1Benchmark.java
@@ -24,7 +24,7 @@ import org.apache.ignite.yardstick.cache.model.Person1;
/**
* Ignite benchmark that performs put operations for entity with indexed fields.
*/
-public class IgnitePutIndexedValue1Benchmark extends IgniteCacheAbstractBenchmark {
+public class IgnitePutIndexedValue1Benchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
/** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
int key = nextRandom(args.range());
@@ -38,4 +38,4 @@ public class IgnitePutIndexedValue1Benchmark extends IgniteCacheAbstractBenchmar
@Override protected IgniteCache<Integer, Object> cache() {
return ignite().cache("atomic-index");
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue2Benchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue2Benchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue2Benchmark.java
index 69d603c..0112163 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue2Benchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue2Benchmark.java
@@ -24,7 +24,7 @@ import org.apache.ignite.yardstick.cache.model.Person2;
/**
* Ignite benchmark that performs put operations for entity with indexed fields.
*/
-public class IgnitePutIndexedValue2Benchmark extends IgniteCacheAbstractBenchmark {
+public class IgnitePutIndexedValue2Benchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
/** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
int key = nextRandom(args.range());
@@ -38,4 +38,4 @@ public class IgnitePutIndexedValue2Benchmark extends IgniteCacheAbstractBenchmar
@Override protected IgniteCache<Integer, Object> cache() {
return ignite().cache("atomic-index");
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue8Benchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue8Benchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue8Benchmark.java
index fb5dd68..dae32b4 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue8Benchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue8Benchmark.java
@@ -24,7 +24,7 @@ import org.apache.ignite.yardstick.cache.model.Person8;
/**
* Ignite benchmark that performs put operations for entity with indexed fields.
*/
-public class IgnitePutIndexedValue8Benchmark extends IgniteCacheAbstractBenchmark {
+public class IgnitePutIndexedValue8Benchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
/** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
int key = nextRandom(args.range());
@@ -38,4 +38,4 @@ public class IgnitePutIndexedValue8Benchmark extends IgniteCacheAbstractBenchmar
@Override protected IgniteCache<Integer, Object> cache() {
return ignite().cache("atomic-index");
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java
index 53bd60c..ead3a63 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java
@@ -24,7 +24,7 @@ import org.apache.ignite.yardstick.cache.model.SampleValue;
/**
* Ignite benchmark that performs transactional put operations.
*/
-public class IgnitePutTxBenchmark extends IgniteCacheAbstractBenchmark {
+public class IgnitePutTxBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
/** {@inheritDoc} */
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
int key = nextRandom(args.range());
@@ -39,4 +39,4 @@ public class IgnitePutTxBenchmark extends IgniteCacheAbstractBenchmark {
@Override protected IgniteCache<Integer, Object> cache() {
return ignite().cache("tx");
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java
index fa16cf2..8e31455 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java
@@ -32,7 +32,7 @@ import static org.yardstickframework.BenchmarkUtils.println;
/**
* Ignite benchmark that performs query operations.
*/
-public class IgniteSqlQueryBenchmark extends IgniteCacheAbstractBenchmark {
+public class IgniteSqlQueryBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
/** {@inheritDoc} */
@Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
super.setUp(cfg);
@@ -90,4 +90,4 @@ public class IgniteSqlQueryBenchmark extends IgniteCacheAbstractBenchmark {
@Override protected IgniteCache<Integer, Object> cache() {
return ignite().cache("query");
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2501c3a5/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmark.java
index ad863b8..1f8006d 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmark.java
@@ -33,7 +33,7 @@ import static org.yardstickframework.BenchmarkUtils.println;
/**
* Ignite benchmark that performs query operations with joins.
*/
-public class IgniteSqlQueryJoinBenchmark extends IgniteCacheAbstractBenchmark {
+public class IgniteSqlQueryJoinBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
/** {@inheritDoc} */
@Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
super.setUp(cfg);
@@ -116,4 +116,4 @@ public class IgniteSqlQueryJoinBenchmark extends IgniteCacheAbstractBenchmark {
@Override protected IgniteCache<Integer, Object> cache() {
return ignite().cache("query");
}
-}
\ No newline at end of file
+}
[12/13] ignite git commit: Merge branch 'ignite-1.5' of
https://git-wip-us.apache.org/repos/asf/ignite into ignite-1.5
Posted by dm...@apache.org.
Merge branch 'ignite-1.5' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-1.5
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2a8ff1cf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2a8ff1cf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2a8ff1cf
Branch: refs/heads/master
Commit: 2a8ff1cf688b6efa9e2bdbfa2b6de9ab977160d7
Parents: 4791907 7adfd4a
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Nov 4 17:44:25 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Nov 4 17:44:25 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/IgniteKernal.java | 1 +
.../affinity/GridAffinityAssignmentCache.java | 13 +++
.../cache/GridCacheAffinityManager.java | 10 ++
.../GridCachePartitionExchangeManager.java | 24 +++++
.../processors/cache/GridCachePreloader.java | 5 +
.../cache/GridCachePreloaderAdapter.java | 5 +
.../dht/preloader/GridDhtForceKeysFuture.java | 14 +++
.../dht/preloader/GridDhtPreloader.java | 17 ++++
.../processors/job/GridJobProcessor.java | 96 +++++++++-----------
.../GridTaskFailoverAffinityRunTest.java | 3 +
...niteCacheClientNodeChangingTopologyTest.java | 4 +-
11 files changed, 138 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2a8ff1cf/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
[03/13] ignite git commit: ignite-1153: improve stop node message
Posted by dm...@apache.org.
ignite-1153: improve stop node message
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/51c0d805
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/51c0d805
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/51c0d805
Branch: refs/heads/master
Commit: 51c0d8055157fedf20a28d206598c7c4c514a7f1
Parents: 2501c3a
Author: kcheng.mvp <kc...@gmail.com>
Authored: Wed Nov 4 12:20:46 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Nov 4 12:20:46 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/internal/IgniteKernal.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/51c0d805/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 5a0fe16..0277acc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -641,7 +641,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
// Catch generic throwable to secure against user assertions.
catch (Throwable e) {
U.error(log, "Failed to notify lifecycle bean (safely ignored) [evt=" + evt +
- ", gridName=" + gridName + ']', e);
+ (gridName == null ? "" : ", gridName=" + gridName) + ']', e);
if (e instanceof Error)
throw (Error)e;
@@ -1673,7 +1673,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
">>> CPU(s): " + locNode.metrics().getTotalCpus() + NL +
">>> Heap: " + U.heapSize(locNode, 2) + "GB" + NL +
">>> VM name: " + rtBean.getName() + NL +
- ">>> Grid name: " + gridName + NL +
+ (gridName == null ? "" : ">>> Grid name: " + gridName + NL) +
">>> Local node [" +
"ID=" + locNode.id().toString().toUpperCase() +
", order=" + locNode.order() + ", clientMode=" + ctx.clientNode() +
@@ -1939,11 +1939,13 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
// Ack stop.
if (log.isQuiet()) {
+ String nodeName = gridName == null ? "" : "name=" + gridName + ", ";
+
if (!errOnStop)
- U.quiet(false, "Ignite node stopped OK [uptime=" +
+ U.quiet(false, "Ignite node stopped OK [" + nodeName + "uptime=" +
X.timeSpan2HMSM(U.currentTimeMillis() - startTime) + ']');
else
- U.quiet(true, "Ignite node stopped wih ERRORS [uptime=" +
+ U.quiet(true, "Ignite node stopped wih ERRORS [" + nodeName + "uptime=" +
X.timeSpan2HMSM(U.currentTimeMillis() - startTime) + ']');
}
@@ -1958,7 +1960,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
">>> " + dash + NL +
">>> " + ack + NL +
">>> " + dash + NL +
- ">>> Grid name: " + gridName + NL +
+ (gridName == null ? "" : ">>> Grid name: " + gridName + NL) +
">>> Grid uptime: " + X.timeSpan2HMSM(U.currentTimeMillis() - startTime) +
NL +
NL);
@@ -1972,7 +1974,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
log.info(NL + NL +
">>> " + ack + NL +
">>> " + dash + NL +
- ">>> Grid name: " + gridName + NL +
+ (gridName == null ? "" : ">>> Grid name: " + gridName + NL) +
">>> Grid uptime: " + X.timeSpan2HMSM(U.currentTimeMillis() - startTime) +
NL +
">>> See log above for detailed error message." + NL +
[11/13] ignite git commit: ignite-1226: Need to add method that
returns names of all available caches
Posted by dm...@apache.org.
ignite-1226: Need to add method that returns names of all available caches
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/47919078
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/47919078
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/47919078
Branch: refs/heads/master
Commit: 47919078df447d7594793f2223649784fe1b8d93
Parents: 7944be8
Author: kcheng.mvp <kc...@gmail.com>
Authored: Wed Nov 4 14:57:05 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Nov 4 14:57:05 2015 +0300
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/Ignite.java | 12 +++-
.../apache/ignite/internal/IgniteKernal.java | 12 ++++
.../processors/cache/GridCacheProcessor.java | 19 ++++++
.../processors/cache/CacheNamesSelfTest.java | 69 ++++++++++++++++++++
.../ignite/testframework/junits/IgniteMock.java | 5 ++
.../junits/multijvm/IgniteProcessProxy.java | 7 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 2 +
.../org/apache/ignite/IgniteSpringBean.java | 10 ++-
8 files changed, 133 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/47919078/modules/core/src/main/java/org/apache/ignite/Ignite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/Ignite.java b/modules/core/src/main/java/org/apache/ignite/Ignite.java
index 0afccd0..fc9cf06 100644
--- a/modules/core/src/main/java/org/apache/ignite/Ignite.java
+++ b/modules/core/src/main/java/org/apache/ignite/Ignite.java
@@ -315,6 +315,16 @@ public interface Ignite extends AutoCloseable {
public <K, V> IgniteCache<K, V> cache(@Nullable String name);
/**
+ * Gets the collection of names of currently available caches.
+ *
+ * Collection may contain {@code null} as a value for a cache name. Refer to {@link CacheConfiguration#getName()}
+ * for more info.
+ *
+ * @return Collection of names of currently available caches or an empty collection if no caches are available.
+ */
+ public Collection<String> cacheNames();
+
+ /**
* Gets grid transactions facade.
*
* @return Grid transactions facade.
@@ -477,4 +487,4 @@ public interface Ignite extends AutoCloseable {
* @return Affinity.
*/
public <K> Affinity<K> affinity(String cacheName);
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/47919078/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 0277acc..2f80e5e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -2645,6 +2645,18 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
/** {@inheritDoc} */
+ @Override public Collection<String> cacheNames() {
+ guard();
+
+ try {
+ return ctx.cache().publicCacheNames();
+ }
+ finally {
+ unguard();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public <K extends GridCacheUtilityKey, V> IgniteInternalCache<K, V> utilityCache() {
guard();
http://git-wip-us.apache.org/repos/asf/ignite/blob/47919078/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 301e7d3..b2bb6ff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -1522,6 +1522,25 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
+ * Gets a collection of currently started public cache names.
+ *
+ * @return Collection of currently started public cache names
+ */
+ public Collection<String> publicCacheNames() {
+ return F.viewReadOnly(registeredCaches.values(),
+ new IgniteClosure<DynamicCacheDescriptor, String>() {
+ @Override public String apply(DynamicCacheDescriptor desc) {
+ return desc.cacheConfiguration().getName();
+ }
+ },
+ new IgnitePredicate<DynamicCacheDescriptor>() {
+ @Override public boolean apply(DynamicCacheDescriptor desc) {
+ return desc.started() && desc.cacheType().userCache();
+ }
+ }
+ );
+ }
+ /**
* Gets cache mode.
*
* @param cacheName Cache name to check.
http://git-wip-us.apache.org/repos/asf/ignite/blob/47919078/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNamesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNamesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNamesSelfTest.java
new file mode 100644
index 0000000..6f65b16
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNamesSelfTest.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Collection;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Test that validates {@link Ignite#cacheNames()} implementation.
+ */
+public class CacheNamesSelfTest extends GridCommonAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ CacheConfiguration cacheCfg1 = new CacheConfiguration();
+ cacheCfg1.setCacheMode(CacheMode.REPLICATED);
+ cacheCfg1.setName("replicated");
+
+ CacheConfiguration cacheCfg2 = new CacheConfiguration();
+ cacheCfg2.setCacheMode(CacheMode.PARTITIONED);
+ cacheCfg2.setName("partitioned");
+
+ CacheConfiguration cacheCfg3 = new CacheConfiguration();
+ cacheCfg3.setCacheMode(CacheMode.LOCAL);
+
+ cfg.setCacheConfiguration(cacheCfg1, cacheCfg2, cacheCfg3);
+
+ return cfg;
+ }
+
+ /**
+ * @throws Exception In case of failure.
+ */
+ public void testCacheNames() throws Exception {
+ try {
+ startGridsMultiThreaded(2);
+
+ Collection<String> names = grid(0).cacheNames();
+
+ assertEquals(3, names.size());
+
+ for (String name : names)
+ assertTrue(name == null || name.equals("replicated") || name.equals("partitioned"));
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/47919078/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
index 964753d..bfeafdf 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
@@ -194,6 +194,11 @@ public class IgniteMock implements Ignite {
}
/** {@inheritDoc} */
+ @Override public Collection<String> cacheNames() {
+ return null;
+ }
+
+ /** {@inheritDoc} */
@Override public <K, V> IgniteCache<K, V> createCache(CacheConfiguration<K, V> cacheCfg) {
return null;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/47919078/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
index aa1d470..3eb9d98 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
@@ -477,6 +477,11 @@ public class IgniteProcessProxy implements IgniteEx {
}
/** {@inheritDoc} */
+ @Override public Collection<String> cacheNames() {
+ return locJvmGrid.cacheNames();
+ }
+
+ /** {@inheritDoc} */
@Override public IgniteTransactions transactions() {
throw new UnsupportedOperationException("Transactions can't be supported automatically in multi JVM mode.");
}
@@ -645,4 +650,4 @@ public class IgniteProcessProxy implements IgniteEx {
return ((IgniteEx)ignite).localNode();
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/47919078/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index c62a131..f6432a7 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -35,6 +35,7 @@ import org.apache.ignite.cache.store.jdbc.GridCacheJdbcBlobStoreMultithreadedSel
import org.apache.ignite.cache.store.jdbc.GridCacheJdbcBlobStoreSelfTest;
import org.apache.ignite.internal.processors.cache.CacheAffinityCallSelfTest;
import org.apache.ignite.internal.processors.cache.CacheFutureExceptionSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheNamesSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheAffinityApiSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheAffinityMapperSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheAffinityRoutingSelfTest;
@@ -196,6 +197,7 @@ public class IgniteCacheTestSuite extends TestSuite {
suite.addTestSuite(GridCacheSwapReloadSelfTest.class);
// Common tests.
+ suite.addTestSuite(CacheNamesSelfTest.class);
suite.addTestSuite(GridCacheConcurrentMapSelfTest.class);
suite.addTestSuite(GridCacheAffinityMapperSelfTest.class);
suite.addTestSuite(CacheAffinityCallSelfTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/47919078/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java b/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
index 42514e3..7740907 100644
--- a/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
+++ b/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
@@ -240,6 +240,14 @@ public class IgniteSpringBean implements Ignite, DisposableBean, InitializingBea
return g.cache(name);
}
+
+ /** {@inheritDoc} */
+ @Override public Collection<String> cacheNames() {
+ assert g != null;
+
+ return g.cacheNames();
+ }
+
/** {@inheritDoc} */
@Override public <K, V> IgniteCache<K, V> createCache(CacheConfiguration<K, V> cacheCfg) {
assert g != null;
@@ -437,4 +445,4 @@ public class IgniteSpringBean implements Ignite, DisposableBean, InitializingBea
cfg = g.configuration();
}
-}
\ No newline at end of file
+}
[13/13] ignite git commit: Merge remote-tracking branch
'remotes/apache-main/ignite-1.5' into master-main
Posted by dm...@apache.org.
Merge remote-tracking branch 'remotes/apache-main/ignite-1.5' into master-main
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ad60979f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ad60979f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ad60979f
Branch: refs/heads/master
Commit: ad60979f111c9786f9da225f7c790214857d6f00
Parents: dca9e57 2a8ff1c
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Nov 4 18:02:59 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Nov 4 18:02:59 2015 +0300
----------------------------------------------------------------------
.../java8/messaging/MessagingExample.java | 7 +-
.../src/main/java/org/apache/ignite/Ignite.java | 12 +-
.../apache/ignite/internal/IgniteKernal.java | 27 +-
.../affinity/GridAffinityAssignmentCache.java | 13 +
.../cache/GridCacheAffinityManager.java | 10 +
.../GridCachePartitionExchangeManager.java | 24 ++
.../processors/cache/GridCachePreloader.java | 5 +
.../cache/GridCachePreloaderAdapter.java | 5 +
.../processors/cache/GridCacheProcessor.java | 19 ++
.../dht/preloader/GridDhtForceKeysFuture.java | 14 ++
.../GridDhtPartitionsExchangeFuture.java | 6 +
.../dht/preloader/GridDhtPreloader.java | 17 ++
.../processors/job/GridJobProcessor.java | 96 ++++---
.../ignite/spi/discovery/tcp/ServerImpl.java | 21 +-
.../TcpDiscoveryClientReconnectMessage.java | 1 +
.../messages/TcpDiscoveryDiscardMessage.java | 1 +
.../GridTaskFailoverAffinityRunTest.java | 3 +
.../processors/cache/CacheNamesSelfTest.java | 69 +++++
...niteCacheClientNodeChangingTopologyTest.java | 4 +-
...gniteClientReconnectMassiveShutdownTest.java | 84 ++++---
.../tcp/TcpDiscoveryMultiThreadedTest.java | 5 +-
.../ignite/testframework/junits/IgniteMock.java | 5 +
.../junits/multijvm/IgniteProcessProxy.java | 7 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 2 +
modules/rest-http/pom.xml | 6 +
.../http/jetty/GridJettyRestProtocol.java | 4 +-
.../scala/org/apache/ignite/spark/Entity.scala | 2 +-
.../org/apache/ignite/spark/IgniteRDDSpec.scala | 249 +++++++++++++++++++
.../org/apache/ignite/spark/IgniteRddSpec.scala | 249 -------------------
.../org/apache/ignite/IgniteSpringBean.java | 10 +-
30 files changed, 617 insertions(+), 360 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad60979f/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
[06/13] ignite git commit: ignite-1808: Wrong Jetty's thread pool
size settings
Posted by dm...@apache.org.
ignite-1808: Wrong Jetty's thread pool size settings
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/39405aef
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/39405aef
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/39405aef
Branch: refs/heads/master
Commit: 39405aef01c2afb88aad4ef44f9dba8a2e8468b5
Parents: 73c2db5
Author: Roman Shtykh <ap...@gmail.com>
Authored: Wed Nov 4 12:48:54 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Nov 4 12:50:11 2015 +0300
----------------------------------------------------------------------
.../rest/protocols/http/jetty/GridJettyRestProtocol.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/39405aef/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
index 6e201c9..ac49ef6 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
@@ -287,7 +287,7 @@ public class GridJettyRestProtocol extends GridRestProtocolAdapter {
"cannot be cast to integer: " + srvPortStr);
}
- httpSrv = new Server(new QueuedThreadPool(20, 200));
+ httpSrv = new Server(new QueuedThreadPool(200, 20));
ServerConnector srvConn = new ServerConnector(httpSrv, new HttpConnectionFactory(httpCfg));
@@ -421,4 +421,4 @@ public class GridJettyRestProtocol extends GridRestProtocolAdapter {
@Override public String toString() {
return S.toString(GridJettyRestProtocol.class, this);
}
-}
\ No newline at end of file
+}
[10/13] ignite git commit: ignite-1843 Reverted forceKey futures
cancel on stop.
Posted by dm...@apache.org.
ignite-1843 Reverted forceKey futures cancel on stop.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7adfd4a5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7adfd4a5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7adfd4a5
Branch: refs/heads/master
Commit: 7adfd4a5690c235035b776e2ec6addc92b288030
Parents: 0354db1
Author: sboikov <sb...@gridgain.com>
Authored: Wed Nov 4 14:16:42 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Nov 4 14:16:42 2015 +0300
----------------------------------------------------------------------
.../dht/preloader/GridDhtPreloader.java | 20 --------------------
1 file changed, 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7adfd4a5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index fe85968..998c720 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -96,9 +96,6 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
private ConcurrentMap<AffinityTopologyVersion, GridDhtAssignmentFetchFuture> pendingAssignmentFetchFuts =
new ConcurrentHashMap8<>();
- /** Stop flag. */
- private volatile boolean stopping;
-
/** Discovery listener. */
private final GridLocalEventListener discoLsnr = new GridLocalEventListener() {
@Override public void onEvent(Event evt) {
@@ -221,8 +218,6 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
if (log.isDebugEnabled())
log.debug("DHT rebalancer onKernalStop callback.");
- stopping = true;
-
cctx.events().removeListener(discoLsnr);
// Acquire write busy lock.
@@ -234,11 +229,6 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
if (demandPool != null)
demandPool.stop();
- IgniteCheckedException err = stopError();
-
- for (GridDhtForceKeysFuture fut : forceKeyFuts.values())
- fut.onDone(err);
-
top = null;
}
@@ -605,9 +595,6 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
*/
void addFuture(GridDhtForceKeysFuture<?, ?> fut) {
forceKeyFuts.put(fut.futureId(), fut);
-
- if (stopping)
- fut.onDone(stopError());
}
/**
@@ -619,13 +606,6 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
forceKeyFuts.remove(fut.futureId(), fut);
}
- /**
- * @return Node stop exception.
- */
- private IgniteCheckedException stopError() {
- return new IgniteCheckedException("Operation has been cancelled (cache or node is stopping).");
- }
-
/** {@inheritDoc} */
@Override public void dumpDebugInfo() {
if (!forceKeyFuts.isEmpty()) {
[09/13] ignite git commit: Renamed IgniteRddSpec to IgniteRDDSpec
Posted by dm...@apache.org.
Renamed IgniteRddSpec to IgniteRDDSpec
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7944be8e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7944be8e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7944be8e
Branch: refs/heads/master
Commit: 7944be8e6ad3bcad754d6e3f738ce18e6e0431c6
Parents: c66df66
Author: Stephen Boesch <ja...@gmail.com>
Authored: Wed Nov 4 13:39:09 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Nov 4 13:39:09 2015 +0300
----------------------------------------------------------------------
.../scala/org/apache/ignite/spark/Entity.scala | 2 +-
.../org/apache/ignite/spark/IgniteRDDSpec.scala | 249 +++++++++++++++++++
.../apache/ignite/spark/IgniteRddSpec1.scala | 249 -------------------
3 files changed, 250 insertions(+), 250 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7944be8e/modules/spark/src/test/scala/org/apache/ignite/spark/Entity.scala
----------------------------------------------------------------------
diff --git a/modules/spark/src/test/scala/org/apache/ignite/spark/Entity.scala b/modules/spark/src/test/scala/org/apache/ignite/spark/Entity.scala
index e56558d..bef87d5 100644
--- a/modules/spark/src/test/scala/org/apache/ignite/spark/Entity.scala
+++ b/modules/spark/src/test/scala/org/apache/ignite/spark/Entity.scala
@@ -17,7 +17,7 @@
package org.apache.ignite.spark
-import org.apache.ignite.spark.IgniteRddSpec1.ScalarCacheQuerySqlField
+import org.apache.ignite.spark.IgniteRDDSpec.ScalarCacheQuerySqlField
class Entity (
@ScalarCacheQuerySqlField(index = true) val id: Int,
http://git-wip-us.apache.org/repos/asf/ignite/blob/7944be8e/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRDDSpec.scala
----------------------------------------------------------------------
diff --git a/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRDDSpec.scala b/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRDDSpec.scala
new file mode 100644
index 0000000..071897a
--- /dev/null
+++ b/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRDDSpec.scala
@@ -0,0 +1,249 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spark
+
+import org.apache.ignite.Ignition
+import org.apache.ignite.cache.query.annotations.{QueryTextField, QuerySqlField}
+import org.apache.ignite.configuration.{CacheConfiguration, IgniteConfiguration}
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder
+import org.apache.spark.SparkContext
+import org.junit.runner.RunWith
+import org.scalatest._
+import org.scalatest.junit.JUnitRunner
+
+import IgniteRDDSpec._
+
+import scala.annotation.meta.field
+
+@RunWith(classOf[JUnitRunner])
+class IgniteRDDSpec extends FunSpec with Matchers with BeforeAndAfterAll with BeforeAndAfterEach {
+ describe("IgniteRDD") {
+ it("should successfully store data to ignite") {
+ val sc = new SparkContext("local[*]", "test")
+
+ try {
+ val ic = new IgniteContext[String, String](sc,
+ () ⇒ configuration("client", client = true))
+
+ // Save pairs ("0", "val0"), ("1", "val1"), ... to Ignite cache.
+ ic.fromCache(PARTITIONED_CACHE_NAME).savePairs(sc.parallelize(0 to 10000, 2).map(i ⇒ (String.valueOf(i), "val" + i)))
+
+ // Check cache contents.
+ val ignite = Ignition.ignite("grid-0")
+
+ for (i ← 0 to 10000) {
+ val res = ignite.cache[String, String](PARTITIONED_CACHE_NAME).get(String.valueOf(i))
+
+ assert(res != null, "Value was not put to cache for key: " + i)
+ assert("val" + i == res, "Invalid value stored for key: " + i)
+ }
+ }
+ finally {
+ sc.stop()
+ }
+ }
+
+ it("should successfully read data from ignite") {
+ val sc = new SparkContext("local[*]", "test")
+
+ try {
+ val cache = Ignition.ignite("grid-0").cache[String, Int](PARTITIONED_CACHE_NAME)
+
+ val num = 10000
+
+ for (i ← 0 to num) {
+ cache.put(String.valueOf(i), i)
+ }
+
+ val ic = new IgniteContext[String, Int](sc,
+ () ⇒ configuration("client", client = true))
+
+ val res = ic.fromCache(PARTITIONED_CACHE_NAME).map(_._2).sum()
+
+ assert(res == (0 to num).sum)
+ }
+ finally {
+ sc.stop()
+ }
+ }
+
+ it("should successfully query objects from ignite") {
+ val sc = new SparkContext("local[*]", "test")
+
+ try {
+ val ic = new IgniteContext[String, Entity](sc,
+ () ⇒ configuration("client", client = true))
+
+ val cache: IgniteRDD[String, Entity] = ic.fromCache(PARTITIONED_CACHE_NAME)
+
+ cache.savePairs(sc.parallelize(0 to 1000, 2).map(i ⇒ (String.valueOf(i), new Entity(i, "name" + i, i * 100))))
+
+ val res: Array[Entity] = cache.objectSql("Entity", "name = ? and salary = ?", "name50", 5000).map(_._2).collect()
+
+ assert(res.length == 1, "Invalid result length")
+ assert(50 == res(0).id, "Invalid result")
+ assert("name50" == res(0).name, "Invalid result")
+ assert(5000 == res(0).salary)
+
+ assert(500 == cache.objectSql("Entity", "id > 500").count(), "Invalid count")
+ }
+ finally {
+ sc.stop()
+ }
+ }
+
+ it("should successfully query fields from ignite") {
+ val sc = new SparkContext("local[*]", "test")
+
+ try {
+ val ic = new IgniteContext[String, Entity](sc,
+ () ⇒ configuration("client", client = true))
+
+ val cache: IgniteRDD[String, Entity] = ic.fromCache(PARTITIONED_CACHE_NAME)
+
+ import ic.sqlContext.implicits._
+
+ cache.savePairs(sc.parallelize(0 to 1000, 2).map(i ⇒ (String.valueOf(i), new Entity(i, "name" + i, i * 100))))
+
+ val df = cache.sql("select id, name, salary from Entity where name = ? and salary = ?", "name50", 5000)
+
+ df.printSchema()
+
+ val res = df.collect()
+
+ assert(res.length == 1, "Invalid result length")
+ assert(50 == res(0)(0), "Invalid result")
+ assert("name50" == res(0)(1), "Invalid result")
+ assert(5000 == res(0)(2), "Invalid result")
+
+ val df0 = cache.sql("select id, name, salary from Entity").where('NAME === "name50" and 'SALARY === 5000)
+
+ val res0 = df0.collect()
+
+ assert(res0.length == 1, "Invalid result length")
+ assert(50 == res0(0)(0), "Invalid result")
+ assert("name50" == res0(0)(1), "Invalid result")
+ assert(5000 == res0(0)(2), "Invalid result")
+
+ assert(500 == cache.sql("select id from Entity where id > 500").count(), "Invalid count")
+ }
+ finally {
+ sc.stop()
+ }
+ }
+
+ it("should successfully start spark context with XML configuration") {
+ val sc = new SparkContext("local[*]", "test")
+
+ try {
+ val ic = new IgniteContext[String, String](sc,
+ "modules/core/src/test/config/spark/spark-config.xml")
+
+ val cache: IgniteRDD[String, String] = ic.fromCache(PARTITIONED_CACHE_NAME)
+
+ cache.savePairs(sc.parallelize(1 to 1000, 2).map(i ⇒ (String.valueOf(i), "val" + i)))
+
+ assert(1000 == cache.count())
+ }
+ finally {
+ sc.stop()
+ }
+ }
+ }
+
+ override protected def beforeEach() = {
+ Ignition.ignite("grid-0").cache(PARTITIONED_CACHE_NAME).removeAll()
+ }
+
+ override protected def afterEach() = {
+ Ignition.stop("client", false)
+ }
+
+ override protected def beforeAll() = {
+ for (i ← 0 to 3) {
+ Ignition.start(configuration("grid-" + i, client = false))
+ }
+ }
+
+ override protected def afterAll() = {
+ for (i ← 0 to 3) {
+ Ignition.stop("grid-" + i, false)
+ }
+ }
+}
+
+/**
+ * Constants and utility methods.
+ */
+object IgniteRDDSpec {
+ /** IP finder for the test. */
+ val IP_FINDER = new TcpDiscoveryVmIpFinder(true)
+
+ /** Partitioned cache name. */
+ val PARTITIONED_CACHE_NAME = "partitioned"
+
+ /** Type alias for `QuerySqlField`. */
+ type ScalarCacheQuerySqlField = QuerySqlField @field
+
+ /** Type alias for `QueryTextField`. */
+ type ScalarCacheQueryTextField = QueryTextField @field
+
+ /**
+ * Gets ignite configuration.
+ *
+ * @param gridName Grid name.
+ * @param client Client mode flag.
+ * @return Ignite configuration.
+ */
+ def configuration(gridName: String, client: Boolean): IgniteConfiguration = {
+ val cfg = new IgniteConfiguration
+
+ val discoSpi = new TcpDiscoverySpi
+
+ discoSpi.setIpFinder(IgniteRDDSpec.IP_FINDER)
+
+ cfg.setDiscoverySpi(discoSpi)
+
+ cfg.setCacheConfiguration(cacheConfiguration(gridName))
+
+ cfg.setClientMode(client)
+
+ cfg.setGridName(gridName)
+
+ cfg
+ }
+
+ /**
+ * Gets cache configuration for the given grid name.
+ *
+ * @param gridName Grid name.
+ * @return Cache configuration.
+ */
+ def cacheConfiguration(gridName: String): CacheConfiguration[Object, Object] = {
+ val ccfg = new CacheConfiguration[Object, Object]()
+
+ ccfg.setBackups(1)
+
+ ccfg.setName(PARTITIONED_CACHE_NAME)
+
+ ccfg.setIndexedTypes(classOf[String], classOf[Entity])
+
+ ccfg
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7944be8e/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec1.scala
----------------------------------------------------------------------
diff --git a/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec1.scala b/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec1.scala
deleted file mode 100644
index 3ef3225..0000000
--- a/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec1.scala
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spark
-
-import org.apache.ignite.Ignition
-import org.apache.ignite.cache.query.annotations.{QueryTextField, QuerySqlField}
-import org.apache.ignite.configuration.{CacheConfiguration, IgniteConfiguration}
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder
-import org.apache.spark.SparkContext
-import org.junit.runner.RunWith
-import org.scalatest._
-import org.scalatest.junit.JUnitRunner
-
-import IgniteRddSpec1._
-
-import scala.annotation.meta.field
-
-@RunWith(classOf[JUnitRunner])
-class IgniteRddSpec1 extends FunSpec with Matchers with BeforeAndAfterAll with BeforeAndAfterEach {
- describe("IgniteRDD") {
- it("should successfully store data to ignite") {
- val sc = new SparkContext("local[*]", "test")
-
- try {
- val ic = new IgniteContext[String, String](sc,
- () ⇒ configuration("client", client = true))
-
- // Save pairs ("0", "val0"), ("1", "val1"), ... to Ignite cache.
- ic.fromCache(PARTITIONED_CACHE_NAME).savePairs(sc.parallelize(0 to 10000, 2).map(i ⇒ (String.valueOf(i), "val" + i)))
-
- // Check cache contents.
- val ignite = Ignition.ignite("grid-0")
-
- for (i ← 0 to 10000) {
- val res = ignite.cache[String, String](PARTITIONED_CACHE_NAME).get(String.valueOf(i))
-
- assert(res != null, "Value was not put to cache for key: " + i)
- assert("val" + i == res, "Invalid value stored for key: " + i)
- }
- }
- finally {
- sc.stop()
- }
- }
-
- it("should successfully read data from ignite") {
- val sc = new SparkContext("local[*]", "test")
-
- try {
- val cache = Ignition.ignite("grid-0").cache[String, Int](PARTITIONED_CACHE_NAME)
-
- val num = 10000
-
- for (i ← 0 to num) {
- cache.put(String.valueOf(i), i)
- }
-
- val ic = new IgniteContext[String, Int](sc,
- () ⇒ configuration("client", client = true))
-
- val res = ic.fromCache(PARTITIONED_CACHE_NAME).map(_._2).sum()
-
- assert(res == (0 to num).sum)
- }
- finally {
- sc.stop()
- }
- }
-
- it("should successfully query objects from ignite") {
- val sc = new SparkContext("local[*]", "test")
-
- try {
- val ic = new IgniteContext[String, Entity](sc,
- () ⇒ configuration("client", client = true))
-
- val cache: IgniteRDD[String, Entity] = ic.fromCache(PARTITIONED_CACHE_NAME)
-
- cache.savePairs(sc.parallelize(0 to 1000, 2).map(i ⇒ (String.valueOf(i), new Entity(i, "name" + i, i * 100))))
-
- val res: Array[Entity] = cache.objectSql("Entity", "name = ? and salary = ?", "name50", 5000).map(_._2).collect()
-
- assert(res.length == 1, "Invalid result length")
- assert(50 == res(0).id, "Invalid result")
- assert("name50" == res(0).name, "Invalid result")
- assert(5000 == res(0).salary)
-
- assert(500 == cache.objectSql("Entity", "id > 500").count(), "Invalid count")
- }
- finally {
- sc.stop()
- }
- }
-
- it("should successfully query fields from ignite") {
- val sc = new SparkContext("local[*]", "test")
-
- try {
- val ic = new IgniteContext[String, Entity](sc,
- () ⇒ configuration("client", client = true))
-
- val cache: IgniteRDD[String, Entity] = ic.fromCache(PARTITIONED_CACHE_NAME)
-
- import ic.sqlContext.implicits._
-
- cache.savePairs(sc.parallelize(0 to 1000, 2).map(i ⇒ (String.valueOf(i), new Entity(i, "name" + i, i * 100))))
-
- val df = cache.sql("select id, name, salary from Entity where name = ? and salary = ?", "name50", 5000)
-
- df.printSchema()
-
- val res = df.collect()
-
- assert(res.length == 1, "Invalid result length")
- assert(50 == res(0)(0), "Invalid result")
- assert("name50" == res(0)(1), "Invalid result")
- assert(5000 == res(0)(2), "Invalid result")
-
- val df0 = cache.sql("select id, name, salary from Entity").where('NAME === "name50" and 'SALARY === 5000)
-
- val res0 = df0.collect()
-
- assert(res0.length == 1, "Invalid result length")
- assert(50 == res0(0)(0), "Invalid result")
- assert("name50" == res0(0)(1), "Invalid result")
- assert(5000 == res0(0)(2), "Invalid result")
-
- assert(500 == cache.sql("select id from Entity where id > 500").count(), "Invalid count")
- }
- finally {
- sc.stop()
- }
- }
-
- it("should successfully start spark context with XML configuration") {
- val sc = new SparkContext("local[*]", "test")
-
- try {
- val ic = new IgniteContext[String, String](sc,
- "modules/core/src/test/config/spark/spark-config.xml")
-
- val cache: IgniteRDD[String, String] = ic.fromCache(PARTITIONED_CACHE_NAME)
-
- cache.savePairs(sc.parallelize(1 to 1000, 2).map(i ⇒ (String.valueOf(i), "val" + i)))
-
- assert(1000 == cache.count())
- }
- finally {
- sc.stop()
- }
- }
- }
-
- override protected def beforeEach() = {
- Ignition.ignite("grid-0").cache(PARTITIONED_CACHE_NAME).removeAll()
- }
-
- override protected def afterEach() = {
- Ignition.stop("client", false)
- }
-
- override protected def beforeAll() = {
- for (i ← 0 to 3) {
- Ignition.start(configuration("grid-" + i, client = false))
- }
- }
-
- override protected def afterAll() = {
- for (i ← 0 to 3) {
- Ignition.stop("grid-" + i, false)
- }
- }
-}
-
-/**
- * Constants and utility methods.
- */
-object IgniteRddSpec1 {
- /** IP finder for the test. */
- val IP_FINDER = new TcpDiscoveryVmIpFinder(true)
-
- /** Partitioned cache name. */
- val PARTITIONED_CACHE_NAME = "partitioned"
-
- /** Type alias for `QuerySqlField`. */
- type ScalarCacheQuerySqlField = QuerySqlField @field
-
- /** Type alias for `QueryTextField`. */
- type ScalarCacheQueryTextField = QueryTextField @field
-
- /**
- * Gets ignite configuration.
- *
- * @param gridName Grid name.
- * @param client Client mode flag.
- * @return Ignite configuration.
- */
- def configuration(gridName: String, client: Boolean): IgniteConfiguration = {
- val cfg = new IgniteConfiguration
-
- val discoSpi = new TcpDiscoverySpi
-
- discoSpi.setIpFinder(IgniteRddSpec1.IP_FINDER)
-
- cfg.setDiscoverySpi(discoSpi)
-
- cfg.setCacheConfiguration(cacheConfiguration(gridName))
-
- cfg.setClientMode(client)
-
- cfg.setGridName(gridName)
-
- cfg
- }
-
- /**
- * Gets cache configuration for the given grid name.
- *
- * @param gridName Grid name.
- * @return Cache configuration.
- */
- def cacheConfiguration(gridName: String): CacheConfiguration[Object, Object] = {
- val ccfg = new CacheConfiguration[Object, Object]()
-
- ccfg.setBackups(1)
-
- ccfg.setName(PARTITIONED_CACHE_NAME)
-
- ccfg.setIndexedTypes(classOf[String], classOf[Entity])
-
- ccfg
- }
-}
[08/13] ignite git commit: Renamed IgniteRddSpec to IgniteRDDSpec
Posted by dm...@apache.org.
Renamed IgniteRddSpec to IgniteRDDSpec
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c66df66c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c66df66c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c66df66c
Branch: refs/heads/master
Commit: c66df66c24a9e9dbee5caca459555fae7c2b2eb8
Parents: 39405ae
Author: Stephen Boesch <ja...@gmail.com>
Authored: Wed Nov 4 13:38:13 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Nov 4 13:38:13 2015 +0300
----------------------------------------------------------------------
.../scala/org/apache/ignite/spark/Entity.scala | 2 +-
.../org/apache/ignite/spark/IgniteRddSpec.scala | 249 -------------------
.../apache/ignite/spark/IgniteRddSpec1.scala | 249 +++++++++++++++++++
3 files changed, 250 insertions(+), 250 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c66df66c/modules/spark/src/test/scala/org/apache/ignite/spark/Entity.scala
----------------------------------------------------------------------
diff --git a/modules/spark/src/test/scala/org/apache/ignite/spark/Entity.scala b/modules/spark/src/test/scala/org/apache/ignite/spark/Entity.scala
index 00beac6..e56558d 100644
--- a/modules/spark/src/test/scala/org/apache/ignite/spark/Entity.scala
+++ b/modules/spark/src/test/scala/org/apache/ignite/spark/Entity.scala
@@ -17,7 +17,7 @@
package org.apache.ignite.spark
-import org.apache.ignite.spark.IgniteRddSpec.ScalarCacheQuerySqlField
+import org.apache.ignite.spark.IgniteRddSpec1.ScalarCacheQuerySqlField
class Entity (
@ScalarCacheQuerySqlField(index = true) val id: Int,
http://git-wip-us.apache.org/repos/asf/ignite/blob/c66df66c/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec.scala
----------------------------------------------------------------------
diff --git a/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec.scala b/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec.scala
deleted file mode 100644
index 8fa6949..0000000
--- a/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec.scala
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spark
-
-import org.apache.ignite.Ignition
-import org.apache.ignite.cache.query.annotations.{QueryTextField, QuerySqlField}
-import org.apache.ignite.configuration.{CacheConfiguration, IgniteConfiguration}
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder
-import org.apache.spark.SparkContext
-import org.junit.runner.RunWith
-import org.scalatest._
-import org.scalatest.junit.JUnitRunner
-
-import IgniteRddSpec._
-
-import scala.annotation.meta.field
-
-@RunWith(classOf[JUnitRunner])
-class IgniteRddSpec extends FunSpec with Matchers with BeforeAndAfterAll with BeforeAndAfterEach {
- describe("IgniteRDD") {
- it("should successfully store data to ignite") {
- val sc = new SparkContext("local[*]", "test")
-
- try {
- val ic = new IgniteContext[String, String](sc,
- () ⇒ configuration("client", client = true))
-
- // Save pairs ("0", "val0"), ("1", "val1"), ... to Ignite cache.
- ic.fromCache(PARTITIONED_CACHE_NAME).savePairs(sc.parallelize(0 to 10000, 2).map(i ⇒ (String.valueOf(i), "val" + i)))
-
- // Check cache contents.
- val ignite = Ignition.ignite("grid-0")
-
- for (i ← 0 to 10000) {
- val res = ignite.cache[String, String](PARTITIONED_CACHE_NAME).get(String.valueOf(i))
-
- assert(res != null, "Value was not put to cache for key: " + i)
- assert("val" + i == res, "Invalid value stored for key: " + i)
- }
- }
- finally {
- sc.stop()
- }
- }
-
- it("should successfully read data from ignite") {
- val sc = new SparkContext("local[*]", "test")
-
- try {
- val cache = Ignition.ignite("grid-0").cache[String, Int](PARTITIONED_CACHE_NAME)
-
- val num = 10000
-
- for (i ← 0 to num) {
- cache.put(String.valueOf(i), i)
- }
-
- val ic = new IgniteContext[String, Int](sc,
- () ⇒ configuration("client", client = true))
-
- val res = ic.fromCache(PARTITIONED_CACHE_NAME).map(_._2).sum()
-
- assert(res == (0 to num).sum)
- }
- finally {
- sc.stop()
- }
- }
-
- it("should successfully query objects from ignite") {
- val sc = new SparkContext("local[*]", "test")
-
- try {
- val ic = new IgniteContext[String, Entity](sc,
- () ⇒ configuration("client", client = true))
-
- val cache: IgniteRDD[String, Entity] = ic.fromCache(PARTITIONED_CACHE_NAME)
-
- cache.savePairs(sc.parallelize(0 to 1000, 2).map(i ⇒ (String.valueOf(i), new Entity(i, "name" + i, i * 100))))
-
- val res: Array[Entity] = cache.objectSql("Entity", "name = ? and salary = ?", "name50", 5000).map(_._2).collect()
-
- assert(res.length == 1, "Invalid result length")
- assert(50 == res(0).id, "Invalid result")
- assert("name50" == res(0).name, "Invalid result")
- assert(5000 == res(0).salary)
-
- assert(500 == cache.objectSql("Entity", "id > 500").count(), "Invalid count")
- }
- finally {
- sc.stop()
- }
- }
-
- it("should successfully query fields from ignite") {
- val sc = new SparkContext("local[*]", "test")
-
- try {
- val ic = new IgniteContext[String, Entity](sc,
- () ⇒ configuration("client", client = true))
-
- val cache: IgniteRDD[String, Entity] = ic.fromCache(PARTITIONED_CACHE_NAME)
-
- import ic.sqlContext.implicits._
-
- cache.savePairs(sc.parallelize(0 to 1000, 2).map(i ⇒ (String.valueOf(i), new Entity(i, "name" + i, i * 100))))
-
- val df = cache.sql("select id, name, salary from Entity where name = ? and salary = ?", "name50", 5000)
-
- df.printSchema()
-
- val res = df.collect()
-
- assert(res.length == 1, "Invalid result length")
- assert(50 == res(0)(0), "Invalid result")
- assert("name50" == res(0)(1), "Invalid result")
- assert(5000 == res(0)(2), "Invalid result")
-
- val df0 = cache.sql("select id, name, salary from Entity").where('NAME === "name50" and 'SALARY === 5000)
-
- val res0 = df0.collect()
-
- assert(res0.length == 1, "Invalid result length")
- assert(50 == res0(0)(0), "Invalid result")
- assert("name50" == res0(0)(1), "Invalid result")
- assert(5000 == res0(0)(2), "Invalid result")
-
- assert(500 == cache.sql("select id from Entity where id > 500").count(), "Invalid count")
- }
- finally {
- sc.stop()
- }
- }
-
- it("should successfully start spark context with XML configuration") {
- val sc = new SparkContext("local[*]", "test")
-
- try {
- val ic = new IgniteContext[String, String](sc,
- "modules/core/src/test/config/spark/spark-config.xml")
-
- val cache: IgniteRDD[String, String] = ic.fromCache(PARTITIONED_CACHE_NAME)
-
- cache.savePairs(sc.parallelize(1 to 1000, 2).map(i ⇒ (String.valueOf(i), "val" + i)))
-
- assert(1000 == cache.count())
- }
- finally {
- sc.stop()
- }
- }
- }
-
- override protected def beforeEach() = {
- Ignition.ignite("grid-0").cache(PARTITIONED_CACHE_NAME).removeAll()
- }
-
- override protected def afterEach() = {
- Ignition.stop("client", false)
- }
-
- override protected def beforeAll() = {
- for (i ← 0 to 3) {
- Ignition.start(configuration("grid-" + i, client = false))
- }
- }
-
- override protected def afterAll() = {
- for (i ← 0 to 3) {
- Ignition.stop("grid-" + i, false)
- }
- }
-}
-
-/**
- * Constants and utility methods.
- */
-object IgniteRddSpec {
- /** IP finder for the test. */
- val IP_FINDER = new TcpDiscoveryVmIpFinder(true)
-
- /** Partitioned cache name. */
- val PARTITIONED_CACHE_NAME = "partitioned"
-
- /** Type alias for `QuerySqlField`. */
- type ScalarCacheQuerySqlField = QuerySqlField @field
-
- /** Type alias for `QueryTextField`. */
- type ScalarCacheQueryTextField = QueryTextField @field
-
- /**
- * Gets ignite configuration.
- *
- * @param gridName Grid name.
- * @param client Client mode flag.
- * @return Ignite configuration.
- */
- def configuration(gridName: String, client: Boolean): IgniteConfiguration = {
- val cfg = new IgniteConfiguration
-
- val discoSpi = new TcpDiscoverySpi
-
- discoSpi.setIpFinder(IgniteRddSpec.IP_FINDER)
-
- cfg.setDiscoverySpi(discoSpi)
-
- cfg.setCacheConfiguration(cacheConfiguration(gridName))
-
- cfg.setClientMode(client)
-
- cfg.setGridName(gridName)
-
- cfg
- }
-
- /**
- * Gets cache configuration for the given grid name.
- *
- * @param gridName Grid name.
- * @return Cache configuration.
- */
- def cacheConfiguration(gridName: String): CacheConfiguration[Object, Object] = {
- val ccfg = new CacheConfiguration[Object, Object]()
-
- ccfg.setBackups(1)
-
- ccfg.setName(PARTITIONED_CACHE_NAME)
-
- ccfg.setIndexedTypes(classOf[String], classOf[Entity])
-
- ccfg
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c66df66c/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec1.scala
----------------------------------------------------------------------
diff --git a/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec1.scala b/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec1.scala
new file mode 100644
index 0000000..3ef3225
--- /dev/null
+++ b/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec1.scala
@@ -0,0 +1,249 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spark
+
+import org.apache.ignite.Ignition
+import org.apache.ignite.cache.query.annotations.{QueryTextField, QuerySqlField}
+import org.apache.ignite.configuration.{CacheConfiguration, IgniteConfiguration}
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder
+import org.apache.spark.SparkContext
+import org.junit.runner.RunWith
+import org.scalatest._
+import org.scalatest.junit.JUnitRunner
+
+import IgniteRddSpec1._
+
+import scala.annotation.meta.field
+
+@RunWith(classOf[JUnitRunner])
+class IgniteRddSpec1 extends FunSpec with Matchers with BeforeAndAfterAll with BeforeAndAfterEach {
+ describe("IgniteRDD") {
+ it("should successfully store data to ignite") {
+ val sc = new SparkContext("local[*]", "test")
+
+ try {
+ val ic = new IgniteContext[String, String](sc,
+ () ⇒ configuration("client", client = true))
+
+ // Save pairs ("0", "val0"), ("1", "val1"), ... to Ignite cache.
+ ic.fromCache(PARTITIONED_CACHE_NAME).savePairs(sc.parallelize(0 to 10000, 2).map(i ⇒ (String.valueOf(i), "val" + i)))
+
+ // Check cache contents.
+ val ignite = Ignition.ignite("grid-0")
+
+ for (i ← 0 to 10000) {
+ val res = ignite.cache[String, String](PARTITIONED_CACHE_NAME).get(String.valueOf(i))
+
+ assert(res != null, "Value was not put to cache for key: " + i)
+ assert("val" + i == res, "Invalid value stored for key: " + i)
+ }
+ }
+ finally {
+ sc.stop()
+ }
+ }
+
+ it("should successfully read data from ignite") {
+ val sc = new SparkContext("local[*]", "test")
+
+ try {
+ val cache = Ignition.ignite("grid-0").cache[String, Int](PARTITIONED_CACHE_NAME)
+
+ val num = 10000
+
+ for (i ← 0 to num) {
+ cache.put(String.valueOf(i), i)
+ }
+
+ val ic = new IgniteContext[String, Int](sc,
+ () ⇒ configuration("client", client = true))
+
+ val res = ic.fromCache(PARTITIONED_CACHE_NAME).map(_._2).sum()
+
+ assert(res == (0 to num).sum)
+ }
+ finally {
+ sc.stop()
+ }
+ }
+
+ it("should successfully query objects from ignite") {
+ val sc = new SparkContext("local[*]", "test")
+
+ try {
+ val ic = new IgniteContext[String, Entity](sc,
+ () ⇒ configuration("client", client = true))
+
+ val cache: IgniteRDD[String, Entity] = ic.fromCache(PARTITIONED_CACHE_NAME)
+
+ cache.savePairs(sc.parallelize(0 to 1000, 2).map(i ⇒ (String.valueOf(i), new Entity(i, "name" + i, i * 100))))
+
+ val res: Array[Entity] = cache.objectSql("Entity", "name = ? and salary = ?", "name50", 5000).map(_._2).collect()
+
+ assert(res.length == 1, "Invalid result length")
+ assert(50 == res(0).id, "Invalid result")
+ assert("name50" == res(0).name, "Invalid result")
+ assert(5000 == res(0).salary)
+
+ assert(500 == cache.objectSql("Entity", "id > 500").count(), "Invalid count")
+ }
+ finally {
+ sc.stop()
+ }
+ }
+
+ it("should successfully query fields from ignite") {
+ val sc = new SparkContext("local[*]", "test")
+
+ try {
+ val ic = new IgniteContext[String, Entity](sc,
+ () ⇒ configuration("client", client = true))
+
+ val cache: IgniteRDD[String, Entity] = ic.fromCache(PARTITIONED_CACHE_NAME)
+
+ import ic.sqlContext.implicits._
+
+ cache.savePairs(sc.parallelize(0 to 1000, 2).map(i ⇒ (String.valueOf(i), new Entity(i, "name" + i, i * 100))))
+
+ val df = cache.sql("select id, name, salary from Entity where name = ? and salary = ?", "name50", 5000)
+
+ df.printSchema()
+
+ val res = df.collect()
+
+ assert(res.length == 1, "Invalid result length")
+ assert(50 == res(0)(0), "Invalid result")
+ assert("name50" == res(0)(1), "Invalid result")
+ assert(5000 == res(0)(2), "Invalid result")
+
+ val df0 = cache.sql("select id, name, salary from Entity").where('NAME === "name50" and 'SALARY === 5000)
+
+ val res0 = df0.collect()
+
+ assert(res0.length == 1, "Invalid result length")
+ assert(50 == res0(0)(0), "Invalid result")
+ assert("name50" == res0(0)(1), "Invalid result")
+ assert(5000 == res0(0)(2), "Invalid result")
+
+ assert(500 == cache.sql("select id from Entity where id > 500").count(), "Invalid count")
+ }
+ finally {
+ sc.stop()
+ }
+ }
+
+ it("should successfully start spark context with XML configuration") {
+ val sc = new SparkContext("local[*]", "test")
+
+ try {
+ val ic = new IgniteContext[String, String](sc,
+ "modules/core/src/test/config/spark/spark-config.xml")
+
+ val cache: IgniteRDD[String, String] = ic.fromCache(PARTITIONED_CACHE_NAME)
+
+ cache.savePairs(sc.parallelize(1 to 1000, 2).map(i ⇒ (String.valueOf(i), "val" + i)))
+
+ assert(1000 == cache.count())
+ }
+ finally {
+ sc.stop()
+ }
+ }
+ }
+
+ override protected def beforeEach() = {
+ Ignition.ignite("grid-0").cache(PARTITIONED_CACHE_NAME).removeAll()
+ }
+
+ override protected def afterEach() = {
+ Ignition.stop("client", false)
+ }
+
+ override protected def beforeAll() = {
+ for (i ← 0 to 3) {
+ Ignition.start(configuration("grid-" + i, client = false))
+ }
+ }
+
+ override protected def afterAll() = {
+ for (i ← 0 to 3) {
+ Ignition.stop("grid-" + i, false)
+ }
+ }
+}
+
+/**
+ * Constants and utility methods.
+ */
+object IgniteRddSpec1 {
+ /** IP finder for the test. */
+ val IP_FINDER = new TcpDiscoveryVmIpFinder(true)
+
+ /** Partitioned cache name. */
+ val PARTITIONED_CACHE_NAME = "partitioned"
+
+ /** Type alias for `QuerySqlField`. */
+ type ScalarCacheQuerySqlField = QuerySqlField @field
+
+ /** Type alias for `QueryTextField`. */
+ type ScalarCacheQueryTextField = QueryTextField @field
+
+ /**
+ * Gets ignite configuration.
+ *
+ * @param gridName Grid name.
+ * @param client Client mode flag.
+ * @return Ignite configuration.
+ */
+ def configuration(gridName: String, client: Boolean): IgniteConfiguration = {
+ val cfg = new IgniteConfiguration
+
+ val discoSpi = new TcpDiscoverySpi
+
+ discoSpi.setIpFinder(IgniteRddSpec1.IP_FINDER)
+
+ cfg.setDiscoverySpi(discoSpi)
+
+ cfg.setCacheConfiguration(cacheConfiguration(gridName))
+
+ cfg.setClientMode(client)
+
+ cfg.setGridName(gridName)
+
+ cfg
+ }
+
+ /**
+ * Gets cache configuration for the given grid name.
+ *
+ * @param gridName Grid name.
+ * @return Cache configuration.
+ */
+ def cacheConfiguration(gridName: String): CacheConfiguration[Object, Object] = {
+ val ccfg = new CacheConfiguration[Object, Object]()
+
+ ccfg.setBackups(1)
+
+ ccfg.setName(PARTITIONED_CACHE_NAME)
+
+ ccfg.setIndexedTypes(classOf[String], classOf[Entity])
+
+ ccfg
+ }
+}