You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2018/12/06 16:26:49 UTC
[01/50] [abbrv] ignite git commit: IGNITE-10374 Fixed race leading to
rebalancing hang when WAL is disabled during rebalancing - Fixes #5468.
Repository: ignite
Updated Branches:
refs/heads/ignite-10044 216474c6b -> 89ec0339d
IGNITE-10374 Fixed race leading to rebalancing hang when WAL is disabled during rebalancing - Fixes #5468.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/493e0aa9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/493e0aa9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/493e0aa9
Branch: refs/heads/ignite-10044
Commit: 493e0aa9e8451d36ff504560cc5309e8cd04a616
Parents: d36055e
Author: Sergey Chugunov <se...@gmail.com>
Authored: Sat Dec 1 19:33:14 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Sat Dec 1 19:34:39 2018 +0300
----------------------------------------------------------------------
.../processors/cache/WalStateManager.java | 4 +-
.../GridDhtPartitionsExchangeFuture.java | 3 +-
.../dht/preloader/GridDhtPreloader.java | 35 +--
.../topology/GridClientPartitionTopology.java | 2 +-
.../dht/topology/GridDhtPartitionTopology.java | 4 +-
.../topology/GridDhtPartitionTopologyImpl.java | 17 +-
.../cache/persistence/CheckpointFuture.java | 2 +-
.../GridCacheDatabaseSharedManager.java | 2 +-
...itePdsCacheWalDisabledOnRebalancingTest.java | 266 +++++++++++++++++++
.../ignite/testsuites/IgnitePdsTestSuite4.java | 3 +
10 files changed, 293 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/493e0aa9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/WalStateManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/WalStateManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/WalStateManager.java
index d17f20f..ed62cad 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/WalStateManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/WalStateManager.java
@@ -473,7 +473,7 @@ public class WalStateManager extends GridCacheSharedManagerAdapter {
public void onGroupRebalanceFinished(int grpId, AffinityTopologyVersion topVer) {
TemporaryDisabledWal session0 = tmpDisabledWal;
- if (session0 == null || !session0.topVer.equals(topVer))
+ if (session0 == null || session0.topVer.compareTo(topVer) > 0)
return;
session0.remainingGrps.remove(grpId);
@@ -506,7 +506,7 @@ public class WalStateManager extends GridCacheSharedManagerAdapter {
assert grp != null;
- grp.topology().ownMoving(session0.topVer);
+ grp.topology().ownMoving(topVer);
}
cctx.exchange().refreshPartitions();
http://git-wip-us.apache.org/repos/asf/ignite/blob/493e0aa9/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 3384bb9..1eba8b4 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
@@ -2101,7 +2101,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
grp.topology().onExchangeDone(this, grp.affinity().readyAffinity(res), false);
}
- cctx.walState().changeLocalStatesOnExchangeDone(res);
+ if (changedAffinity())
+ cctx.walState().changeLocalStatesOnExchangeDone(res);
}
final Throwable err0 = err;
http://git-wip-us.apache.org/repos/asf/ignite/blob/493e0aa9/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 eed0816..c8705d0 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
@@ -23,7 +23,6 @@ import java.util.List;
import java.util.UUID;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.stream.Collectors;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -186,38 +185,10 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
if (rebFut.isDone() && !rebFut.result())
return true; // Required, previous rebalance cancelled.
- final AffinityTopologyVersion exchTopVer = exchFut.context().events().topologyVersion();
+ AffinityTopologyVersion lastAffChangeTopVer =
+ ctx.exchange().lastAffinityChangedTopologyVersion(exchFut.topologyVersion());
- Collection<UUID> aliveNodes = ctx.discovery().aliveServerNodes().stream()
- .map(ClusterNode::id)
- .collect(Collectors.toList());
-
- return assignmentsChanged(rebTopVer, exchTopVer) ||
- !aliveNodes.containsAll(demander.remainingNodes()); // Some of nodes left before rabalance compelete.
- }
-
- /**
- * @param oldTopVer Previous topology version.
- * @param newTopVer New topology version to check result.
- * @return {@code True} if affinity assignments changed between two versions for local node.
- */
- private boolean assignmentsChanged(AffinityTopologyVersion oldTopVer, AffinityTopologyVersion newTopVer) {
- final AffinityAssignment aff = grp.affinity().readyAffinity(newTopVer);
-
- // We should get affinity assignments based on previous rebalance to calculate difference.
- // Whole history size described by IGNITE_AFFINITY_HISTORY_SIZE constant.
- final AffinityAssignment prevAff = grp.affinity().cachedVersions().contains(oldTopVer) ?
- grp.affinity().cachedAffinity(oldTopVer) : null;
-
- if (prevAff == null)
- return false;
-
- boolean assignsChanged = false;
-
- for (int p = 0; !assignsChanged && p < grp.affinity().partitions(); p++)
- assignsChanged |= aff.get(p).contains(ctx.localNode()) != prevAff.get(p).contains(ctx.localNode());
-
- return assignsChanged;
+ return lastAffChangeTopVer.compareTo(rebTopVer) > 0;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/493e0aa9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridClientPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridClientPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridClientPartitionTopology.java
index fc8975b..9fb6825 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridClientPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridClientPartitionTopology.java
@@ -1110,7 +1110,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
}
/** {@inheritDoc} */
- @Override public void ownMoving(AffinityTopologyVersion topVer) {
+ @Override public void ownMoving(AffinityTopologyVersion rebFinishedTopVer) {
// No-op
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/493e0aa9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopology.java
index 81eab84..4b1e5a6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopology.java
@@ -373,9 +373,9 @@ public interface GridDhtPartitionTopology {
/**
* Owns all moving partitions for the given topology version.
*
- * @param topVer Topology version.
+ * @param rebFinishedTopVer Topology version when rebalancing finished.
*/
- public void ownMoving(AffinityTopologyVersion topVer);
+ public void ownMoving(AffinityTopologyVersion rebFinishedTopVer);
/**
* @param part Evicted partition.
http://git-wip-us.apache.org/repos/asf/ignite/blob/493e0aa9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java
index 887f3d0..c90d40f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java
@@ -2574,19 +2574,26 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
}
/** {@inheritDoc} */
- @Override public void ownMoving(AffinityTopologyVersion topVer) {
+ @Override public void ownMoving(AffinityTopologyVersion rebFinishedTopVer) {
lock.writeLock().lock();
+ AffinityTopologyVersion lastAffChangeVer = ctx.exchange().lastAffinityChangedTopologyVersion(lastTopChangeVer);
+
+ if (lastAffChangeVer.compareTo(rebFinishedTopVer) > 0)
+ log.info("Affinity topology changed, no MOVING partitions will be owned " +
+ "[rebFinishedTopVer=" + rebFinishedTopVer +
+ ", lastAffChangeVer=" + lastAffChangeVer + "]");
+
try {
for (GridDhtLocalPartition locPart : grp.topology().currentLocalPartitions()) {
if (locPart.state() == MOVING) {
boolean reserved = locPart.reserve();
try {
- if (reserved && locPart.state() == MOVING && lastTopChangeVer.equals(topVer))
- grp.topology().own(locPart);
- else // topology changed, rebalancing must be restarted
- return;
+ if (reserved && locPart.state() == MOVING &&
+ lastAffChangeVer.compareTo(rebFinishedTopVer) <= 0 &&
+ rebFinishedTopVer.compareTo(lastTopChangeVer) <= 0)
+ grp.topology().own(locPart);
}
finally {
if (reserved)
http://git-wip-us.apache.org/repos/asf/ignite/blob/493e0aa9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CheckpointFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CheckpointFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CheckpointFuture.java
index 1c77013..7671738 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CheckpointFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CheckpointFuture.java
@@ -31,5 +31,5 @@ public interface CheckpointFuture {
/**
* @return Finish future.
*/
- public GridFutureAdapter finishFuture();
+ public GridFutureAdapter<Object> finishFuture();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/493e0aa9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index eb52ee6..d610a51 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -4277,7 +4277,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
/** {@inheritDoc} */
- @Override public GridFutureAdapter finishFuture() {
+ @Override public GridFutureAdapter<Object> finishFuture() {
return cpFinishFut;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/493e0aa9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheWalDisabledOnRebalancingTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheWalDisabledOnRebalancingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheWalDisabledOnRebalancingTest.java
new file mode 100644
index 0000000..1246db1
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheWalDisabledOnRebalancingTest.java
@@ -0,0 +1,266 @@
+/*
+ * 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.persistence.db;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.TestRecordingCommunicationSpi;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.mxbean.CacheGroupMetricsMXBean;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR;
+
+/**
+ * Test scenarios with rebalancing, IGNITE_DISABLE_WAL_DURING_REBALANCING optimization and topology changes
+ * such as client nodes join/leave, server nodes from BLT leave/join, server nodes out of BLT join/leave.
+ */
+public class IgnitePdsCacheWalDisabledOnRebalancingTest extends GridCommonAbstractTest {
+ /** Block message predicate to set to Communication SPI in node configuration. */
+ private IgniteBiPredicate<ClusterNode, Message> blockMessagePredicate;
+
+ /** */
+ private static final int CACHE1_PARTS_NUM = 8;
+
+ /** */
+ private static final int CACHE2_PARTS_NUM = 16;
+
+ /** */
+ private static final int CACHE3_PARTS_NUM = 32;
+
+ /** */
+ private static final int CACHE_SIZE = 2_000;
+
+ /** */
+ private static final String CACHE3_NAME = "cache3";
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ cleanPersistenceDir();
+
+ System.setProperty(IgniteSystemProperties.IGNITE_DISABLE_WAL_DURING_REBALANCING, "true");
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ cleanPersistenceDir();
+
+ System.clearProperty(IgniteSystemProperties.IGNITE_DISABLE_WAL_DURING_REBALANCING);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ CacheConfiguration ccfg1 = new CacheConfiguration("cache1")
+ .setAtomicityMode(CacheAtomicityMode.ATOMIC)
+ .setCacheMode(CacheMode.REPLICATED)
+ .setAffinity(new RendezvousAffinityFunction(false, CACHE1_PARTS_NUM));
+
+ CacheConfiguration ccfg2 = new CacheConfiguration("cache2")
+ .setBackups(1)
+ .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+ .setCacheMode(CacheMode.PARTITIONED)
+ .setAffinity(new RendezvousAffinityFunction(false, CACHE2_PARTS_NUM));
+
+ CacheConfiguration ccfg3 = new CacheConfiguration(CACHE3_NAME)
+ .setBackups(2)
+ .setAtomicityMode(CacheAtomicityMode.ATOMIC)
+ .setCacheMode(CacheMode.PARTITIONED)
+ .setAffinity(new RendezvousAffinityFunction(false, CACHE3_PARTS_NUM));
+
+ cfg.setCacheConfiguration(ccfg1, ccfg2, ccfg3);
+
+ if ("client".equals(igniteInstanceName))
+ cfg.setClientMode(true);
+ else {
+ DataStorageConfiguration dsCfg = new DataStorageConfiguration()
+ .setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4)
+ .setWalMode(WALMode.LOG_ONLY)
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration()
+ .setPersistenceEnabled(true)
+ .setMaxSize(256 * 1024 * 1024));
+
+ cfg.setDataStorageConfiguration(dsCfg);
+ }
+
+ TestRecordingCommunicationSpi commSpi = new TestRecordingCommunicationSpi();
+ commSpi.blockMessages(blockMessagePredicate);
+
+ cfg.setCommunicationSpi(commSpi);
+
+
+ return cfg;
+ }
+
+ /**
+ * If client joins topology during rebalancing process, rebalancing finishes successfully,
+ * all partitions are owned as expected when rebalancing finishes.
+ */
+ public void testClientJoinsLeavesDuringRebalancing() throws Exception {
+ Ignite ig0 = startGrids(2);
+
+ ig0.active(true);
+
+ for (int i = 0; i < 3; i++)
+ fillCache(ig0.getOrCreateCache("cache" + i), CACHE_SIZE);
+
+ String ig1Name = "node01-" + grid(1).localNode().consistentId();
+
+ stopGrid(1);
+
+ cleanPersistenceFiles(ig1Name);
+
+ int groupId = ((IgniteEx) ig0).cachex(CACHE3_NAME).context().groupId();
+
+ blockMessagePredicate = (node, msg) -> {
+ if (msg instanceof GridDhtPartitionDemandMessage)
+ return ((GridDhtPartitionDemandMessage) msg).groupId() == groupId;
+
+ return false;
+ };
+
+ IgniteEx ig1 = startGrid(1);
+
+ startGrid("client");
+
+ stopGrid("client");
+
+ CacheGroupMetricsMXBean mxBean = ig1.cachex(CACHE3_NAME).context().group().mxBean();
+
+ assertTrue("Unexpected moving partitions count: " + mxBean.getLocalNodeMovingPartitionsCount(),
+ mxBean.getLocalNodeMovingPartitionsCount() == CACHE3_PARTS_NUM);
+
+ TestRecordingCommunicationSpi commSpi = (TestRecordingCommunicationSpi) ig1
+ .configuration().getCommunicationSpi();
+
+ commSpi.stopBlock();
+
+ boolean waitResult = GridTestUtils.waitForCondition(
+ () -> mxBean.getLocalNodeMovingPartitionsCount() == 0,
+ 30_000);
+
+ assertTrue("Failed to wait for owning all partitions, parts in moving state: "
+ + mxBean.getLocalNodeMovingPartitionsCount(), waitResult);
+ }
+
+ /**
+ * If server nodes from BLT leave topology and then join again after additional keys were put to caches,
+ * rebalance starts.
+ *
+ * Test verifies that all moving partitions get owned after rebalance finishes.
+ *
+ * @throws Exception If failed.
+ */
+ public void testServerNodesFromBltLeavesAndJoinsDuringRebalancing() throws Exception {
+ Ignite ig0 = startGridsMultiThreaded(4);
+
+ fillCache(ig0.cache(CACHE3_NAME), CACHE_SIZE);
+
+ List<Integer> nonAffinityKeys1 = nearKeys(grid(1).cache(CACHE3_NAME), 100, CACHE_SIZE / 2);
+ List<Integer> nonAffinityKeys2 = nearKeys(grid(2).cache(CACHE3_NAME), 100, CACHE_SIZE / 2);
+
+ stopGrid(1);
+ stopGrid(2);
+
+ Set<Integer> nonAffinityKeysSet = new HashSet<>();
+
+ nonAffinityKeysSet.addAll(nonAffinityKeys1);
+ nonAffinityKeysSet.addAll(nonAffinityKeys2);
+
+ fillCache(ig0.cache(CACHE3_NAME), nonAffinityKeysSet);
+
+ int groupId = ((IgniteEx) ig0).cachex(CACHE3_NAME).context().groupId();
+
+ blockMessagePredicate = (node, msg) -> {
+ if (msg instanceof GridDhtPartitionDemandMessage)
+ return ((GridDhtPartitionDemandMessage) msg).groupId() == groupId;
+
+ return false;
+ };
+
+ IgniteEx ig1 = startGrid(1);
+
+ CacheGroupMetricsMXBean mxBean = ig1.cachex(CACHE3_NAME).context().group().mxBean();
+
+ TestRecordingCommunicationSpi commSpi = (TestRecordingCommunicationSpi) ig1
+ .configuration().getCommunicationSpi();
+
+ startGrid(2);
+
+ commSpi.stopBlock();
+
+ boolean allOwned = GridTestUtils.waitForCondition(
+ () -> mxBean.getLocalNodeMovingPartitionsCount() == 0, 30_000);
+
+ assertTrue("Partitions were not owned, there are " + mxBean.getLocalNodeMovingPartitionsCount() +
+ " partitions in MOVING state", allOwned);
+ }
+
+ /** */
+ private void cleanPersistenceFiles(String igName) throws Exception {
+ String ig1DbPath = Paths.get(DFLT_STORE_DIR, igName).toString();
+
+ File igDbDir = U.resolveWorkDirectory(U.defaultWorkDirectory(), ig1DbPath, false);
+
+ U.delete(igDbDir);
+ Files.createDirectory(igDbDir.toPath());
+
+ String ig1DbWalPath = Paths.get(DFLT_STORE_DIR, "wal", igName).toString();
+
+ U.delete(U.resolveWorkDirectory(U.defaultWorkDirectory(), ig1DbWalPath, false));
+ }
+
+ /** */
+ private void fillCache(IgniteCache cache, int cacheSize) {
+ for (int i = 0; i < cacheSize; i++)
+ cache.put(i, "value_" + i);
+ }
+
+ /** */
+ private void fillCache(IgniteCache cache, Collection<Integer> keys) {
+ for (Integer key : keys)
+ cache.put(key, "value_" + key);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/493e0aa9/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
index 027f341..ad6bbbf 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
@@ -23,6 +23,7 @@ import org.apache.ignite.internal.processors.cache.IgniteClusterActivateDeactiva
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsContinuousRestartTestWithSharedGroupAndIndexes;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsRecoveryAfterFileCorruptionTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsTaskCancelingTest;
+import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsCacheWalDisabledOnRebalancingTest;
import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsPageEvictionDuringPartitionClearTest;
import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsPartitionPreloadTest;
import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsTransactionsHangTest;
@@ -50,6 +51,8 @@ public class IgnitePdsTestSuite4 extends TestSuite {
suite.addTestSuite(ResetLostPartitionTest.class);
+ suite.addTestSuite(IgnitePdsCacheWalDisabledOnRebalancingTest.class);
+
return suite;
}
[49/50] [abbrv] ignite git commit: IGNITE-10242 Pause ongoing
rebalance on cache group stopping
Posted by sb...@apache.org.
IGNITE-10242 Pause ongoing rebalance on cache group stopping
Signed-off-by: Pavel Kovalenko <jo...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/025a0360
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/025a0360
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/025a0360
Branch: refs/heads/ignite-10044
Commit: 025a0360c86a5ceb8c3eef2f514c29846081d4c2
Parents: 9199aac
Author: Ivan Daschinskiy <iv...@gmail.com>
Authored: Thu Dec 6 18:51:24 2018 +0300
Committer: Pavel Kovalenko <jo...@gmail.com>
Committed: Thu Dec 6 18:51:24 2018 +0300
----------------------------------------------------------------------
.../GridCachePartitionExchangeManager.java | 4 +-
.../processors/cache/GridCachePreloader.java | 10 +
.../cache/GridCachePreloaderAdapter.java | 10 +
.../processors/cache/GridCacheProcessor.java | 106 ++++---
.../dht/preloader/GridDhtPartitionDemander.java | 3 +
.../GridDhtPartitionSupplyMessage.java | 3 +
.../GridDhtPartitionsExchangeFuture.java | 8 +-
.../preloader/GridDhtPartitionsFullMessage.java | 5 +-
.../dht/preloader/GridDhtPreloader.java | 51 +++-
.../ignite/internal/util/IgniteUtils.java | 66 +++++
...balanceOnCachesStoppingOrDestroyingTest.java | 279 +++++++++++++++++++
.../ignite/testsuites/IgnitePdsTestSuite4.java | 3 +
12 files changed, 498 insertions(+), 50 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/025a0360/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 6dad367..0a0e709 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
@@ -437,9 +437,11 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
return;
}
+ else
+ U.error(log, "Unsupported message type: " + m.getClass().getName());
}
- U.error(log, "Unsupported message type: " + m.getClass().getName());
+ U.warn(log, "Cache group with id=" + m.groupId() + " is stopped or absent");
}
finally {
leaveBusy();
http://git-wip-us.apache.org/repos/asf/ignite/blob/025a0360/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 d629e94..6ac26c9 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
@@ -192,4 +192,14 @@ public interface GridCachePreloader {
* Dumps debug information.
*/
public void dumpDebugInfo();
+
+ /**
+ * Pause preloader.
+ */
+ public void pause();
+
+ /**
+ * Resume preloader.
+ */
+ public void resume();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/025a0360/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 c5e4a81..f16305c 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
@@ -181,4 +181,14 @@ public class GridCachePreloaderAdapter implements GridCachePreloader {
@Override public void dumpDebugInfo() {
// No-op.
}
+
+ /** {@inheritDoc} */
+ @Override public void pause() {
+ // No-op
+ }
+
+ /** {@inheritDoc} */
+ @Override public void resume() {
+ // No-op
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/025a0360/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 b49c697..375dd12 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
@@ -73,6 +73,7 @@ import org.apache.ignite.internal.IgniteTransactionsEx;
import org.apache.ignite.internal.binary.BinaryContext;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.binary.GridBinaryMarshaller;
+import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
import org.apache.ignite.internal.pagemem.store.IgnitePageStoreManager;
import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
@@ -2113,10 +2114,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
else {
Map<StartCacheInfo, GridCacheContext> cacheContexts = new ConcurrentHashMap<>();
- int parallelismLvl = sharedCtx.kernalContext().config().getSystemThreadPoolSize();
-
// Reserve at least 2 threads for system operations.
- parallelismLvl = Math.max(1, parallelismLvl - 2);
+ int parallelismLvl = U.availableThreadCount(ctx, GridIoPolicy.SYSTEM_POOL, 2);
doInParallel(
parallelismLvl,
@@ -2908,7 +2907,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @param exchActions Change requests.
*/
private void processCacheStopRequestOnExchangeDone(ExchangeActions exchActions) {
- // Force checkpoint if there is any cache stop request
+ // Reserve at least 2 threads for system operations.
+ int parallelismLvl = U.availableThreadCount(ctx, GridIoPolicy.SYSTEM_POOL, 2);
+
if (!exchActions.cacheStopRequests().isEmpty()) {
try {
sharedCtx.database().waitForCheckpoint("caches stop");
@@ -2918,63 +2919,88 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
}
- for (ExchangeActions.CacheActionData action : exchActions.cacheStopRequests()) {
- CacheGroupContext gctx = cacheGrps.get(action.descriptor().groupId());
+ List<IgniteBiTuple<CacheGroupContext, Boolean>> grpToStop = exchActions.cacheGroupsToStop().stream()
+ .filter(a -> cacheGrps.containsKey(a.descriptor().groupId()))
+ .map(a -> F.t(cacheGrps.get(a.descriptor().groupId()), a.destroy()))
+ .collect(Collectors.toList());
- // Cancel all operations blocking gateway
- if (gctx != null) {
- final String msg = "Failed to wait for topology update, cache group is stopping.";
+ Map<Integer, List<ExchangeActions.CacheActionData>> cachesToStop = exchActions.cacheStopRequests().stream()
+ .collect(Collectors.groupingBy(action -> action.descriptor().groupId()));
- // If snapshot operation in progress we must throw CacheStoppedException
- // for correct cache proxy restart. For more details see
- // IgniteCacheProxy.cacheException()
- gctx.affinity().cancelFutures(new CacheStoppedException(msg));
- }
+ try {
+ doInParallel(
+ parallelismLvl,
+ sharedCtx.kernalContext().getSystemExecutorService(),
+ cachesToStop.entrySet(),
+ cachesToStopByGrp -> {
+ CacheGroupContext gctx = cacheGrps.get(cachesToStopByGrp.getKey());
- stopGateway(action.request());
+ if (gctx != null)
+ gctx.preloader().pause();
- sharedCtx.database().checkpointReadLock();
+ try {
- try {
- prepareCacheStop(action.request().cacheName(), action.request().destroy());
- }
- finally {
- sharedCtx.database().checkpointReadUnlock();
- }
+ if (gctx != null) {
+ final String msg = "Failed to wait for topology update, cache group is stopping.";
+
+ // If snapshot operation in progress we must throw CacheStoppedException
+ // for correct cache proxy restart. For more details see
+ // IgniteCacheProxy.cacheException()
+ gctx.affinity().cancelFutures(new CacheStoppedException(msg));
+ }
+
+ for (ExchangeActions.CacheActionData action: cachesToStopByGrp.getValue()) {
+ stopGateway(action.request());
+
+ sharedCtx.database().checkpointReadLock();
+
+ try {
+ prepareCacheStop(action.request().cacheName(), action.request().destroy());
+ }
+ finally {
+ sharedCtx.database().checkpointReadUnlock();
+ }
+ }
+ }
+ finally {
+ if (gctx != null)
+ gctx.preloader().resume();
+ }
+
+ return null;
+ }
+ );
+ }
+ catch (IgniteCheckedException e) {
+ String msg = "Failed to stop caches";
+
+ log.error(msg, e);
+
+ throw new IgniteException(msg, e);
}
sharedCtx.database().checkpointReadLock();
try {
// Do not invoke checkpoint listeners for groups are going to be destroyed to prevent metadata corruption.
- for (ExchangeActions.CacheGroupActionData action : exchActions.cacheGroupsToStop()) {
- Integer groupId = action.descriptor().groupId();
- CacheGroupContext grp = cacheGrps.get(groupId);
+ grpToStop.forEach(grp -> {
+ CacheGroupContext gctx = grp.getKey();
- if (grp != null && grp.persistenceEnabled() && sharedCtx.database() instanceof GridCacheDatabaseSharedManager) {
+ if (gctx != null && gctx.persistenceEnabled() && sharedCtx.database() instanceof GridCacheDatabaseSharedManager) {
GridCacheDatabaseSharedManager mngr = (GridCacheDatabaseSharedManager)sharedCtx.database();
- mngr.removeCheckpointListener((DbCheckpointListener)grp.offheap());
+ mngr.removeCheckpointListener((DbCheckpointListener)gctx.offheap());
}
- }
+ });
}
finally {
sharedCtx.database().checkpointReadUnlock();
}
- List<IgniteBiTuple<CacheGroupContext, Boolean>> stoppedGroups = new ArrayList<>();
-
- for (ExchangeActions.CacheGroupActionData action : exchActions.cacheGroupsToStop()) {
- Integer groupId = action.descriptor().groupId();
-
- if (cacheGrps.containsKey(groupId)) {
- stoppedGroups.add(F.t(cacheGrps.get(groupId), action.destroy()));
-
- stopCacheGroup(groupId);
- }
- }
+ for (IgniteBiTuple<CacheGroupContext, Boolean> grp : grpToStop)
+ stopCacheGroup(grp.get1().groupId());
if (!sharedCtx.kernalContext().clientNode())
- sharedCtx.database().onCacheGroupsStopped(stoppedGroups);
+ sharedCtx.database().onCacheGroupsStopped(grpToStop);
if (exchActions.deactivate())
sharedCtx.deactivate();
http://git-wip-us.apache.org/repos/asf/ignite/blob/025a0360/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
index a75fae7..ddbb3b1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
@@ -906,6 +906,9 @@ public class GridDhtPartitionDemander {
try {
GridCacheContext cctx = grp.sharedGroup() ? ctx.cacheContext(entry.cacheId()) : grp.singleCacheContext();
+ if (cctx == null)
+ return true;
+
if (cctx.isNear())
cctx = cctx.dhtCache().context();
http://git-wip-us.apache.org/repos/asf/ignite/blob/025a0360/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
index 3034fb9..7e281e5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
@@ -249,6 +249,9 @@ public class GridDhtPartitionSupplyMessage extends GridCacheGroupIdMessage imple
CacheGroupContext grp = ctx.cache().cacheGroup(grpId);
+ if (grp == null)
+ return;
+
for (CacheEntryInfoCollection col : infos().values()) {
List<GridCacheEntryInfo> entries = col.infos();
http://git-wip-us.apache.org/repos/asf/ignite/blob/025a0360/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 ffc55a9..89e03a2 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
@@ -3533,10 +3533,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
* failed to send update counter deltas to backup.
*/
private void finalizePartitionCounters() {
- int parallelismLvl = cctx.kernalContext().config().getSystemThreadPoolSize();
-
// Reserve at least 2 threads for system operations.
- parallelismLvl = Math.max(1, parallelismLvl - 2);
+ int parallelismLvl = U.availableThreadCount(cctx.kernalContext(), GridIoPolicy.SYSTEM_POOL, 2);
long time = System.currentTimeMillis();
@@ -3965,10 +3963,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
long time = System.currentTimeMillis();
- int parallelismLvl = cctx.kernalContext().config().getSystemThreadPoolSize();
-
// Reserve at least 2 threads for system operations.
- parallelismLvl = Math.max(1, parallelismLvl - 2);
+ int parallelismLvl = U.availableThreadCount(cctx.kernalContext(), GridIoPolicy.SYSTEM_POOL, 2);
try {
doInParallel(
http://git-wip-us.apache.org/repos/asf/ignite/blob/025a0360/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
index fbaa241..a2cecb8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
@@ -31,6 +31,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.GridDirectMap;
import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
@@ -415,7 +416,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
if (marshal) {
// Reserve at least 2 threads for system operations.
- int parallelismLvl = Math.max(1, ctx.kernalContext().config().getSystemThreadPoolSize() - 2);
+ int parallelismLvl = U.availableThreadCount(ctx.kernalContext(), GridIoPolicy.SYSTEM_POOL, 2);
Collection<Object> objectsToMarshall = new ArrayList<>();
@@ -509,7 +510,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
Collection<byte[]> objectsToUnmarshall = new ArrayList<>();
// Reserve at least 2 threads for system operations.
- int parallelismLvl = Math.max(1, ctx.kernalContext().config().getSystemThreadPoolSize() - 2);
+ int parallelismLvl = U.availableThreadCount(ctx.kernalContext(), GridIoPolicy.SYSTEM_POOL, 2);
if (partsBytes != null && parts == null)
objectsToUnmarshall.add(partsBytes);
http://git-wip-us.apache.org/repos/asf/ignite/blob/025a0360/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 c8705d0..e92a240 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
@@ -20,13 +20,16 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.preloader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Queue;
import java.util.UUID;
+import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.NodeStoppingException;
+import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.processors.affinity.AffinityAssignment;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheGroupContext;
@@ -42,7 +45,9 @@ import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.lang.GridPlainRunnable;
+import org.apache.ignite.internal.util.lang.GridTuple3;
import org.apache.ignite.internal.util.typedef.CI1;
+import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgnitePredicate;
import org.jetbrains.annotations.Nullable;
@@ -80,6 +85,12 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
private final ReadWriteLock demandLock = new ReentrantReadWriteLock();
/** */
+ private boolean paused;
+
+ /** */
+ private Queue<GridTuple3<Integer, UUID, GridDhtPartitionSupplyMessage>> pausedDemanderQueue = new ConcurrentLinkedQueue<>();
+
+ /** */
private boolean stopped;
/**
@@ -357,7 +368,10 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
demandLock.readLock().lock();
try {
- demander.handleSupplyMessage(idx, id, s);
+ if (paused)
+ pausedDemanderQueue.add(F.t(idx, id, s));
+ else
+ demander.handleSupplyMessage(idx, id, s);
}
finally {
demandLock.readLock().unlock();
@@ -562,6 +576,41 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
}
/** {@inheritDoc} */
+ @Override public void pause() {
+ demandLock.writeLock().lock();
+
+ try {
+ paused = true;
+ }
+ finally {
+ demandLock.writeLock().unlock();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void resume() {
+ demandLock.writeLock().lock();
+
+ try {
+ final List<GridTuple3<Integer, UUID, GridDhtPartitionSupplyMessage>> msgToProc =
+ new ArrayList<>(pausedDemanderQueue);
+
+ pausedDemanderQueue.clear();
+
+ final GridDhtPreloader preloader = this;
+
+ ctx.kernalContext().closure().runLocalSafe(() -> msgToProc.forEach(
+ m -> preloader.handleSupplyMessage(m.get1(), m.get2(), m.get3())
+ ), GridIoPolicy.SYSTEM_POOL);
+
+ paused = false;
+ }
+ finally {
+ demandLock.writeLock().unlock();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void dumpDebugInfo() {
// No-op
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/025a0360/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 946378d..6da5c6e 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -55,6 +55,7 @@ import org.apache.ignite.internal.compute.ComputeTaskCancelledCheckedException;
import org.apache.ignite.internal.compute.ComputeTaskTimeoutCheckedException;
import org.apache.ignite.internal.events.DiscoveryCustomEvent;
import org.apache.ignite.internal.managers.communication.GridIoManager;
+import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.managers.deployment.GridDeploymentInfo;
import org.apache.ignite.internal.mxbean.IgniteStandardMXBean;
import org.apache.ignite.internal.processors.cache.CacheClassLoaderMarker;
@@ -10604,6 +10605,71 @@ public abstract class IgniteUtils {
}
/**
+ * @param ctx Kernal context.
+ * @param plc IO Policy.
+ * @param reserved Thread to reserve.
+ * @return Number of available threads in executor service for {@code plc}. If {@code plc}
+ * is invalid, return {@code 1}.
+ */
+ public static int availableThreadCount(GridKernalContext ctx, byte plc, int reserved) {
+ IgniteConfiguration cfg = ctx.config();
+
+ int parallelismLvl;
+
+ switch (plc) {
+ case GridIoPolicy.P2P_POOL:
+ parallelismLvl = cfg.getPeerClassLoadingThreadPoolSize();
+
+ break;
+
+ case GridIoPolicy.SYSTEM_POOL:
+ parallelismLvl = cfg.getSystemThreadPoolSize();
+
+ break;
+
+ case GridIoPolicy.PUBLIC_POOL:
+ parallelismLvl = cfg.getPublicThreadPoolSize();
+
+ break;
+
+ case GridIoPolicy.MANAGEMENT_POOL:
+ parallelismLvl = cfg.getManagementThreadPoolSize();
+
+ break;
+
+ case GridIoPolicy.UTILITY_CACHE_POOL:
+ parallelismLvl = cfg.getUtilityCacheThreadPoolSize();
+
+ break;
+
+ case GridIoPolicy.IGFS_POOL:
+ parallelismLvl = cfg.getIgfsThreadPoolSize();
+
+ break;
+
+ case GridIoPolicy.SERVICE_POOL:
+ parallelismLvl = cfg.getServiceThreadPoolSize();
+
+ break;
+
+ case GridIoPolicy.DATA_STREAMER_POOL:
+ parallelismLvl = cfg.getDataStreamerThreadPoolSize();
+
+ break;
+
+ case GridIoPolicy.QUERY_POOL:
+ parallelismLvl = cfg.getQueryThreadPoolSize();
+
+ break;
+
+ default:
+ parallelismLvl = -1;
+ }
+
+ return Math.max(1, parallelismLvl - reserved);
+ }
+
+ /**
* Execute operation on data in parallel.
*
* @param executorSvc Service for parallel execution.
http://git-wip-us.apache.org/repos/asf/ignite/blob/025a0360/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/IgniteRebalanceOnCachesStoppingOrDestroyingTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/IgniteRebalanceOnCachesStoppingOrDestroyingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/IgniteRebalanceOnCachesStoppingOrDestroyingTest.java
new file mode 100644
index 0000000..97f8d45
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/IgniteRebalanceOnCachesStoppingOrDestroyingTest.java
@@ -0,0 +1,279 @@
+/*
+ * 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.distributed.rebalancing;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.TransactionConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.failure.StopNodeFailureHandler;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.managers.communication.GridIoMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheGroupIdMessage;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessage;
+import org.apache.ignite.internal.util.lang.IgniteThrowableConsumer;
+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.U;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.spi.IgniteSpiException;
+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.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class IgniteRebalanceOnCachesStoppingOrDestroyingTest extends GridCommonAbstractTest {
+ /** */
+ private static final String CACHE_1 = "cache_1";
+
+ /** */
+ private static final String CACHE_2 = "cache_2";
+
+ /** */
+ private static final String CACHE_3 = "cache_3";
+
+ /** */
+ private static final String CACHE_4 = "cache_4";
+
+ /** */
+ private static final String GROUP_1 = "group_1";
+
+ /** */
+ private static final String GROUP_2 = "group_2";
+
+ /** */
+ private static final int REBALANCE_BATCH_SIZE = 50 * 1024;
+
+ /** */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ cleanPersistenceDir();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ stopAllGrids();
+
+ cleanPersistenceDir();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ TcpDiscoverySpi spi = new TcpDiscoverySpi();
+
+ spi.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(spi);
+
+ cfg.setCommunicationSpi(new RebalanceBlockingSPI());
+
+ cfg.setFailureHandler(new StopNodeFailureHandler());
+
+ cfg.setRebalanceThreadPoolSize(4);
+
+ cfg.setTransactionConfiguration(new TransactionConfiguration()
+ .setDefaultTxTimeout(1000));
+
+ cfg.setDataStorageConfiguration(
+ new DataStorageConfiguration()
+ .setWalMode(WALMode.LOG_ONLY)
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration()
+ .setPersistenceEnabled(true)
+ .setMaxSize(100L * 1024 * 1024)));
+
+ return cfg;
+ }
+
+ /**
+ *
+ */
+ public void testStopCachesOnDeactivation() throws Exception {
+ performTest(ig -> {
+ ig.cluster().active(false);
+
+ // Add to escape possible long waiting in awaitPartitionMapExchange due to {@link CacheAffinityChangeMessage}.
+ ig.cluster().active(true);
+
+ return null;
+ });
+ }
+
+ /**
+ *
+ */
+ public void testDestroySpecificCachesInDifferentCacheGroups() throws Exception {
+ performTest(ig -> {
+ ig.destroyCaches(Arrays.asList(CACHE_1, CACHE_3));
+
+ return null;
+ });
+ }
+
+ /**
+ *
+ */
+ public void testDestroySpecificCacheAndCacheGroup() throws Exception {
+ performTest(ig -> {
+ ig.destroyCaches(Arrays.asList(CACHE_1, CACHE_3, CACHE_4));
+
+ return null;
+ });
+ }
+
+ /**
+ * @param testAction Action that trigger stop or destroy of caches.
+ */
+ private void performTest(IgniteThrowableConsumer<Ignite, Void> testAction) throws Exception {
+ IgniteEx ig0 = (IgniteEx)startGrids(2);
+
+ ig0.cluster().active(true);
+
+ stopGrid(1);
+
+ loadData(ig0);
+
+ startGrid(1);
+
+ runLoad(ig0);
+
+ testAction.accept(ig0);
+
+ U.sleep(1000);
+
+ awaitPartitionMapExchange(true, true, null, true);
+
+ assertNull(grid(1).context().failure().failureContext());
+ }
+
+ /**
+ * @param ig Ig.
+ */
+ private void loadData(Ignite ig) {
+ List<CacheConfiguration> configs = Stream.of(
+ F.t(CACHE_1, GROUP_1),
+ F.t(CACHE_2, GROUP_1),
+ F.t(CACHE_3, GROUP_2),
+ F.t(CACHE_4, GROUP_2)
+ ).map(names -> new CacheConfiguration<>(names.get1())
+ .setGroupName(names.get2())
+ .setRebalanceBatchSize(REBALANCE_BATCH_SIZE)
+ .setCacheMode(CacheMode.REPLICATED)
+ ).collect(Collectors.toList());
+
+ ig.getOrCreateCaches(configs);
+
+ configs.forEach(cfg -> {
+ try (IgniteDataStreamer<Object, Object> streamer = ig.dataStreamer(cfg.getName())) {
+ for (int i = 0; i < 3_000; i++)
+ streamer.addData(i, new byte[1024]);
+
+ streamer.flush();
+ }
+ });
+ }
+
+ /**
+ * @param ig Ignite instance.
+ */
+ private void runLoad(Ignite ig) throws Exception{
+ GridTestUtils.runMultiThreaded(new Runnable() {
+ @Override public void run() {
+ String cacheName = F.rand(CACHE_1, CACHE_2, CACHE_3, CACHE_4);
+
+ IgniteCache cache = ig.cache(cacheName);
+
+ for (int i = 0; i < 3_000; i++) {
+ int idx = ThreadLocalRandom.current().nextInt(3_000);
+
+ cache.put(idx, new byte[1024]);
+ }
+ }
+ }, 4, "load-thread");
+ }
+
+ /**
+ *
+ */
+ private static class RebalanceBlockingSPI extends TcpCommunicationSpi {
+ /** */
+ public static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** {@inheritDoc} */
+ @Override public void sendMessage(ClusterNode node, Message msg) throws IgniteSpiException {
+ slowDownMessage(msg);
+
+ super.sendMessage(node, msg);
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public void sendMessage(ClusterNode node, Message msg,
+ IgniteInClosure<IgniteException> ackC) throws IgniteSpiException {
+ slowDownMessage(msg);
+
+ super.sendMessage(node, msg, ackC);
+ }
+
+ /**
+ * @param msg Message.
+ */
+ private void slowDownMessage(Message msg) {
+ if (msg instanceof GridIoMessage && ((GridIoMessage)msg).message() instanceof GridDhtPartitionSupplyMessage) {
+ int grpId = ((GridCacheGroupIdMessage)((GridIoMessage)msg).message()).groupId();
+
+ if (grpId == CU.cacheId(GROUP_1) || grpId == CU.cacheId(GROUP_2)) {
+ try {
+ U.sleep(50);
+ }
+ catch (IgniteInterruptedCheckedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/025a0360/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
index 11f0219..d01f1ed 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
@@ -21,6 +21,7 @@ import junit.framework.TestSuite;
import org.apache.ignite.cache.ResetLostPartitionTest;
import org.apache.ignite.internal.processors.cache.IgniteClusterActivateDeactivateTestWithPersistenceAndMemoryReuse;
import org.apache.ignite.internal.processors.cache.distributed.CachePageWriteLockUnlockTest;
+import org.apache.ignite.internal.processors.cache.distributed.rebalancing.IgniteRebalanceOnCachesStoppingOrDestroyingTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsContinuousRestartTestWithSharedGroupAndIndexes;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsRecoveryAfterFileCorruptionTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsTaskCancelingTest;
@@ -52,6 +53,8 @@ public class IgnitePdsTestSuite4 extends TestSuite {
suite.addTestSuite(ResetLostPartitionTest.class);
+ suite.addTestSuite(IgniteRebalanceOnCachesStoppingOrDestroyingTest.class);
+
suite.addTestSuite(CachePageWriteLockUnlockTest.class);
suite.addTestSuite(IgnitePdsCacheWalDisabledOnRebalancingTest.class);
[04/50] [abbrv] ignite git commit: IGNITE-6173: SQL: Create schema
for client caches without their start. This closes #4663.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/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 937363a..e726857 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
@@ -62,6 +62,7 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheContextInfo;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
@@ -73,7 +74,6 @@ import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot;
import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
-import org.apache.ignite.internal.processors.query.h2.affinity.PartitionInfo;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
@@ -100,7 +100,9 @@ import org.apache.ignite.internal.processors.query.QueryIndexDescriptorImpl;
import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.processors.query.SqlClientContext;
import org.apache.ignite.internal.processors.query.UpdateSourceIterator;
+import org.apache.ignite.internal.processors.query.h2.affinity.PartitionInfo;
import org.apache.ignite.internal.processors.query.h2.database.H2RowFactory;
+import org.apache.ignite.internal.processors.query.h2.database.H2TreeClientIndex;
import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
import org.apache.ignite.internal.processors.query.h2.database.io.H2ExtrasInnerIO;
import org.apache.ignite.internal.processors.query.h2.database.io.H2ExtrasLeafIO;
@@ -751,16 +753,20 @@ public class IgniteH2Indexing implements GridQueryIndexing {
GridH2IndexBase createSortedIndex(String name, GridH2Table tbl, boolean pk, boolean affinityKey,
List<IndexColumn> unwrappedCols, List<IndexColumn> wrappedCols, int inlineSize) {
try {
- GridCacheContext cctx = tbl.cache();
+ GridCacheContextInfo cacheInfo = tbl.cacheInfo();
if (log.isDebugEnabled())
- log.debug("Creating cache index [cacheId=" + cctx.cacheId() + ", idxName=" + name + ']');
+ log.debug("Creating cache index [cacheId=" + cacheInfo.cacheId() + ", idxName=" + name + ']');
- final int segments = tbl.rowDescriptor().context().config().getQueryParallelism();
+ if (cacheInfo.affinityNode()) {
+ final int segments = tbl.rowDescriptor().context().config().getQueryParallelism();
- H2RowCache cache = rowCache.forGroup(cctx.groupId());
+ H2RowCache cache = rowCache.forGroup(cacheInfo.groupId());
- return new H2TreeIndex(cctx, cache, tbl, name, pk, affinityKey, unwrappedCols, wrappedCols, inlineSize, segments);
+ return new H2TreeIndex(cacheInfo.gridCacheContext(), cache, tbl, name, pk, affinityKey, unwrappedCols, wrappedCols, inlineSize, segments);
+ }
+ else
+ return new H2TreeClientIndex(tbl, name, pk, unwrappedCols);
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
@@ -1379,7 +1385,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
if (o instanceof GridSqlAlias)
o = GridSqlAlias.unwrap((GridSqlAst) o);
if (o instanceof GridSqlTable && ((GridSqlTable) o).dataTable() != null) {
- GridCacheContext cctx = ((GridSqlTable) o).dataTable().cache();
+ GridCacheContext cctx = ((GridSqlTable)o).dataTable().cacheContext();
if (mvccEnabled == null) {
mvccEnabled = cctx.mvccEnabled();
@@ -2335,31 +2341,12 @@ public class IgniteH2Indexing implements GridQueryIndexing {
* @return H2 prepared statement.
*/
private PreparedStatement prepareStatementAndCaches(Connection c, String sqlQry) {
- boolean cachesCreated = false;
-
- while (true) {
- try {
- return prepareStatement(c, sqlQry, true);
- }
- catch (SQLException e) {
- if (!cachesCreated && (
- e.getErrorCode() == ErrorCode.SCHEMA_NOT_FOUND_1 ||
- e.getErrorCode() == ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1 ||
- e.getErrorCode() == ErrorCode.INDEX_NOT_FOUND_1)
- ) {
- try {
- ctx.cache().createMissingQueryCaches();
- }
- catch (IgniteCheckedException ignored) {
- throw new CacheException("Failed to create missing caches.", e);
- }
-
- cachesCreated = true;
- }
- else
- throw new IgniteSQLException("Failed to parse query. " + e.getMessage(),
- IgniteQueryErrorCode.PARSING, e);
- }
+ try {
+ return prepareStatement(c, sqlQry, true);
+ }
+ catch (SQLException e) {
+ throw new IgniteSQLException("Failed to parse query. " + e.getMessage(),
+ IgniteQueryErrorCode.PARSING, e);
}
}
@@ -2445,19 +2432,20 @@ public class IgniteH2Indexing implements GridQueryIndexing {
*
* This implementation doesn't support type reregistration.
*
+ * @param cacheInfo Cache context info.
* @param type Type description.
* @param isSql {@code true} in case table has been created from SQL.
* @throws IgniteCheckedException In case of error.
*/
- @Override public boolean registerType(GridCacheContext cctx, GridQueryTypeDescriptor type, boolean isSql)
+ @Override public boolean registerType(GridCacheContextInfo cacheInfo, GridQueryTypeDescriptor type, boolean isSql)
throws IgniteCheckedException {
validateTypeDescriptor(type);
- String schemaName = schema(cctx.name());
+ String schemaName = schema(cacheInfo.name());
H2Schema schema = schemas.get(schemaName);
- H2TableDescriptor tbl = new H2TableDescriptor(this, schema, type, cctx, isSql);
+ H2TableDescriptor tbl = new H2TableDescriptor(this, schema, type, cacheInfo, isSql);
try {
Connection conn = connMgr.connectionForThread(schemaName);
@@ -2596,6 +2584,16 @@ public class IgniteH2Indexing implements GridQueryIndexing {
dataTables.remove(h2Tbl.identifier(), h2Tbl);
}
+ /** {@inheritDoc} */
+ public GridCacheContextInfo registeredCacheInfo(String cacheName) {
+ for (GridH2Table value : dataTables.values()) {
+ if (value.cacheName().equals(cacheName))
+ return value.cacheInfo();
+ }
+
+ return null;
+ }
+
/**
* Find table for index.
*
@@ -2675,7 +2673,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
List<H2TableDescriptor> tbls = new ArrayList<>();
for (H2TableDescriptor tbl : s.tables()) {
- if (F.eq(tbl.cache().name(), cacheName))
+ if (F.eq(tbl.cacheName(), cacheName))
tbls.add(tbl);
}
@@ -3044,9 +3042,25 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/** {@inheritDoc} */
- @Override public void registerCache(String cacheName, String schemaName, GridCacheContext<?, ?> cctx)
+ @Override public boolean initCacheContext(GridCacheContext cacheCtx) {
+ GridCacheContextInfo cacheInfo = registeredCacheInfo(cacheCtx.name());
+
+ if (cacheInfo != null) {
+ assert !cacheInfo.isCacheContextInited() : cacheInfo.name();
+ assert cacheInfo.name().equals(cacheCtx.name()) : cacheInfo.name() + " != " + cacheCtx.name();
+
+ cacheInfo.initCacheContext(cacheCtx);
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void registerCache(String cacheName, String schemaName, GridCacheContextInfo<?, ?> cacheInfo)
throws IgniteCheckedException {
- rowCache.onCacheRegistered(cctx);
+ rowCache.onCacheRegistered(cacheInfo);
synchronized (schemaMux) {
createSchemaIfNeeded(schemaName, false);
@@ -3054,14 +3068,14 @@ public class IgniteH2Indexing implements GridQueryIndexing {
cacheName2schema.put(cacheName, schemaName);
- createSqlFunctions(schemaName, cctx.config().getSqlFunctionClasses());
+ createSqlFunctions(schemaName, cacheInfo.config().getSqlFunctionClasses());
}
/** {@inheritDoc} */
- @Override public void unregisterCache(GridCacheContext cctx, boolean rmvIdx) {
- rowCache.onCacheUnregistered(cctx);
+ @Override public void unregisterCache(GridCacheContextInfo cacheInfo, boolean rmvIdx) {
+ rowCache.onCacheUnregistered(cacheInfo);
- String cacheName = cctx.name();
+ String cacheName = cacheInfo.name();
String schemaName = schema(cacheName);
@@ -3078,7 +3092,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
Collection<H2TableDescriptor> rmvTbls = new HashSet<>();
for (H2TableDescriptor tbl : schema.tables()) {
- if (F.eq(tbl.cache().name(), cacheName)) {
+ if (F.eq(tbl.cacheName(), cacheName)) {
try {
tbl.table().setRemoveIndexOnDestroy(rmvIdx);
@@ -3297,6 +3311,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
GridH2Table tbl = dataTable(tblKey);
if (tbl != null) {
+ H2Utils.checkAndStartNotStartedCache(tbl);
+
int cacheId = tbl.cacheId();
caches0.add(cacheId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeClientIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeClientIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeClientIndex.java
new file mode 100644
index 0000000..a0bab43
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeClientIndex.java
@@ -0,0 +1,114 @@
+/*
+ * 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.query.h2.database;
+
+import java.util.List;
+import org.apache.ignite.internal.processors.query.IgniteSQLException;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2Row;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
+import org.h2.engine.Session;
+import org.h2.index.Cursor;
+import org.h2.index.IndexType;
+import org.h2.result.SearchRow;
+import org.h2.table.IndexColumn;
+
+/**
+ * We need indexes on an not affinity nodes. The index shouldn't contains any data.
+ */
+public class H2TreeClientIndex extends H2TreeIndexBase {
+
+ /**
+ *
+ */
+ public static final IgniteSQLException SHOULDNT_BE_INVOKED_EXCEPTION = new IgniteSQLException("Shouldn't be invoked, due to it's not affinity node");
+
+ /**
+ * @param tbl Table.
+ * @param name Index name.
+ * @param pk Primary key.
+ * @param colsList Index columns.
+ */
+ public H2TreeClientIndex(
+ GridH2Table tbl,
+ String name,
+ boolean pk,
+ List<IndexColumn> colsList
+ ) {
+ IndexColumn[] cols = colsList.toArray(new IndexColumn[colsList.size()]);
+
+ IndexColumn.mapColumns(cols, tbl);
+
+ initBaseIndex(tbl, 0, name, cols,
+ pk ? IndexType.createPrimaryKey(false, false) : IndexType.createNonUnique(false, false, false));
+ }
+
+ /** {@inheritDoc} */
+ @Override public void refreshColumnIds() {
+ //do nothing.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void destroy(boolean rmvIndex) {
+ //do nothing.
+ }
+
+ /** {@inheritDoc} */
+ @Override protected int segmentsCount() {
+ throw SHOULDNT_BE_INVOKED_EXCEPTION;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Cursor find(Session ses, SearchRow lower, SearchRow upper) {
+ throw SHOULDNT_BE_INVOKED_EXCEPTION;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridH2Row put(GridH2Row row) {
+ throw SHOULDNT_BE_INVOKED_EXCEPTION;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean putx(GridH2Row row) {
+ throw SHOULDNT_BE_INVOKED_EXCEPTION;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridH2Row remove(SearchRow row) {
+ throw SHOULDNT_BE_INVOKED_EXCEPTION;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean removex(SearchRow row) {
+ throw SHOULDNT_BE_INVOKED_EXCEPTION;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getRowCount(Session ses) {
+ throw SHOULDNT_BE_INVOKED_EXCEPTION;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Cursor findFirstOrLast(Session session, boolean b) {
+ throw SHOULDNT_BE_INVOKED_EXCEPTION;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected H2Tree treeForRead(int segment) {
+ throw SHOULDNT_BE_INVOKED_EXCEPTION;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
index b7179b7..2c0a9d8 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.query.h2.database;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.IgniteCheckedException;
@@ -35,7 +34,6 @@ import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
import org.apache.ignite.internal.processors.query.h2.H2Cursor;
import org.apache.ignite.internal.processors.query.h2.H2RowCache;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2Cursor;
-import org.apache.ignite.internal.processors.query.h2.opt.GridH2IndexBase;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryContext;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2Row;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2SearchRow;
@@ -52,10 +50,7 @@ import org.h2.index.IndexType;
import org.h2.index.SingleRowCursor;
import org.h2.message.DbException;
import org.h2.result.SearchRow;
-import org.h2.result.SortOrder;
-import org.h2.table.Column;
import org.h2.table.IndexColumn;
-import org.h2.table.TableFilter;
import org.h2.value.Value;
import org.jetbrains.annotations.Nullable;
@@ -63,7 +58,7 @@ import org.jetbrains.annotations.Nullable;
* H2 Index over {@link BPlusTree}.
*/
@SuppressWarnings({"TypeMayBeWeakened", "unchecked"})
-public class H2TreeIndex extends GridH2IndexBase {
+public class H2TreeIndex extends H2TreeIndexBase {
/** Default value for {@code IGNITE_MAX_INDEX_PAYLOAD_SIZE} */
public static final int IGNITE_MAX_INDEX_PAYLOAD_SIZE_DEFAULT = 10;
@@ -145,66 +140,59 @@ public class H2TreeIndex extends GridH2IndexBase {
IndexColumn[] cols;
- if (cctx.affinityNode()) {
- segments = new H2Tree[segmentsCnt];
-
- IgniteCacheDatabaseSharedManager db = cctx.shared().database();
-
- AtomicInteger maxCalculatedInlineSize = new AtomicInteger();
-
- for (int i = 0; i < segments.length; i++) {
- db.checkpointReadLock();
-
- try {
- RootPage page = getMetaPage(treeName, i);
-
- segments[i] = new H2Tree(
- treeName,
- idxName,
- tblName,
- tbl.cacheName(),
- cctx.offheap().reuseListForIndex(treeName),
- cctx.groupId(),
- cctx.dataRegion().pageMemory(),
- cctx.shared().wal(),
- cctx.offheap().globalRemoveId(),
- tbl.rowFactory(),
- page.pageId().pageId(),
- page.isAllocated(),
- unwrappedColsInfo,
- wrappedColsInfo,
- maxCalculatedInlineSize,
- pk,
- affinityKey,
- cctx.mvccEnabled(),
- rowCache,
- cctx.kernalContext().failure(),
- log) {
- @Override public int compareValues(Value v1, Value v2) {
- return v1 == v2 ? 0 : table.compareTypeSafe(v1, v2);
- }
- };
- }
- finally {
- db.checkpointReadUnlock();
- }
+ assert cctx.affinityNode();
+
+ segments = new H2Tree[segmentsCnt];
+
+ IgniteCacheDatabaseSharedManager db = cctx.shared().database();
+
+ AtomicInteger maxCalculatedInlineSize = new AtomicInteger();
+
+ for (int i = 0; i < segments.length; i++) {
+ db.checkpointReadLock();
+
+ try {
+ RootPage page = getMetaPage(treeName, i);
+
+ segments[i] = new H2Tree(
+ treeName,
+ idxName,
+ tblName,
+ tbl.cacheName(),
+ cctx.offheap().reuseListForIndex(treeName),
+ cctx.groupId(),
+ cctx.dataRegion().pageMemory(),
+ cctx.shared().wal(),
+ cctx.offheap().globalRemoveId(),
+ tbl.rowFactory(),
+ page.pageId().pageId(),
+ page.isAllocated(),
+ unwrappedColsInfo,
+ wrappedColsInfo,
+ maxCalculatedInlineSize,
+ pk,
+ affinityKey,
+ cctx.mvccEnabled(),
+ rowCache,
+ cctx.kernalContext().failure(),
+ log) {
+ @Override public int compareValues(Value v1, Value v2) {
+ return v1 == v2 ? 0 : table.compareTypeSafe(v1, v2);
+ }
+ };
}
+ finally {
+ db.checkpointReadUnlock();
+ }
+ }
- boolean useUnwrappedCols = segments[0].unwrappedPk();
-
- IndexColumnsInfo colsInfo = useUnwrappedCols ? unwrappedColsInfo : wrappedColsInfo;
+ boolean useUnwrappedCols = segments[0].unwrappedPk();
- cols = colsInfo.cols();
+ IndexColumnsInfo colsInfo = useUnwrappedCols ? unwrappedColsInfo : wrappedColsInfo;
- inlineIdxs = colsInfo.inlineIdx();
- }
- else {
- // We need indexes on the client node, but index will not contain any data.
- segments = null;
- inlineIdxs = null;
+ cols = colsInfo.cols();
- cols = unwrappedColsInfo.cols();
- }
+ inlineIdxs = colsInfo.inlineIdx();
IndexColumn.mapColumns(cols, tbl);
@@ -371,17 +359,6 @@ public class H2TreeIndex extends GridH2IndexBase {
}
/** {@inheritDoc} */
- @Override public double getCost(Session ses, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, HashSet<Column> allColumnsSet) {
- long rowCnt = getRowCountApproximation();
-
- double baseCost = getCostRangeIndex(masks, rowCnt, filters, filter, sortOrder, false, allColumnsSet);
-
- int mul = getDistributedMultiplier(ses, filters, filter);
-
- return mul * baseCost;
- }
-
- /** {@inheritDoc} */
@Override public long getRowCount(Session ses) {
try {
int seg = threadLocalSegment();
@@ -398,16 +375,6 @@ public class H2TreeIndex extends GridH2IndexBase {
}
/** {@inheritDoc} */
- @Override public long getRowCountApproximation() {
- return 10_000; // TODO
- }
-
- /** {@inheritDoc} */
- @Override public boolean canGetFirstOrLast() {
- return true;
- }
-
- /** {@inheritDoc} */
@Override public Cursor findFirstOrLast(Session session, boolean b) {
try {
H2Tree tree = treeForRead(threadLocalSegment());
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndexBase.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndexBase.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndexBase.java
new file mode 100644
index 0000000..e6dda14
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndexBase.java
@@ -0,0 +1,53 @@
+/*
+ * 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.query.h2.database;
+
+import java.util.HashSet;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2IndexBase;
+import org.h2.engine.Session;
+import org.h2.result.SortOrder;
+import org.h2.table.Column;
+import org.h2.table.TableFilter;
+
+/**
+ * H2 tree index base.
+ */
+public abstract class H2TreeIndexBase extends GridH2IndexBase {
+ /** {@inheritDoc} */
+ @Override public double getCost(Session ses, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder,
+ HashSet<Column> allColumnsSet) {
+ long rowCnt = getRowCountApproximation();
+
+ double baseCost = getCostRangeIndex(masks, rowCnt, filters, filter, sortOrder, false, allColumnsSet);
+
+ int mul = getDistributedMultiplier(ses, filters, filter);
+
+ return mul * baseCost;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean canGetFirstOrLast() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getRowCountApproximation() {
+ return 10_000; // TODO
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
index b99d7dc..6308eab 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
@@ -129,7 +129,7 @@ public class DdlStatementsProcessor {
if (cmd instanceof SqlCreateIndexCommand) {
SqlCreateIndexCommand cmd0 = (SqlCreateIndexCommand)cmd;
- GridH2Table tbl = dataTableWithRetry(cmd0.schemaName(), cmd0.tableName());
+ GridH2Table tbl = idx.dataTable(cmd0.schemaName(), cmd0.tableName());
if (tbl == null)
throw new SchemaOperationException(SchemaOperationException.CODE_TABLE_NOT_FOUND, cmd0.tableName());
@@ -167,7 +167,7 @@ public class DdlStatementsProcessor {
else if (cmd instanceof SqlDropIndexCommand) {
SqlDropIndexCommand cmd0 = (SqlDropIndexCommand)cmd;
- GridH2Table tbl = dataTableForIndexWithRetry(cmd0.schemaName(), cmd0.indexName());
+ GridH2Table tbl = idx.dataTableForIndex(cmd0.schemaName(), cmd0.indexName());
if (tbl != null) {
isDdlSupported(tbl);
@@ -186,7 +186,7 @@ public class DdlStatementsProcessor {
else if (cmd instanceof SqlAlterTableCommand) {
SqlAlterTableCommand cmd0 = (SqlAlterTableCommand)cmd;
- GridH2Table tbl = dataTableWithRetry(cmd0.schemaName(), cmd0.tableName());
+ GridH2Table tbl = idx.dataTable(cmd0.schemaName(), cmd0.tableName());
if (tbl == null) {
throw new SchemaOperationException(SchemaOperationException.CODE_TABLE_NOT_FOUND,
@@ -270,7 +270,7 @@ public class DdlStatementsProcessor {
isDdlOnSchemaSupported(cmd.schemaName());
- GridH2Table tbl = dataTableWithRetry(cmd.schemaName(), cmd.tableName());
+ GridH2Table tbl = idx.dataTable(cmd.schemaName(), cmd.tableName());
if (tbl == null)
throw new SchemaOperationException(SchemaOperationException.CODE_TABLE_NOT_FOUND, cmd.tableName());
@@ -309,7 +309,7 @@ public class DdlStatementsProcessor {
isDdlOnSchemaSupported(cmd.schemaName());
- GridH2Table tbl = dataTableForIndexWithRetry(cmd.schemaName(), cmd.indexName());
+ GridH2Table tbl = idx.dataTableForIndex(cmd.schemaName(), cmd.indexName());
if (tbl != null) {
isDdlSupported(tbl);
@@ -332,7 +332,7 @@ public class DdlStatementsProcessor {
isDdlOnSchemaSupported(cmd.schemaName());
- GridH2Table tbl = dataTableWithRetry(cmd.schemaName(), cmd.tableName());
+ GridH2Table tbl = idx.dataTable(cmd.schemaName(), cmd.tableName());
if (tbl != null) {
if (!cmd.ifNotExists())
@@ -365,7 +365,7 @@ public class DdlStatementsProcessor {
isDdlOnSchemaSupported(cmd.schemaName());
- GridH2Table tbl = dataTableWithRetry(cmd.schemaName(), cmd.tableName());
+ GridH2Table tbl = idx.dataTable(cmd.schemaName(), cmd.tableName());
if (tbl == null) {
if (!cmd.ifExists())
@@ -380,7 +380,7 @@ public class DdlStatementsProcessor {
isDdlOnSchemaSupported(cmd.schemaName());
- GridH2Table tbl = dataTableWithRetry(cmd.schemaName(), cmd.tableName());
+ GridH2Table tbl = idx.dataTable(cmd.schemaName(), cmd.tableName());
if (tbl == null) {
if (!cmd.ifTableExists())
@@ -423,7 +423,7 @@ public class DdlStatementsProcessor {
assert tbl.rowDescriptor() != null;
if (!allFieldsNullable)
- QueryUtils.checkNotNullAllowed(tbl.cache().config());
+ QueryUtils.checkNotNullAllowed(tbl.cacheContext().config());
fut = ctx.query().dynamicColumnAdd(tbl.cacheName(), cmd.schemaName(),
tbl.rowDescriptor().type().tableName(), cols, cmd.ifTableExists(), cmd.ifNotExists());
@@ -435,7 +435,7 @@ public class DdlStatementsProcessor {
isDdlOnSchemaSupported(cmd.schemaName());
- GridH2Table tbl = dataTableWithRetry(cmd.schemaName(), cmd.tableName());
+ GridH2Table tbl = idx.dataTable(cmd.schemaName(), cmd.tableName());
if (tbl == null) {
if (!cmd.ifTableExists())
@@ -445,7 +445,7 @@ public class DdlStatementsProcessor {
else {
assert tbl.rowDescriptor() != null;
- if (tbl.cache().mvccEnabled())
+ if (tbl.cacheContext().mvccEnabled())
throw new IgniteSQLException("Cannot drop column(s) with enabled MVCC. " +
"Operation is unsupported at the moment.", IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
@@ -511,46 +511,6 @@ public class DdlStatementsProcessor {
}
/**
- * Get table by name optionally creating missing query caches.
- *
- * @param schemaName Schema name.
- * @param tableName Table name.
- * @return Table or {@code null} if none found.
- * @throws IgniteCheckedException If failed.
- */
- private GridH2Table dataTableWithRetry(String schemaName, String tableName) throws IgniteCheckedException {
- GridH2Table tbl = idx.dataTable(schemaName, tableName);
-
- if (tbl == null) {
- ctx.cache().createMissingQueryCaches();
-
- tbl = idx.dataTable(schemaName, tableName);
- }
-
- return tbl;
- }
-
- /**
- * Get table by name optionally creating missing query caches.
- *
- * @param schemaName Schema name.
- * @param indexName Index name.
- * @return Table or {@code null} if none found.
- * @throws IgniteCheckedException If failed.
- */
- private GridH2Table dataTableForIndexWithRetry(String schemaName, String indexName) throws IgniteCheckedException {
- GridH2Table tbl = idx.dataTableForIndex(schemaName, indexName);
-
- if (tbl == null) {
- ctx.cache().createMissingQueryCaches();
-
- tbl = idx.dataTableForIndex(schemaName, indexName);
- }
-
- return tbl;
- }
-
- /**
* Check if schema supports DDL statement.
*
* @param schemaName Schema name.
@@ -567,7 +527,7 @@ public class DdlStatementsProcessor {
* @param tbl Table.
*/
private static void isDdlSupported(GridH2Table tbl) {
- GridCacheContext cctx = tbl.cache();
+ GridCacheContext cctx = tbl.cacheContext();
assert cctx != null;
@@ -683,11 +643,10 @@ public class DdlStatementsProcessor {
scale.put(e.getKey(), col.getScale());
}
- if (col.getType() == Value.STRING ||
- col.getType() == Value.STRING_FIXED ||
- col.getType() == Value.STRING_IGNORECASE) {
+ if (col.getType() == Value.STRING ||
+ col.getType() == Value.STRING_FIXED ||
+ col.getType() == Value.STRING_IGNORECASE)
precision.put(e.getKey(), (int)col.getPrecision());
- }
}
if (!F.isEmpty(dfltValues))
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlan.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlan.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlan.java
index 0f8b6d8..fc3514b 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlan.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlan.java
@@ -535,7 +535,7 @@ public final class UpdatePlan {
* @return Cache context.
*/
public GridCacheContext cacheContext() {
- return tbl.cache();
+ return tbl.cacheContext();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
index 477f22a..f1826a1 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
@@ -22,6 +22,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -39,6 +40,7 @@ import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.processors.query.h2.DmlStatementsProcessor;
+import org.apache.ignite.internal.processors.query.h2.H2Utils;
import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
@@ -93,6 +95,7 @@ public final class UpdatePlanBuilder {
* @param fieldsQry Original query.
* @return Update plan.
*/
+ @SuppressWarnings("ConstantConditions")
public static UpdatePlan planForStatement(Prepared prepared, boolean loc, IgniteH2Indexing idx,
@Nullable Connection conn, @Nullable SqlFieldsQuery fieldsQry, @Nullable Integer errKeysPos,
boolean dmlInsideTxAllowed)
@@ -103,15 +106,60 @@ public final class UpdatePlanBuilder {
GridSqlStatement stmt = parser.parse(prepared);
- boolean mvccEnabled = false;
+
+ List<GridH2Table> tbls = extractTablesParticipateAtQuery(parser);
GridCacheContext prevCctx = null;
+ boolean mvccEnabled = false;
- for (Object o : parser.objectsMap().values()) {
- if (o instanceof GridSqlInsert)
- o = ((GridSqlInsert)o).into();
- else if (o instanceof GridSqlMerge)
+ for (GridH2Table h2tbl : tbls) {
+ H2Utils.checkAndStartNotStartedCache(h2tbl);
+
+ if (prevCctx == null) {
+ prevCctx = h2tbl.cacheContext();
+
+ assert prevCctx != null : h2tbl.cacheName() + " is not initted";
+
+ mvccEnabled = prevCctx.mvccEnabled();
+
+ if (!mvccEnabled && !dmlInsideTxAllowed && prevCctx.cache().context().tm().inUserTx()) {
+ throw new IgniteSQLException("DML statements are not allowed inside a transaction over " +
+ "cache(s) with TRANSACTIONAL atomicity mode (change atomicity mode to " +
+ "TRANSACTIONAL_SNAPSHOT or disable this error message with system property " +
+ "\"IGNITE_ALLOW_DML_INSIDE_TRANSACTION\" [cacheName=" + prevCctx.name() + ']');
+ }
+ }
+ else if (h2tbl.cacheContext().mvccEnabled() != mvccEnabled)
+ MvccUtils.throwAtomicityModesMismatchException(prevCctx, h2tbl.cacheContext());
+ }
+
+ if (stmt instanceof GridSqlMerge || stmt instanceof GridSqlInsert)
+ return planForInsert(stmt, loc, idx, mvccEnabled, conn, fieldsQry);
+ else if (stmt instanceof GridSqlUpdate || stmt instanceof GridSqlDelete)
+ return planForUpdate(stmt, loc, idx, mvccEnabled, conn, fieldsQry, errKeysPos);
+ else
+ throw new IgniteSQLException("Unsupported operation: " + prepared.getSQL(),
+ IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
+ }
+
+ /**
+ * Extract all tables participate at query
+ *
+ * @param parser Parser related to the query.
+ * @return List of tables participate at query.
+ * @throws IgniteSQLException in case query contains virtual tables.
+ */
+ private static List<GridH2Table> extractTablesParticipateAtQuery(GridSqlQueryParser parser) throws IgniteSQLException {
+ Collection<?> parserObjects = parser.objectsMap().values();
+
+ List<GridH2Table> tbls = new ArrayList<>(parserObjects.size());
+
+ // check all involved caches
+ for (Object o : parserObjects) {
+ if (o instanceof GridSqlMerge)
o = ((GridSqlMerge)o).into();
+ else if (o instanceof GridSqlInsert)
+ o = ((GridSqlInsert)o).into();
else if (o instanceof GridSqlUpdate)
o = ((GridSqlUpdate)o).target();
else if (o instanceof GridSqlDelete)
@@ -121,39 +169,18 @@ public final class UpdatePlanBuilder {
o = GridSqlAlias.unwrap((GridSqlAst)o);
if (o instanceof GridSqlTable) {
- if (((GridSqlTable)o).dataTable() == null) { // Check for virtual tables.
+ GridH2Table h2tbl = ((GridSqlTable)o).dataTable();
+
+ if (h2tbl == null) { // Check for virtual tables.
throw new IgniteSQLException("Operation not supported for table '" +
((GridSqlTable)o).tableName() + "'", IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
}
- if (prevCctx == null) {
- prevCctx = (((GridSqlTable)o).dataTable()).cache();
-
- mvccEnabled = prevCctx.mvccEnabled();
-
- if (!mvccEnabled && !dmlInsideTxAllowed && prevCctx.cache().context().tm().inUserTx()) {
- throw new IgniteSQLException("DML statements are not allowed inside a transaction over " +
- "cache(s) with TRANSACTIONAL atomicity mode (change atomicity mode to " +
- "TRANSACTIONAL_SNAPSHOT or disable this error message with system property " +
- "\"IGNITE_ALLOW_DML_INSIDE_TRANSACTION\" [cacheName=" + prevCctx.name() + ']');
- }
- }
- else {
- GridCacheContext cctx = ((GridSqlTable)o).dataTable().cache();
-
- if (cctx.mvccEnabled() != mvccEnabled)
- MvccUtils.throwAtomicityModesMismatchException(prevCctx, cctx);
- }
+ tbls.add(h2tbl);
}
}
- if (stmt instanceof GridSqlMerge || stmt instanceof GridSqlInsert)
- return planForInsert(stmt, loc, idx, mvccEnabled, conn, fieldsQry);
- else if (stmt instanceof GridSqlUpdate || stmt instanceof GridSqlDelete)
- return planForUpdate(stmt, loc, idx, mvccEnabled, conn, fieldsQry, errKeysPos);
- else
- throw new IgniteSQLException("Unsupported operation: " + prepared.getSQL(),
- IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
+ return tbls;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
index 9c4941d..ddfc437 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
@@ -29,6 +29,7 @@ import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheContextInfo;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.query.GridQueryProperty;
import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
@@ -57,6 +58,7 @@ import org.h2.value.ValueString;
import org.h2.value.ValueTime;
import org.h2.value.ValueTimestamp;
import org.h2.value.ValueUuid;
+import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.internal.processors.query.h2.opt.GridH2KeyValueRowOnheap.DEFAULT_COLUMNS_COUNT;
import static org.apache.ignite.internal.processors.query.h2.opt.GridH2KeyValueRowOnheap.KEY_COL;
@@ -171,12 +173,22 @@ public class GridH2RowDescriptor {
return type;
}
+
+ /**
+ * Gets cache context info for this row descriptor.
+ *
+ * @return Cache context info.
+ */
+ public GridCacheContextInfo<?, ?> cacheInfo() {
+ return tbl.cacheInfo();
+ }
+
/**
* Gets cache context for this row descriptor.
*
* @return Cache context.
*/
- public GridCacheContext<?, ?> context() {
+ @Nullable public GridCacheContext<?, ?> context() {
return tbl.cache();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SystemIndexFactory.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SystemIndexFactory.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SystemIndexFactory.java
index f150b6a..fa1e5cb 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SystemIndexFactory.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SystemIndexFactory.java
@@ -17,19 +17,17 @@
package org.apache.ignite.internal.processors.query.h2.opt;
-import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
-import org.h2.index.Index;
-
import java.util.ArrayList;
+import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndexBase;
+import org.h2.index.Index;
/**
* Factory for system table indexes.
*/
public interface GridH2SystemIndexFactory {
/**
- * Create list of indexes. First must be primary key, after that all unique indexes and
- * only then non-unique indexes.
- * All indexes must be subtypes of {@link H2TreeIndex}.
+ * Create list of indexes. First must be primary key, after that all unique indexes and only then non-unique
+ * indexes. All indexes must be subtypes of {@link H2TreeIndexBase}.
*
* @param tbl Table to create indexes for.
* @return List of indexes.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
index b2da670..ef31f20 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
@@ -31,12 +31,13 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteInterruptedException;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheContextInfo;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.query.QueryTable;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.QueryField;
import org.apache.ignite.internal.processors.query.h2.database.H2RowFactory;
-import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
+import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndexBase;
import org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor;
import org.apache.ignite.internal.util.typedef.F;
import org.h2.command.ddl.CreateTableData;
@@ -69,8 +70,8 @@ public class GridH2Table extends TableBase {
/** Insert hack flag. */
private static final ThreadLocal<Boolean> INSERT_HACK = new ThreadLocal<>();
- /** Cache context. */
- private final GridCacheContext cctx;
+ /** Cache context info. */
+ private final GridCacheContextInfo cacheInfo;
/** */
private final GridH2RowDescriptor desc;
@@ -124,16 +125,16 @@ public class GridH2Table extends TableBase {
* @param desc Row descriptor.
* @param rowFactory Row factory.
* @param idxsFactory Indexes factory.
- * @param cctx Cache context.
+ * @param cacheInfo Cache context info.
*/
public GridH2Table(CreateTableData createTblData, GridH2RowDescriptor desc, H2RowFactory rowFactory,
- GridH2SystemIndexFactory idxsFactory, GridCacheContext cctx) {
+ GridH2SystemIndexFactory idxsFactory, GridCacheContextInfo cacheInfo) {
super(createTblData);
assert idxsFactory != null;
this.desc = desc;
- this.cctx = cctx;
+ this.cacheInfo = cacheInfo;
if (desc.context() != null && !desc.context().customAffinityMapper()) {
boolean affinityColExists = true;
@@ -200,7 +201,7 @@ public class GridH2Table extends TableBase {
* @return {@code true} If this is a partitioned table.
*/
public boolean isPartitioned() {
- return desc != null && desc.context().config().getCacheMode() == PARTITIONED;
+ return desc != null && desc.cacheInfo().config().getCacheMode() == PARTITIONED;
}
/**
@@ -226,21 +227,35 @@ public class GridH2Table extends TableBase {
* @return Cache name.
*/
public String cacheName() {
- return cctx.name();
+ return cacheInfo.name();
}
/**
* @return Cache ID.
*/
public int cacheId() {
- return cctx.cacheId();
+ return cacheInfo.cacheId();
+ }
+
+ /**
+ * @return Cache context info.
+ */
+ public GridCacheContextInfo cacheInfo() {
+ return cacheInfo;
+ }
+
+ /**
+ * @return {@code true} If Cache is lazy (not full inited).
+ */
+ public boolean isCacheLazy() {
+ return cacheInfo.gridCacheContext() == null;
}
/**
* @return Cache context.
*/
- public GridCacheContext cache() {
- return cctx;
+ @Nullable public GridCacheContext cacheContext() {
+ return cacheInfo.gridCacheContext();
}
/** {@inheritDoc} */
@@ -854,7 +869,7 @@ public class GridH2Table extends TableBase {
* @return Proxy index.
*/
private Index createDuplicateIndexIfNeeded(Index target) {
- if (!(target instanceof H2TreeIndex) && !(target instanceof SpatialIndex))
+ if (!(target instanceof H2TreeIndexBase) && !(target instanceof SpatialIndex))
return null;
IndexColumn[] cols = target.getIndexColumns();
@@ -1064,4 +1079,4 @@ public class GridH2Table extends TableBase {
return true;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
index 122a9f7..34e223c 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
@@ -1728,7 +1728,11 @@ public class GridSqlQueryParser {
GridH2Table tbl = ((GridSqlTable)o).dataTable();
if (tbl != null) {
- GridCacheContext cctx = tbl.cache();
+ //It's not affinity cache. Can't be local.
+ if (tbl.cacheContext() == null)
+ return false;
+
+ GridCacheContext cctx = tbl.cacheContext();
if (cctx.mvccEnabled())
return false;
@@ -1759,8 +1763,8 @@ public class GridSqlQueryParser {
if (o instanceof GridSqlTable) {
GridH2Table tbl = ((GridSqlTable)o).dataTable();
- if (tbl != null && tbl.cache().isPartitioned())
- return tbl.cache();
+ if (tbl != null && tbl.cacheContext().isPartitioned())
+ return tbl.cacheContext();
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesClosure.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesClosure.java b/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesClosure.java
index b6909e3..6e27ca2 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesClosure.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesClosure.java
@@ -61,7 +61,7 @@ import org.apache.ignite.internal.processors.query.GridQueryProcessor;
import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
import org.apache.ignite.internal.processors.query.QueryTypeDescriptorImpl;
import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
-import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
+import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndexBase;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2Row;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
@@ -229,7 +229,7 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
ArrayList<Index> indexes = gridH2Tbl.getIndexes();
for (Index idx : indexes)
- if (idx instanceof H2TreeIndex)
+ if (idx instanceof H2TreeIndexBase)
idxArgs.add(new T2<>(ctx, idx));
}
}
@@ -517,7 +517,7 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
ArrayList<Index> indexes = gridH2Tbl.getIndexes();
for (Index idx : indexes) {
- if (!(idx instanceof H2TreeIndex))
+ if (!(idx instanceof H2TreeIndexBase))
continue;
try {
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDynamicLoadOnClientPersistentTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDynamicLoadOnClientPersistentTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDynamicLoadOnClientPersistentTest.java
new file mode 100644
index 0000000..ab93a4c
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDynamicLoadOnClientPersistentTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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 org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+
+/**
+ * Test lazy cache start on client nodes with persistence cache.
+ */
+public class GridCacheDynamicLoadOnClientPersistentTest extends GridCacheDynamicLoadOnClientTest {
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ DataStorageConfiguration dsCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
+
+ cfg.setDataStorageConfiguration(dsCfg);
+
+ return cfg;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDynamicLoadOnClientTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDynamicLoadOnClientTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDynamicLoadOnClientTest.java
new file mode 100644
index 0000000..5cc559e
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDynamicLoadOnClientTest.java
@@ -0,0 +1,304 @@
+/*
+ * 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.io.Serializable;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Collection;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.odbc.ClientListenerProcessor;
+import org.apache.ignite.internal.processors.port.GridPortRecord;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Assert;
+
+/**
+ * Test lazy cache start on client nodes with inmemory cache.
+ */
+public class GridCacheDynamicLoadOnClientTest extends GridCommonAbstractTest {
+ /** Cache name. */
+ private static final String PERSON_CACHE = "Person";
+
+ /** SQL schema name. */
+ private static final String PERSON_SCHEMA = "test";
+
+ /** Number of element to add into cache. */
+ private static final int CACHE_ELEMENT_COUNT = 10;
+
+ /** Full table name. */
+ private static final String FULL_TABLE_NAME = PERSON_SCHEMA + "." + PERSON_CACHE;
+
+ /** Number of nodes. */
+ private static final int NODES = 2;
+
+ /** Client or server mode for configuration. */
+ protected boolean client;
+
+ /** Instance of client node. */
+ private static IgniteEx clientNode;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ return super.getConfiguration(igniteInstanceName).setClientMode(client);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ client = false;
+
+ startGridsMultiThreaded(NODES - 1);
+
+ client = true;
+
+ clientNode = startGrid(NODES - 1);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ clientNode.destroyCache(PERSON_CACHE);
+
+ createAndFillServerCache();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ super.afterTestsStopped();
+
+ stopAllGrids();
+ }
+
+ /**
+ * Test from client node batch merge through JDBC.
+ *
+ * @throws Exception If failure.
+ */
+ public void testBatchMerge() throws Exception {
+ final int BATCH_SIZE = 7;
+
+ try (Connection con = connect(clientNode);
+ Statement stmt = con.createStatement()) {
+ for (int idx = 0, i = 0; i < BATCH_SIZE; ++i, idx += i) {
+ stmt.addBatch("merge into " + FULL_TABLE_NAME + " (_key, name, orgId) values (" +
+ (100 + idx) + "," +
+ "'" + "batch-" + idx + "'" + "," +
+ idx +
+ ")");
+ }
+
+ int[] updCnts = stmt.executeBatch();
+
+ assertEquals("Invalid update counts size", BATCH_SIZE, updCnts.length);
+ }
+ }
+
+ /**
+ * Test from client node to delete cache elements through JDBC.
+ *
+ * @throws Exception If failure.
+ */
+ public void testClientJdbcDelete() throws Exception {
+ try (Connection con = connect(clientNode);
+ Statement stmt = con.createStatement()) {
+ int cnt = stmt.executeUpdate(("DELETE " + FULL_TABLE_NAME + " WHERE _key=1"));
+
+ Assert.assertEquals(1, cnt);
+ }
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("SELECT * FROM " + FULL_TABLE_NAME);
+
+ Assert.assertEquals(CACHE_ELEMENT_COUNT - 1, clientNode.cache(PERSON_CACHE).query(qry).getAll().size());
+ }
+
+ /**
+ * Test from client node to insert into cache through JDBC.
+ *
+ * @throws Exception If failure.
+ */
+ public void testClientJdbcInsert() throws Exception {
+ try (Connection con = connect(clientNode);
+ Statement stmt = con.createStatement()) {
+ int cnt = stmt.executeUpdate(
+ "INSERT INTO " + FULL_TABLE_NAME + "(_key, name, orgId) VALUES(1000,'new_name', 10000)");
+
+ Assert.assertEquals(1, cnt);
+ }
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("SELECT * FROM " + FULL_TABLE_NAME);
+
+ Assert.assertEquals(CACHE_ELEMENT_COUNT + 1, clientNode.cache(PERSON_CACHE).query(qry).getAll().size());
+ }
+
+ /**
+ * Test from client node to update cache elements through JDBC.
+ *
+ * @throws Exception If failure.
+ */
+ public void testClientJdbcUpdate() throws Exception {
+ try (Connection con = connect(clientNode);
+ Statement stmt = con.createStatement()) {
+ int cnt = stmt.executeUpdate(("UPDATE " + FULL_TABLE_NAME + " SET name = 'new_name'"));
+
+ Assert.assertEquals(CACHE_ELEMENT_COUNT, cnt);
+ }
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("SELECT * FROM " + FULL_TABLE_NAME + " WHERE name = 'new_name'");
+
+ Assert.assertEquals(CACHE_ELEMENT_COUNT, clientNode.cache(PERSON_CACHE).query(qry).getAll().size());
+ }
+
+ /**
+ * Test from client node to get cache elements through JDBC.
+ *
+ * @throws Exception If failure.
+ */
+ public void testClientJdbc() throws Exception {
+ try (Connection con = connect(clientNode);
+ Statement st = con.createStatement()) {
+ ResultSet rs = st.executeQuery("SELECT count(*) FROM " + FULL_TABLE_NAME);
+
+ rs.next();
+
+ Assert.assertEquals(CACHE_ELEMENT_COUNT, rs.getInt(1));
+ }
+ }
+
+ /**
+ * Test from client node to put cache elements through cache API.
+ */
+ public void testClientPut() {
+ clientNode.cache(PERSON_CACHE).put(-100, new Person(-100, "name-"));
+
+ Assert.assertEquals(CACHE_ELEMENT_COUNT + 1, clientNode.cache(PERSON_CACHE).size());
+ }
+
+ /**
+ * Test from client node to get cache elements through cache API.
+ */
+ public void testClientSqlFieldsQuery() {
+ SqlFieldsQuery qry = new SqlFieldsQuery("SELECT * FROM " + FULL_TABLE_NAME);
+
+ Assert.assertEquals(CACHE_ELEMENT_COUNT, clientNode.cache(PERSON_CACHE).query(qry).getAll().size());
+ }
+
+ /**
+ * Test from client node to get cache elements through cache API.
+ */
+ public void testClientSqlQuery() {
+ SqlQuery<Integer, Person> qry = new SqlQuery<>(PERSON_CACHE, "FROM " + PERSON_CACHE);
+
+ Assert.assertEquals(CACHE_ELEMENT_COUNT,
+ clientNode.cache(PERSON_CACHE).query(qry).getAll().size());
+ }
+
+ /**
+ * Create cache at server node and put some values into the cache.
+ */
+ private void createAndFillServerCache() {
+ IgniteEx srvNode = grid(0);
+
+ srvNode.createCache(cacheConfiguration());
+
+ for (int i = 0; i < CACHE_ELEMENT_COUNT; i++)
+ srvNode.cache(PERSON_CACHE).put(i, new Person(i, "name-" + i));
+ }
+
+ /**
+ * @return Cache configuration.
+ */
+ private CacheConfiguration<?, ?> cacheConfiguration() {
+ CacheConfiguration ccfg = new CacheConfiguration(PERSON_CACHE);
+
+ ccfg.setSqlSchema(PERSON_SCHEMA);
+ ccfg.setCacheMode(CacheMode.PARTITIONED);
+
+ QueryEntity person = new QueryEntity();
+ person.setKeyType(Integer.class.getName());
+ person.setValueType(Person.class.getName());
+ person.addQueryField("orgId", Integer.class.getName(), null);
+ person.addQueryField("id", Integer.class.getName(), null);
+ person.addQueryField("name", String.class.getName(), null);
+ person.setIndexes(F.asList(new QueryIndex("orgId"), new QueryIndex("id"), new QueryIndex("name")));
+
+ ccfg.setQueryEntities(F.asList(person));
+
+ return ccfg;
+ }
+
+ /**
+ * Create SQL connection to node specified as argument
+ *
+ * @param node Node to connect.
+ * @return Connection.
+ * @throws SQLException In case of failure.
+ */
+ private static Connection connect(IgniteEx node) throws SQLException {
+ Collection<GridPortRecord> recs = node.context().ports().records();
+
+ GridPortRecord cliLsnrRec = null;
+
+ for (GridPortRecord rec : recs) {
+ if (rec.clazz() == ClientListenerProcessor.class) {
+ cliLsnrRec = rec;
+
+ break;
+ }
+ }
+
+ String connStr = "jdbc:ignite:thin://127.0.0.1:" + cliLsnrRec.port();
+
+ return DriverManager.getConnection(connStr);
+ }
+
+ /**
+ * Test object to keep in cache.
+ */
+ private static class Person implements Serializable {
+ /** */
+ @QuerySqlField
+ int orgId;
+
+ /** */
+ @QuerySqlField
+ String name;
+
+ /**
+ * @param orgId Organization ID.
+ * @param name Name.
+ */
+ public Person(int orgId, String name) {
+ this.orgId = orgId;
+ this.name = name;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
index 07c0ede..5634748 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
@@ -725,6 +725,28 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
}
/**
+ * Test that {@code DROP TABLE} executed at client node actually removes specified cache and type descriptor on all nodes.
+ * @throws Exception if failed.
+ */
+ public void testDropTableFromClient() throws Exception {
+ execute(grid(0),"CREATE TABLE IF NOT EXISTS \"Person\" (\"id\" int, \"city\" varchar," +
+ " \"name\" varchar, \"surname\" varchar, \"age\" int, PRIMARY KEY (\"id\", \"city\")) WITH " +
+ "\"template=cache\"");
+
+ execute(client(), "DROP TABLE \"Person\"");
+
+ for (int i = 0; i < 4; i++) {
+ IgniteEx node = grid(i);
+
+ assertNull(node.cache("Person"));
+
+ QueryTypeDescriptorImpl desc = type(node, "Person", "Person");
+
+ assertNull(desc);
+ }
+ }
+
+ /**
* Test that {@code DROP TABLE} actually removes specified cache and type descriptor on all nodes.
* @throws Exception if failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SchemaExchangeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SchemaExchangeSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SchemaExchangeSelfTest.java
index c7709f2..bd2b578 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SchemaExchangeSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SchemaExchangeSelfTest.java
@@ -17,6 +17,9 @@
package org.apache.ignite.internal.processors.cache.index;
+import java.util.Collections;
+import java.util.Map;
+import junit.framework.AssertionFailedError;
import org.apache.ignite.IgniteClientDisconnectedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.Ignition;
@@ -26,18 +29,18 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.query.QueryTypeDescriptorImpl;
import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.GridTestUtils;
-import java.util.Collections;
-import java.util.Map;
-
import static org.apache.ignite.internal.IgniteClientReconnectAbstractTest.TestTcpDiscoverySpi;
import static org.apache.ignite.internal.IgniteClientReconnectAbstractTest.reconnectClientNode;
@@ -171,11 +174,13 @@ public class SchemaExchangeSelfTest extends AbstractSchemaSelfTest {
assertTypes(node1, ValueClass.class);
assertTypes(node2, ValueClass.class);
+ assertCacheStarted(CACHE_NAME, node1, node2);
- assertTypes(node3);
+ assertTypes(node3, ValueClass.class);
+ assertCacheNotStarted(CACHE_NAME, node3);
node3.cache(CACHE_NAME);
- assertTypes(node3, ValueClass.class);
+ assertCacheStarted(CACHE_NAME, node3);
// Check restarts from the first node.
destroySqlCache(node1);
@@ -193,11 +198,14 @@ public class SchemaExchangeSelfTest extends AbstractSchemaSelfTest {
assertTypes(node1, ValueClass.class, ValueClass2.class);
assertTypes(node2, ValueClass.class, ValueClass2.class);
+ assertTypes(node3, ValueClass.class, ValueClass2.class);
- assertTypes(node3);
+ assertCacheStarted(CACHE_NAME, node1, node2);
+
+ assertCacheNotStarted(CACHE_NAME, node3);
node3.cache(CACHE_NAME);
- assertTypes(node3, ValueClass.class, ValueClass2.class);
+ assertCacheStarted(CACHE_NAME, node3);
// Check restarts from the second node.
node2.destroyCache(CACHE_NAME);
@@ -215,16 +223,20 @@ public class SchemaExchangeSelfTest extends AbstractSchemaSelfTest {
assertTypes(node1, ValueClass.class, ValueClass2.class);
assertTypes(node2, ValueClass.class, ValueClass2.class);
+ assertTypes(node3, ValueClass.class, ValueClass2.class);
+ assertTypes(node4, ValueClass.class, ValueClass2.class);
- assertTypes(node3);
+ assertCacheStarted(CACHE_NAME, node1, node2);
+
+ assertCacheNotStarted(CACHE_NAME, node3);
node3.cache(CACHE_NAME);
- assertTypes(node3, ValueClass.class, ValueClass2.class);
+ assertCacheStarted(CACHE_NAME, node3);
- assertTypes(node4);
+ assertCacheNotStarted(CACHE_NAME, node4);
node4.cache(CACHE_NAME);
- assertTypes(node4, ValueClass.class, ValueClass2.class);
+ assertCacheStarted(CACHE_NAME, node4);
// Make sure that joining node observes correct state.
assertTypes(start(5), ValueClass.class, ValueClass2.class);
@@ -234,10 +246,13 @@ public class SchemaExchangeSelfTest extends AbstractSchemaSelfTest {
IgniteEx node8 = startClientNoCache(8);
- assertTypes(node8);
+ assertTypes(node8, ValueClass.class, ValueClass2.class);
+
+ assertCacheNotStarted(CACHE_NAME, node8);
node8.cache(CACHE_NAME);
- assertTypes(node8, ValueClass.class, ValueClass2.class);
+
+ assertCacheStarted(CACHE_NAME, node8);
}
/**
@@ -292,10 +307,15 @@ public class SchemaExchangeSelfTest extends AbstractSchemaSelfTest {
assertTypes(node2, ValueClass.class);
assertTypes(node3, ValueClass.class);
- assertTypes(node4);
+ assertTypes(node4, ValueClass.class);
+
+ assertCacheStarted(CACHE_NAME, node1, node2, node3);
+
+ assertCacheNotStarted(CACHE_NAME, node4);
node4.cache(CACHE_NAME);
- assertTypes(node4, ValueClass.class);
+
+ assertCacheStarted(CACHE_NAME, node4);
}
/**
@@ -345,40 +365,31 @@ public class SchemaExchangeSelfTest extends AbstractSchemaSelfTest {
IgniteEx node7 = startClient(7, KeyClass.class, ValueClass.class, KeyClass2.class, ValueClass2.class);
IgniteEx node8 = startClientNoCache(8);
- assertTypes(node1, ValueClass.class);
- assertTypes(node2, ValueClass.class);
- assertTypes(node3, ValueClass.class);
- assertTypes(node4, ValueClass.class);
- assertTypes(node5, ValueClass.class);
- assertTypes(node6, ValueClass.class);
- assertTypes(node7, ValueClass.class);
+ assertCacheStarted(CACHE_NAME, node1, node2, node3, node4, node5, node6, node7);
+ assertCacheNotStarted(CACHE_NAME, node8);
+ assertTypes(node8, ValueClass.class);
- assertTypes(node8);
node8.cache(CACHE_NAME);
- assertTypes(node8, ValueClass.class);
+
+ assertCacheStarted(CACHE_NAME, node8);
destroySqlCache(node2);
node2.getOrCreateCache(
cacheConfiguration(KeyClass.class, ValueClass.class, KeyClass2.class, ValueClass2.class));
- assertTypes(node1, ValueClass.class, ValueClass2.class);
- assertTypes(node2, ValueClass.class, ValueClass2.class);
- assertTypes(node3, ValueClass.class, ValueClass2.class);
- assertTypes(node4, ValueClass.class, ValueClass2.class);
- assertTypes(node5, ValueClass.class, ValueClass2.class);
+ assertCacheStarted(CACHE_NAME, node1, node2, node3, node4, node5);
+ assertCacheNotStarted(CACHE_NAME, node6, node7, node8);
- assertTypes(node6);
- assertTypes(node7);
- assertTypes(node8);
+ assertTypes(node6, ValueClass.class, ValueClass2.class);
+ assertTypes(node7, ValueClass.class, ValueClass2.class);
+ assertTypes(node8, ValueClass.class, ValueClass2.class);
node6.cache(CACHE_NAME);
node7.cache(CACHE_NAME);
node8.cache(CACHE_NAME);
- assertTypes(node6, ValueClass.class, ValueClass2.class);
- assertTypes(node7, ValueClass.class, ValueClass2.class);
- assertTypes(node8, ValueClass.class, ValueClass2.class);
+ assertCacheStarted(CACHE_NAME, node6, node7, node8);
}
/**
@@ -399,11 +410,14 @@ public class SchemaExchangeSelfTest extends AbstractSchemaSelfTest {
IgniteEx node3 = startNoCache(3);
assertTypes(node1, ValueClass.class);
assertTypes(node2, ValueClass.class);
+ assertTypes(node3, ValueClass.class);
- assertTypes(node3);
+ assertCacheStarted(CACHE_NAME, node1, node2);
+
+ assertCacheNotStarted(CACHE_NAME, node3);
node3.cache(CACHE_NAME);
- assertTypes(node3, ValueClass.class);
+ assertCacheStarted(CACHE_NAME, node1, node3);
}
/**
@@ -416,7 +430,12 @@ public class SchemaExchangeSelfTest extends AbstractSchemaSelfTest {
assertTypes(node1, ValueClass.class);
IgniteEx node2 = startClientNoCache(2);
- assertTypes(node2);
+
+ GridCacheContext<Object, Object> context0 = node2.context().cache().context().cacheContext(CU.cacheId(CACHE_NAME));
+ node2.cache(CACHE_NAME);
+ GridCacheContext<Object, Object> context = node2.context().cache().context().cacheContext(CU.cacheId(CACHE_NAME));
+ GridCacheAdapter<Object, Object> entries = node2.context().cache().internalCache(CACHE_NAME);
+ assertTrue(entries.active());
node2.cache(CACHE_NAME);
assertTypes(node2, ValueClass.class);
@@ -431,7 +450,7 @@ public class SchemaExchangeSelfTest extends AbstractSchemaSelfTest {
IgniteFuture reconnFut = null;
- try {
+ try {
node2.cache(CACHE_NAME);
fail();
@@ -442,13 +461,17 @@ public class SchemaExchangeSelfTest extends AbstractSchemaSelfTest {
node1 = start(1, KeyClass.class, ValueClass.class, KeyClass2.class, ValueClass2.class);
assertTypes(node1, ValueClass.class, ValueClass2.class);
+ assertTypes(node2, ValueClass.class);
+
+ assertCacheStarted(CACHE_NAME, node1);
reconnFut.get();
- assertTypes(node2);
+ assertTypes(node2, ValueClass.class, ValueClass2.class);
+ assertCacheNotStarted(CACHE_NAME, node2);
node2.cache(CACHE_NAME);
- assertTypes(node2, ValueClass.class, ValueClass2.class);
+ assertCacheStarted(CACHE_NAME, node2);
}
/**
@@ -462,10 +485,11 @@ public class SchemaExchangeSelfTest extends AbstractSchemaSelfTest {
assertTypes(node1, ValueClass.class);
final IgniteEx node2 = startClientNoCache(2);
- assertTypes(node2);
+ assertTypes(node2, ValueClass.class);
+ assertCacheNotStarted(CACHE_NAME, node2);
node2.cache(CACHE_NAME);
- assertTypes(node2, ValueClass.class);
+ assertCacheStarted(CACHE_NAME, node2);
reconnectClientNode(log, node2, node1, new Runnable() {
@Override public void run() {
@@ -489,6 +513,45 @@ public class SchemaExchangeSelfTest extends AbstractSchemaSelfTest {
}
/**
+ * Check is cache started on the given node or not.
+ *
+ * @param cacheName Cache name.
+ * @param node Node to check cache.
+ * @return {@code true} in case cache is started.
+ */
+ private boolean isCacheStarted(String cacheName, IgniteEx node) {
+ GridCacheContext cacheCtx = node.context().cache().context().cacheContext(CU.cacheId(cacheName));
+
+ return cacheCtx != null;
+ }
+
+ /**
+ * Check is cache started on the given nodes.
+ *
+ * @param nodes Node to check cache.
+ * @param cacheName Cache name.
+ * @throws AssertionFailedError If failed.
+ */
+ private void assertCacheStarted(String cacheName, IgniteEx... nodes) throws AssertionFailedError {
+ for (IgniteEx node : nodes) {
+ assertTrue(isCacheStarted(cacheName, node));
+ }
+ }
+
+ /**
+ * Check is cache not started on the given nodes.
+ *
+ * @param nodes Node to check cache.
+ * @param cacheName Cache name.
+ * @throws AssertionFailedError If failed.
+ */
+ private void assertCacheNotStarted(String cacheName, IgniteEx... nodes) throws AssertionFailedError {
+ for (IgniteEx node : nodes) {
+ assertFalse(isCacheStarted(cacheName, node));
+ }
+ }
+
+ /**
* Ensure that only provided types exists for the given cache.
*
* @param node Node.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
index 25cb473..d96b445 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
@@ -43,6 +43,8 @@ import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryMetricsLo
import org.apache.ignite.internal.processors.cache.CacheSqlQueryValueCopySelfTest;
import org.apache.ignite.internal.processors.cache.DdlTransactionSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheCrossCacheQuerySelfTest;
+import org.apache.ignite.internal.processors.cache.GridCacheDynamicLoadOnClientPersistentTest;
+import org.apache.ignite.internal.processors.cache.GridCacheDynamicLoadOnClientTest;
import org.apache.ignite.internal.processors.cache.GridCacheFullTextQuerySelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheLazyQueryPartitionsReleaseTest;
import org.apache.ignite.internal.processors.cache.GridCacheQueryIndexDisabledSelfTest;
@@ -533,6 +535,9 @@ public class IgniteBinaryCacheQueryTestSuite extends TestSuite {
// Partition pruning.
suite.addTestSuite(InOperationExtractPartitionSelfTest.class);
+ suite.addTestSuite(GridCacheDynamicLoadOnClientTest.class);
+ suite.addTestSuite(GridCacheDynamicLoadOnClientPersistentTest.class);
+
return suite;
}
}
[10/50] [abbrv] ignite git commit: IGNITE-10369 Avoid race on
handling discovery messages if last custom message is not processed
completely - Fixes #5462.
Posted by sb...@apache.org.
IGNITE-10369 Avoid race on handling discovery messages if last custom message is not processed completely - Fixes #5462.
Signed-off-by: Pavel Kovalenko <jo...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0cd303f1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0cd303f1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0cd303f1
Branch: refs/heads/ignite-10044
Commit: 0cd303f1f1b4be23be8f3be6301d4defd4be6ea1
Parents: 504393f
Author: ibessonov <be...@gmail.com>
Authored: Tue Dec 4 12:55:45 2018 +0300
Committer: Pavel Kovalenko <jo...@gmail.com>
Committed: Tue Dec 4 12:55:45 2018 +0300
----------------------------------------------------------------------
.../discovery/GridDiscoveryManager.java | 4 +-
.../cluster/GridClusterStateProcessor.java | 2 +-
.../ignite/spi/discovery/DiscoveryDataBag.java | 6 +++
.../ignite/spi/discovery/tcp/ServerImpl.java | 41 +++++++++++++++++++-
.../IgniteClusterActivateDeactivateTest.java | 4 +-
.../zk/internal/ZookeeperDiscoveryImpl.java | 21 ++++++++++
6 files changed, 70 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0cd303f1/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index beb8d21..5abe63c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -765,8 +765,6 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
// Current version.
discoCache = discoCache();
- final DiscoCache discoCache0 = discoCache;
-
// If this is a local join event, just save it and do not notify listeners.
if (locJoinEvt) {
if (gridStartTime == 0)
@@ -854,7 +852,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
try {
fut.get();
- discoWrk.addEvent(type, nextTopVer, node, discoCache0, topSnapshot, null);
+ discoWrk.addEvent(EVT_CLIENT_NODE_RECONNECTED, nextTopVer, node, discoCache, topSnapshot, null);
}
catch (IgniteException ignore) {
// No-op.
http://git-wip-us.apache.org/repos/asf/ignite/blob/0cd303f1/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
index c48128e..9d2adae 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
@@ -414,7 +414,7 @@ public class GridClusterStateProcessor extends GridProcessorAdapter implements I
if (msg.requestId().equals(state.transitionRequestId())) {
log.info("Received state change finish message: " + msg.clusterActive());
- globalState = globalState.finish(msg.success());
+ globalState = state.finish(msg.success());
afterStateChangeFinished(msg.id(), msg.success());
http://git-wip-us.apache.org/repos/asf/ignite/blob/0cd303f1/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryDataBag.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryDataBag.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryDataBag.java
index b8d8908..2b6bbca 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryDataBag.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryDataBag.java
@@ -23,6 +23,7 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.apache.ignite.internal.GridComponent;
+import org.apache.ignite.internal.util.typedef.internal.S;
import org.jetbrains.annotations.Nullable;
/**
@@ -312,4 +313,9 @@ public class DiscoveryDataBag {
@Nullable public Map<Integer, Serializable> localNodeSpecificData() {
return nodeSpecificData.get(DEFAULT_KEY);
}
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(DiscoveryDataBag.class, this);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0cd303f1/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 ce69e78..bab9ec0 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
@@ -261,6 +261,9 @@ class ServerImpl extends TcpDiscoveryImpl {
private final ConcurrentMap<InetSocketAddress, GridPingFutureAdapter<IgniteBiTuple<UUID, Boolean>>> pingMap =
new ConcurrentHashMap<>();
+ /** Last listener future. */
+ private IgniteFuture<?> lastCustomEvtLsnrFut;
+
/**
* @param adapter Adapter.
*/
@@ -2157,6 +2160,20 @@ class ServerImpl extends TcpDiscoveryImpl {
}
/**
+ * Wait for all the listeners from previous discovery message to be completed.
+ */
+ private void waitForLastCustomEventListenerFuture() {
+ if (lastCustomEvtLsnrFut != null) {
+ try {
+ lastCustomEvtLsnrFut.get();
+ }
+ finally {
+ lastCustomEvtLsnrFut = null;
+ }
+ }
+ }
+
+ /**
* Discovery messages history used for client reconnect.
*/
private class EnsuredMessageHistory {
@@ -4160,6 +4177,15 @@ class ServerImpl extends TcpDiscoveryImpl {
private void processNodeAddedMessage(TcpDiscoveryNodeAddedMessage msg) {
assert msg != null;
+ blockingSectionBegin();
+
+ try {
+ waitForLastCustomEventListenerFuture();
+ }
+ finally {
+ blockingSectionEnd();
+ }
+
TcpDiscoveryNode node = msg.node();
assert node != null;
@@ -5606,8 +5632,19 @@ class ServerImpl extends TcpDiscoveryImpl {
hist,
msgObj);
- if (waitForNotification || msgObj.isMutable())
- fut.get();
+ if (waitForNotification || msgObj.isMutable()) {
+ blockingSectionBegin();
+
+ try {
+ fut.get();
+ }
+ finally {
+ blockingSectionEnd();
+ }
+ }
+ else {
+ lastCustomEvtLsnrFut = fut;
+ }
if (msgObj.isMutable()) {
try {
http://git-wip-us.apache.org/repos/asf/ignite/blob/0cd303f1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
index ed6eb86..cc65ada 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
@@ -1201,13 +1201,13 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
client = false;
- IgniteInternalFuture startFut1 = GridTestUtils.runAsync((Callable)() -> {
+ IgniteInternalFuture<?> startFut1 = GridTestUtils.runAsync(() -> {
startGrid(4);
return null;
}, "start-node1");
- IgniteInternalFuture startFut2 = GridTestUtils.runAsync((Callable)() -> {
+ IgniteInternalFuture<?> startFut2 = GridTestUtils.runAsync(() -> {
startGrid(5);
return null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/0cd303f1/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
index abe1877..284f642 100644
--- a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
+++ b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
@@ -192,6 +192,9 @@ public class ZookeeperDiscoveryImpl {
/** */
private final ZookeeperDiscoveryStatistics stats;
+ /** Last listener future. */
+ private IgniteFuture<?> lastCustomEvtLsnrFut;
+
/**
* @param spi Discovery SPI.
* @param igniteInstanceName Instance name.
@@ -2752,6 +2755,8 @@ public class ZookeeperDiscoveryImpl {
private boolean processBulkJoin(ZkDiscoveryEventsData evtsData, ZkDiscoveryNodeJoinEventData evtData)
throws Exception
{
+ waitForLastListenerFuture();
+
boolean evtProcessed = false;
for (int i = 0; i < evtData.joinedNodes.size(); i++) {
@@ -3430,6 +3435,8 @@ public class ZookeeperDiscoveryImpl {
if (msg != null && msg.isMutable())
fut.get();
+ else
+ lastCustomEvtLsnrFut = fut;
}
/**
@@ -3987,6 +3994,20 @@ public class ZookeeperDiscoveryImpl {
}
/**
+ * Wait for all the listeners from previous discovery message to be completed.
+ */
+ private void waitForLastListenerFuture() {
+ if (lastCustomEvtLsnrFut != null) {
+ try {
+ lastCustomEvtLsnrFut.get();
+ }
+ finally {
+ lastCustomEvtLsnrFut = null;
+ }
+ }
+ }
+
+ /**
*
*/
private class ReconnectClosure implements Runnable {
[15/50] [abbrv] ignite git commit: IGNITE-10272: [ML] Inject learning
environment into scope of dataset compute task
Posted by sb...@apache.org.
IGNITE-10272: [ML] Inject learning environment into scope of
dataset compute task
This closes #5484
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ff6b8eed
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ff6b8eed
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ff6b8eed
Branch: refs/heads/ignite-10044
Commit: ff6b8eed8401590792b1d11b91b0039ddd03f958
Parents: c6a05f8
Author: Artem Malykh <am...@gmail.com>
Authored: Tue Dec 4 14:57:31 2018 +0300
Committer: Yury Babak <yb...@gridgain.com>
Committed: Tue Dec 4 14:57:31 2018 +0300
----------------------------------------------------------------------
.../AlgorithmSpecificDatasetExample.java | 2 +-
...ggedLogisticRegressionSGDTrainerExample.java | 3 +-
.../RandomForestRegressionExample.java | 9 +-
.../ml/clustering/kmeans/KMeansTrainer.java | 9 +-
.../boosting/GDBBinaryClassifierTrainer.java | 12 +-
.../boosting/GDBLearningStrategy.java | 21 ++-
.../boosting/GDBRegressionTrainer.java | 6 +
.../ml/composition/boosting/GDBTrainer.java | 20 ++-
.../convergence/ConvergenceChecker.java | 8 +-
.../simple/ConvergenceCheckerStub.java | 3 +-
.../org/apache/ignite/ml/dataset/Dataset.java | 61 ++++---
.../ignite/ml/dataset/DatasetBuilder.java | 17 +-
.../ignite/ml/dataset/DatasetFactory.java | 174 ++++++++++++++++--
.../ml/dataset/PartitionContextBuilder.java | 11 +-
.../ignite/ml/dataset/PartitionDataBuilder.java | 12 +-
.../ignite/ml/dataset/UpstreamTransformer.java | 22 ++-
.../ml/dataset/UpstreamTransformerBuilder.java | 72 ++++++++
.../ml/dataset/UpstreamTransformerChain.java | 153 ----------------
.../BootstrappedDatasetBuilder.java | 15 +-
.../dataset/impl/cache/CacheBasedDataset.java | 49 +++--
.../impl/cache/CacheBasedDatasetBuilder.java | 40 +++--
.../dataset/impl/cache/util/ComputeUtils.java | 128 ++++++++-----
.../ml/dataset/impl/local/LocalDataset.java | 18 +-
.../dataset/impl/local/LocalDatasetBuilder.java | 118 ++++++------
.../ml/dataset/primitive/DatasetWrapper.java | 5 +-
...eatureMatrixWithLabelsOnHeapDataBuilder.java | 7 +-
.../builder/context/EmptyContextBuilder.java | 3 +-
.../builder/data/SimpleDatasetDataBuilder.java | 5 +-
.../data/SimpleLabeledDatasetDataBuilder.java | 5 +-
.../DefaultLearningEnvironmentBuilder.java | 178 +++++++++++++++++++
.../ml/environment/LearningEnvironment.java | 19 +-
.../environment/LearningEnvironmentBuilder.java | 167 +++++++++--------
.../ml/environment/logging/ConsoleLogger.java | 3 +
.../parallelism/ParallelismStrategy.java | 1 -
.../java/org/apache/ignite/ml/knn/KNNUtils.java | 9 +-
.../ml/knn/ann/ANNClassificationTrainer.java | 10 +-
.../KNNClassificationTrainer.java | 8 +-
.../ml/knn/regression/KNNRegressionTrainer.java | 9 +-
.../ml/math/functions/IgniteFunction.java | 12 +-
.../ignite/ml/math/isolve/lsqr/LSQROnHeap.java | 6 +-
.../ml/math/primitives/vector/VectorUtils.java | 11 ++
.../ignite/ml/multiclass/OneVsRestTrainer.java | 3 +-
.../gaussian/GaussianNaiveBayesTrainer.java | 11 +-
.../org/apache/ignite/ml/nn/MLPTrainer.java | 1 +
.../org/apache/ignite/ml/pipeline/Pipeline.java | 14 ++
.../ml/preprocessing/PreprocessingTrainer.java | 66 ++++++-
.../binarization/BinarizationTrainer.java | 5 +-
.../preprocessing/encoding/EncoderTrainer.java | 12 +-
.../preprocessing/imputing/ImputerTrainer.java | 10 +-
.../maxabsscaling/MaxAbsScalerTrainer.java | 10 +-
.../minmaxscaling/MinMaxScalerTrainer.java | 12 +-
.../normalization/NormalizationTrainer.java | 5 +-
.../standardscaling/StandardScalerTrainer.java | 14 +-
.../linear/LinearRegressionLSQRTrainer.java | 1 +
.../LogRegressionMultiClassTrainer.java | 3 +-
.../LabelPartitionDataBuilderOnHeap.java | 8 +-
...abeledDatasetPartitionDataBuilderOnHeap.java | 7 +-
.../SVMLinearBinaryClassificationTrainer.java | 3 +-
...VMLinearMultiClassClassificationTrainer.java | 3 +-
.../ignite/ml/trainers/DatasetTrainer.java | 28 ++-
.../ignite/ml/trainers/TrainerTransformers.java | 68 +------
.../BaggingUpstreamTransformer.java | 29 ++-
.../org/apache/ignite/ml/tree/DecisionTree.java | 7 +
.../tree/DecisionTreeClassificationTrainer.java | 6 +
.../ml/tree/DecisionTreeRegressionTrainer.java | 6 +
.../GDBBinaryClassifierOnTreesTrainer.java | 6 +
.../boosting/GDBOnTreesLearningStrategy.java | 3 +-
.../boosting/GDBRegressionOnTreesTrainer.java | 6 +
.../ml/tree/data/DecisionTreeDataBuilder.java | 7 +-
.../tree/randomforest/RandomForestTrainer.java | 1 +
.../java/org/apache/ignite/ml/TestUtils.java | 79 ++++++++
.../MeanAbsValueConvergenceCheckerTest.java | 10 +-
.../MedianOfMedianConvergenceCheckerTest.java | 10 +-
.../cache/CacheBasedDatasetBuilderTest.java | 11 +-
.../impl/cache/CacheBasedDatasetTest.java | 11 +-
.../impl/cache/util/ComputeUtilsTest.java | 16 +-
.../impl/local/LocalDatasetBuilderTest.java | 14 +-
.../ml/dataset/primitive/SimpleDatasetTest.java | 2 +
.../primitive/SimpleLabeledDatasetTest.java | 11 +-
.../LearningEnvironmentBuilderTest.java | 36 ++--
.../ml/environment/LearningEnvironmentTest.java | 130 +++++++++++++-
.../ml/math/isolve/lsqr/LSQROnHeapTest.java | 4 +
.../binarization/BinarizationTrainerTest.java | 3 +
.../encoding/EncoderTrainerTest.java | 5 +
.../imputing/ImputerTrainerTest.java | 2 +
.../maxabsscaling/MaxAbsScalerTrainerTest.java | 2 +
.../minmaxscaling/MinMaxScalerTrainerTest.java | 2 +
.../normalization/NormalizationTrainerTest.java | 2 +
.../StandardScalerTrainerTest.java | 3 +
.../scoring/evaluator/EvaluatorTest.java | 11 +-
.../apache/ignite/ml/trainers/BaggingTest.java | 30 +++-
91 files changed, 1553 insertions(+), 637 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/examples/src/main/java/org/apache/ignite/examples/ml/dataset/AlgorithmSpecificDatasetExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/dataset/AlgorithmSpecificDatasetExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/dataset/AlgorithmSpecificDatasetExample.java
index 4d42d19..5148d9a 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/dataset/AlgorithmSpecificDatasetExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/dataset/AlgorithmSpecificDatasetExample.java
@@ -73,7 +73,7 @@ public class AlgorithmSpecificDatasetExample {
try (AlgorithmSpecificDataset dataset = DatasetFactory.create(
ignite,
persons,
- (upstream, upstreamSize) -> new AlgorithmSpecificPartitionContext(),
+ (env, upstream, upstreamSize) -> new AlgorithmSpecificPartitionContext(),
new SimpleLabeledDatasetDataBuilder<Integer, Person, AlgorithmSpecificPartitionContext>(
(k, v) -> VectorUtils.of(v.getAge()),
(k, v) -> new double[] {v.getSalary()}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/bagged/BaggedLogisticRegressionSGDTrainerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/bagged/BaggedLogisticRegressionSGDTrainerExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/bagged/BaggedLogisticRegressionSGDTrainerExample.java
index baf513a..44fb77e 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/bagged/BaggedLogisticRegressionSGDTrainerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/bagged/BaggedLogisticRegressionSGDTrainerExample.java
@@ -81,8 +81,7 @@ public class BaggedLogisticRegressionSGDTrainerExample {
0.6,
4,
3,
- new OnMajorityPredictionsAggregator(),
- 123L);
+ new OnMajorityPredictionsAggregator());
System.out.println(">>> Perform evaluation of the model.");
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestRegressionExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestRegressionExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestRegressionExample.java
index 3bf2c8e..a3c33cb 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestRegressionExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestRegressionExample.java
@@ -31,7 +31,7 @@ import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
import org.apache.ignite.examples.ml.util.SandboxMLCache;
import org.apache.ignite.ml.composition.ModelsComposition;
import org.apache.ignite.ml.dataset.feature.FeatureMeta;
-import org.apache.ignite.ml.environment.LearningEnvironment;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.environment.logging.ConsoleLogger;
import org.apache.ignite.ml.environment.logging.MLLogger;
import org.apache.ignite.ml.environment.parallelism.ParallelismStrategy;
@@ -80,10 +80,9 @@ public class RandomForestRegressionExample {
.withSubSampleSize(0.3)
.withSeed(0);
- trainer.setEnvironment(LearningEnvironment.builder()
- .withParallelismStrategy(ParallelismStrategy.Type.ON_DEFAULT_POOL)
- .withLoggingFactory(ConsoleLogger.factory(MLLogger.VerboseLevel.LOW))
- .build()
+ trainer.withEnvironmentBuilder(LearningEnvironmentBuilder.defaultBuilder()
+ .withParallelismStrategyTypeDependency(part -> ParallelismStrategy.Type.ON_DEFAULT_POOL)
+ .withLoggingFactoryDependency(part -> ConsoleLogger.factory(MLLogger.VerboseLevel.LOW))
);
System.out.println(">>> Configured trainer: " + trainer.getClass().getSimpleName());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/clustering/kmeans/KMeansTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/clustering/kmeans/KMeansTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/clustering/kmeans/KMeansTrainer.java
index a20d5da..88ea9b9 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/clustering/kmeans/KMeansTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/clustering/kmeans/KMeansTrainer.java
@@ -32,6 +32,7 @@ import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.PartitionDataBuilder;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.distances.DistanceMeasure;
import org.apache.ignite.ml.math.distances.EuclideanDistance;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
@@ -78,6 +79,11 @@ public class KMeansTrainer extends SingleLabelDatasetTrainer<KMeansModel> {
}
/** {@inheritDoc} */
+ @Override public KMeansTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) {
+ return (KMeansTrainer)super.withEnvironmentBuilder(envBuilder);
+ }
+
+ /** {@inheritDoc} */
@Override protected <K, V> KMeansModel updateModel(KMeansModel mdl, DatasetBuilder<K, V> datasetBuilder,
IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, Double> lbExtractor) {
@@ -91,7 +97,8 @@ public class KMeansTrainer extends SingleLabelDatasetTrainer<KMeansModel> {
Vector[] centers;
try (Dataset<EmptyContext, LabeledVectorSet<Double, LabeledVector>> dataset = datasetBuilder.build(
- (upstream, upstreamSize) -> new EmptyContext(),
+ envBuilder,
+ (env, upstream, upstreamSize) -> new EmptyContext(),
partDataBuilder
)) {
final Integer cols = dataset.compute(org.apache.ignite.ml.structures.Dataset::colSize, (a, b) -> {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBBinaryClassifierTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBBinaryClassifierTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBBinaryClassifierTrainer.java
index 8682a46..3acca14 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBBinaryClassifierTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBBinaryClassifierTrainer.java
@@ -25,12 +25,14 @@ import org.apache.ignite.ml.composition.boosting.loss.LogLoss;
import org.apache.ignite.ml.composition.boosting.loss.Loss;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.primitive.builder.context.EmptyContextBuilder;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.functions.IgniteFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.structures.LabeledVector;
import org.apache.ignite.ml.structures.LabeledVectorSet;
import org.apache.ignite.ml.structures.partition.LabeledDatasetPartitionDataBuilderOnHeap;
+import org.apache.ignite.ml.tree.boosting.GDBBinaryClassifierOnTreesTrainer;
/**
* Trainer for binary classifier using Gradient Boosting. As preparing stage this algorithm learn labels in dataset and
@@ -69,7 +71,10 @@ public abstract class GDBBinaryClassifierTrainer extends GDBTrainer {
IgniteBiFunction<K, V, Vector> featureExtractor,
IgniteBiFunction<K, V, Double> lExtractor) {
- Set<Double> uniqLabels = builder.build(new EmptyContextBuilder<>(), new LabeledDatasetPartitionDataBuilderOnHeap<>(featureExtractor, lExtractor))
+ Set<Double> uniqLabels = builder.build(
+ envBuilder,
+ new EmptyContextBuilder<>(),
+ new LabeledDatasetPartitionDataBuilderOnHeap<>(featureExtractor, lExtractor))
.compute((IgniteFunction<LabeledVectorSet<Double, LabeledVector>, Set<Double>>)x ->
Arrays.stream(x.labels()).boxed().collect(Collectors.toSet()), (a, b) -> {
if (a == null)
@@ -102,4 +107,9 @@ public abstract class GDBBinaryClassifierTrainer extends GDBTrainer {
double internalCls = sigma < 0.5 ? 0.0 : 1.0;
return internalCls == 0.0 ? externalFirstCls : externalSecondCls;
}
+
+ /** {@inheritDoc} */
+ @Override public GDBBinaryClassifierOnTreesTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) {
+ return (GDBBinaryClassifierOnTreesTrainer)super.withEnvironmentBuilder(envBuilder);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBLearningStrategy.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBLearningStrategy.java b/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBLearningStrategy.java
index e689b91..0b87748 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBLearningStrategy.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBLearningStrategy.java
@@ -29,6 +29,7 @@ import org.apache.ignite.ml.composition.boosting.loss.Loss;
import org.apache.ignite.ml.composition.predictionsaggregator.WeightedPredictionsAggregator;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.environment.LearningEnvironment;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.environment.logging.MLLogger;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.functions.IgniteFunction;
@@ -41,8 +42,11 @@ import org.jetbrains.annotations.NotNull;
* Learning strategy for gradient boosting.
*/
public class GDBLearningStrategy {
- /** Learning environment. */
- protected LearningEnvironment environment;
+ /** Learning environment builder. */
+ protected LearningEnvironmentBuilder envBuilder;
+
+ /** Learning environment used for trainer. */
+ protected LearningEnvironment trainerEnvironment;
/** Count of iterations. */
protected int cntOfIterations;
@@ -101,6 +105,8 @@ public class GDBLearningStrategy {
public <K,V> List<Model<Vector, Double>> update(GDBTrainer.GDBModel mdlToUpdate,
DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor,
IgniteBiFunction<K, V, Double> lbExtractor) {
+ if (trainerEnvironment == null)
+ throw new IllegalStateException("Learning environment builder is not set.");
List<Model<Vector, Double>> models = initLearningState(mdlToUpdate);
@@ -113,7 +119,7 @@ public class GDBLearningStrategy {
WeightedPredictionsAggregator aggregator = new WeightedPredictionsAggregator(weights, meanLbVal);
ModelsComposition currComposition = new ModelsComposition(models, aggregator);
- if (convCheck.isConverged(datasetBuilder, currComposition))
+ if (convCheck.isConverged(envBuilder, datasetBuilder, currComposition))
break;
IgniteBiFunction<K, V, Double> lbExtractorWrap = (k, v) -> {
@@ -125,7 +131,7 @@ public class GDBLearningStrategy {
long startTs = System.currentTimeMillis();
models.add(trainer.fit(datasetBuilder, featureExtractor, lbExtractorWrap));
double learningTime = (double)(System.currentTimeMillis() - startTs) / 1000.0;
- environment.logger(getClass()).log(MLLogger.VerboseLevel.LOW, "One model training time was %.2fs", learningTime);
+ trainerEnvironment.logger(getClass()).log(MLLogger.VerboseLevel.LOW, "One model training time was %.2fs", learningTime);
}
return models;
@@ -157,10 +163,11 @@ public class GDBLearningStrategy {
/**
* Sets learning environment.
*
- * @param environment Learning Environment.
+ * @param envBuilder Learning Environment.
*/
- public GDBLearningStrategy withEnvironment(LearningEnvironment environment) {
- this.environment = environment;
+ public GDBLearningStrategy withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) {
+ this.envBuilder = envBuilder;
+ this.trainerEnvironment = envBuilder.buildForTrainer();
return this;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBRegressionTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBRegressionTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBRegressionTrainer.java
index 8c1afd7..3dc95ee 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBRegressionTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBRegressionTrainer.java
@@ -19,6 +19,7 @@ package org.apache.ignite.ml.composition.boosting;
import org.apache.ignite.ml.composition.boosting.loss.SquaredError;
import org.apache.ignite.ml.dataset.DatasetBuilder;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
@@ -53,4 +54,9 @@ public abstract class GDBRegressionTrainer extends GDBTrainer {
@Override protected double internalLabelToExternal(double x) {
return x;
}
+
+ /** {@inheritDoc} */
+ @Override public GDBRegressionTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) {
+ return (GDBRegressionTrainer)super.withEnvironmentBuilder(envBuilder);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBTrainer.java
index 89cc6b1..03772ec 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/GDBTrainer.java
@@ -30,6 +30,7 @@ import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.primitive.builder.context.EmptyContextBuilder;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.environment.logging.MLLogger;
import org.apache.ignite.ml.knn.regression.KNNRegressionTrainer;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
@@ -99,7 +100,11 @@ public abstract class GDBTrainer extends DatasetTrainer<ModelsComposition, Doubl
if (!learnLabels(datasetBuilder, featureExtractor, lbExtractor))
return getLastTrainedModelOrThrowEmptyDatasetException(mdl);
- IgniteBiTuple<Double, Long> initAndSampleSize = computeInitialValue(datasetBuilder, featureExtractor, lbExtractor);
+ IgniteBiTuple<Double, Long> initAndSampleSize = computeInitialValue(
+ envBuilder,
+ datasetBuilder,
+ featureExtractor,
+ lbExtractor);
if(initAndSampleSize == null)
return getLastTrainedModelOrThrowEmptyDatasetException(mdl);
@@ -112,7 +117,7 @@ public abstract class GDBTrainer extends DatasetTrainer<ModelsComposition, Doubl
.withBaseModelTrainerBuilder(this::buildBaseModelTrainer)
.withExternalLabelToInternal(this::externalLabelToInternal)
.withCntOfIterations(cntOfIterations)
- .withEnvironment(environment)
+ .withEnvironmentBuilder(envBuilder)
.withLossGradient(loss)
.withSampleSize(sampleSize)
.withMeanLabelValue(mean)
@@ -140,6 +145,11 @@ public abstract class GDBTrainer extends DatasetTrainer<ModelsComposition, Doubl
return mdl instanceof GDBModel;
}
+ /** {@inheritDoc} */
+ @Override public GDBTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) {
+ return (GDBTrainer)super.withEnvironmentBuilder(envBuilder);
+ }
+
/**
* Defines unique labels in dataset if need (useful in case of classification).
*
@@ -175,14 +185,18 @@ public abstract class GDBTrainer extends DatasetTrainer<ModelsComposition, Doubl
* Compute mean value of label as first approximation.
*
* @param builder Dataset builder.
+ * @param envBuilder Learning environment builder.
* @param featureExtractor Feature extractor.
* @param lbExtractor Label extractor.
*/
- protected <V, K> IgniteBiTuple<Double, Long> computeInitialValue(DatasetBuilder<K, V> builder,
+ protected <V, K> IgniteBiTuple<Double, Long> computeInitialValue(
+ LearningEnvironmentBuilder envBuilder,
+ DatasetBuilder<K, V> builder,
IgniteBiFunction<K, V, Vector> featureExtractor,
IgniteBiFunction<K, V, Double> lbExtractor) {
try (Dataset<EmptyContext, DecisionTreeData> dataset = builder.build(
+ envBuilder,
new EmptyContextBuilder<>(),
new DecisionTreeDataBuilder<>(featureExtractor, lbExtractor, false)
)) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/convergence/ConvergenceChecker.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/convergence/ConvergenceChecker.java b/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/convergence/ConvergenceChecker.java
index 88841e2..e383e39 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/convergence/ConvergenceChecker.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/convergence/ConvergenceChecker.java
@@ -26,6 +26,7 @@ import org.apache.ignite.ml.dataset.primitive.FeatureMatrixWithLabelsOnHeapData;
import org.apache.ignite.ml.dataset.primitive.FeatureMatrixWithLabelsOnHeapDataBuilder;
import org.apache.ignite.ml.dataset.primitive.builder.context.EmptyContextBuilder;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.functions.IgniteFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
@@ -88,11 +89,16 @@ public abstract class ConvergenceChecker<K, V> implements Serializable {
/**
* Checks convergency on dataset.
*
+ * @param envBuilder Learning environment builder.
* @param currMdl Current model.
* @return true if GDB is converged.
*/
- public boolean isConverged(DatasetBuilder<K, V> datasetBuilder, ModelsComposition currMdl) {
+ public boolean isConverged(
+ LearningEnvironmentBuilder envBuilder,
+ DatasetBuilder<K, V> datasetBuilder,
+ ModelsComposition currMdl) {
try (Dataset<EmptyContext, FeatureMatrixWithLabelsOnHeapData> dataset = datasetBuilder.build(
+ envBuilder,
new EmptyContextBuilder<>(),
new FeatureMatrixWithLabelsOnHeapDataBuilder<>(featureExtractor, lbExtractor)
)) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/convergence/simple/ConvergenceCheckerStub.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/convergence/simple/ConvergenceCheckerStub.java b/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/convergence/simple/ConvergenceCheckerStub.java
index 98cfbe1..193afaf 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/convergence/simple/ConvergenceCheckerStub.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/composition/boosting/convergence/simple/ConvergenceCheckerStub.java
@@ -24,6 +24,7 @@ import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.primitive.FeatureMatrixWithLabelsOnHeapData;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.functions.IgniteFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
@@ -60,7 +61,7 @@ public class ConvergenceCheckerStub<K,V> extends ConvergenceChecker<K,V> {
}
/** {@inheritDoc} */
- @Override public boolean isConverged(DatasetBuilder<K, V> datasetBuilder, ModelsComposition currMdl) {
+ @Override public boolean isConverged(LearningEnvironmentBuilder envBuilder, DatasetBuilder<K, V> datasetBuilder, ModelsComposition currMdl) {
return false;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/Dataset.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/Dataset.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/Dataset.java
index 230a467..d821fe3 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/Dataset.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/Dataset.java
@@ -20,6 +20,7 @@ package org.apache.ignite.ml.dataset;
import java.io.Serializable;
import org.apache.ignite.ml.dataset.impl.cache.CacheBasedDataset;
import org.apache.ignite.ml.dataset.impl.local.LocalDataset;
+import org.apache.ignite.ml.environment.LearningEnvironment;
import org.apache.ignite.ml.math.functions.IgniteBiConsumer;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.functions.IgniteBinaryOperator;
@@ -56,49 +57,50 @@ public interface Dataset<C extends Serializable, D extends AutoCloseable> extend
* Applies the specified {@code map} function to every partition {@code data}, {@code context} and partition
* index in the dataset and then reduces {@code map} results to final result by using the {@code reduce} function.
*
- * @param map Function applied to every partition {@code data}, {@code context} and partition index.
+ * @param map Function applied to every partition {@code data}, {@code context} and {@link LearningEnvironment}.
* @param reduce Function applied to results of {@code map} to get final result.
* @param identity Identity.
* @param <R> Type of a result.
* @return Final result.
*/
- public <R> R computeWithCtx(IgniteTriFunction<C, D, Integer, R> map, IgniteBinaryOperator<R> reduce, R identity);
+ public <R> R computeWithCtx(IgniteTriFunction<C, D, LearningEnvironment, R> map, IgniteBinaryOperator<R> reduce, R identity);
/**
- * Applies the specified {@code map} function to every partition {@code data} and partition index in the dataset
- * and then reduces {@code map} results to final result by using the {@code reduce} function.
+ * Applies the specified {@code map} function to every partition {@code data} and {@link LearningEnvironment}
+ * in the dataset and then reduces {@code map} results to final result by using the {@code reduce} function.
*
- * @param map Function applied to every partition {@code data} and partition index.
+ * @param map Function applied to every partition {@code data} and {@link LearningEnvironment}.
* @param reduce Function applied to results of {@code map} to get final result.
* @param identity Identity.
* @param <R> Type of a result.
* @return Final result.
*/
- public <R> R compute(IgniteBiFunction<D, Integer, R> map, IgniteBinaryOperator<R> reduce, R identity);
+ public <R> R compute(IgniteBiFunction<D, LearningEnvironment, R> map, IgniteBinaryOperator<R> reduce, R identity);
/**
- * Applies the specified {@code map} function to every partition {@code data}, {@code context} and partition
- * index in the dataset and then reduces {@code map} results to final result by using the {@code reduce} function.
+ * Applies the specified {@code map} function to every partition {@code data}, {@code context} and
+ * {@link LearningEnvironment} in the dataset and then reduces {@code map} results to final
+ * result by using the {@code reduce} function.
*
- * @param map Function applied to every partition {@code data}, {@code context} and partition index.
+ * @param map Function applied to every partition {@code data}, {@code context} and {@link LearningEnvironment}.
* @param reduce Function applied to results of {@code map} to get final result.
* @param <R> Type of a result.
* @return Final result.
*/
- public default <R> R computeWithCtx(IgniteTriFunction<C, D, Integer, R> map, IgniteBinaryOperator<R> reduce) {
+ public default <R> R computeWithCtx(IgniteTriFunction<C, D, LearningEnvironment, R> map, IgniteBinaryOperator<R> reduce) {
return computeWithCtx(map, reduce, null);
}
/**
- * Applies the specified {@code map} function to every partition {@code data} and partition index in the dataset
- * and then reduces {@code map} results to final result by using the {@code reduce} function.
+ * Applies the specified {@code map} function to every partition {@code data} and {@link LearningEnvironment}
+ * in the dataset and then reduces {@code map} results to final result by using the {@code reduce} function.
*
- * @param map Function applied to every partition {@code data} and partition index.
+ * @param map Function applied to every partition {@code data} and {@link LearningEnvironment}.
* @param reduce Function applied to results of {@code map} to get final result.
* @param <R> Type of a result.
* @return Final result.
*/
- public default <R> R compute(IgniteBiFunction<D, Integer, R> map, IgniteBinaryOperator<R> reduce) {
+ public default <R> R compute(IgniteBiFunction<D, LearningEnvironment, R> map, IgniteBinaryOperator<R> reduce) {
return compute(map, reduce, null);
}
@@ -113,7 +115,7 @@ public interface Dataset<C extends Serializable, D extends AutoCloseable> extend
* @return Final result.
*/
public default <R> R computeWithCtx(IgniteBiFunction<C, D, R> map, IgniteBinaryOperator<R> reduce, R identity) {
- return computeWithCtx((ctx, data, partIdx) -> map.apply(ctx, data), reduce, identity);
+ return computeWithCtx((ctx, data, env) -> map.apply(ctx, data), reduce, identity);
}
/**
@@ -127,7 +129,7 @@ public interface Dataset<C extends Serializable, D extends AutoCloseable> extend
* @return Final result.
*/
public default <R> R compute(IgniteFunction<D, R> map, IgniteBinaryOperator<R> reduce, R identity) {
- return compute((data, partIdx) -> map.apply(data), reduce, identity);
+ return compute((data, env) -> map.apply(data), reduce, identity);
}
/**
@@ -140,7 +142,7 @@ public interface Dataset<C extends Serializable, D extends AutoCloseable> extend
* @return Final result.
*/
public default <R> R computeWithCtx(IgniteBiFunction<C, D, R> map, IgniteBinaryOperator<R> reduce) {
- return computeWithCtx((ctx, data, partIdx) -> map.apply(ctx, data), reduce);
+ return computeWithCtx((ctx, data, env) -> map.apply(ctx, data), reduce);
}
/**
@@ -153,30 +155,31 @@ public interface Dataset<C extends Serializable, D extends AutoCloseable> extend
* @return Final result.
*/
public default <R> R compute(IgniteFunction<D, R> map, IgniteBinaryOperator<R> reduce) {
- return compute((data, partIdx) -> map.apply(data), reduce);
+ return compute((data, env) -> map.apply(data), reduce);
}
/**
- * Applies the specified {@code map} function to every partition {@code data}, {@code context} and partition
- * index in the dataset.
+ * Applies the specified {@code map} function to every partition {@code data}, {@code context} and
+ * {@link LearningEnvironment} in the dataset.
*
* @param map Function applied to every partition {@code data}, {@code context} and partition index.
*/
- public default void computeWithCtx(IgniteTriConsumer<C, D, Integer> map) {
- computeWithCtx((ctx, data, partIdx) -> {
- map.accept(ctx, data, partIdx);
+ public default void computeWithCtx(IgniteTriConsumer<C, D, LearningEnvironment> map) {
+ computeWithCtx((ctx, data, env) -> {
+ map.accept(ctx, data, env);
return null;
}, (a, b) -> null);
}
/**
- * Applies the specified {@code map} function to every partition {@code data} in the dataset and partition index.
+ * Applies the specified {@code map} function to every partition {@code data} in the dataset and
+ * {@link LearningEnvironment}.
*
* @param map Function applied to every partition {@code data} and partition index.
*/
- public default void compute(IgniteBiConsumer<D, Integer> map) {
- compute((data, partIdx) -> {
- map.accept(data, partIdx);
+ public default void compute(IgniteBiConsumer<D, LearningEnvironment> map) {
+ compute((data, env) -> {
+ map.accept(data, env);
return null;
}, (a, b) -> null);
}
@@ -187,7 +190,7 @@ public interface Dataset<C extends Serializable, D extends AutoCloseable> extend
* @param map Function applied to every partition {@code data} and {@code context}.
*/
public default void computeWithCtx(IgniteBiConsumer<C, D> map) {
- computeWithCtx((ctx, data, partIdx) -> map.accept(ctx, data));
+ computeWithCtx((ctx, data, env) -> map.accept(ctx, data));
}
/**
@@ -196,7 +199,7 @@ public interface Dataset<C extends Serializable, D extends AutoCloseable> extend
* @param map Function applied to every partition {@code data}.
*/
public default void compute(IgniteConsumer<D> map) {
- compute((data, partIdx) -> map.accept(data));
+ compute((data, env) -> map.accept(data));
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/DatasetBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/DatasetBuilder.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/DatasetBuilder.java
index 4dd0a96..9900659 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/DatasetBuilder.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/DatasetBuilder.java
@@ -21,6 +21,7 @@ import java.io.Serializable;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.ml.dataset.impl.cache.CacheBasedDatasetBuilder;
import org.apache.ignite.ml.dataset.impl.local.LocalDatasetBuilder;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.trainers.transformers.BaggingUpstreamTransformer;
/**
@@ -40,6 +41,7 @@ public interface DatasetBuilder<K, V> {
* Constructs a new instance of {@link Dataset} that includes allocation required data structures and
* initialization of {@code context} part of partitions.
*
+ * @param envBuilder Learning environment builder.
* @param partCtxBuilder Partition {@code context} builder.
* @param partDataBuilder Partition {@code data} builder.
* @param <C> Type of a partition {@code context}.
@@ -47,18 +49,25 @@ public interface DatasetBuilder<K, V> {
* @return Dataset.
*/
public <C extends Serializable, D extends AutoCloseable> Dataset<C, D> build(
- PartitionContextBuilder<K, V, C> partCtxBuilder, PartitionDataBuilder<K, V, C, D> partDataBuilder);
+ LearningEnvironmentBuilder envBuilder,
+ PartitionContextBuilder<K, V, C> partCtxBuilder,
+ PartitionDataBuilder<K, V, C, D> partDataBuilder);
/**
- * Get upstream transformers chain. This chain is applied to upstream data before it is passed
+ * Returns new instance of {@link DatasetBuilder} with new {@link UpstreamTransformerBuilder} added
+ * to chain of upstream transformer builders. When needed, each builder in chain first transformed into
+ * {@link UpstreamTransformer}, those are in turn composed together one after another forming
+ * final {@link UpstreamTransformer}.
+ * This transformer is applied to upstream data before it is passed
* to {@link PartitionDataBuilder} and {@link PartitionContextBuilder}. This is needed to allow
* transformation to upstream data which are agnostic of any changes that happen after.
* Such transformations may be used for deriving meta-algorithms such as bagging
* (see {@link BaggingUpstreamTransformer}).
*
- * @return Upstream transformers chain.
+ * @return Returns new instance of {@link DatasetBuilder} with new {@link UpstreamTransformerBuilder} added
+ * to chain of upstream transformer builders.
*/
- public UpstreamTransformerChain<K, V> upstreamTransformersChain();
+ public DatasetBuilder<K, V> withUpstreamTransformer(UpstreamTransformerBuilder<K, V> builder);
/**
* Returns new instance of DatasetBuilder using conjunction of internal filter and {@code filterToAdd}.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/DatasetFactory.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/DatasetFactory.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/DatasetFactory.java
index 1623a2b..ef8eb23 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/DatasetFactory.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/DatasetFactory.java
@@ -31,6 +31,7 @@ import org.apache.ignite.ml.dataset.primitive.builder.data.SimpleLabeledDatasetD
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
import org.apache.ignite.ml.dataset.primitive.data.SimpleDatasetData;
import org.apache.ignite.ml.dataset.primitive.data.SimpleLabeledDatasetData;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
@@ -76,6 +77,7 @@ public class DatasetFactory {
* {@code partDataBuilder}. This is the generic methods that allows to create any Ignite Cache based datasets with
* any desired partition {@code context} and {@code data}.
*
+ * @param envBuilder Learning environment builder.
* @param datasetBuilder Dataset builder.
* @param partCtxBuilder Partition {@code context} builder.
* @param partDataBuilder Partition {@code data} builder.
@@ -86,13 +88,42 @@ public class DatasetFactory {
* @return Dataset.
*/
public static <K, V, C extends Serializable, D extends AutoCloseable> Dataset<C, D> create(
- DatasetBuilder<K, V> datasetBuilder, PartitionContextBuilder<K, V, C> partCtxBuilder,
+ DatasetBuilder<K, V> datasetBuilder,
+ LearningEnvironmentBuilder envBuilder,
+ PartitionContextBuilder<K, V, C> partCtxBuilder,
PartitionDataBuilder<K, V, C, D> partDataBuilder) {
return datasetBuilder.build(
+ envBuilder,
partCtxBuilder,
partDataBuilder
);
}
+
+ /**
+ * Creates a new instance of distributed dataset using the specified {@code partCtxBuilder} and
+ * {@code partDataBuilder}. This is the generic methods that allows to create any Ignite Cache based datasets with
+ * any desired partition {@code context} and {@code data}.
+ *
+ * @param datasetBuilder Dataset builder.
+ * @param partCtxBuilder Partition {@code context} builder.
+ * @param partDataBuilder Partition {@code data} builder.
+ * @param <K> Type of a key in {@code upstream} data.
+ * @param <V> ype of a value in {@code upstream} data.
+ * @param <C> Type of a partition {@code context}.
+ * @param <D> Type of a partition {@code data}.
+ * @return Dataset.
+ */
+ public static <K, V, C extends Serializable, D extends AutoCloseable> Dataset<C, D> create(
+ DatasetBuilder<K, V> datasetBuilder,
+ PartitionContextBuilder<K, V, C> partCtxBuilder,
+ PartitionDataBuilder<K, V, C, D> partDataBuilder) {
+ return datasetBuilder.build(
+ LearningEnvironmentBuilder.defaultBuilder(),
+ partCtxBuilder,
+ partDataBuilder
+ );
+ }
+
/**
* Creates a new instance of distributed dataset using the specified {@code partCtxBuilder} and
* {@code partDataBuilder}. This is the generic methods that allows to create any Ignite Cache based datasets with
@@ -100,6 +131,7 @@ public class DatasetFactory {
*
* @param ignite Ignite instance.
* @param upstreamCache Ignite Cache with {@code upstream} data.
+ * @param envBuilder Learning environment builder.
* @param partCtxBuilder Partition {@code context} builder.
* @param partDataBuilder Partition {@code data} builder.
* @param <K> Type of a key in {@code upstream} data.
@@ -109,7 +141,36 @@ public class DatasetFactory {
* @return Dataset.
*/
public static <K, V, C extends Serializable, D extends AutoCloseable> Dataset<C, D> create(
- Ignite ignite, IgniteCache<K, V> upstreamCache, PartitionContextBuilder<K, V, C> partCtxBuilder,
+ Ignite ignite, IgniteCache<K, V> upstreamCache,
+ LearningEnvironmentBuilder envBuilder,
+ PartitionContextBuilder<K, V, C> partCtxBuilder,
+ PartitionDataBuilder<K, V, C, D> partDataBuilder) {
+ return create(
+ new CacheBasedDatasetBuilder<>(ignite, upstreamCache),
+ envBuilder,
+ partCtxBuilder,
+ partDataBuilder
+ );
+ }
+
+ /**
+ * Creates a new instance of distributed dataset using the specified {@code partCtxBuilder} and
+ * {@code partDataBuilder}. This is the generic methods that allows to create any Ignite Cache based datasets with
+ * any desired partition {@code context} and {@code data}.
+ *
+ * @param ignite Ignite instance.
+ * @param upstreamCache Ignite Cache with {@code upstream} data.
+ * @param partCtxBuilder Partition {@code context} builder.
+ * @param partDataBuilder Partition {@code data} builder.
+ * @param <K> Type of a key in {@code upstream} data.
+ * @param <V> Type of a value in {@code upstream} data.
+ * @param <C> Type of a partition {@code context}.
+ * @param <D> Type of a partition {@code data}.
+ * @return Dataset.
+ */
+ public static <K, V, C extends Serializable, D extends AutoCloseable> Dataset<C, D> create(
+ Ignite ignite, IgniteCache<K, V> upstreamCache,
+ PartitionContextBuilder<K, V, C> partCtxBuilder,
PartitionDataBuilder<K, V, C, D> partDataBuilder) {
return create(
new CacheBasedDatasetBuilder<>(ignite, upstreamCache),
@@ -124,6 +185,7 @@ public class DatasetFactory {
* allows to use any desired type of partition {@code context}.
*
* @param datasetBuilder Dataset builder.
+ * @param envBuilder Learning environment builder.
* @param partCtxBuilder Partition {@code context} builder.
* @param featureExtractor Feature extractor used to extract features and build {@link SimpleDatasetData}.
* @param <K> Type of a key in {@code upstream} data.
@@ -132,10 +194,13 @@ public class DatasetFactory {
* @return Dataset.
*/
public static <K, V, C extends Serializable> SimpleDataset<C> createSimpleDataset(
- DatasetBuilder<K, V> datasetBuilder, PartitionContextBuilder<K, V, C> partCtxBuilder,
+ DatasetBuilder<K, V> datasetBuilder,
+ LearningEnvironmentBuilder envBuilder,
+ PartitionContextBuilder<K, V, C> partCtxBuilder,
IgniteBiFunction<K, V, Vector> featureExtractor) {
return create(
datasetBuilder,
+ envBuilder,
partCtxBuilder,
new SimpleDatasetDataBuilder<>(featureExtractor)
).wrap(SimpleDataset::new);
@@ -148,6 +213,7 @@ public class DatasetFactory {
*
* @param ignite Ignite instance.
* @param upstreamCache Ignite Cache with {@code upstream} data.
+ * @param envBuilder Learning environment builder.
* @param partCtxBuilder Partition {@code context} builder.
* @param featureExtractor Feature extractor used to extract features and build {@link SimpleDatasetData}.
* @param <K> Type of a key in {@code upstream} data.
@@ -156,10 +222,13 @@ public class DatasetFactory {
* @return Dataset.
*/
public static <K, V, C extends Serializable> SimpleDataset<C> createSimpleDataset(Ignite ignite,
- IgniteCache<K, V> upstreamCache, PartitionContextBuilder<K, V, C> partCtxBuilder,
+ IgniteCache<K, V> upstreamCache,
+ LearningEnvironmentBuilder envBuilder,
+ PartitionContextBuilder<K, V, C> partCtxBuilder,
IgniteBiFunction<K, V, Vector> featureExtractor) {
return createSimpleDataset(
new CacheBasedDatasetBuilder<>(ignite, upstreamCache),
+ envBuilder,
partCtxBuilder,
featureExtractor
);
@@ -171,6 +240,7 @@ public class DatasetFactory {
* {@link SimpleLabeledDatasetData}, but allows to use any desired type of partition {@code context}.
*
* @param datasetBuilder Dataset builder.
+ * @param envBuilder Learning environment builder.
* @param partCtxBuilder Partition {@code context} builder.
* @param featureExtractor Feature extractor used to extract features and build {@link SimpleLabeledDatasetData}.
* @param lbExtractor Label extractor used to extract labels and build {@link SimpleLabeledDatasetData}.
@@ -180,10 +250,14 @@ public class DatasetFactory {
* @return Dataset.
*/
public static <K, V, C extends Serializable> SimpleLabeledDataset<C> createSimpleLabeledDataset(
- DatasetBuilder<K, V> datasetBuilder, PartitionContextBuilder<K, V, C> partCtxBuilder,
- IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, double[]> lbExtractor) {
+ DatasetBuilder<K, V> datasetBuilder,
+ LearningEnvironmentBuilder envBuilder,
+ PartitionContextBuilder<K, V, C> partCtxBuilder,
+ IgniteBiFunction<K, V, Vector> featureExtractor,
+ IgniteBiFunction<K, V, double[]> lbExtractor) {
return create(
datasetBuilder,
+ envBuilder,
partCtxBuilder,
new SimpleLabeledDatasetDataBuilder<>(featureExtractor, lbExtractor)
).wrap(SimpleLabeledDataset::new);
@@ -196,6 +270,7 @@ public class DatasetFactory {
*
* @param ignite Ignite instance.
* @param upstreamCache Ignite Cache with {@code upstream} data.
+ * @param envBuilder Learning environment builder.
* @param partCtxBuilder Partition {@code context} builder.
* @param featureExtractor Feature extractor used to extract features and build {@link SimpleLabeledDatasetData}.
* @param lbExtractor Label extractor used to extract labels and build {@link SimpleLabeledDatasetData}.
@@ -204,11 +279,16 @@ public class DatasetFactory {
* @param <C> Type of a partition {@code context}.
* @return Dataset.
*/
- public static <K, V, C extends Serializable> SimpleLabeledDataset<C> createSimpleLabeledDataset(Ignite ignite,
- IgniteCache<K, V> upstreamCache, PartitionContextBuilder<K, V, C> partCtxBuilder,
- IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, double[]> lbExtractor) {
+ public static <K, V, C extends Serializable> SimpleLabeledDataset<C> createSimpleLabeledDataset(
+ Ignite ignite,
+ IgniteCache<K, V> upstreamCache,
+ LearningEnvironmentBuilder envBuilder,
+ PartitionContextBuilder<K, V, C> partCtxBuilder,
+ IgniteBiFunction<K, V, Vector> featureExtractor,
+ IgniteBiFunction<K, V, double[]> lbExtractor) {
return createSimpleLabeledDataset(
new CacheBasedDatasetBuilder<>(ignite, upstreamCache),
+ envBuilder,
partCtxBuilder,
featureExtractor,
lbExtractor
@@ -221,15 +301,19 @@ public class DatasetFactory {
* {@link SimpleDatasetData}.
*
* @param datasetBuilder Dataset builder.
+ * @param envBuilder Learning environment builder.
* @param featureExtractor Feature extractor used to extract features and build {@link SimpleDatasetData}.
* @param <K> Type of a key in {@code upstream} data.
* @param <V> Type of a value in {@code upstream} data.
* @return Dataset.
*/
- public static <K, V> SimpleDataset<EmptyContext> createSimpleDataset(DatasetBuilder<K, V> datasetBuilder,
+ public static <K, V> SimpleDataset<EmptyContext> createSimpleDataset(
+ DatasetBuilder<K, V> datasetBuilder,
+ LearningEnvironmentBuilder envBuilder,
IgniteBiFunction<K, V, Vector> featureExtractor) {
return createSimpleDataset(
datasetBuilder,
+ envBuilder,
new EmptyContextBuilder<>(),
featureExtractor
);
@@ -242,15 +326,43 @@ public class DatasetFactory {
*
* @param ignite Ignite instance.
* @param upstreamCache Ignite Cache with {@code upstream} data.
+ * @param envBuilder Learning environment builder.
* @param featureExtractor Feature extractor used to extract features and build {@link SimpleDatasetData}.
* @param <K> Type of a key in {@code upstream} data.
* @param <V> Type of a value in {@code upstream} data.
* @return Dataset.
*/
- public static <K, V> SimpleDataset<EmptyContext> createSimpleDataset(Ignite ignite, IgniteCache<K, V> upstreamCache,
+ public static <K, V> SimpleDataset<EmptyContext> createSimpleDataset(
+ Ignite ignite,
+ IgniteCache<K, V> upstreamCache,
+ LearningEnvironmentBuilder envBuilder,
IgniteBiFunction<K, V, Vector> featureExtractor) {
return createSimpleDataset(
new CacheBasedDatasetBuilder<>(ignite, upstreamCache),
+ envBuilder,
+ featureExtractor
+ );
+ }
+
+ /**
+ * Creates a new instance of distributed {@link SimpleDataset} using the specified {@code featureExtractor}. This
+ * methods determines partition {@code context} to be {@link EmptyContext} and partition {@code data} to be
+ * {@link SimpleDatasetData}.
+ *
+ * @param ignite Ignite instance.
+ * @param upstreamCache Ignite Cache with {@code upstream} data.
+ * @param featureExtractor Feature extractor used to extract features and build {@link SimpleDatasetData}.
+ * @param <K> Type of a key in {@code upstream} data.
+ * @param <V> Type of a value in {@code upstream} data.
+ * @return Dataset.
+ */
+ public static <K, V> SimpleDataset<EmptyContext> createSimpleDataset(
+ Ignite ignite,
+ IgniteCache<K, V> upstreamCache,
+ IgniteBiFunction<K, V, Vector> featureExtractor) {
+ return createSimpleDataset(
+ new CacheBasedDatasetBuilder<>(ignite, upstreamCache),
+ LearningEnvironmentBuilder.defaultBuilder(),
featureExtractor
);
}
@@ -261,6 +373,7 @@ public class DatasetFactory {
* partition {@code data} to be {@link SimpleLabeledDatasetData}.
*
* @param datasetBuilder Dataset builder.
+ * @param envBuilder Learning environment builder.
* @param featureExtractor Feature extractor used to extract features and build {@link SimpleLabeledDatasetData}.
* @param lbExtractor Label extractor used to extract labels and build {@link SimpleLabeledDatasetData}.
* @param <K> Type of a key in {@code upstream} data.
@@ -268,10 +381,13 @@ public class DatasetFactory {
* @return Dataset.
*/
public static <K, V> SimpleLabeledDataset<EmptyContext> createSimpleLabeledDataset(
- DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor,
+ DatasetBuilder<K, V> datasetBuilder,
+ LearningEnvironmentBuilder envBuilder,
+ IgniteBiFunction<K, V, Vector> featureExtractor,
IgniteBiFunction<K, V, double[]> lbExtractor) {
return createSimpleLabeledDataset(
datasetBuilder,
+ envBuilder,
new EmptyContextBuilder<>(),
featureExtractor,
lbExtractor
@@ -285,17 +401,21 @@ public class DatasetFactory {
*
* @param ignite Ignite instance.
* @param upstreamCache Ignite Cache with {@code upstream} data.
+ * @param envBuilder Learning environment builder.
* @param featureExtractor Feature extractor used to extract features and build {@link SimpleLabeledDatasetData}.
* @param lbExtractor Label extractor used to extract labels and build {@link SimpleLabeledDatasetData}.
* @param <K> Type of a key in {@code upstream} data.
* @param <V> Type of a value in {@code upstream} data.
* @return Dataset.
*/
- public static <K, V> SimpleLabeledDataset<EmptyContext> createSimpleLabeledDataset(Ignite ignite,
+ public static <K, V> SimpleLabeledDataset<EmptyContext> createSimpleLabeledDataset(
+ Ignite ignite,
+ LearningEnvironmentBuilder envBuilder,
IgniteCache<K, V> upstreamCache, IgniteBiFunction<K, V, Vector> featureExtractor,
IgniteBiFunction<K, V, double[]> lbExtractor) {
return createSimpleLabeledDataset(
new CacheBasedDatasetBuilder<>(ignite, upstreamCache),
+ envBuilder,
featureExtractor,
lbExtractor
);
@@ -309,6 +429,7 @@ public class DatasetFactory {
* @param upstreamMap {@code Map} with {@code upstream} data.
* @param partitions Number of partitions {@code upstream} {@code Map} will be divided on.
* @param partCtxBuilder Partition {@code context} builder.
+ * @param envBuilder Learning environment builder.
* @param partDataBuilder Partition {@code data} builder.
* @param <K> Type of a key in {@code upstream} data.
* @param <V> Type of a value in {@code upstream} data.
@@ -317,10 +438,13 @@ public class DatasetFactory {
* @return Dataset.
*/
public static <K, V, C extends Serializable, D extends AutoCloseable> Dataset<C, D> create(
- Map<K, V> upstreamMap, int partitions, PartitionContextBuilder<K, V, C> partCtxBuilder,
+ Map<K, V> upstreamMap,
+ LearningEnvironmentBuilder envBuilder,
+ int partitions, PartitionContextBuilder<K, V, C> partCtxBuilder,
PartitionDataBuilder<K, V, C, D> partDataBuilder) {
return create(
new LocalDatasetBuilder<>(upstreamMap, partitions),
+ envBuilder,
partCtxBuilder,
partDataBuilder
);
@@ -333,6 +457,7 @@ public class DatasetFactory {
*
* @param upstreamMap {@code Map} with {@code upstream} data.
* @param partitions Number of partitions {@code upstream} {@code Map} will be divided on.
+ * @param envBuilder Learning environment builder.
* @param partCtxBuilder Partition {@code context} builder.
* @param featureExtractor Feature extractor used to extract features and build {@link SimpleDatasetData}.
* @param <K> Type of a key in {@code upstream} data.
@@ -340,11 +465,15 @@ public class DatasetFactory {
* @param <C> Type of a partition {@code context}.
* @return Dataset.
*/
- public static <K, V, C extends Serializable> SimpleDataset<C> createSimpleDataset(Map<K, V> upstreamMap,
- int partitions, PartitionContextBuilder<K, V, C> partCtxBuilder,
+ public static <K, V, C extends Serializable> SimpleDataset<C> createSimpleDataset(
+ Map<K, V> upstreamMap,
+ int partitions,
+ LearningEnvironmentBuilder envBuilder,
+ PartitionContextBuilder<K, V, C> partCtxBuilder,
IgniteBiFunction<K, V, Vector> featureExtractor) {
return createSimpleDataset(
new LocalDatasetBuilder<>(upstreamMap, partitions),
+ envBuilder,
partCtxBuilder,
featureExtractor
);
@@ -357,6 +486,7 @@ public class DatasetFactory {
*
* @param upstreamMap {@code Map} with {@code upstream} data.
* @param partitions Number of partitions {@code upstream} {@code Map} will be divided on.
+ * @param envBuilder Learning environment builder.
* @param partCtxBuilder Partition {@code context} builder.
* @param featureExtractor Feature extractor used to extract features and build {@link SimpleLabeledDatasetData}.
* @param lbExtractor Label extractor used to extract labels and build {@link SimpleLabeledDatasetData}.
@@ -366,10 +496,14 @@ public class DatasetFactory {
* @return Dataset.
*/
public static <K, V, C extends Serializable> SimpleLabeledDataset<C> createSimpleLabeledDataset(
- Map<K, V> upstreamMap, int partitions, PartitionContextBuilder<K, V, C> partCtxBuilder,
+ Map<K, V> upstreamMap,
+ int partitions,
+ LearningEnvironmentBuilder envBuilder,
+ PartitionContextBuilder<K, V, C> partCtxBuilder,
IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, double[]> lbExtractor) {
return createSimpleLabeledDataset(
new LocalDatasetBuilder<>(upstreamMap, partitions),
+ envBuilder,
partCtxBuilder,
featureExtractor, lbExtractor
);
@@ -382,15 +516,18 @@ public class DatasetFactory {
*
* @param upstreamMap {@code Map} with {@code upstream} data.
* @param partitions Number of partitions {@code upstream} {@code Map} will be divided on.
+ * @param envBuilder Learning environment builder.
* @param featureExtractor Feature extractor used to extract features and build {@link SimpleDatasetData}.
* @param <K> Type of a key in {@code upstream} data.
* @param <V> Type of a value in {@code upstream} data.
* @return Dataset.
*/
public static <K, V> SimpleDataset<EmptyContext> createSimpleDataset(Map<K, V> upstreamMap, int partitions,
+ LearningEnvironmentBuilder envBuilder,
IgniteBiFunction<K, V, Vector> featureExtractor) {
return createSimpleDataset(
new LocalDatasetBuilder<>(upstreamMap, partitions),
+ envBuilder,
featureExtractor
);
}
@@ -402,6 +539,7 @@ public class DatasetFactory {
*
* @param upstreamMap {@code Map} with {@code upstream} data.
* @param partitions Number of partitions {@code upstream} {@code Map} will be divided on.
+ * @param envBuilder Learning environment builder.
* @param featureExtractor Feature extractor used to extract features and build {@link SimpleLabeledDatasetData}.
* @param lbExtractor Label extractor used to extract labels and build {@link SimpleLabeledDatasetData}.
* @param <K> Type of a key in {@code upstream} data.
@@ -409,10 +547,12 @@ public class DatasetFactory {
* @return Dataset.
*/
public static <K, V> SimpleLabeledDataset<EmptyContext> createSimpleLabeledDataset(Map<K, V> upstreamMap,
+ LearningEnvironmentBuilder envBuilder,
int partitions, IgniteBiFunction<K, V, Vector> featureExtractor,
IgniteBiFunction<K, V, double[]> lbExtractor) {
return createSimpleLabeledDataset(
new LocalDatasetBuilder<>(upstreamMap, partitions),
+ envBuilder,
featureExtractor,
lbExtractor
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/PartitionContextBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/PartitionContextBuilder.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/PartitionContextBuilder.java
index 6e1fec3..c5eac88 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/PartitionContextBuilder.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/PartitionContextBuilder.java
@@ -21,6 +21,7 @@ import java.io.Serializable;
import java.util.Iterator;
import java.util.stream.Stream;
import org.apache.ignite.ml.dataset.primitive.builder.context.EmptyContextBuilder;
+import org.apache.ignite.ml.environment.LearningEnvironment;
import org.apache.ignite.ml.math.functions.IgniteFunction;
/**
@@ -43,11 +44,12 @@ public interface PartitionContextBuilder<K, V, C extends Serializable> extends S
* constraint. This constraint is omitted to allow upstream data transformers in {@link DatasetBuilder} replicating
* entries. For example it can be useful for bootstrapping.
*
+ * @param env Learning environment.
* @param upstreamData Partition {@code upstream} data.
* @param upstreamDataSize Partition {@code upstream} data size.
* @return Partition {@code context}.
*/
- public C build(Iterator<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize);
+ public C build(LearningEnvironment env, Iterator<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize);
/**
@@ -57,12 +59,13 @@ public interface PartitionContextBuilder<K, V, C extends Serializable> extends S
* constraint. This constraint is omitted to allow upstream data transformers in {@link DatasetBuilder} replicating
* entries. For example it can be useful for bootstrapping.
*
+ * @param env Learning environment.
* @param upstreamData Partition {@code upstream} data.
* @param upstreamDataSize Partition {@code upstream} data size.
* @return Partition {@code context}.
*/
- public default C build(Stream<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize) {
- return build(upstreamData.iterator(), upstreamDataSize);
+ public default C build(LearningEnvironment env, Stream<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize) {
+ return build(env, upstreamData.iterator(), upstreamDataSize);
}
/**
@@ -74,6 +77,6 @@ public interface PartitionContextBuilder<K, V, C extends Serializable> extends S
* @return Composed partition {@code context} builder.
*/
public default <C2 extends Serializable> PartitionContextBuilder<K, V, C2> andThen(IgniteFunction<C, C2> fun) {
- return (upstreamData, upstreamDataSize) -> fun.apply(build(upstreamData, upstreamDataSize));
+ return (env, upstreamData, upstreamDataSize) -> fun.apply(build(env, upstreamData, upstreamDataSize));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/PartitionDataBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/PartitionDataBuilder.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/PartitionDataBuilder.java
index 106084b..4a0e68e 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/PartitionDataBuilder.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/PartitionDataBuilder.java
@@ -22,6 +22,7 @@ import java.util.Iterator;
import java.util.stream.Stream;
import org.apache.ignite.ml.dataset.primitive.builder.data.SimpleDatasetDataBuilder;
import org.apache.ignite.ml.dataset.primitive.builder.data.SimpleLabeledDatasetDataBuilder;
+import org.apache.ignite.ml.environment.LearningEnvironment;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
/**
@@ -46,12 +47,13 @@ public interface PartitionDataBuilder<K, V, C extends Serializable, D extends Au
* constraint. This constraint is omitted to allow upstream data transformers in {@link DatasetBuilder} replicating
* entries. For example it can be useful for bootstrapping.
*
+ * @param env Learning environment.
* @param upstreamData Partition {@code upstream} data.
* @param upstreamDataSize Partition {@code upstream} data size.
* @param ctx Partition {@code context}.
* @return Partition {@code data}.
*/
- public D build(Iterator<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize, C ctx);
+ public D build(LearningEnvironment env, Iterator<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize, C ctx);
/**
* Builds a new partition {@code data} from a partition {@code upstream} data and partition {@code context}.
@@ -60,13 +62,14 @@ public interface PartitionDataBuilder<K, V, C extends Serializable, D extends Au
* constraint. This constraint is omitted to allow upstream data transformers in {@link DatasetBuilder} replicating
* entries. For example it can be useful for bootstrapping.
*
+ * @param env Learning environment.
* @param upstreamData Partition {@code upstream} data.
* @param upstreamDataSize Partition {@code upstream} data size.
* @param ctx Partition {@code context}.
* @return Partition {@code data}.
*/
- public default D build(Stream<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize, C ctx) {
- return build(upstreamData.iterator(), upstreamDataSize, ctx);
+ public default D build(LearningEnvironment env, Stream<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize, C ctx) {
+ return build(env, upstreamData.iterator(), upstreamDataSize, ctx);
}
/**
@@ -79,6 +82,7 @@ public interface PartitionDataBuilder<K, V, C extends Serializable, D extends Au
*/
public default <D2 extends AutoCloseable> PartitionDataBuilder<K, V, C, D2> andThen(
IgniteBiFunction<D, C, D2> fun) {
- return (upstreamData, upstreamDataSize, ctx) -> fun.apply(build(upstreamData, upstreamDataSize, ctx), ctx);
+ return (env, upstreamData, upstreamDataSize, ctx) ->
+ fun.apply(build(env, upstreamData, upstreamDataSize, ctx), ctx);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/UpstreamTransformer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/UpstreamTransformer.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/UpstreamTransformer.java
index ba70e2e..11b250b 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/UpstreamTransformer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/UpstreamTransformer.java
@@ -18,7 +18,6 @@
package org.apache.ignite.ml.dataset;
import java.io.Serializable;
-import java.util.Random;
import java.util.stream.Stream;
/**
@@ -27,16 +26,25 @@ import java.util.stream.Stream;
* @param <K> Type of keys in the upstream.
* @param <V> Type of values in the upstream.
*/
+// TODO: IGNITE-10297: Investigate possibility of API change.
@FunctionalInterface
public interface UpstreamTransformer<K, V> extends Serializable {
/**
- * Perform transformation of upstream.
+ * Transform upstream.
*
- * @param rnd Random numbers generator.
- * @param upstream Upstream.
+ * @param upstream Upstream to transform.
* @return Transformed upstream.
*/
- // TODO: IGNITE-10296: Inject capabilities of randomization through learning environment.
- // TODO: IGNITE-10297: Investigate possibility of API change.
- public Stream<UpstreamEntry<K, V>> transform(Random rnd, Stream<UpstreamEntry<K, V>> upstream);
+ public Stream<UpstreamEntry<K, V>> transform(Stream<UpstreamEntry<K, V>> upstream);
+
+ /**
+ * Get composition of this transformer and other transformer which is
+ * itself is {@link UpstreamTransformer} applying this transformer and then other transformer.
+ *
+ * @param other Other transformer.
+ * @return Composition of this and other transformer.
+ */
+ default UpstreamTransformer<K, V> andThen(UpstreamTransformer<K, V> other) {
+ return upstream -> other.transform(transform(upstream));
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/UpstreamTransformerBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/UpstreamTransformerBuilder.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/UpstreamTransformerBuilder.java
new file mode 100644
index 0000000..9adfab5
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/UpstreamTransformerBuilder.java
@@ -0,0 +1,72 @@
+/*
+ * 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.ml.dataset;
+
+import java.io.Serializable;
+import org.apache.ignite.ml.environment.LearningEnvironment;
+
+/**
+ * Builder of {@link UpstreamTransformerBuilder}.
+ * @param <K> Type of keys in upstream.
+ * @param <V> Type of values in upstream.
+ */
+@FunctionalInterface
+public interface UpstreamTransformerBuilder<K, V> extends Serializable {
+ /**
+ * Create {@link UpstreamTransformer} based on learning environment.
+ *
+ * @param env Learning environment.
+ * @return Upstream transformer.
+ */
+ public UpstreamTransformer<K, V> build(LearningEnvironment env);
+
+ /**
+ * Combunes two builders (this and other respectfully)
+ * <pre>
+ * env -> transformer1
+ * env -> transformer2
+ * </pre>
+ * into
+ * <pre>
+ * env -> transformer2 . transformer1
+ * </pre>
+ *
+ * @param other Builder to combine with.
+ * @return Compositional builder.
+ */
+ public default UpstreamTransformerBuilder<K, V> andThen(UpstreamTransformerBuilder<K, V> other) {
+ UpstreamTransformerBuilder<K, V> self = this;
+ return env -> {
+ UpstreamTransformer<K, V> transformer1 = self.build(env);
+ UpstreamTransformer<K, V> transformer2 = other.build(env);
+
+ return upstream -> transformer2.transform(transformer1.transform(upstream));
+ };
+ }
+
+ /**
+ * Returns identity upstream transformer.
+ *
+ * @param <K> Type of keys in upstream.
+ * @param <V> Type of values in upstream.
+ * @return Identity upstream transformer.
+ */
+ public static <K, V> UpstreamTransformerBuilder<K, V> identity() {
+ return env -> upstream -> upstream;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/UpstreamTransformerChain.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/UpstreamTransformerChain.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/UpstreamTransformerChain.java
deleted file mode 100644
index 3ad6446..0000000
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/UpstreamTransformerChain.java
+++ /dev/null
@@ -1,153 +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.ml.dataset;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-import java.util.stream.Stream;
-import org.apache.ignite.ml.math.functions.IgniteFunction;
-
-/**
- * Class representing chain of transformers applied to upstream.
- *
- * @param <K> Type of upstream keys.
- * @param <V> Type of upstream values.
- */
-public class UpstreamTransformerChain<K, V> implements Serializable {
- /** Seed used for transformations. */
- private Long seed;
-
- /** List of upstream transformations. */
- private List<UpstreamTransformer<K, V>> list;
-
- /**
- * Creates empty upstream transformers chain (basically identity function).
- *
- * @param <K> Type of upstream keys.
- * @param <V> Type of upstream values.
- * @return Empty upstream transformers chain.
- */
- public static <K, V> UpstreamTransformerChain<K, V> empty() {
- return new UpstreamTransformerChain<>();
- }
-
- /**
- * Creates upstream transformers chain consisting of one specified transformer.
- *
- * @param <K> Type of upstream keys.
- * @param <V> Type of upstream values.
- * @return Upstream transformers chain consisting of one specified transformer.
- */
- public static <K, V> UpstreamTransformerChain<K, V> of(UpstreamTransformer<K, V> trans) {
- UpstreamTransformerChain<K, V> res = new UpstreamTransformerChain<>();
- return res.addUpstreamTransformer(trans);
- }
-
- /**
- * Construct instance of this class.
- */
- private UpstreamTransformerChain() {
- list = new ArrayList<>();
- seed = new Random().nextLong();
- }
-
- /**
- * Adds upstream transformer to this chain.
- *
- * @param next Transformer to add.
- * @return This chain with added transformer.
- */
- public UpstreamTransformerChain<K, V> addUpstreamTransformer(UpstreamTransformer<K, V> next) {
- list.add(next);
-
- return this;
- }
-
- /**
- * Add upstream transformer based on given lambda.
- *
- * @param transformer Transformer.
- * @return This object.
- */
- public UpstreamTransformerChain<K, V> addUpstreamTransformer(IgniteFunction<Stream<UpstreamEntry<K, V>>,
- Stream<UpstreamEntry<K, V>>> transformer) {
- return addUpstreamTransformer((rnd, upstream) -> transformer.apply(upstream));
- }
-
- /**
- * Performs stream transformation using RNG based on provided seed as pseudo-randomness source for all
- * transformers in the chain.
- *
- * @param upstream Upstream.
- * @return Transformed upstream.
- */
- public Stream<UpstreamEntry<K, V>> transform(Stream<UpstreamEntry<K, V>> upstream) {
- Random rnd = new Random(seed);
-
- Stream<UpstreamEntry<K, V>> res = upstream;
-
- for (UpstreamTransformer<K, V> kvUpstreamTransformer : list)
- res = kvUpstreamTransformer.transform(rnd, res);
-
- return res;
- }
-
- /**
- * Checks if this chain is empty.
- *
- * @return Result of check if this chain is empty.
- */
- public boolean isEmpty() {
- return list.isEmpty();
- }
-
- /**
- * Set seed for transformations.
- *
- * @param seed Seed.
- * @return This object.
- */
- public UpstreamTransformerChain<K, V> setSeed(long seed) {
- this.seed = seed;
-
- return this;
- }
-
- /**
- * Modifies seed for transformations if it is present.
- *
- * @param f Modification function.
- * @return This object.
- */
- public UpstreamTransformerChain<K, V> modifySeed(IgniteFunction<Long, Long> f) {
- seed = f.apply(seed);
-
- return this;
- }
-
- /**
- * Get seed used for RNG in transformations.
- *
- * @return Seed used for RNG in transformations.
- */
- public Long seed() {
- return seed;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/bootstrapping/BootstrappedDatasetBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/bootstrapping/BootstrappedDatasetBuilder.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/bootstrapping/BootstrappedDatasetBuilder.java
index 8707e3a..c8d78dd 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/bootstrapping/BootstrappedDatasetBuilder.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/bootstrapping/BootstrappedDatasetBuilder.java
@@ -20,9 +20,11 @@ package org.apache.ignite.ml.dataset.impl.bootstrapping;
import java.util.Arrays;
import java.util.Iterator;
import org.apache.commons.math3.distribution.PoissonDistribution;
+import org.apache.commons.math3.random.Well19937c;
import org.apache.ignite.ml.dataset.PartitionDataBuilder;
import org.apache.ignite.ml.dataset.UpstreamEntry;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironment;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
@@ -69,13 +71,22 @@ public class BootstrappedDatasetBuilder<K,V> implements PartitionDataBuilder<K,V
}
/** {@inheritDoc} */
- @Override public BootstrappedDatasetPartition build(Iterator<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize,
+ @Override public BootstrappedDatasetPartition build(
+ LearningEnvironment env,
+ Iterator<UpstreamEntry<K, V>> upstreamData,
+ long upstreamDataSize,
EmptyContext ctx) {
BootstrappedVector[] dataset = new BootstrappedVector[Math.toIntExact(upstreamDataSize)];
int cntr = 0;
- PoissonDistribution poissonDistribution = new PoissonDistribution(subsampleSize);
+
+ PoissonDistribution poissonDistribution = new PoissonDistribution(
+ new Well19937c(env.randomNumbersGenerator().nextLong()),
+ subsampleSize,
+ PoissonDistribution.DEFAULT_EPSILON,
+ PoissonDistribution.DEFAULT_MAX_ITERATIONS);
+
while(upstreamData.hasNext()) {
UpstreamEntry<K, V> nextRow = upstreamData.next();
Vector features = featureExtractor.apply(nextRow.getKey(), nextRow.getValue());
[12/50] [abbrv] ignite git commit: IGNITE-10272: [ML] Inject learning
environment into scope of dataset compute task
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/math/isolve/lsqr/LSQROnHeapTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/isolve/lsqr/LSQROnHeapTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/isolve/lsqr/LSQROnHeapTest.java
index b720695..b743a37 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/isolve/lsqr/LSQROnHeapTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/isolve/lsqr/LSQROnHeapTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.ml.math.isolve.lsqr;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.common.TrainerTest;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.impl.local.LocalDatasetBuilder;
@@ -47,6 +48,7 @@ public class LSQROnHeapTest extends TrainerTest {
LSQROnHeap<Integer, double[]> lsqr = new LSQROnHeap<>(
datasetBuilder,
+ TestUtils.testEnvBuilder(),
new SimpleLabeledDatasetDataBuilder<>(
(k, v) -> VectorUtils.of(Arrays.copyOf(v, v.length - 1)),
(k, v) -> new double[]{v[3]}
@@ -80,6 +82,7 @@ public class LSQROnHeapTest extends TrainerTest {
LSQROnHeap<Integer, double[]> lsqr = new LSQROnHeap<>(
datasetBuilder,
+ TestUtils.testEnvBuilder(),
new SimpleLabeledDatasetDataBuilder<>(
(k, v) -> VectorUtils.of(Arrays.copyOf(v, v.length - 1)),
(k, v) -> new double[]{v[3]}
@@ -113,6 +116,7 @@ public class LSQROnHeapTest extends TrainerTest {
try (LSQROnHeap<Integer, double[]> lsqr = new LSQROnHeap<>(
datasetBuilder,
+ TestUtils.testEnvBuilder(),
new SimpleLabeledDatasetDataBuilder<>(
(k, v) -> VectorUtils.of(Arrays.copyOf(v, v.length - 1)),
(k, v) -> new double[]{v[4]}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/binarization/BinarizationTrainerTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/binarization/BinarizationTrainerTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/binarization/BinarizationTrainerTest.java
index 4b7fa33..b611104 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/binarization/BinarizationTrainerTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/binarization/BinarizationTrainerTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.ml.preprocessing.binarization;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.common.TrainerTest;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.impl.local.LocalDatasetBuilder;
@@ -51,6 +52,7 @@ public class BinarizationTrainerTest extends TrainerTest {
assertEquals(10., binarizationTrainer.getThreshold(), 0);
BinarizationPreprocessor<Integer, double[]> preprocessor = binarizationTrainer.fit(
+ TestUtils.testEnvBuilder(),
datasetBuilder,
(k, v) -> VectorUtils.of(v)
);
@@ -75,6 +77,7 @@ public class BinarizationTrainerTest extends TrainerTest {
assertEquals(10., binarizationTrainer.getThreshold(), 0);
IgniteBiFunction<Integer, double[], Vector> preprocessor = binarizationTrainer.fit(
+ TestUtils.testEnvBuilder(),
data,
parts,
(k, v) -> VectorUtils.of(v)
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/encoding/EncoderTrainerTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/encoding/EncoderTrainerTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/encoding/EncoderTrainerTest.java
index 7c7eabe..f9d56a9 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/encoding/EncoderTrainerTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/encoding/EncoderTrainerTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.ml.preprocessing.encoding;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.common.TrainerTest;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.impl.local.LocalDatasetBuilder;
@@ -51,6 +52,7 @@ public class EncoderTrainerTest extends TrainerTest {
.withEncodedFeature(1);
EncoderPreprocessor<Integer, String[]> preprocessor = strEncoderTrainer.fit(
+ TestUtils.testEnvBuilder(),
datasetBuilder,
(k, v) -> v
);
@@ -77,6 +79,7 @@ public class EncoderTrainerTest extends TrainerTest {
.withEncodedFeature(1);
EncoderPreprocessor<Integer, Object[]> preprocessor = strEncoderTrainer.fit(
+ TestUtils.testEnvBuilder(),
datasetBuilder,
(k, v) -> v
);
@@ -103,6 +106,7 @@ public class EncoderTrainerTest extends TrainerTest {
.withEncodedFeature(1);
EncoderPreprocessor<Integer, Object[]> preprocessor = strEncoderTrainer.fit(
+ TestUtils.testEnvBuilder(),
datasetBuilder,
(k, v) -> v
);
@@ -136,6 +140,7 @@ public class EncoderTrainerTest extends TrainerTest {
.withEncodedFeature(1);
EncoderPreprocessor<Integer, String[]> preprocessor = strEncoderTrainer.fit(
+ TestUtils.testEnvBuilder(),
datasetBuilder,
(k, v) -> v
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/imputing/ImputerTrainerTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/imputing/ImputerTrainerTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/imputing/ImputerTrainerTest.java
index 9c11d13..f8a5e78 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/imputing/ImputerTrainerTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/imputing/ImputerTrainerTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.ml.preprocessing.imputing;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.common.TrainerTest;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.impl.local.LocalDatasetBuilder;
@@ -47,6 +48,7 @@ public class ImputerTrainerTest extends TrainerTest {
.withImputingStrategy(ImputingStrategy.MOST_FREQUENT);
ImputerPreprocessor<Integer, Vector> preprocessor = imputerTrainer.fit(
+ TestUtils.testEnvBuilder(),
datasetBuilder,
(k, v) -> v
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/maxabsscaling/MaxAbsScalerTrainerTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/maxabsscaling/MaxAbsScalerTrainerTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/maxabsscaling/MaxAbsScalerTrainerTest.java
index 844468e..fc3433b 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/maxabsscaling/MaxAbsScalerTrainerTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/maxabsscaling/MaxAbsScalerTrainerTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.ml.preprocessing.maxabsscaling;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.common.TrainerTest;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.impl.local.LocalDatasetBuilder;
@@ -46,6 +47,7 @@ public class MaxAbsScalerTrainerTest extends TrainerTest {
MaxAbsScalerTrainer<Integer, Vector> standardizationTrainer = new MaxAbsScalerTrainer<>();
MaxAbsScalerPreprocessor<Integer, Vector> preprocessor = standardizationTrainer.fit(
+ TestUtils.testEnvBuilder(),
datasetBuilder,
(k, v) -> v
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/minmaxscaling/MinMaxScalerTrainerTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/minmaxscaling/MinMaxScalerTrainerTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/minmaxscaling/MinMaxScalerTrainerTest.java
index 4c0a99f..8716324 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/minmaxscaling/MinMaxScalerTrainerTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/minmaxscaling/MinMaxScalerTrainerTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.ml.preprocessing.minmaxscaling;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.common.TrainerTest;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.impl.local.LocalDatasetBuilder;
@@ -46,6 +47,7 @@ public class MinMaxScalerTrainerTest extends TrainerTest {
MinMaxScalerTrainer<Integer, Vector> standardizationTrainer = new MinMaxScalerTrainer<>();
MinMaxScalerPreprocessor<Integer, Vector> preprocessor = standardizationTrainer.fit(
+ TestUtils.testEnvBuilder(),
datasetBuilder,
(k, v) -> v
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/normalization/NormalizationTrainerTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/normalization/NormalizationTrainerTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/normalization/NormalizationTrainerTest.java
index 9d39354..d8a8191 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/normalization/NormalizationTrainerTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/normalization/NormalizationTrainerTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.ml.preprocessing.normalization;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.common.TrainerTest;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.impl.local.LocalDatasetBuilder;
@@ -50,6 +51,7 @@ public class NormalizationTrainerTest extends TrainerTest {
assertEquals(3., normalizationTrainer.p(), 0);
NormalizationPreprocessor<Integer, double[]> preprocessor = normalizationTrainer.fit(
+ TestUtils.testEnvBuilder(),
datasetBuilder,
(k, v) -> VectorUtils.of(v)
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerTrainerTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerTrainerTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerTrainerTest.java
index 6f10b37..839cb20 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerTrainerTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerTrainerTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.ml.preprocessing.standardscaling;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.common.TrainerTest;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.impl.local.LocalDatasetBuilder;
@@ -62,6 +63,7 @@ public class StandardScalerTrainerTest extends TrainerTest {
double[] expectedMeans = new double[] {0.5, 1.75, 4.5, 0.875};
StandardScalerPreprocessor<Integer, Vector> preprocessor = standardizationTrainer.fit(
+ TestUtils.testEnvBuilder(),
datasetBuilder,
(k, v) -> v
);
@@ -75,6 +77,7 @@ public class StandardScalerTrainerTest extends TrainerTest {
double[] expectedSigmas = new double[] {0.5, 1.47901995, 14.51723114, 0.93374247};
StandardScalerPreprocessor<Integer, Vector> preprocessor = standardizationTrainer.fit(
+ TestUtils.testEnvBuilder(),
datasetBuilder,
(k, v) -> v
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/selection/scoring/evaluator/EvaluatorTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/selection/scoring/evaluator/EvaluatorTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/selection/scoring/evaluator/EvaluatorTest.java
index 6f7aa36..1abf7f0 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/selection/scoring/evaluator/EvaluatorTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/selection/scoring/evaluator/EvaluatorTest.java
@@ -48,6 +48,7 @@ import org.apache.ignite.ml.tree.DecisionTreeNode;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.thread.IgniteThread;
+import static org.apache.ignite.ml.TestUtils.testEnvBuilder;
import static org.junit.Assert.assertArrayEquals;
/**
@@ -288,19 +289,24 @@ public class EvaluatorTest extends GridCommonAbstractTest {
.withEncoderType(EncoderType.STRING_ENCODER)
.withEncodedFeature(1)
.withEncodedFeature(6) // <--- Changed index here
- .fit(ignite,
+ .fit(
+ testEnvBuilder(123L),
+ ignite,
cache,
featureExtractor
);
IgniteBiFunction<Integer, Object[], Vector> imputingPreprocessor = new ImputerTrainer<Integer, Object[]>()
- .fit(ignite,
+ .fit(
+ testEnvBuilder(124L),
+ ignite,
cache,
strEncoderPreprocessor
);
IgniteBiFunction<Integer, Object[], Vector> minMaxScalerPreprocessor = new MinMaxScalerTrainer<Integer, Object[]>()
.fit(
+ testEnvBuilder(125L),
ignite,
cache,
imputingPreprocessor
@@ -309,6 +315,7 @@ public class EvaluatorTest extends GridCommonAbstractTest {
return new NormalizationTrainer<Integer, Object[]>()
.withP(2)
.fit(
+ testEnvBuilder(126L),
ignite,
cache,
minMaxScalerPreprocessor
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/trainers/BaggingTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/trainers/BaggingTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/trainers/BaggingTest.java
index a82374b..1b96ce2 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/trainers/BaggingTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/trainers/BaggingTest.java
@@ -28,6 +28,8 @@ import org.apache.ignite.ml.composition.predictionsaggregator.MeanValuePredictio
import org.apache.ignite.ml.composition.predictionsaggregator.OnMajorityPredictionsAggregator;
import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.DatasetBuilder;
+import org.apache.ignite.ml.environment.LearningEnvironment;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.functions.IgniteTriFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
@@ -75,11 +77,15 @@ public class BaggingTest extends TrainerTest {
.withBatchSize(10)
.withSeed(123L);
+ trainer.withEnvironmentBuilder(TestUtils.testEnvBuilder());
+
DatasetTrainer<ModelsComposition, Double> baggedTrainer =
TrainerTransformers.makeBagged(
trainer,
10,
0.7,
+ 2,
+ 2,
new OnMajorityPredictionsAggregator());
ModelsComposition mdl = baggedTrainer.fit(
@@ -98,14 +104,20 @@ public class BaggingTest extends TrainerTest {
*
* @param counter Function specifying which data we should count.
*/
- protected void count(IgniteTriFunction<Long, CountData, Integer, Long> counter) {
+ protected void count(IgniteTriFunction<Long, CountData, LearningEnvironment, Long> counter) {
Map<Integer, Double[]> cacheMock = getCacheMock();
CountTrainer countTrainer = new CountTrainer(counter);
double subsampleRatio = 0.3;
- ModelsComposition model = TrainerTransformers.makeBagged(countTrainer, 100, subsampleRatio, new MeanValuePredictionsAggregator())
+ ModelsComposition model = TrainerTransformers.makeBagged(
+ countTrainer,
+ 100,
+ subsampleRatio,
+ 2,
+ 2,
+ new MeanValuePredictionsAggregator())
.fit(cacheMock, parts, null, null);
Double res = model.apply(null);
@@ -155,14 +167,14 @@ public class BaggingTest extends TrainerTest {
/**
* Function specifying which entries to count.
*/
- private final IgniteTriFunction<Long, CountData, Integer, Long> counter;
+ private final IgniteTriFunction<Long, CountData, LearningEnvironment, Long> counter;
/**
* Construct instance of this class.
*
* @param counter Function specifying which entries to count.
*/
- public CountTrainer(IgniteTriFunction<Long, CountData, Integer, Long> counter) {
+ public CountTrainer(IgniteTriFunction<Long, CountData, LearningEnvironment, Long> counter) {
this.counter = counter;
}
@@ -172,8 +184,9 @@ public class BaggingTest extends TrainerTest {
IgniteBiFunction<K, V, Vector> featureExtractor,
IgniteBiFunction<K, V, Double> lbExtractor) {
Dataset<Long, CountData> dataset = datasetBuilder.build(
- (upstreamData, upstreamDataSize) -> upstreamDataSize,
- (upstreamData, upstreamDataSize, ctx) -> new CountData(upstreamDataSize)
+ TestUtils.testEnvBuilder(),
+ (env, upstreamData, upstreamDataSize) -> upstreamDataSize,
+ (env, upstreamData, upstreamDataSize, ctx) -> new CountData(upstreamDataSize)
);
Long cnt = dataset.computeWithCtx(counter, BaggingTest::plusOfNullables);
@@ -193,6 +206,11 @@ public class BaggingTest extends TrainerTest {
IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, Double> lbExtractor) {
return fit(datasetBuilder, featureExtractor, lbExtractor);
}
+
+ /** {@inheritDoc} */
+ @Override public CountTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) {
+ return (CountTrainer)super.withEnvironmentBuilder(envBuilder);
+ }
}
/** Data for count trainer. */
[35/50] [abbrv] ignite git commit: IGNITE-10049: MVCC: Create "Cache
4" test suite for MVCC mode. This closes #5499.
Posted by sb...@apache.org.
IGNITE-10049: MVCC: Create "Cache 4" test suite for MVCC mode. This closes #5499.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cf32fc7b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cf32fc7b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cf32fc7b
Branch: refs/heads/ignite-10044
Commit: cf32fc7baccea641f11a691f4897d564387b7fc8
Parents: ee5a8f3
Author: rkondakov <ko...@mail.ru>
Authored: Wed Dec 5 15:54:44 2018 +0300
Committer: Igor Seliverstov <gv...@gmail.com>
Committed: Wed Dec 5 15:54:44 2018 +0300
----------------------------------------------------------------------
...RWThroughDisabledTransactionalCacheTest.java | 8 +
...heStoreSessionListenerLifecycleSelfTest.java | 8 +
...reSessionListenerWriteBehindEnabledTest.java | 8 +
.../CacheJdbcStoreSessionListenerSelfTest.java | 8 +
.../GridCacheTxLoadFromStoreOnLockSelfTest.java | 8 +
.../cache/CacheClientStoreSelfTest.java | 8 +
.../cache/CacheConnectionLeakStoreTxTest.java | 20 +
.../cache/CacheEventWithTxLabelTest.java | 494 +++++++++++++++++++
.../cache/CacheGetEntryAbstractTest.java | 4 +-
...GetEntryOptimisticReadCommittedSelfTest.java | 36 ++
...GetEntryOptimisticReadCommittedSeltTest.java | 36 --
...etEntryOptimisticRepeatableReadSelfTest.java | 36 ++
...etEntryOptimisticRepeatableReadSeltTest.java | 36 --
...eGetEntryOptimisticSerializableSelfTest.java | 36 ++
...eGetEntryOptimisticSerializableSeltTest.java | 36 --
...etEntryPessimisticReadCommittedSelfTest.java | 36 ++
...etEntryPessimisticReadCommittedSeltTest.java | 36 --
...tEntryPessimisticRepeatableReadSelfTest.java | 105 ++++
...tEntryPessimisticRepeatableReadSeltTest.java | 40 --
...GetEntryPessimisticSerializableSelfTest.java | 36 ++
...GetEntryPessimisticSerializableSeltTest.java | 36 --
.../cache/CacheOffheapMapEntrySelfTest.java | 14 +
.../CacheReadThroughLocalRestartSelfTest.java | 8 +
.../cache/CacheReadThroughRestartSelfTest.java | 11 +
.../cache/CacheRemoveAllSelfTest.java | 9 +
.../cache/CacheStopAndDestroySelfTest.java | 18 +
...heStoreUsageMultinodeDynamicStartTxTest.java | 8 +
...cheStoreUsageMultinodeStaticStartTxTest.java | 8 +
.../CacheTxNotAllowReadFromBackupTest.java | 66 +++
.../cache/CashEventWithTxLabelTest.java | 487 ------------------
.../processors/cache/CrossCacheLockTest.java | 8 +
.../cache/GridCacheAbstractSelfTest.java | 4 +-
.../GridCacheMarshallingNodeJoinSelfTest.java | 8 +
...ridCacheMultinodeUpdateAbstractSelfTest.java | 17 +-
...inodeUpdateNearEnabledNoBackupsSelfTest.java | 6 +-
...CacheMultinodeUpdateNearEnabledSelfTest.java | 13 +-
...ridCacheStoreManagerDeserializationTest.java | 10 +-
.../cache/GridCacheVersionMultinodeTest.java | 35 +-
...iteCacheInvokeReadThroughSingleNodeTest.java | 46 ++
.../cache/IgniteCacheInvokeReadThroughTest.java | 55 +++
.../IgniteCacheReadThroughStoreCallTest.java | 8 +
.../IgniteCacheTxCopyOnReadDisabledTest.java | 7 +
.../cache/IgniteCacheTxLocalPeekModesTest.java | 8 +
.../cache/IgniteCacheTxLocalStoreValueTest.java | 8 +
.../IgniteCacheTxNearEnabledStoreValueTest.java | 8 +
.../cache/IgniteCacheTxNearPeekModesTest.java | 9 +
.../cache/IgniteCacheTxPeekModesTest.java | 9 +-
.../cache/IgniteCacheTxStoreValueTest.java | 8 +
...IgniteClientCacheInitializationFailTest.java | 37 +-
.../cache/IgniteDynamicCacheFilterTest.java | 2 +
...ynamicCacheStartCoordinatorFailoverTest.java | 3 +
...eDynamicCacheStartNoExchangeTimeoutTest.java | 36 +-
.../cache/IgniteDynamicCacheStartSelfTest.java | 14 +
...niteDynamicCacheWithConfigStartSelfTest.java | 2 +
.../IgniteDynamicClientCacheStartSelfTest.java | 8 +-
.../IgniteStartCacheInTransactionSelfTest.java | 3 +
.../distributed/CacheAffinityEarlyTest.java | 2 +-
.../distributed/CacheGroupsPreloadTest.java | 44 ++
.../cache/distributed/CacheStartOnJoinTest.java | 14 +-
.../IgniteCacheCreatePutMultiNodeSelfTest.java | 17 +-
.../distributed/IgniteCacheCreatePutTest.java | 11 +
.../IgniteCacheFailedUpdateResponseTest.java | 41 +-
.../IgniteCacheReadFromBackupTest.java | 89 +++-
.../IgniteCacheSingleGetMessageTest.java | 33 +-
.../IgniteTxPreloadAbstractTest.java | 10 +-
.../dht/IgniteCacheLockFailoverSelfTest.java | 8 +
.../dht/IgniteCacheMultiTxLockSelfTest.java | 24 +-
.../dht/IgniteCrossCacheMvccTxSelfTest.java | 39 ++
.../dht/IgniteCrossCacheTxAbstractSelfTest.java | 181 +++++++
.../dht/IgniteCrossCacheTxSelfTest.java | 155 +-----
.../near/GridCacheNearTxPreloadSelfTest.java | 8 +
.../near/GridCachePartitionedEventSelfTest.java | 8 +
.../near/IgniteCacheNearOnlyTxTest.java | 8 +
.../near/IgniteCacheNearReadCommittedTest.java | 8 +
.../IgniteCacheLoadAllAbstractTest.java | 10 +-
.../IgniteCacheTxLoaderWriterTest.java | 8 +
.../IgniteCacheTxLocalLoadAllTest.java | 7 +
...niteCacheTxLocalNoLoadPreviousValueTest.java | 8 +
.../IgniteCacheTxLocalNoReadThroughTest.java | 8 +
.../IgniteCacheTxLocalNoWriteThroughTest.java | 8 +
...cheTxNearEnabledNoLoadPreviousValueTest.java | 8 +
...iteCacheTxNearEnabledNoWriteThroughTest.java | 8 +
.../IgniteCacheTxNoLoadPreviousValueTest.java | 8 +
.../IgniteCacheTxNoReadThroughTest.java | 8 +
.../IgniteCacheTxNoWriteThroughTest.java | 8 +
.../IgniteCacheTxStoreSessionTest.java | 8 +
...TxStoreSessionWriteBehindCoalescingTest.java | 8 +
...gniteCacheTxStoreSessionWriteBehindTest.java | 8 +
...ersionedEntryLocalTransactionalSelfTest.java | 9 +
.../testframework/MvccFeatureChecker.java | 20 +
.../testsuites/IgniteCacheMvccTestSuite2.java | 1 +
.../testsuites/IgniteCacheMvccTestSuite4.java | 197 ++++++++
.../testsuites/IgniteCacheTestSuite4.java | 356 ++++++-------
93 files changed, 2396 insertions(+), 1072 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreListenerRWThroughDisabledTransactionalCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreListenerRWThroughDisabledTransactionalCacheTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreListenerRWThroughDisabledTransactionalCacheTest.java
index 4503815..faf30b7 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreListenerRWThroughDisabledTransactionalCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreListenerRWThroughDisabledTransactionalCacheTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.cache.store;
import java.util.Random;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
@@ -37,6 +38,13 @@ import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
*/
public class CacheStoreListenerRWThroughDisabledTransactionalCacheTest extends CacheStoreSessionListenerReadWriteThroughDisabledAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected CacheAtomicityMode atomicityMode() {
return TRANSACTIONAL;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerLifecycleSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerLifecycleSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerLifecycleSelfTest.java
index ff176c5..9bc3cdc 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerLifecycleSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerLifecycleSelfTest.java
@@ -34,6 +34,7 @@ import org.apache.ignite.resources.IgniteInstanceResource;
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.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
@@ -50,6 +51,13 @@ public class CacheStoreSessionListenerLifecycleSelfTest extends GridCommonAbstra
private static final Queue<String> evts = new ConcurrentLinkedDeque<>();
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerWriteBehindEnabledTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerWriteBehindEnabledTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerWriteBehindEnabledTest.java
index 9314dbb..3ba4ec2 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerWriteBehindEnabledTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerWriteBehindEnabledTest.java
@@ -44,6 +44,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
import org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore;
import org.apache.ignite.resources.CacheStoreSessionResource;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
/**
* This class tests that calls of {@link CacheStoreSessionListener#onSessionStart(CacheStoreSession)}
@@ -67,6 +68,13 @@ public class CacheStoreSessionListenerWriteBehindEnabledTest extends GridCacheAb
private static final AtomicInteger uninitializedListenerCnt = new AtomicInteger();
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected int gridCount() {
return 1;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java
index 237cfeb..968dc08 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java
@@ -32,6 +32,7 @@ import org.apache.ignite.cache.store.CacheStoreSessionListener;
import org.apache.ignite.cache.store.CacheStoreSessionListenerAbstractSelfTest;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.resources.CacheStoreSessionResource;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import org.h2.jdbcx.JdbcConnectionPool;
/**
@@ -39,6 +40,13 @@ import org.h2.jdbcx.JdbcConnectionPool;
*/
public class CacheJdbcStoreSessionListenerSelfTest extends CacheStoreSessionListenerAbstractSelfTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected Factory<? extends CacheStore<Integer, Integer>> storeFactory() {
return new Factory<CacheStore<Integer, Integer>>() {
@Override public CacheStore<Integer, Integer> create() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java
index 6293723..a1f18a7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java
@@ -33,6 +33,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
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.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
@@ -46,6 +47,13 @@ public class GridCacheTxLoadFromStoreOnLockSelfTest extends GridCommonAbstractTe
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java
index 8703791..ecf9d2e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java
@@ -40,6 +40,7 @@ import org.apache.ignite.resources.IgniteInstanceResource;
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.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK;
@@ -67,6 +68,13 @@ public class CacheClientStoreSelfTest extends GridCommonAbstractTest {
private static volatile boolean loadedFromClient;
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConnectionLeakStoreTxTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConnectionLeakStoreTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConnectionLeakStoreTxTest.java
index 27dbe62..db08d53 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConnectionLeakStoreTxTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConnectionLeakStoreTxTest.java
@@ -170,6 +170,26 @@ public class CacheConnectionLeakStoreTxTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testConnectionLeakOneBackupMvccPessimisticRepeatableRead() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-8582");
+
+ checkConnectionLeak(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, PESSIMISTIC, REPEATABLE_READ);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testConnectionLeakOneBackupMvccPessimisticRepeatableReadLoadFromStore() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-8582");
+
+ isLoadFromStore = true;
+
+ checkConnectionLeak(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, PESSIMISTIC, REPEATABLE_READ);
+ }
+
+ /**
* @param atomicityMode Atomicity mode.
* @param txConcurrency Transaction concurrency.
* @param txIsolation Transaction isolation.
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEventWithTxLabelTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEventWithTxLabelTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEventWithTxLabelTest.java
new file mode 100644
index 0000000..dabf0db
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEventWithTxLabelTest.java
@@ -0,0 +1,494 @@
+/*
+ * 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.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.events.CacheEvent;
+import org.apache.ignite.events.Event;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.util.lang.IgnitePair;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.testframework.MvccFeatureChecker;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+import org.junit.Assert;
+
+import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT;
+import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ;
+import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED;
+
+/**
+ * Test to check passing transaction's label for EVT_CACHE_OBJECT_READ, EVT_CACHE_OBJECT_PUT,
+ * EVT_CACHE_OBJECT_REMOVED events.
+ */
+public class CacheEventWithTxLabelTest extends GridCommonAbstractTest {
+ /** Types event to be checked. */
+ private static final int[] CACHE_EVENT_TYPES = {EVT_CACHE_OBJECT_READ, EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_REMOVED};
+
+ /** Transaction label. */
+ private static final String TX_LABEL = "TX_LABEL";
+
+ /** Number of server nodes. */
+ private static final int SRVS = 3;
+
+ /** Number of client nodes. */
+ private static final int CLIENTS = 1;
+
+ /** Cache name. */
+ public static final String CACHE_NAME = "cache";
+
+ /** Client or server mode to start Ignite instance. */
+ private static boolean client;
+
+ /** Key related to primary node. */
+ private Integer primaryKey = 0;
+
+ /** Key related to backup node. */
+ private Integer backupKey = 0;
+
+ /** Current cash backup count. */
+ private int backupCnt;
+
+ /** Current transaction isolation level. */
+ private TransactionIsolation isolation;
+
+ /** Current transaction concurrency level. */
+ private TransactionConcurrency concurrency;
+
+ /** All failed tests information, */
+ private ArrayList<String> errors = new ArrayList<>();
+
+ /** Count of errors on previous iteration of testing. */
+ private int prevErrCnt = 0;
+
+ /** List to keep all events with no tx label between run tests */
+ private static List<CacheEvent> wrongEvts = Collections.synchronizedList(new ArrayList<>());
+
+ /** Simple entry processor to use for tests */
+ private static CacheEntryProcessor entryProcessor = (CacheEntryProcessor)(entry, objects) -> entry.getValue();
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ return super.getConfiguration(igniteInstanceName).setClientMode(client);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-10270");
+
+ super.beforeTestsStarted();
+
+ client = false;
+
+ startGridsMultiThreaded(SRVS);
+
+ client = true;
+
+ startGridsMultiThreaded(SRVS, CLIENTS);
+
+ client = false;
+
+ waitForDiscovery(primary(), backup1(), backup2(), client());
+
+ registerEventListeners(primary(), backup1(), backup2(), client());
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ super.afterTestsStopped();
+
+ stopAllGrids();
+ }
+
+ /**
+ * Check all cases for passing transaction label in cash event.
+ *
+ * @throws Exception If failed.
+ */
+ public void testPassTxLabelInCashEventForAllCases() throws Exception {
+ Ignite[] nodes = {client(), primary(), backup1(), backup2()};
+
+ for (int backupCnt = 0; backupCnt < SRVS; backupCnt++) {
+ this.backupCnt = backupCnt;
+
+ prepareCache(backupCnt);
+
+ for (TransactionIsolation isolation : TransactionIsolation.values()) {
+ this.isolation = isolation;
+
+ for (TransactionConcurrency concurrency : TransactionConcurrency.values()) {
+ this.concurrency = concurrency;
+
+ if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation))
+ continue;
+
+ for (int i = 0; i < nodes.length - 1; i++) {
+ Ignite nodeForPut = nodes[i];
+ Ignite nodeForGet = nodes[i + 1];
+
+ singleWriteReadRemoveTest(nodeForPut, nodeForGet);
+
+ multiWriteReadRemoveTest(nodeForPut, nodeForGet);
+
+ singleNodeBatchWriteReadRemoveTest(nodeForPut, nodeForGet);
+
+ multiNodeBatchWriteReadRemoveTest(nodeForPut, nodeForGet);
+
+ writeInvokeRemoveTest(nodeForPut, nodeForGet);
+
+ writeInvokeAllRemoveTest(nodeForPut, nodeForGet);
+ }
+ }
+ }
+ }
+
+ String listOfFailedTests = String.join(",\n", errors);
+
+ Assert.assertTrue("Have been received " + prevErrCnt + " cache events with incorrect txlabel.\n" +
+ "Failed tests:" + listOfFailedTests,
+ errors.isEmpty());
+ }
+
+ /**
+ * Check error after run test. In case error occured information about failed test will be added to errors list.
+ *
+ * @param testName Name of test which result will be checked.
+ * @param node1 First node
+ * @param node2 Second node
+ */
+ private void checkResult(String testName, Ignite node1, Ignite node2) {
+ int currErrCnt = wrongEvts.size();
+
+ if (prevErrCnt != currErrCnt) {
+ prevErrCnt = currErrCnt;
+
+ errors.add(String.format("%s backCnt-%s, %s, %s, node1-%s, node2-%s",
+ testName, backupCnt, isolation, concurrency, nodeType(node1), nodeType(node2)));
+ }
+ }
+
+ /**
+ * @param node Ignite node
+ * @return Node type in the test
+ */
+ private String nodeType(Ignite node) {
+ if (client().equals(node))
+ return "CLIENT";
+ else if (primary().equals(node))
+ return "PRIMARY";
+ else if (backup1().equals(node))
+ return "BACKUP1";
+ else if (backup2().equals(node))
+ return "BACKUP2";
+ else
+ return "UNKNOWN";
+ }
+
+ /**
+ * Test single put, get, remove operations.
+ *
+ * @param instanceToPut Ignite instance to put test data.
+ * @param instanceToGet Ignite instance to get test data.
+ */
+ private void singleWriteReadRemoveTest(Ignite instanceToPut, Ignite instanceToGet) {
+ runTransactionally(instanceToPut, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).put(primaryKey, 3);
+ });
+
+ runTransactionally(instanceToGet, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).get(primaryKey);
+ });
+
+ runTransactionally(instanceToGet, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).remove(primaryKey);
+ });
+
+ checkResult("singleWriteReadRemoveTest", instanceToPut, instanceToGet);
+ }
+
+ /**
+ * Test multi put, get, remove operations
+ *
+ * @param instanceToPut Ignite instance to put test data.
+ * @param instanceToGet Ignite instance to get test data.
+ */
+ private void multiWriteReadRemoveTest(Ignite instanceToPut, Ignite instanceToGet) {
+ runTransactionally(instanceToPut, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).put(primaryKey, 2);
+ ign.cache(CACHE_NAME).put(backupKey, 3);
+ });
+
+ runTransactionally(instanceToGet, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).get(primaryKey);
+ ign.cache(CACHE_NAME).get(backupKey);
+ });
+
+ runTransactionally(instanceToGet, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).remove(primaryKey);
+ ign.cache(CACHE_NAME).remove(backupKey);
+ });
+
+ checkResult("multiWriteReadRemoveTest", instanceToPut, instanceToGet);
+ }
+
+ /**
+ * Test multi nodes batch write-read
+ *
+ * @param instanceToPut Ignite instance to put test data.
+ * @param instanceToGet Ignite instance to get test data.
+ */
+ private void multiNodeBatchWriteReadRemoveTest(Ignite instanceToPut, Ignite instanceToGet) {
+ Map<Integer, Integer> keyValuesMap = IntStream.range(0, 100).boxed()
+ .collect(Collectors.toMap(Function.identity(), Function.identity()));
+
+ runTransactionally(instanceToPut, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).putAll(keyValuesMap);
+ });
+
+ runTransactionally(instanceToGet, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).getAll(keyValuesMap.keySet());
+ });
+
+ runTransactionally(instanceToGet, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).removeAll(keyValuesMap.keySet());
+ });
+
+ checkResult("multiNodeBatchWriteReadRemoveTest", instanceToPut, instanceToGet);
+ }
+
+ /**
+ * Test single node batch write-read-remove
+ *
+ * @param instanceToPut Ignite instance to put test data.
+ * @param instanceToGet Ignite instance to get test data.
+ */
+ private void singleNodeBatchWriteReadRemoveTest(Ignite instanceToPut, Ignite instanceToGet) {
+ IgnitePair<Integer> keys = evaluatePrimaryAndBackupKeys(primaryKey + 1, backupKey + 1);
+
+ Map<Integer, Integer> keyValuesMap = new HashMap<>();
+ keyValuesMap.put(primaryKey, 1);
+ keyValuesMap.put(keys.get1(), 2);
+
+ runTransactionally(instanceToPut, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).putAll(keyValuesMap);
+ });
+
+ runTransactionally(instanceToGet, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).getAll(keyValuesMap.keySet());
+ });
+
+ runTransactionally(instanceToGet, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).removeAll(keyValuesMap.keySet());
+ });
+
+ checkResult("oneNodeBatchWriteReadRemoveTest", instanceToPut, instanceToGet);
+ }
+
+ /**
+ * Test put-invoke-remove
+ *
+ * @param instanceToPut Ignite instance to put test data.
+ * @param instanceToGet Ignite instance to get test data.
+ */
+ @SuppressWarnings("unchecked")
+ private void writeInvokeRemoveTest(Ignite instanceToPut, Ignite instanceToGet) {
+ runTransactionally(instanceToGet, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).put(primaryKey, 3);
+ });
+
+ runTransactionally(instanceToPut, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).invoke(primaryKey, entryProcessor);
+ ign.cache(CACHE_NAME).invoke(backupKey, entryProcessor);
+ });
+
+ runTransactionally(instanceToGet, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).remove(primaryKey);
+ });
+
+ checkResult("writeInvokeRemoveTest", instanceToPut, instanceToGet);
+ }
+
+ /**
+ * Test putAll-invokeAll-removeAll
+ *
+ * @param instanceToPut Ignite instance to put test data.
+ * @param instanceToGet Ignite instance to get test data.
+ */
+ @SuppressWarnings("unchecked")
+ private void writeInvokeAllRemoveTest(Ignite instanceToPut, Ignite instanceToGet) {
+ Map<Integer, Integer> keyValuesMap = IntStream.range(0, 100).boxed()
+ .collect(Collectors.toMap(Function.identity(), Function.identity()));
+
+ runTransactionally(instanceToGet, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).putAll(keyValuesMap);
+ });
+
+ runTransactionally(instanceToPut, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).invokeAll(keyValuesMap.keySet(), entryProcessor);
+ });
+
+ runTransactionally(instanceToGet, (Ignite ign) -> {
+ ign.cache(CACHE_NAME).removeAll(keyValuesMap.keySet());
+ });
+
+ checkResult("WriteInvokeAllRemoveTest", instanceToPut, instanceToGet);
+ }
+
+ /**
+ * Run command in transaction.
+ *
+ * @param startNode Ignite node to start transaction and run passed command.
+ * @param cmdInTx Command which should be done in transaction.
+ */
+ private void runTransactionally(Ignite startNode, Consumer<Ignite> cmdInTx) {
+ try (Transaction tx = startNode.transactions().withLabel(TX_LABEL).txStart(concurrency, isolation)) {
+ cmdInTx.accept(startNode);
+
+ tx.commit();
+ }
+ }
+
+ /**
+ * Add event listener to passed Ignite instances for cache event types.
+ *
+ * @param igns Ignite instances.
+ */
+ private void registerEventListeners(Ignite... igns) {
+ if (igns != null) {
+ for (Ignite ign : igns) {
+ ign.events().enableLocal(CACHE_EVENT_TYPES);
+ ign.events().localListen((IgnitePredicate<Event>)event -> {
+ CacheEvent cacheEvt = (CacheEvent)event;
+
+ if (!TX_LABEL.equals(cacheEvt.txLabel())) {
+ log.error("Has been received event with incorrect label " + cacheEvt.txLabel() + " ," +
+ " expected " + TX_LABEL + " label");
+
+ wrongEvts.add(cacheEvt);
+ }
+
+ return true;
+ }, CACHE_EVENT_TYPES);
+ }
+ }
+ }
+
+ /**
+ * Create cache with passed number of backups and determinate primary and backup keys. If cache was created before
+ * it will be removed before create new one.
+ *
+ * @param cacheBackups Number of backups for cache.
+ * @throws InterruptedException In case of fail.
+ */
+ private void prepareCache(int cacheBackups) throws InterruptedException {
+ IgniteCache<Object, Object> cache = client().cache(CACHE_NAME);
+
+ if (cache != null)
+ cache.destroy();
+
+ client().createCache(
+ new CacheConfiguration<Integer, Integer>()
+ .setName(CACHE_NAME)
+ .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+ .setCacheMode(CacheMode.PARTITIONED)
+ .setBackups(cacheBackups)
+ );
+
+ awaitPartitionMapExchange();
+
+ IgnitePair<Integer> keys = evaluatePrimaryAndBackupKeys(0, 0);
+
+ primaryKey = keys.get1();
+ backupKey = keys.get2();
+ }
+
+ /**
+ * Evaluate primary and backup keys.
+ *
+ * @param primaryKeyStart Value from need to start calculate primary key.
+ * @param backupKeyStart Value from need to start calculate backup key.
+ * @return Pair of result. The first result is found primary key. The second is found backup key.
+ */
+ private IgnitePair<Integer> evaluatePrimaryAndBackupKeys(final int primaryKeyStart, final int backupKeyStart) {
+ int primaryKey = primaryKeyStart;
+ int backupKey = backupKeyStart;
+
+ while (!client().affinity(CACHE_NAME).isPrimary(((IgniteKernal)primary()).localNode(), primaryKey))
+ primaryKey++;
+
+ while (!client().affinity(CACHE_NAME).isBackup(((IgniteKernal)primary()).localNode(), backupKey)
+ && backupKey < 100 + backupKeyStart)
+ backupKey++;
+
+ return new IgnitePair<>(primaryKey, backupKey);
+ }
+
+ /**
+ * Return primary node.
+ *
+ * @return Primary node.
+ */
+ private Ignite primary() {
+ return ignite(0);
+ }
+
+ /**
+ * Return first backup node.
+ *
+ * @return First backup node.
+ */
+ private Ignite backup1() {
+ return ignite(1);
+ }
+
+ /**
+ * Return second backup node.
+ *
+ * @return Second backup node.
+ */
+ private Ignite backup2() {
+ return ignite(2);
+ }
+
+ /**
+ * Return client node.
+ *
+ * @return Client node.
+ */
+ private Ignite client() {
+ return ignite(3);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryAbstractTest.java
index f347525..3e7b791 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryAbstractTest.java
@@ -170,8 +170,6 @@ public abstract class CacheGetEntryAbstractTest extends GridCacheAbstractSelfTes
* @throws Exception If failed.
*/
public void testLocalTransactional() throws Exception {
- // TODO: fails since d13520e9a05bd9e9b987529472d6317951b72f96, need to review changes.
-
CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
cfg.setWriteSynchronizationMode(FULL_SYNC);
@@ -214,7 +212,7 @@ public abstract class CacheGetEntryAbstractTest extends GridCacheAbstractSelfTes
* @param cfg Cache configuration.
* @throws Exception If failed.
*/
- private void test(CacheConfiguration cfg) throws Exception {
+ protected void test(CacheConfiguration cfg) throws Exception {
test(cfg, true);
test(cfg, false);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticReadCommittedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticReadCommittedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticReadCommittedSelfTest.java
new file mode 100644
index 0000000..0927546
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticReadCommittedSelfTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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 org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+
+/**
+ * Test getEntry and getEntries methods.
+ */
+public class CacheGetEntryOptimisticReadCommittedSelfTest extends CacheGetEntryAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected TransactionConcurrency concurrency() {
+ return TransactionConcurrency.OPTIMISTIC;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected TransactionIsolation isolation() {
+ return TransactionIsolation.READ_COMMITTED;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticReadCommittedSeltTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticReadCommittedSeltTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticReadCommittedSeltTest.java
deleted file mode 100644
index c04612d..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticReadCommittedSeltTest.java
+++ /dev/null
@@ -1,36 +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.internal.processors.cache;
-
-import org.apache.ignite.transactions.TransactionConcurrency;
-import org.apache.ignite.transactions.TransactionIsolation;
-
-/**
- * Test getEntry and getEntries methods.
- */
-public class CacheGetEntryOptimisticReadCommittedSeltTest extends CacheGetEntryAbstractTest {
- /** {@inheritDoc} */
- @Override protected TransactionConcurrency concurrency() {
- return TransactionConcurrency.OPTIMISTIC;
- }
-
- /** {@inheritDoc} */
- @Override protected TransactionIsolation isolation() {
- return TransactionIsolation.READ_COMMITTED;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticRepeatableReadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticRepeatableReadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticRepeatableReadSelfTest.java
new file mode 100644
index 0000000..2c6a204
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticRepeatableReadSelfTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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 org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+
+/**
+ * Test getEntry and getEntries methods.
+ */
+public class CacheGetEntryOptimisticRepeatableReadSelfTest extends CacheGetEntryAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected TransactionConcurrency concurrency() {
+ return TransactionConcurrency.OPTIMISTIC;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected TransactionIsolation isolation() {
+ return TransactionIsolation.REPEATABLE_READ;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticRepeatableReadSeltTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticRepeatableReadSeltTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticRepeatableReadSeltTest.java
deleted file mode 100644
index 6153869..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticRepeatableReadSeltTest.java
+++ /dev/null
@@ -1,36 +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.internal.processors.cache;
-
-import org.apache.ignite.transactions.TransactionConcurrency;
-import org.apache.ignite.transactions.TransactionIsolation;
-
-/**
- * Test getEntry and getEntries methods.
- */
-public class CacheGetEntryOptimisticRepeatableReadSeltTest extends CacheGetEntryAbstractTest {
- /** {@inheritDoc} */
- @Override protected TransactionConcurrency concurrency() {
- return TransactionConcurrency.OPTIMISTIC;
- }
-
- /** {@inheritDoc} */
- @Override protected TransactionIsolation isolation() {
- return TransactionIsolation.REPEATABLE_READ;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticSerializableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticSerializableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticSerializableSelfTest.java
new file mode 100644
index 0000000..63161e2
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticSerializableSelfTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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 org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+
+/**
+ * Test getEntry and getEntries methods.
+ */
+public class CacheGetEntryOptimisticSerializableSelfTest extends CacheGetEntryAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected TransactionConcurrency concurrency() {
+ return TransactionConcurrency.OPTIMISTIC;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected TransactionIsolation isolation() {
+ return TransactionIsolation.SERIALIZABLE;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticSerializableSeltTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticSerializableSeltTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticSerializableSeltTest.java
deleted file mode 100644
index 6ded4a9..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticSerializableSeltTest.java
+++ /dev/null
@@ -1,36 +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.internal.processors.cache;
-
-import org.apache.ignite.transactions.TransactionConcurrency;
-import org.apache.ignite.transactions.TransactionIsolation;
-
-/**
- * Test getEntry and getEntries methods.
- */
-public class CacheGetEntryOptimisticSerializableSeltTest extends CacheGetEntryAbstractTest {
- /** {@inheritDoc} */
- @Override protected TransactionConcurrency concurrency() {
- return TransactionConcurrency.OPTIMISTIC;
- }
-
- /** {@inheritDoc} */
- @Override protected TransactionIsolation isolation() {
- return TransactionIsolation.SERIALIZABLE;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticReadCommittedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticReadCommittedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticReadCommittedSelfTest.java
new file mode 100644
index 0000000..0a291f7
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticReadCommittedSelfTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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 org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+
+/**
+ * Test getEntry and getEntries methods.
+ */
+public class CacheGetEntryPessimisticReadCommittedSelfTest extends CacheGetEntryAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected TransactionConcurrency concurrency() {
+ return TransactionConcurrency.PESSIMISTIC;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected TransactionIsolation isolation() {
+ return TransactionIsolation.READ_COMMITTED;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticReadCommittedSeltTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticReadCommittedSeltTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticReadCommittedSeltTest.java
deleted file mode 100644
index 975d271..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticReadCommittedSeltTest.java
+++ /dev/null
@@ -1,36 +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.internal.processors.cache;
-
-import org.apache.ignite.transactions.TransactionConcurrency;
-import org.apache.ignite.transactions.TransactionIsolation;
-
-/**
- * Test getEntry and getEntries methods.
- */
-public class CacheGetEntryPessimisticReadCommittedSeltTest extends CacheGetEntryAbstractTest {
- /** {@inheritDoc} */
- @Override protected TransactionConcurrency concurrency() {
- return TransactionConcurrency.PESSIMISTIC;
- }
-
- /** {@inheritDoc} */
- @Override protected TransactionIsolation isolation() {
- return TransactionIsolation.READ_COMMITTED;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSelfTest.java
new file mode 100644
index 0000000..906b726
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSelfTest.java
@@ -0,0 +1,105 @@
+/*
+ * 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 org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
+import static org.apache.ignite.cache.CacheMode.LOCAL;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheMode.REPLICATED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Test getEntry and getEntries methods.
+ */
+public class CacheGetEntryPessimisticRepeatableReadSelfTest extends CacheGetEntryAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected TransactionConcurrency concurrency() {
+ return TransactionConcurrency.PESSIMISTIC;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected TransactionIsolation isolation() {
+ return TransactionIsolation.REPEATABLE_READ;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNearTransactionalMvcc() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-7187");
+
+ CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+ cfg.setWriteSynchronizationMode(FULL_SYNC);
+ cfg.setCacheMode(PARTITIONED);
+ cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
+ cfg.setName("nearT");
+ cfg.setNearConfiguration(new NearCacheConfiguration());
+
+ test(cfg);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPartitionedTransactionalMvcc() throws Exception {
+ CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+ cfg.setWriteSynchronizationMode(FULL_SYNC);
+ cfg.setCacheMode(PARTITIONED);
+ cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
+ cfg.setName("partitionedT");
+
+ test(cfg);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testLocalTransactionalMvcc() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-9530");
+
+ CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+ cfg.setWriteSynchronizationMode(FULL_SYNC);
+ cfg.setCacheMode(LOCAL);
+ cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
+ cfg.setName("localT");
+
+ test(cfg);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testReplicatedTransactionalMvcc() throws Exception {
+ CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+ cfg.setWriteSynchronizationMode(FULL_SYNC);
+ cfg.setCacheMode(REPLICATED);
+ cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
+ cfg.setName("replicatedT");
+
+ test(cfg);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSeltTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSeltTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSeltTest.java
deleted file mode 100644
index 4aa693c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSeltTest.java
+++ /dev/null
@@ -1,40 +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.internal.processors.cache;
-
-import org.apache.ignite.transactions.TransactionConcurrency;
-import org.apache.ignite.transactions.TransactionIsolation;
-
-/**
- * Test getEntry and getEntries methods.
- */
-public class CacheGetEntryPessimisticRepeatableReadSeltTest extends CacheGetEntryAbstractTest {
- /** {@inheritDoc} */
- @Override protected TransactionConcurrency concurrency() {
- return TransactionConcurrency.PESSIMISTIC;
- }
-
- /** {@inheritDoc} */
- @Override protected TransactionIsolation isolation() {
- return TransactionIsolation.REPEATABLE_READ;
- }
-
- @Override public void testReplicatedTransactional() throws Exception {
- super.testReplicatedTransactional();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticSerializableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticSerializableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticSerializableSelfTest.java
new file mode 100644
index 0000000..dfaed7e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticSerializableSelfTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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 org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+
+/**
+ * Test getEntry and getEntries methods.
+ */
+public class CacheGetEntryPessimisticSerializableSelfTest extends CacheGetEntryAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected TransactionConcurrency concurrency() {
+ return TransactionConcurrency.PESSIMISTIC;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected TransactionIsolation isolation() {
+ return TransactionIsolation.SERIALIZABLE;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticSerializableSeltTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticSerializableSeltTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticSerializableSeltTest.java
deleted file mode 100644
index 70f71ce..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticSerializableSeltTest.java
+++ /dev/null
@@ -1,36 +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.internal.processors.cache;
-
-import org.apache.ignite.transactions.TransactionConcurrency;
-import org.apache.ignite.transactions.TransactionIsolation;
-
-/**
- * Test getEntry and getEntries methods.
- */
-public class CacheGetEntryPessimisticSerializableSeltTest extends CacheGetEntryAbstractTest {
- /** {@inheritDoc} */
- @Override protected TransactionConcurrency concurrency() {
- return TransactionConcurrency.PESSIMISTIC;
- }
-
- /** {@inheritDoc} */
- @Override protected TransactionIsolation isolation() {
- return TransactionIsolation.SERIALIZABLE;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
index e520d45..f2e12ad 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
@@ -25,9 +25,11 @@ import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
import org.apache.ignite.internal.processors.cache.local.GridLocalCacheEntry;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheMode.LOCAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
@@ -76,6 +78,9 @@ public class CacheOffheapMapEntrySelfTest extends GridCacheAbstractSelfTest {
cfg.setAtomicityMode(atomicityMode);
cfg.setName(cacheName);
+ if (atomicityMode == TRANSACTIONAL_SNAPSHOT && !MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE))
+ cfg.setNearConfiguration(null);
+
return cfg;
}
@@ -87,13 +92,22 @@ public class CacheOffheapMapEntrySelfTest extends GridCacheAbstractSelfTest {
checkCacheMapEntry(TRANSACTIONAL, LOCAL, GridLocalCacheEntry.class);
+ if (MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.LOCAL_CACHE))
+ checkCacheMapEntry(TRANSACTIONAL_SNAPSHOT, LOCAL, GridLocalCacheEntry.class);
+
checkCacheMapEntry(ATOMIC, PARTITIONED, GridNearCacheEntry.class);
checkCacheMapEntry(TRANSACTIONAL, PARTITIONED, GridNearCacheEntry.class);
+ if (MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.CACHE_STORE))
+ checkCacheMapEntry(TRANSACTIONAL_SNAPSHOT, PARTITIONED, GridDhtCacheEntry.class);
+
checkCacheMapEntry(ATOMIC, REPLICATED, GridDhtCacheEntry.class);
checkCacheMapEntry(TRANSACTIONAL, REPLICATED, GridDhtCacheEntry.class);
+
+ if (MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.CACHE_STORE))
+ checkCacheMapEntry(TRANSACTIONAL_SNAPSHOT, REPLICATED, GridDhtCacheEntry.class);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalRestartSelfTest.java
index 58fa8d6..5e8b1eb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalRestartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalRestartSelfTest.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -29,4 +30,11 @@ public class CacheReadThroughLocalRestartSelfTest extends CacheReadThroughRestar
@Override protected CacheMode cacheMode() {
return LOCAL;
}
+
+ /** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+ super.setUp();
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
index 422ed58..5b79f7f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
@@ -27,6 +27,7 @@ import org.apache.ignite.configuration.TransactionConfiguration;
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.testframework.MvccFeatureChecker;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
@@ -42,6 +43,13 @@ public class CacheReadThroughRestartSelfTest extends GridCacheAbstractSelfTest {
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected int gridCount() {
return 2;
}
@@ -116,6 +124,9 @@ public class CacheReadThroughRestartSelfTest extends GridCacheAbstractSelfTest {
for (TransactionConcurrency txConcurrency : TransactionConcurrency.values()) {
for (TransactionIsolation txIsolation : TransactionIsolation.values()) {
+ if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(txConcurrency, txIsolation))
+ continue;
+
try (Transaction tx = ignite.transactions().txStart(txConcurrency, txIsolation, 100000, 1000)) {
for (int k = 0; k < 1000; k++) {
String key = "key" + k;
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
index a27bdda..cccb92a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
@@ -24,12 +24,21 @@ import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
/**
* Test remove all method.
*/
public class CacheRemoveAllSelfTest extends GridCacheAbstractSelfTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-10082");
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected long getTestTimeout() {
return 2 * 60 * 1000;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
index 6239b52..a204ddf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
@@ -29,6 +29,7 @@ import javax.cache.configuration.MutableConfiguration;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
@@ -47,6 +48,7 @@ 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.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -150,6 +152,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
cfg.setName(CACHE_NAME_DHT);
cfg.setCacheMode(PARTITIONED);
+ cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
cfg.setNearConfiguration(null);
return cfg;
@@ -163,6 +166,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
cfg.setName(CACHE_NAME_CLIENT);
cfg.setCacheMode(PARTITIONED);
+ cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
cfg.setNearConfiguration(null);
return cfg;
@@ -176,6 +180,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
cfg.setName(CACHE_NAME_NEAR);
cfg.setCacheMode(PARTITIONED);
+ cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
cfg.setNearConfiguration(new NearCacheConfiguration());
return cfg;
@@ -190,6 +195,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
cfg.setName(CACHE_NAME_LOC);
cfg.setCacheMode(LOCAL);
cfg.setNearConfiguration(null);
+ cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
return cfg;
}
@@ -280,6 +286,8 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testNearDoubleDestroy() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
startGridsMultiThreaded(gridCount());
nearDestroy();
@@ -320,6 +328,8 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testLocalDoubleDestroy() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
startGridsMultiThreaded(gridCount());
localDestroy();
@@ -563,6 +573,8 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testNearClose() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
startGridsMultiThreaded(gridCount());
IgniteCache<String, String> cache0 = grid(0).getOrCreateCache(getNearConfig());
@@ -636,6 +648,8 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testNearCloseWithTry() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
startGridsMultiThreaded(gridCount());
String curVal = null;
@@ -674,6 +688,8 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testLocalClose() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
memCfg = new DataStorageConfiguration();
startGridsMultiThreaded(gridCount());
@@ -725,6 +741,8 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testLocalCloseWithTry() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
memCfg = new DataStorageConfiguration();
startGridsMultiThreaded(gridCount());
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.java
index 4511fc5..e217a1f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -26,6 +27,13 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
*/
public class CacheStoreUsageMultinodeDynamicStartTxTest extends CacheStoreUsageMultinodeDynamicStartAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected CacheAtomicityMode atomicityMode() {
return TRANSACTIONAL;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.java
index 2f11fc8..8fa7e65 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -26,6 +27,13 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
*/
public class CacheStoreUsageMultinodeStaticStartTxTest extends CacheStoreUsageMultinodeStaticStartAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected CacheAtomicityMode atomicityMode() {
return TRANSACTIONAL;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxNotAllowReadFromBackupTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxNotAllowReadFromBackupTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxNotAllowReadFromBackupTest.java
index f0ec084..fad2c61 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxNotAllowReadFromBackupTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxNotAllowReadFromBackupTest.java
@@ -189,6 +189,72 @@ public class CacheTxNotAllowReadFromBackupTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testBackupConsistencyReplicatedMvcc() throws Exception {
+ CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>("test-cache");
+
+ cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT);
+ cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
+ cfg.setCacheMode(CacheMode.REPLICATED);
+ cfg.setReadFromBackup(false);
+
+ checkBackupConsistency(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ);
+
+ checkBackupConsistencyGetAll(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testBackupConsistencyReplicatedFullSyncMvcc() throws Exception {
+ CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>("test-cache");
+
+ cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT);
+ cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+ cfg.setCacheMode(CacheMode.REPLICATED);
+ cfg.setReadFromBackup(false);
+
+ checkBackupConsistency(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ);
+
+ checkBackupConsistencyGetAll(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testBackupConsistencyPartitionedMvcc() throws Exception {
+ CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>("test-cache");
+
+ cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT);
+ cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
+ cfg.setCacheMode(CacheMode.PARTITIONED);
+ cfg.setBackups(NODES - 1);
+ cfg.setReadFromBackup(false);
+
+ checkBackupConsistency(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ);
+
+ checkBackupConsistencyGetAll(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testBackupConsistencyPartitionedFullSyncMvcc() throws Exception {
+ CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>("test-cache");
+
+ cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT);
+ cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+ cfg.setCacheMode(CacheMode.PARTITIONED);
+ cfg.setBackups(NODES - 1);
+ cfg.setReadFromBackup(false);
+
+ checkBackupConsistency(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ);
+
+ checkBackupConsistencyGetAll(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ);
+ }
+
+ /**
* @param ccfg Cache configuration.
* @throws Exception If failed.
*/
[38/50] [abbrv] ignite git commit: IGNITE-10509 reordered setting of
timeout flag and transaction state - Fixes #5555.
Posted by sb...@apache.org.
IGNITE-10509 reordered setting of timeout flag and transaction state - Fixes #5555.
Signed-off-by: Dmitriy Govorukhin <dm...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5fa79c6a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5fa79c6a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5fa79c6a
Branch: refs/heads/ignite-10044
Commit: 5fa79c6a134b9530e0055eddcb90b53ce3d768bc
Parents: bc895ac
Author: Anton Kalashnikov <ka...@yandex.ru>
Authored: Wed Dec 5 16:30:16 2018 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Wed Dec 5 16:30:16 2018 +0300
----------------------------------------------------------------------
.../internal/processors/cache/transactions/IgniteTxAdapter.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5fa79c6a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index c8b0459..47a0276 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -1185,11 +1185,11 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement
}
if (valid) {
- this.state = state;
-
if (timedOut)
this.timedOut = true;
+ this.state = state;
+
if (log.isDebugEnabled())
log.debug("Changed transaction state [prev=" + prev + ", new=" + this.state + ", tx=" + this + ']');
[48/50] [abbrv] ignite git commit: IGNITE-9980 Added additional flag
to filter caches by types to control.sh - Fixes #5496.
Posted by sb...@apache.org.
IGNITE-9980 Added additional flag to filter caches by types to control.sh - Fixes #5496.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9199aac1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9199aac1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9199aac1
Branch: refs/heads/ignite-10044
Commit: 9199aac144844aa8e4a44e36e366af25dd90eb18
Parents: 6613376
Author: vd-pyatkov <vp...@gridgain.com>
Authored: Thu Dec 6 18:39:07 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Dec 6 18:39:07 2018 +0300
----------------------------------------------------------------------
.../internal/commandline/CommandHandler.java | 24 ++-
.../commandline/cache/CacheArguments.java | 18 ++
.../verify/VerifyBackupPartitionsTaskV2.java | 97 ++++++++--
.../internal/visor/verify/CacheFilterEnum.java | 52 ++++++
.../verify/VisorIdleVerifyDumpTaskArg.java | 30 +++-
.../ignite/util/GridCommandHandlerTest.java | 177 ++++++++++++++++++-
6 files changed, 376 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9199aac1/modules/core/src/main/java/org/apache/ignite/internal/commandline/CommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/commandline/CommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/commandline/CommandHandler.java
index 56f278b..da6495f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/commandline/CommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/commandline/CommandHandler.java
@@ -101,6 +101,7 @@ import org.apache.ignite.internal.visor.tx.VisorTxSortOrder;
import org.apache.ignite.internal.visor.tx.VisorTxTask;
import org.apache.ignite.internal.visor.tx.VisorTxTaskArg;
import org.apache.ignite.internal.visor.tx.VisorTxTaskResult;
+import org.apache.ignite.internal.visor.verify.CacheFilterEnum;
import org.apache.ignite.internal.visor.verify.IndexIntegrityCheckIssue;
import org.apache.ignite.internal.visor.verify.IndexValidationIssue;
import org.apache.ignite.internal.visor.verify.ValidateIndexesPartitionResult;
@@ -195,6 +196,9 @@ public class CommandHandler {
/** */
private static final String CMD_SKIP_ZEROS = "--skipZeros";
+ /** Cache filter. */
+ private static final String CACHE_FILTER = "--cacheFilter";
+
/** */
private static final String CMD_USER_ATTRIBUTES = "--user-attributes";
@@ -809,10 +813,14 @@ public class CommandHandler {
nl();
log(i("Subcommands:"));
- usageCache(LIST, "regexPattern", "[groups|seq]", "[nodeId]", op(CONFIG), op(OUTPUT_FORMAT, MULTI_LINE.text()));
- usageCache(CONTENTION, "minQueueSize", "[nodeId]", "[maxPrint]");
- usageCache(IDLE_VERIFY, op(CMD_DUMP), op(CMD_SKIP_ZEROS), "[cache1,...,cacheN]");
- usageCache(VALIDATE_INDEXES, "[cache1,...,cacheN]", "[nodeId]", op(or(VI_CHECK_FIRST + " N", VI_CHECK_THROUGH + " K")));
+ usageCache(LIST, "regexPattern", op(or("groups","seq")), op("nodeId"), op(CONFIG), op(OUTPUT_FORMAT, MULTI_LINE
+ .text()));
+ usageCache(CONTENTION, "minQueueSize", op("nodeId"), op("maxPrint"));
+ usageCache(IDLE_VERIFY, op(CMD_DUMP), op(CMD_SKIP_ZEROS), "[cache1,...,cacheN]",
+ op(CACHE_FILTER, or(CacheFilterEnum.ALL.toString(), CacheFilterEnum.SYSTEM.toString(), CacheFilterEnum.PERSISTENT.toString(),
+ CacheFilterEnum.NOT_PERSISTENT.toString())));
+ usageCache(VALIDATE_INDEXES, "[cache1,...,cacheN]", op("nodeId"), op(or(VI_CHECK_FIRST + " N",
+ VI_CHECK_THROUGH + " K")));
usageCache(DISTRIBUTION, or("nodeId", NULL), "[cacheName1,...,cacheNameN]", op(CMD_USER_ATTRIBUTES, "attName1,...,attrNameN"));
usageCache(RESET_LOST_PARTITIONS, "cacheName1,...,cacheNameN");
nl();
@@ -1133,7 +1141,7 @@ public class CommandHandler {
String path = executeTask(
client,
VisorIdleVerifyDumpTask.class,
- new VisorIdleVerifyDumpTaskArg(cacheArgs.caches(), cacheArgs.isSkipZeros())
+ new VisorIdleVerifyDumpTaskArg(cacheArgs.caches(), cacheArgs.isSkipZeros(), cacheArgs.getCacheFilterEnum())
);
log("VisorIdleVerifyDumpTask successfully written output to '" + path + "'");
@@ -2049,6 +2057,12 @@ public class CommandHandler {
cacheArgs.dump(true);
else if (CMD_SKIP_ZEROS.equals(nextArg))
cacheArgs.skipZeros(true);
+ else if (CACHE_FILTER.equals(nextArg)) {
+ String filter = nextArg("The cache filter should be specified. The following values can be " +
+ "used: " + Arrays.toString(CacheFilterEnum.values()) + '.').toUpperCase();
+
+ cacheArgs.setCacheFilterEnum(CacheFilterEnum.valueOf(filter));
+ }
else
parseCacheNames(nextArg, cacheArgs);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9199aac1/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/CacheArguments.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/CacheArguments.java b/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/CacheArguments.java
index e92b627..9372391 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/CacheArguments.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/CacheArguments.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.commandline.cache;
import java.util.Set;
import java.util.UUID;
import org.apache.ignite.internal.commandline.OutputFormat;
+import org.apache.ignite.internal.visor.verify.CacheFilterEnum;
import org.apache.ignite.internal.visor.verify.VisorViewCacheCmd;
import org.jetbrains.annotations.Nullable;
@@ -71,6 +72,23 @@ public class CacheArguments {
/** Full config flag. */
private boolean fullConfig;
+ /** Cache filter. */
+ private CacheFilterEnum cacheFilterEnum = CacheFilterEnum.ALL;
+
+ /**
+ * @return Gets filter of caches, which will by checked.
+ */
+ public CacheFilterEnum getCacheFilterEnum() {
+ return cacheFilterEnum;
+ }
+
+ /**
+ * @param cacheFilterEnum Cache filter.
+ */
+ public void setCacheFilterEnum(CacheFilterEnum cacheFilterEnum) {
+ this.cacheFilterEnum = cacheFilterEnum;
+ }
+
/**
* @return Full config flag.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/9199aac1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/VerifyBackupPartitionsTaskV2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/VerifyBackupPartitionsTaskV2.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/VerifyBackupPartitionsTaskV2.java
index e698e3a..14995cb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/VerifyBackupPartitionsTaskV2.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/VerifyBackupPartitionsTaskV2.java
@@ -36,20 +36,26 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteInterruptedException;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.compute.ComputeJobAdapter;
import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.compute.ComputeTaskAdapter;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.CacheGroupContext;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
+import org.apache.ignite.internal.processors.cache.GridCacheUtils;
import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.lang.GridIterator;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.verify.CacheFilterEnum;
+import org.apache.ignite.internal.visor.verify.VisorIdleVerifyDumpTaskArg;
import org.apache.ignite.internal.visor.verify.VisorIdleVerifyTaskArg;
import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.resources.IgniteInstanceResource;
@@ -176,7 +182,7 @@ public class VerifyBackupPartitionsTaskV2 extends ComputeTaskAdapter<VisorIdleVe
for (String cacheName : arg.getCaches()) {
DynamicCacheDescriptor desc = ignite.context().cache().cacheDescriptor(cacheName);
- if (desc == null) {
+ if (desc == null || !isCacheMatchFilter(cacheName)) {
missingCaches.add(cacheName);
continue;
@@ -185,15 +191,13 @@ public class VerifyBackupPartitionsTaskV2 extends ComputeTaskAdapter<VisorIdleVe
grpIds.add(desc.groupId());
}
- if (!missingCaches.isEmpty()) {
- StringBuilder strBuilder = new StringBuilder("The following caches do not exist: ");
-
- for (String name : missingCaches)
- strBuilder.append(name).append(", ");
-
- strBuilder.delete(strBuilder.length() - 2, strBuilder.length());
-
- throw new IgniteException(strBuilder.toString());
+ handlingMissedCaches(missingCaches);
+ }
+ else if (onlySpecificCaches()) {
+ for (DynamicCacheDescriptor desc : ignite.context().cache().cacheDescriptors().values()) {
+ if (desc.cacheConfiguration().getCacheMode() != CacheMode.LOCAL
+ && isCacheMatchFilter(desc.cacheName()))
+ grpIds.add(desc.groupId());
}
}
else {
@@ -260,6 +264,79 @@ public class VerifyBackupPartitionsTaskV2 extends ComputeTaskAdapter<VisorIdleVe
}
/**
+ * Checks and throw exception if caches was missed.
+ *
+ * @param missingCaches Missing caches.
+ */
+ private void handlingMissedCaches(Set<String> missingCaches) {
+ if (missingCaches.isEmpty())
+ return;
+
+ StringBuilder strBuilder = new StringBuilder("The following caches do not exist");
+
+ if (onlySpecificCaches()) {
+ VisorIdleVerifyDumpTaskArg vdta = (VisorIdleVerifyDumpTaskArg)arg;
+
+ strBuilder.append(" or do not match to the given filter [")
+ .append(vdta.getCacheFilterEnum())
+ .append("]: ");
+ }
+ else
+ strBuilder.append(": ");
+
+ for (String name : missingCaches)
+ strBuilder.append(name).append(", ");
+
+ strBuilder.delete(strBuilder.length() - 2, strBuilder.length());
+
+ throw new IgniteException(strBuilder.toString());
+ }
+
+ /**
+ * @return True if validates only specific caches, else false.
+ */
+ private boolean onlySpecificCaches() {
+ if (arg instanceof VisorIdleVerifyDumpTaskArg) {
+ VisorIdleVerifyDumpTaskArg vdta = (VisorIdleVerifyDumpTaskArg)arg;
+
+ return vdta.getCacheFilterEnum() != CacheFilterEnum.ALL;
+ }
+
+ return false;
+ }
+
+ /**
+ * @param cacheName Cache name.
+ */
+ private boolean isCacheMatchFilter(String cacheName) {
+ if (arg instanceof VisorIdleVerifyDumpTaskArg) {
+ DataStorageConfiguration dsc = ignite.context().config().getDataStorageConfiguration();
+ DynamicCacheDescriptor desc = ignite.context().cache().cacheDescriptor(cacheName);
+ CacheConfiguration cc = desc.cacheConfiguration();
+ VisorIdleVerifyDumpTaskArg vdta = (VisorIdleVerifyDumpTaskArg)arg;
+
+ switch (vdta.getCacheFilterEnum()) {
+ case SYSTEM:
+ return !desc.cacheType().userCache();
+
+ case NOT_PERSISTENT:
+ return desc.cacheType().userCache() && !GridCacheUtils.isPersistentCache(cc, dsc);
+
+ case PERSISTENT:
+ return desc.cacheType().userCache() && GridCacheUtils.isPersistentCache(cc, dsc);
+
+ case ALL:
+ break;
+
+ default:
+ assert false: "Illegal cache filter: " + vdta.getCacheFilterEnum();
+ }
+ }
+
+ return true;
+ }
+
+ /**
* @param grpCtx Group context.
* @param part Local partition.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/9199aac1/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/CacheFilterEnum.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/CacheFilterEnum.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/CacheFilterEnum.java
new file mode 100644
index 0000000..4e87d50
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/CacheFilterEnum.java
@@ -0,0 +1,52 @@
+/*
+ * 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.visor.verify;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents a type of cache(s) that can be used for comparing update counters and checksums between primary and backup partitions.
+ * <br>
+ * @see org.apache.ignite.internal.processors.cache.verify.VerifyBackupPartitionsTaskV2
+ */
+public enum CacheFilterEnum {
+ /** All. */
+ ALL,
+
+ /** System. */
+ SYSTEM,
+
+ /** Persistent. */
+ PERSISTENT,
+
+ /** Not persistent. */
+ NOT_PERSISTENT;
+
+ /** Enumerated values. */
+ private static final CacheFilterEnum[] VALS = values();
+
+ /**
+ * Efficiently gets enumerated value from its ordinal.
+ *
+ * @param ord Ordinal value.
+ * @return Enumerated value or {@code null} if ordinal out of range.
+ */
+ public static @Nullable CacheFilterEnum fromOrdinal(int ord) {
+ return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9199aac1/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyDumpTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyDumpTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyDumpTaskArg.java
index 6316c24..29dfb5b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyDumpTaskArg.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyDumpTaskArg.java
@@ -22,6 +22,7 @@ import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Set;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
/**
* Arguments for {@link VisorIdleVerifyDumpTask}.
@@ -29,9 +30,13 @@ import org.apache.ignite.internal.util.typedef.internal.S;
public class VisorIdleVerifyDumpTaskArg extends VisorIdleVerifyTaskArg {
/** */
private static final long serialVersionUID = 0L;
+
/** */
private boolean skipZeros;
+ /** Cache kind. */
+ private CacheFilterEnum cacheFilterEnum;
+
/**
* Default constructor.
*/
@@ -41,10 +46,12 @@ public class VisorIdleVerifyDumpTaskArg extends VisorIdleVerifyTaskArg {
/**
* @param caches Caches.
* @param skipZeros Skip zeros partitions.
+ * @param cacheFilterEnum Cache kind.
*/
- public VisorIdleVerifyDumpTaskArg(Set<String> caches, boolean skipZeros) {
+ public VisorIdleVerifyDumpTaskArg(Set<String> caches, boolean skipZeros, CacheFilterEnum cacheFilterEnum) {
super(caches);
this.skipZeros = skipZeros;
+ this.cacheFilterEnum = cacheFilterEnum;
}
/**
@@ -54,16 +61,37 @@ public class VisorIdleVerifyDumpTaskArg extends VisorIdleVerifyTaskArg {
return skipZeros;
}
+ /**
+ * @return Kind fo cache.
+ */
+ public CacheFilterEnum getCacheFilterEnum() {
+ return cacheFilterEnum;
+ }
+
/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
super.writeExternalData(out);
+
out.writeBoolean(skipZeros);
+
+ U.writeEnum(out, cacheFilterEnum);
}
/** {@inheritDoc} */
@Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternalData(protoVer, in);
+
skipZeros = in.readBoolean();
+
+ if (protoVer >= V2)
+ cacheFilterEnum = CacheFilterEnum.fromOrdinal(in.readByte());
+ else
+ cacheFilterEnum = CacheFilterEnum.ALL;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte getProtocolVersion() {
+ return V2;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/9199aac1/modules/core/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java b/modules/core/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
index 67fee0a..f5fa887 100644
--- a/modules/core/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.util;
import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
@@ -48,6 +49,7 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.AtomicConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.ConnectorConfiguration;
import org.apache.ignite.configuration.DataRegionConfiguration;
@@ -64,6 +66,7 @@ import org.apache.ignite.internal.commandline.OutputFormat;
import org.apache.ignite.internal.commandline.cache.CacheCommand;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
import org.apache.ignite.internal.pagemem.wal.record.DataEntry;
+import org.apache.ignite.internal.processors.cache.CacheGroupContext;
import org.apache.ignite.internal.processors.cache.CacheObjectImpl;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
@@ -79,15 +82,18 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.processors.datastructures.GridCacheInternalKeyImpl;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.tx.VisorTxInfo;
import org.apache.ignite.internal.visor.tx.VisorTxTaskResult;
+import org.apache.ignite.internal.visor.verify.CacheFilterEnum;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.lang.IgnitePredicate;
@@ -126,6 +132,12 @@ public class GridCommandHandlerTest extends GridCommonAbstractTest {
/** Option is used for auto confirmation. */
private static final String CMD_AUTO_CONFIRMATION = "--yes";
+ /** Atomic configuration. */
+ private AtomicConfiguration atomicConfiguration;
+
+ /** Additional data region configuration. */
+ private DataRegionConfiguration dataRegionConfiguration;
+
/**
* @return Folder in work directory.
* @throws IgniteCheckedException If failed to resolve folder name.
@@ -186,12 +198,19 @@ public class GridCommandHandlerTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+ if (atomicConfiguration != null)
+ cfg.setAtomicConfiguration(atomicConfiguration);
+
cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());
cfg.setConnectorConfiguration(new ConnectorConfiguration());
- DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
- new DataRegionConfiguration().setMaxSize(50L * 1024 * 1024));
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setMaxSize(50L * 1024 * 1024));
+
+ if (dataRegionConfiguration != null)
+ memCfg.setDataRegionConfigurations(dataRegionConfiguration);
cfg.setDataStorageConfiguration(memCfg);
@@ -1055,25 +1074,171 @@ public class GridCommandHandlerTest extends GridCommonAbstractTest {
.setBackups(1)
.setName(DEFAULT_CACHE_NAME));
+ for (int i = 0; i < 100; i++)
+ cache.put(i, i);
+
+ corruptingAndCheckDefaultCache(ignite, parts, CacheFilterEnum.ALL);
+ }
+
+ /**
+ * @param ignite Ignite.
+ * @param parts Parts.
+ */
+ private void corruptingAndCheckDefaultCache(IgniteEx ignite, int parts, CacheFilterEnum cacheFilterEnum) throws IOException {
injectTestSystemOut();
+ GridCacheContext<Object, Object> cacheCtx = ignite.cachex(DEFAULT_CACHE_NAME).context();
+
+ corruptDataEntry(cacheCtx, 0, true, false);
+
+ corruptDataEntry(cacheCtx, parts / 2, false, true);
+
+ assertEquals(EXIT_CODE_OK, execute("--cache", "idle_verify", "--dump", "--cacheFilter", cacheFilterEnum.toString()));
+
+ Matcher fileNameMatcher = dumpFileNameMatcher();
+
+ if (fileNameMatcher.find()) {
+ String dumpWithConflicts = new String(Files.readAllBytes(Paths.get(fileNameMatcher.group(1))));
+
+ assertTrue(dumpWithConflicts.contains("found 2 conflict partitions: [counterConflicts=1, hashConflicts=1]"));
+ }
+ else
+ fail("Should be found dump with conflicts");
+ }
+
+ /**
+ * Tests that idle verify print partitions info over system caches.
+ *
+ * @throws Exception If failed.
+ */
+ public void testCacheIdleVerifyDumpForCorruptedDataOnSystemCache() throws Exception {
+ int parts = 32;
+
+ atomicConfiguration = new AtomicConfiguration()
+ .setAffinity(new RendezvousAffinityFunction(false, parts))
+ .setBackups(2);
+
+ IgniteEx ignite = (IgniteEx)startGrids(3);
+
+ ignite.cluster().active(true);
+
+ injectTestSystemOut();
+
+ // Adding some assignments without deployments.
+ for (int i = 0; i < 100; i++) {
+ ignite.semaphore("s" + i, i, false, true);
+
+ ignite.atomicSequence("sq" + i, 0, true)
+ .incrementAndGet();
+ }
+
+ CacheGroupContext storedSysCacheCtx = ignite.context().cache().cacheGroup(CU.cacheId("default-ds-group"));
+
+ assertNotNull(storedSysCacheCtx);
+
+ corruptDataEntry(storedSysCacheCtx.caches().get(0), new GridCacheInternalKeyImpl("sq0",
+ "default-ds-group"), true, false);
+
+ corruptDataEntry(storedSysCacheCtx.caches().get(0), new GridCacheInternalKeyImpl("sq" + parts / 2,
+ "default-ds-group"), false, true);
+
+ CacheGroupContext memorySysCacheCtx = ignite.context().cache().cacheGroup(CU.cacheId("default-volatile-ds-group"));
+
+ assertNotNull(memorySysCacheCtx);
+
+ corruptDataEntry(memorySysCacheCtx.caches().get(0), new GridCacheInternalKeyImpl("s0",
+ "default-volatile-ds-group"), true, false);
+
+ corruptDataEntry(memorySysCacheCtx.caches().get(0), new GridCacheInternalKeyImpl("s" + parts / 2,
+ "default-volatile-ds-group"), false, true);
+
+ assertEquals(EXIT_CODE_OK, execute("--cache", "idle_verify", "--dump", "--cacheFilter", CacheFilterEnum.SYSTEM.toString()));
+
+ Matcher fileNameMatcher = dumpFileNameMatcher();
+
+ if (fileNameMatcher.find()) {
+ String dumpWithConflicts = new String(Files.readAllBytes(Paths.get(fileNameMatcher.group(1))));
+
+ assertTrue(dumpWithConflicts.contains("found 4 conflict partitions: [counterConflicts=2, " +
+ "hashConflicts=2]"));
+ }
+ else
+ fail("Should be found dump with conflicts");
+ }
+
+ /**
+ * Tests that idle verify print partitions info over persistence client caches.
+ *
+ * @throws Exception If failed.
+ */
+ public void testCacheIdleVerifyDumpForCorruptedDataOnPersistenceClientCache() throws Exception {
+ int parts = 32;
+
+ dataRegionConfiguration = new DataRegionConfiguration()
+ .setName("persistence-region")
+ .setMaxSize(100L * 1024 * 1024)
+ .setPersistenceEnabled(true);
+
+ IgniteEx ignite = (IgniteEx)startGrids(3);
+
+ ignite.cluster().active(true);
+
+ IgniteCache<Object, Object> cache = ignite.createCache(new CacheConfiguration<>()
+ .setAffinity(new RendezvousAffinityFunction(false, parts))
+ .setBackups(2)
+ .setName(DEFAULT_CACHE_NAME)
+ .setDataRegionName("persistence-region"));
+
+ // Adding some assignments without deployments.
for (int i = 0; i < 100; i++)
cache.put(i, i);
+ corruptingAndCheckDefaultCache(ignite, parts, CacheFilterEnum.PERSISTENT);
+ }
+
+ /**
+ * Tests that idle verify print partitions info over none-persistence client caches.
+ *
+ * @throws Exception If failed.
+ */
+ public void testCacheIdleVerifyDumpForCorruptedDataOnNonePersistenceClientCache() throws Exception {
+ int parts = 32;
+
+ dataRegionConfiguration = new DataRegionConfiguration()
+ .setName("none-persistence-region");
+
+ IgniteEx ignite = (IgniteEx)startGrids(3);
+
+ ignite.cluster().active(true);
+
+ IgniteCache<Object, Object> cache = ignite.createCache(new CacheConfiguration<>()
+ .setAffinity(new RendezvousAffinityFunction(false, parts))
+ .setBackups(2)
+ .setName(DEFAULT_CACHE_NAME)
+ .setDataRegionName("none-persistence-region"));
+
+ // Adding some assignments without deployments.
+ for (int i = 0; i < 100; i++)
+ cache.put(i, i);
+
+ injectTestSystemOut();
+
GridCacheContext<Object, Object> cacheCtx = ignite.cachex(DEFAULT_CACHE_NAME).context();
corruptDataEntry(cacheCtx, 0, true, false);
- corruptDataEntry(cacheCtx, 0 + parts / 2, false, true);
+ corruptDataEntry(cacheCtx, parts / 2, false, true);
- assertEquals(EXIT_CODE_OK, execute("--cache", "idle_verify", "--dump"));
+ assertEquals(EXIT_CODE_OK, execute("--cache", "idle_verify", "--dump", "--cacheFilter", CacheFilterEnum
+ .NOT_PERSISTENT.toString()));
Matcher fileNameMatcher = dumpFileNameMatcher();
if (fileNameMatcher.find()) {
String dumpWithConflicts = new String(Files.readAllBytes(Paths.get(fileNameMatcher.group(1))));
- assertTrue(dumpWithConflicts.contains("found 2 conflict partitions: [counterConflicts=1, hashConflicts=1]"));
+ assertTrue(dumpWithConflicts.contains("found 1 conflict partitions: [counterConflicts=0, " +
+ "hashConflicts=1]"));
}
else
fail("Should be found dump with conflicts");
@@ -1629,7 +1794,7 @@ public class GridCommandHandlerTest extends GridCommonAbstractTest {
*/
private void corruptDataEntry(
GridCacheContext<Object, Object> ctx,
- int key,
+ Object key,
boolean breakCntr,
boolean breakData
) {
[17/50] [abbrv] ignite git commit: IGNITE-10457: MVCC TX: Fix
MvccProcessor initialization on recovery from store. This closes #5538.
Posted by sb...@apache.org.
IGNITE-10457: MVCC TX: Fix MvccProcessor initialization on recovery from store. This closes #5538.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cdba7d9a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cdba7d9a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cdba7d9a
Branch: refs/heads/ignite-10044
Commit: cdba7d9a1a1d0e2f69aafaeeef3a2746bc69b072
Parents: 7251718
Author: Igor Seliverstov <gv...@gmail.com>
Authored: Tue Dec 4 17:40:04 2018 +0300
Committer: Igor Seliverstov <gv...@gmail.com>
Committed: Tue Dec 4 17:40:04 2018 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheProcessor.java | 10 +++++++---
.../processors/cache/mvcc/MvccProcessorImpl.java | 6 ++++++
.../persistence/DatabaseLifecycleListener.java | 16 ++++++++++------
.../persistence/GridCacheDatabaseSharedManager.java | 8 +++++---
.../query/h2/GridIndexRebuildSelfTest.java | 2 +-
5 files changed, 29 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdba7d9a/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 0870d1b..b49c697 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
@@ -5476,7 +5476,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/** {@inheritDoc} */
- @Override public void afterBinaryMemoryRestore(GridCacheDatabaseSharedManager.RestoreBinaryState binaryState) throws IgniteCheckedException {
+ @Override public void afterBinaryMemoryRestore(
+ IgniteCacheDatabaseSharedManager mgr,
+ GridCacheDatabaseSharedManager.RestoreBinaryState restoreState) throws IgniteCheckedException {
for (DynamicCacheDescriptor cacheDescriptor : persistentCaches()) {
startCacheInRecoveryMode(cacheDescriptor);
@@ -5485,8 +5487,10 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/** {@inheritDoc} */
- @Override public void afterLogicalUpdatesApplied(GridCacheDatabaseSharedManager.RestoreLogicalState logicalState) throws IgniteCheckedException {
- restorePartitionStates(cacheGroups(), logicalState.partitionRecoveryStates());
+ @Override public void afterLogicalUpdatesApplied(
+ IgniteCacheDatabaseSharedManager mgr,
+ GridCacheDatabaseSharedManager.RestoreLogicalState restoreState) throws IgniteCheckedException {
+ restorePartitionStates(cacheGroups(), restoreState.partitionRecoveryStates());
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdba7d9a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessorImpl.java
index 3ea8f4c..7f386d8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessorImpl.java
@@ -80,6 +80,7 @@ import org.apache.ignite.internal.processors.cache.mvcc.txlog.TxLog;
import org.apache.ignite.internal.processors.cache.mvcc.txlog.TxState;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.persistence.DatabaseLifecycleListener;
+import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.cache.tree.mvcc.data.MvccDataRow;
@@ -347,6 +348,11 @@ public class MvccProcessorImpl extends GridProcessorAdapter implements MvccProce
/** {@inheritDoc} */
@Override public void beforeBinaryMemoryRestore(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException {
txLogPageStoreInit(mgr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void afterBinaryMemoryRestore(IgniteCacheDatabaseSharedManager mgr,
+ GridCacheDatabaseSharedManager.RestoreBinaryState restoreState) throws IgniteCheckedException {
boolean hasMvccCaches = ctx.cache().persistentCaches().stream()
.anyMatch(c -> c.cacheConfiguration().getAtomicityMode() == TRANSACTIONAL_SNAPSHOT);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdba7d9a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DatabaseLifecycleListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DatabaseLifecycleListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DatabaseLifecycleListener.java
index 6762109..34ad751 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DatabaseLifecycleListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DatabaseLifecycleListener.java
@@ -51,20 +51,24 @@ public interface DatabaseLifecycleListener {
/**
* Callback executed when binary memory has fully restored and WAL logging is resumed.
*
- * @param binaryState Result of binary recovery.
+ *
+ * @param mgr
+ * @param restoreState Result of binary recovery.
* @throws IgniteCheckedException If failed.
*/
- public default void afterBinaryMemoryRestore(GridCacheDatabaseSharedManager.RestoreBinaryState binaryState)
- throws IgniteCheckedException {}
+ public default void afterBinaryMemoryRestore(IgniteCacheDatabaseSharedManager mgr,
+ GridCacheDatabaseSharedManager.RestoreBinaryState restoreState) throws IgniteCheckedException {}
/**
* Callback executed when all logical updates were applied and page memory become to fully consistent state.
*
- * @param logicalState Result of logical recovery.
+ *
+ * @param mgr
+ * @param restoreState Result of logical recovery.
* @throws IgniteCheckedException If failed.
*/
- public default void afterLogicalUpdatesApplied(GridCacheDatabaseSharedManager.RestoreLogicalState logicalState)
- throws IgniteCheckedException {}
+ public default void afterLogicalUpdatesApplied(IgniteCacheDatabaseSharedManager mgr,
+ GridCacheDatabaseSharedManager.RestoreLogicalState restoreState) throws IgniteCheckedException {}
/**
* Callback executed when all physical updates are applied and we are ready to write new physical records
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdba7d9a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index 9a03337..95a99fb 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -944,7 +944,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
cctx.wal().resumeLogging(restored);
for (DatabaseLifecycleListener lsnr : getDatabaseListeners(cctx.kernalContext()))
- lsnr.afterBinaryMemoryRestore(binaryState);
+ lsnr.afterBinaryMemoryRestore(this, binaryState);
if (log.isInfoEnabled())
log.info("Binary recovery performed in " + (System.currentTimeMillis() - time) + " ms.");
@@ -2472,7 +2472,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
", time=" + (U.currentTimeMillis() - start) + " ms]");
for (DatabaseLifecycleListener lsnr : getDatabaseListeners(cctx.kernalContext()))
- lsnr.afterLogicalUpdatesApplied(restoreLogicalState);
+ lsnr.afterLogicalUpdatesApplied(this, restoreLogicalState);
return restoreLogicalState;
}
@@ -4713,7 +4713,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
cctx.pageStore().initializeForMetastorage();
}
- @Override public void afterBinaryMemoryRestore(RestoreBinaryState binaryState) throws IgniteCheckedException {
+ @Override public void afterBinaryMemoryRestore(
+ IgniteCacheDatabaseSharedManager mgr,
+ RestoreBinaryState restoreState) throws IgniteCheckedException {
assert metaStorage == null;
metaStorage = createMetastorage(false);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdba7d9a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildSelfTest.java
index d8ba060..9afb749 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildSelfTest.java
@@ -115,7 +115,7 @@ public class GridIndexRebuildSelfTest extends DynamicIndexAbstractSelfTest {
IgniteEx srv = startServer();
execute(srv, "CREATE TABLE T(k int primary key, v int) WITH \"cache_name=T,wrap_value=false," +
- "atomicity=transactional_snapshot\"");
+ "atomicity=transactional\"");
execute(srv, "CREATE INDEX IDX ON T(v)");
[14/50] [abbrv] ignite git commit: IGNITE-10272: [ML] Inject learning
environment into scope of dataset compute task
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDataset.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDataset.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDataset.java
index 0736906..bde4bb6 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDataset.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDataset.java
@@ -28,8 +28,10 @@ import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.PartitionDataBuilder;
-import org.apache.ignite.ml.dataset.UpstreamTransformerChain;
+import org.apache.ignite.ml.dataset.UpstreamTransformerBuilder;
import org.apache.ignite.ml.dataset.impl.cache.util.ComputeUtils;
+import org.apache.ignite.ml.environment.LearningEnvironment;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.functions.IgniteBinaryOperator;
import org.apache.ignite.ml.math.functions.IgniteFunction;
@@ -61,8 +63,8 @@ public class CacheBasedDataset<K, V, C extends Serializable, D extends AutoClose
/** Filter for {@code upstream} data. */
private final IgniteBiPredicate<K, V> filter;
- /** Chain of transformers applied to upstream. */
- private final UpstreamTransformerChain<K, V> upstreamTransformers;
+ /** Builder of transformation applied to upstream. */
+ private final UpstreamTransformerBuilder<K, V> upstreamTransformerBuilder;
/** Ignite Cache with partition {@code context}. */
private final IgniteCache<Integer, C> datasetCache;
@@ -73,6 +75,9 @@ public class CacheBasedDataset<K, V, C extends Serializable, D extends AutoClose
/** Dataset ID that is used to identify dataset in local storage on the node where computation is performed. */
private final UUID datasetId;
+ /** Learning environment builder. */
+ private final LearningEnvironmentBuilder envBuilder;
+
/**
* Constructs a new instance of dataset based on Ignite Cache, which is used as {@code upstream} and as reliable storage for
* partition {@code context} as well.
@@ -80,7 +85,7 @@ public class CacheBasedDataset<K, V, C extends Serializable, D extends AutoClose
* @param ignite Ignite instance.
* @param upstreamCache Ignite Cache with {@code upstream} data.
* @param filter Filter for {@code upstream} data.
- * @param upstreamTransformers Transformers of upstream data (see description in {@link DatasetBuilder}).
+ * @param upstreamTransformerBuilder Transformer of upstream data (see description in {@link DatasetBuilder}).
* @param datasetCache Ignite Cache with partition {@code context}.
* @param partDataBuilder Partition {@code data} builder.
* @param datasetId Dataset ID.
@@ -89,39 +94,45 @@ public class CacheBasedDataset<K, V, C extends Serializable, D extends AutoClose
Ignite ignite,
IgniteCache<K, V> upstreamCache,
IgniteBiPredicate<K, V> filter,
- UpstreamTransformerChain<K, V> upstreamTransformers,
- IgniteCache<Integer, C> datasetCache, PartitionDataBuilder<K, V, C, D> partDataBuilder,
+ UpstreamTransformerBuilder<K, V> upstreamTransformerBuilder,
+ IgniteCache<Integer, C> datasetCache,
+ LearningEnvironmentBuilder envBuilder,
+ PartitionDataBuilder<K, V, C, D> partDataBuilder,
UUID datasetId) {
this.ignite = ignite;
this.upstreamCache = upstreamCache;
this.filter = filter;
- this.upstreamTransformers = upstreamTransformers;
+ this.upstreamTransformerBuilder = upstreamTransformerBuilder;
this.datasetCache = datasetCache;
this.partDataBuilder = partDataBuilder;
+ this.envBuilder = envBuilder;
this.datasetId = datasetId;
}
/** {@inheritDoc} */
- @Override public <R> R computeWithCtx(IgniteTriFunction<C, D, Integer, R> map, IgniteBinaryOperator<R> reduce, R identity) {
+ @Override public <R> R computeWithCtx(IgniteTriFunction<C, D, LearningEnvironment, R> map, IgniteBinaryOperator<R> reduce, R identity) {
String upstreamCacheName = upstreamCache.getName();
String datasetCacheName = datasetCache.getName();
return computeForAllPartitions(part -> {
+ LearningEnvironment env = ComputeUtils.getLearningEnvironment(ignite, datasetId, part, envBuilder);
+
C ctx = ComputeUtils.getContext(Ignition.localIgnite(), datasetCacheName, part);
D data = ComputeUtils.getData(
Ignition.localIgnite(),
upstreamCacheName,
filter,
- upstreamTransformers,
+ upstreamTransformerBuilder,
datasetCacheName,
datasetId,
- part,
- partDataBuilder
+ partDataBuilder,
+ env
);
+
if (data != null) {
- R res = map.apply(ctx, data, part);
+ R res = map.apply(ctx, data, env);
// Saves partition context after update.
ComputeUtils.saveContext(Ignition.localIgnite(), datasetCacheName, part, ctx);
@@ -134,23 +145,24 @@ public class CacheBasedDataset<K, V, C extends Serializable, D extends AutoClose
}
/** {@inheritDoc} */
- @Override public <R> R compute(IgniteBiFunction<D, Integer, R> map, IgniteBinaryOperator<R> reduce, R identity) {
+ @Override public <R> R compute(IgniteBiFunction<D, LearningEnvironment, R> map, IgniteBinaryOperator<R> reduce, R identity) {
String upstreamCacheName = upstreamCache.getName();
String datasetCacheName = datasetCache.getName();
return computeForAllPartitions(part -> {
+ LearningEnvironment env = ComputeUtils.getLearningEnvironment(Ignition.localIgnite(), datasetId, part, envBuilder);
+
D data = ComputeUtils.getData(
Ignition.localIgnite(),
upstreamCacheName,
filter,
- upstreamTransformers,
+ upstreamTransformerBuilder,
datasetCacheName,
datasetId,
- part,
- partDataBuilder
+ partDataBuilder,
+ env
);
-
- return data != null ? map.apply(data, part) : null;
+ return data != null ? map.apply(data, env) : null;
}, reduce, identity);
}
@@ -158,6 +170,7 @@ public class CacheBasedDataset<K, V, C extends Serializable, D extends AutoClose
@Override public void close() {
datasetCache.destroy();
ComputeUtils.removeData(ignite, datasetId);
+ ComputeUtils.removeLearningEnv(ignite, datasetId);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetBuilder.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetBuilder.java
index 1d00875..be40158 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetBuilder.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetBuilder.java
@@ -27,9 +27,10 @@ import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.PartitionContextBuilder;
import org.apache.ignite.ml.dataset.PartitionDataBuilder;
-import org.apache.ignite.ml.dataset.UpstreamTransformerChain;
+import org.apache.ignite.ml.dataset.UpstreamTransformerBuilder;
import org.apache.ignite.ml.dataset.impl.cache.util.ComputeUtils;
import org.apache.ignite.ml.dataset.impl.cache.util.DatasetAffinityFunctionWrapper;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
/**
* A dataset builder that makes {@link CacheBasedDataset}. Encapsulate logic of building cache based dataset such as
@@ -57,8 +58,8 @@ public class CacheBasedDatasetBuilder<K, V> implements DatasetBuilder<K, V> {
/** Filter for {@code upstream} data. */
private final IgniteBiPredicate<K, V> filter;
- /** Chain of upstream transformers. */
- private final UpstreamTransformerChain<K, V> transformersChain;
+ /** Upstream transformer builder. */
+ private final UpstreamTransformerBuilder<K, V> transformerBuilder;
/**
* Constructs a new instance of cache based dataset builder that makes {@link CacheBasedDataset} with default
@@ -79,16 +80,32 @@ public class CacheBasedDatasetBuilder<K, V> implements DatasetBuilder<K, V> {
* @param filter Filter for {@code upstream} data.
*/
public CacheBasedDatasetBuilder(Ignite ignite, IgniteCache<K, V> upstreamCache, IgniteBiPredicate<K, V> filter) {
+ this(ignite, upstreamCache, filter, UpstreamTransformerBuilder.identity());
+ }
+
+ /**
+ * Constructs a new instance of cache based dataset builder that makes {@link CacheBasedDataset}.
+ *
+ * @param ignite Ignite instance.
+ * @param upstreamCache Ignite Cache with {@code upstream} data.
+ * @param filter Filter for {@code upstream} data.
+ */
+ public CacheBasedDatasetBuilder(Ignite ignite,
+ IgniteCache<K, V> upstreamCache,
+ IgniteBiPredicate<K, V> filter,
+ UpstreamTransformerBuilder<K, V> transformerBuilder) {
this.ignite = ignite;
this.upstreamCache = upstreamCache;
this.filter = filter;
- transformersChain = UpstreamTransformerChain.empty();
+ this.transformerBuilder = transformerBuilder;
}
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public <C extends Serializable, D extends AutoCloseable> CacheBasedDataset<K, V, C, D> build(
- PartitionContextBuilder<K, V, C> partCtxBuilder, PartitionDataBuilder<K, V, C, D> partDataBuilder) {
+ LearningEnvironmentBuilder envBuilder,
+ PartitionContextBuilder<K, V, C> partCtxBuilder,
+ PartitionDataBuilder<K, V, C, D> partDataBuilder) {
UUID datasetId = UUID.randomUUID();
// Retrieves affinity function of the upstream Ignite Cache.
@@ -106,25 +123,24 @@ public class CacheBasedDatasetBuilder<K, V> implements DatasetBuilder<K, V> {
ComputeUtils.initContext(
ignite,
upstreamCache.getName(),
+ transformerBuilder,
filter,
- transformersChain,
datasetCache.getName(),
partCtxBuilder,
+ envBuilder,
RETRIES,
RETRY_INTERVAL
);
- return new CacheBasedDataset<>(ignite, upstreamCache, filter, transformersChain, datasetCache, partDataBuilder, datasetId);
+ return new CacheBasedDataset<>(ignite, upstreamCache, filter, transformerBuilder, datasetCache, envBuilder, partDataBuilder, datasetId);
}
/** {@inheritDoc} */
- @Override public UpstreamTransformerChain<K, V> upstreamTransformersChain() {
- return transformersChain;
+ @Override public DatasetBuilder<K, V> withUpstreamTransformer(UpstreamTransformerBuilder<K, V> builder) {
+ return new CacheBasedDatasetBuilder<>(ignite, upstreamCache, filter, transformerBuilder.andThen(builder));
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public DatasetBuilder<K, V> withFilter(IgniteBiPredicate<K, V> filterToAdd) {
return new CacheBasedDatasetBuilder<>(ignite, upstreamCache,
(e1, e2) -> filter.apply(e1, e2) && filterToAdd.apply(e1, e2));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/cache/util/ComputeUtils.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/cache/util/ComputeUtils.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/cache/util/ComputeUtils.java
index 4f18a18..1dc5591 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/cache/util/ComputeUtils.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/cache/util/ComputeUtils.java
@@ -26,6 +26,8 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.locks.LockSupport;
import java.util.stream.Stream;
import org.apache.ignite.Ignite;
@@ -41,7 +43,10 @@ import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.ml.dataset.PartitionContextBuilder;
import org.apache.ignite.ml.dataset.PartitionDataBuilder;
import org.apache.ignite.ml.dataset.UpstreamEntry;
-import org.apache.ignite.ml.dataset.UpstreamTransformerChain;
+import org.apache.ignite.ml.dataset.UpstreamTransformer;
+import org.apache.ignite.ml.dataset.UpstreamTransformerBuilder;
+import org.apache.ignite.ml.environment.LearningEnvironment;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteFunction;
import org.apache.ignite.ml.util.Utils;
@@ -49,11 +54,12 @@ import org.apache.ignite.ml.util.Utils;
* Util class that provides common methods to perform computations on top of the Ignite Compute Grid.
*/
public class ComputeUtils {
- /**
- * Template of the key used to store partition {@code data} in local storage.
- */
+ /** Template of the key used to store partition {@code data} in local storage. */
private static final String DATA_STORAGE_KEY_TEMPLATE = "part_data_storage_%s";
+ /** Template of the key used to store partition {@link LearningEnvironment} in local storage. */
+ private static final String ENVIRONMENT_STORAGE_KEY_TEMPLATE = "part_environment_storage_%s";
+
/**
* Calls the specified {@code fun} function on all partitions so that is't guaranteed that partitions with the same
* index of all specified caches will be placed on the same node and will not be moved before computation is
@@ -134,6 +140,30 @@ public class ComputeUtils {
}
/**
+ * Gets learning environment for given partition. If learning environment is not found in local node map,
+ * it will be created with specified {@link LearningEnvironmentBuilder}.
+ *
+ * @param ignite Ignite instance.
+ * @param datasetId Dataset id.
+ * @param part Partition index.
+ * @param envBuilder {@link LearningEnvironmentBuilder}.
+ * @return Learning environment for given partition.
+ */
+ public static LearningEnvironment getLearningEnvironment(Ignite ignite,
+ UUID datasetId,
+ int part,
+ LearningEnvironmentBuilder envBuilder) {
+
+ @SuppressWarnings("unchecked")
+ ConcurrentMap<Integer, LearningEnvironment> envStorage = (ConcurrentMap<Integer, LearningEnvironment>)ignite
+ .cluster()
+ .nodeLocalMap()
+ .computeIfAbsent(String.format(ENVIRONMENT_STORAGE_KEY_TEMPLATE, datasetId), key -> new ConcurrentHashMap<>());
+
+ return envStorage.computeIfAbsent(part, envBuilder::buildForWorker);
+ }
+
+ /**
* Extracts partition {@code data} from the local storage, if it's not found in local storage recovers this {@code
* data} from a partition {@code upstream} and {@code context}. Be aware that this method should be called from
* the node where partition is placed.
@@ -141,11 +171,11 @@ public class ComputeUtils {
* @param ignite Ignite instance.
* @param upstreamCacheName Name of an {@code upstream} cache.
* @param filter Filter for {@code upstream} data.
- * @param transformersChain Upstream transformers.
+ * @param transformerBuilder Builder of upstream transformers.
* @param datasetCacheName Name of a partition {@code context} cache.
* @param datasetId Dataset ID.
- * @param part Partition index.
* @param partDataBuilder Partition data builder.
+ * @param env Learning environment.
* @param <K> Type of a key in {@code upstream} data.
* @param <V> Type of a value in {@code upstream} data.
* @param <C> Type of a partition {@code context}.
@@ -155,17 +185,18 @@ public class ComputeUtils {
public static <K, V, C extends Serializable, D extends AutoCloseable> D getData(
Ignite ignite,
String upstreamCacheName, IgniteBiPredicate<K, V> filter,
- UpstreamTransformerChain<K, V> transformersChain,
- String datasetCacheName,
- UUID datasetId,
- int part,
- PartitionDataBuilder<K, V, C, D> partDataBuilder) {
+ UpstreamTransformerBuilder<K, V> transformerBuilder,
+ String datasetCacheName, UUID datasetId,
+ PartitionDataBuilder<K, V, C, D> partDataBuilder,
+ LearningEnvironment env) {
PartitionDataStorage dataStorage = (PartitionDataStorage)ignite
.cluster()
.nodeLocalMap()
.computeIfAbsent(String.format(DATA_STORAGE_KEY_TEMPLATE, datasetId), key -> new PartitionDataStorage());
+ final int part = env.partition();
+
return dataStorage.computeDataIfAbsent(part, () -> {
IgniteCache<Integer, C> learningCtxCache = ignite.cache(datasetCacheName);
C ctx = learningCtxCache.get(part);
@@ -177,25 +208,24 @@ public class ComputeUtils {
qry.setPartition(part);
qry.setFilter(filter);
- UpstreamTransformerChain<K, V> chainCopy = Utils.copy(transformersChain);
- chainCopy.modifySeed(s -> s + part);
+ UpstreamTransformer<K, V> transformer = transformerBuilder.build(env);
+ UpstreamTransformer<K, V> transformerCp = Utils.copy(transformer);
- long cnt = computeCount(upstreamCache, qry, chainCopy);
+ long cnt = computeCount(upstreamCache, qry, transformer);
if (cnt > 0) {
try (QueryCursor<UpstreamEntry<K, V>> cursor = upstreamCache.query(qry,
e -> new UpstreamEntry<>(e.getKey(), e.getValue()))) {
Iterator<UpstreamEntry<K, V>> it = cursor.iterator();
- if (!chainCopy.isEmpty()) {
- Stream<UpstreamEntry<K, V>> transformedStream = chainCopy.transform(Utils.asStream(it, cnt));
- it = transformedStream.iterator();
- }
+ Stream<UpstreamEntry<K, V>> transformedStream = transformerCp.transform(Utils.asStream(it, cnt));
+ it = transformedStream.iterator();
+
Iterator<UpstreamEntry<K, V>> iter = new IteratorWithConcurrentModificationChecker<>(it, cnt,
"Cache expected to be not modified during dataset data building [partition=" + part + ']');
- return partDataBuilder.build(iter, cnt, ctx);
+ return partDataBuilder.build(env, iter, cnt, ctx);
}
}
@@ -214,27 +244,40 @@ public class ComputeUtils {
}
/**
+ * Remove learning environment from local cache by Dataset ID.
+ *
+ * @param ignite Ingnite instance.
+ * @param datasetId Dataset ID.
+ */
+ public static void removeLearningEnv(Ignite ignite, UUID datasetId) {
+ ignite.cluster().nodeLocalMap().remove(String.format(ENVIRONMENT_STORAGE_KEY_TEMPLATE, datasetId));
+ }
+
+ /**
* Initializes partition {@code context} by loading it from a partition {@code upstream}.
- * @param <K> Type of a key in {@code upstream} data.
- * @param <V> Type of a value in {@code upstream} data.
- * @param <C> Type of a partition {@code context}.
* @param ignite Ignite instance.
* @param upstreamCacheName Name of an {@code upstream} cache.
* @param filter Filter for {@code upstream} data.
- * @param transformersChain Upstream data {@link Stream} transformers chain.
+ * @param transformerBuilder Upstream transformer builder.
* @param ctxBuilder Partition {@code context} builder.
+ * @param envBuilder Environment builder.
+ * @param <K> Type of a key in {@code upstream} data.
+ * @param <V> Type of a value in {@code upstream} data.
+ * @param <C> Type of a partition {@code context}.
*/
public static <K, V, C extends Serializable> void initContext(
Ignite ignite,
String upstreamCacheName,
+ UpstreamTransformerBuilder<K, V> transformerBuilder,
IgniteBiPredicate<K, V> filter,
- UpstreamTransformerChain<K, V> transformersChain,
String datasetCacheName,
PartitionContextBuilder<K, V, C> ctxBuilder,
+ LearningEnvironmentBuilder envBuilder,
int retries,
int interval) {
affinityCallWithRetries(ignite, Arrays.asList(datasetCacheName, upstreamCacheName), part -> {
Ignite locIgnite = Ignition.localIgnite();
+ LearningEnvironment env = envBuilder.buildForWorker(part);
IgniteCache<K, V> locUpstreamCache = locIgnite.cache(upstreamCacheName);
@@ -244,25 +287,24 @@ public class ComputeUtils {
qry.setFilter(filter);
C ctx;
- UpstreamTransformerChain<K, V> chainCopy = Utils.copy(transformersChain);
- chainCopy.modifySeed(s -> s + part);
+ UpstreamTransformer<K, V> transformer = transformerBuilder.build(env);
+ UpstreamTransformer<K, V> transformerCp = Utils.copy(transformer);
- long cnt = computeCount(locUpstreamCache, qry, transformersChain);
+ long cnt = computeCount(locUpstreamCache, qry, transformer);
try (QueryCursor<UpstreamEntry<K, V>> cursor = locUpstreamCache.query(qry,
e -> new UpstreamEntry<>(e.getKey(), e.getValue()))) {
Iterator<UpstreamEntry<K, V>> it = cursor.iterator();
- if (!chainCopy.isEmpty()) {
- Stream<UpstreamEntry<K, V>> transformedStream = chainCopy.transform(Utils.asStream(it, cnt));
- it = transformedStream.iterator();
- }
+ Stream<UpstreamEntry<K, V>> transformedStream = transformerCp.transform(Utils.asStream(it, cnt));
+ it = transformedStream.iterator();
+
Iterator<UpstreamEntry<K, V>> iter = new IteratorWithConcurrentModificationChecker<>(
it,
cnt,
"Cache expected to be not modified during dataset data building [partition=" + part + ']');
- ctx = ctxBuilder.build(iter, cnt);
+ ctx = ctxBuilder.build(env, iter, cnt);
}
IgniteCache<Integer, C> datasetCache = locIgnite.cache(datasetCacheName);
@@ -279,9 +321,10 @@ public class ComputeUtils {
* @param ignite Ignite instance.
* @param upstreamCacheName Name of an {@code upstream} cache.
* @param filter Filter for {@code upstream} data.
- * @param transformersChain Transformers of upstream data.
+ * @param transformerBuilder Builder of transformer of upstream data.
* @param datasetCacheName Name of a partition {@code context} cache.
* @param ctxBuilder Partition {@code context} builder.
+ * @param envBuilder Environment builder.
* @param retries Number of retries for the case when one of partitions not found on the node.
* @param <K> Type of a key in {@code upstream} data.
* @param <V> Type of a value in {@code upstream} data.
@@ -291,11 +334,12 @@ public class ComputeUtils {
Ignite ignite,
String upstreamCacheName,
IgniteBiPredicate<K, V> filter,
- UpstreamTransformerChain<K, V> transformersChain,
+ UpstreamTransformerBuilder<K, V> transformerBuilder,
String datasetCacheName,
PartitionContextBuilder<K, V, C> ctxBuilder,
+ LearningEnvironmentBuilder envBuilder,
int retries) {
- initContext(ignite, upstreamCacheName, filter, transformersChain, datasetCacheName, ctxBuilder, retries, 0);
+ initContext(ignite, upstreamCacheName, transformerBuilder, filter, datasetCacheName, ctxBuilder, envBuilder, retries, 0);
}
/**
@@ -328,25 +372,21 @@ public class ComputeUtils {
/**
* Computes number of entries selected from the cache by the query.
*
- * @param <K> Type of a key in {@code upstream} data.
- * @param <V> Type of a value in {@code upstream} data.
* @param cache Ignite cache with upstream data.
* @param qry Cache query.
- * @param transformersChain Transformers of stream of upstream data.
+ * @param transformer Upstream transformer.
+ * @param <K> Type of a key in {@code upstream} data.
+ * @param <V> Type of a value in {@code upstream} data.
* @return Number of entries supplied by the iterator.
*/
private static <K, V> long computeCount(
IgniteCache<K, V> cache,
ScanQuery<K, V> qry,
- UpstreamTransformerChain<K, V> transformersChain) {
+ UpstreamTransformer<K, V> transformer) {
try (QueryCursor<UpstreamEntry<K, V>> cursor = cache.query(qry,
e -> new UpstreamEntry<>(e.getKey(), e.getValue()))) {
- // 'If' statement below is just for optimization, to avoid unnecessary iterator -> stream -> iterator
- // operations.
- return transformersChain.isEmpty() ?
- computeCount(cursor.iterator()) :
- computeCount(transformersChain.transform(Utils.asStream(cursor.iterator())).iterator());
+ return computeCount(transformer.transform(Utils.asStream(cursor.iterator())).iterator());
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/local/LocalDataset.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/local/LocalDataset.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/local/LocalDataset.java
index 975beda..8c67c02 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/local/LocalDataset.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/local/LocalDataset.java
@@ -20,6 +20,7 @@ package org.apache.ignite.ml.dataset.impl.local;
import java.io.Serializable;
import java.util.List;
import org.apache.ignite.ml.dataset.Dataset;
+import org.apache.ignite.ml.environment.LearningEnvironment;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.functions.IgniteBinaryOperator;
import org.apache.ignite.ml.math.functions.IgniteTriFunction;
@@ -32,6 +33,9 @@ import org.apache.ignite.ml.math.functions.IgniteTriFunction;
* @param <D> Type of a partition {@code data}.
*/
public class LocalDataset<C extends Serializable, D extends AutoCloseable> implements Dataset<C, D> {
+ /** Partition {@code data} storage. */
+ private final List<LearningEnvironment> envs;
+
/** Partition {@code context} storage. */
private final List<C> ctx;
@@ -42,38 +46,42 @@ public class LocalDataset<C extends Serializable, D extends AutoCloseable> imple
* Constructs a new instance of dataset based on local data structures such as {@code Map} and {@code List} and
* doesn't requires Ignite environment.
*
+ * @param envs List of {@link LearningEnvironment}.
* @param ctx Partition {@code context} storage.
* @param data Partition {@code data} storage.
*/
- LocalDataset(List<C> ctx, List<D> data) {
+ LocalDataset(List<LearningEnvironment> envs, List<C> ctx, List<D> data) {
+ this.envs = envs;
this.ctx = ctx;
this.data = data;
}
/** {@inheritDoc} */
- @Override public <R> R computeWithCtx(IgniteTriFunction<C, D, Integer, R> map, IgniteBinaryOperator<R> reduce,
+ @Override public <R> R computeWithCtx(IgniteTriFunction<C, D, LearningEnvironment, R> map, IgniteBinaryOperator<R> reduce,
R identity) {
R res = identity;
for (int part = 0; part < ctx.size(); part++) {
D partData = data.get(part);
+ LearningEnvironment env = envs.get(part);
if (partData != null)
- res = reduce.apply(res, map.apply(ctx.get(part), partData, part));
+ res = reduce.apply(res, map.apply(ctx.get(part), partData, env));
}
return res;
}
/** {@inheritDoc} */
- @Override public <R> R compute(IgniteBiFunction<D, Integer, R> map, IgniteBinaryOperator<R> reduce, R identity) {
+ @Override public <R> R compute(IgniteBiFunction<D, LearningEnvironment, R> map, IgniteBinaryOperator<R> reduce, R identity) {
R res = identity;
for (int part = 0; part < data.size(); part++) {
D partData = data.get(part);
+ LearningEnvironment env = envs.get(part);
if (partData != null)
- res = reduce.apply(res, map.apply(partData, part));
+ res = reduce.apply(res, map.apply(partData, env));
}
return res;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/local/LocalDatasetBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/local/LocalDatasetBuilder.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/local/LocalDatasetBuilder.java
index 2514f3e..b8cd8dc 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/local/LocalDatasetBuilder.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/impl/local/LocalDatasetBuilder.java
@@ -22,12 +22,17 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.PartitionContextBuilder;
import org.apache.ignite.ml.dataset.PartitionDataBuilder;
import org.apache.ignite.ml.dataset.UpstreamEntry;
-import org.apache.ignite.ml.dataset.UpstreamTransformerChain;
+import org.apache.ignite.ml.dataset.UpstreamTransformer;
+import org.apache.ignite.ml.dataset.UpstreamTransformerBuilder;
+import org.apache.ignite.ml.environment.LearningEnvironment;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteFunction;
import org.apache.ignite.ml.util.Utils;
@@ -49,7 +54,7 @@ public class LocalDatasetBuilder<K, V> implements DatasetBuilder<K, V> {
private final IgniteBiPredicate<K, V> filter;
/** Upstream transformers. */
- private final UpstreamTransformerChain<K, V> upstreamTransformers;
+ private final UpstreamTransformerBuilder<K, V> upstreamTransformerBuilder;
/**
* Constructs a new instance of local dataset builder that makes {@link LocalDataset} with default predicate that
@@ -68,16 +73,34 @@ public class LocalDatasetBuilder<K, V> implements DatasetBuilder<K, V> {
* @param upstreamMap {@code Map} with upstream data.
* @param filter Filter for {@code upstream} data.
* @param partitions Number of partitions.
+ * @param upstreamTransformerBuilder Builder of upstream transformer.
*/
- public LocalDatasetBuilder(Map<K, V> upstreamMap, IgniteBiPredicate<K, V> filter, int partitions) {
+ public LocalDatasetBuilder(Map<K, V> upstreamMap,
+ IgniteBiPredicate<K, V> filter,
+ int partitions,
+ UpstreamTransformerBuilder<K, V> upstreamTransformerBuilder) {
this.upstreamMap = upstreamMap;
this.filter = filter;
this.partitions = partitions;
- this.upstreamTransformers = UpstreamTransformerChain.empty();
+ this.upstreamTransformerBuilder = upstreamTransformerBuilder;
+ }
+
+ /**
+ * Constructs a new instance of local dataset builder that makes {@link LocalDataset}.
+ *
+ * @param upstreamMap {@code Map} with upstream data.
+ * @param filter Filter for {@code upstream} data.
+ * @param partitions Number of partitions.
+ */
+ public LocalDatasetBuilder(Map<K, V> upstreamMap,
+ IgniteBiPredicate<K, V> filter,
+ int partitions) {
+ this(upstreamMap, filter, partitions, UpstreamTransformerBuilder.identity());
}
/** {@inheritDoc} */
@Override public <C extends Serializable, D extends AutoCloseable> LocalDataset<C, D> build(
+ LearningEnvironmentBuilder envBuilder,
PartitionContextBuilder<K, V, C> partCtxBuilder, PartitionDataBuilder<K, V, C, D> partDataBuilder) {
List<C> ctxList = new ArrayList<>();
List<D> dataList = new ArrayList<>();
@@ -99,36 +122,29 @@ public class LocalDatasetBuilder<K, V> implements DatasetBuilder<K, V> {
int ptr = 0;
+ List<LearningEnvironment> envs = IntStream.range(0, partitions).boxed().map(envBuilder::buildForWorker)
+ .collect(Collectors.toList());
+
for (int part = 0; part < partitions; part++) {
- int cnt = part == partitions - 1 ? entriesList.size() - ptr : Math.min(partSize, entriesList.size() - ptr);
-
- int p = part;
- upstreamTransformers.modifySeed(s -> s + p);
-
- if (!upstreamTransformers.isEmpty()) {
- cnt = (int)upstreamTransformers.transform(
- Utils.asStream(new IteratorWindow<>(thirdKeysIter, k -> k, cnt))).count();
- }
-
- Iterator<UpstreamEntry<K, V>> iter;
- if (upstreamTransformers.isEmpty())
- iter = new IteratorWindow<>(firstKeysIter, k -> k, cnt);
-
- else {
- iter = upstreamTransformers.transform(
- Utils.asStream(new IteratorWindow<>(firstKeysIter, k -> k, cnt))).iterator();
- }
- C ctx = cnt > 0 ? partCtxBuilder.build(iter, cnt) : null;
-
- Iterator<UpstreamEntry<K, V>> iter1;
- if (upstreamTransformers.isEmpty()) {
- iter1 = upstreamTransformers.transform(
- Utils.asStream(new IteratorWindow<>(secondKeysIter, k -> k, cnt))).iterator();
- }
- else
- iter1 = new IteratorWindow<>(secondKeysIter, k -> k, cnt);
-
- D data = cnt > 0 ? partDataBuilder.build(
+ int cntBeforeTransform =
+ part == partitions - 1 ? entriesList.size() - ptr : Math.min(partSize, entriesList.size() - ptr);
+ LearningEnvironment env = envs.get(part);
+ UpstreamTransformer<K, V> transformer1 = upstreamTransformerBuilder.build(env);
+ UpstreamTransformer<K, V> transformer2 = Utils.copy(transformer1);
+ UpstreamTransformer<K, V> transformer3 = Utils.copy(transformer1);
+
+ int cnt = (int)transformer1.transform(Utils.asStream(new IteratorWindow<>(thirdKeysIter, k -> k, cntBeforeTransform))).count();
+
+ Iterator<UpstreamEntry<K, V>> iter =
+ transformer2.transform(Utils.asStream(new IteratorWindow<>(firstKeysIter, k -> k, cntBeforeTransform))).iterator();
+
+ C ctx = cntBeforeTransform > 0 ? partCtxBuilder.build(env, iter, cnt) : null;
+
+ Iterator<UpstreamEntry<K, V>> iter1 = transformer3.transform(
+ Utils.asStream(new IteratorWindow<>(secondKeysIter, k -> k, cntBeforeTransform))).iterator();
+
+ D data = cntBeforeTransform > 0 ? partDataBuilder.build(
+ env,
iter1,
cnt,
ctx
@@ -137,20 +153,18 @@ public class LocalDatasetBuilder<K, V> implements DatasetBuilder<K, V> {
ctxList.add(ctx);
dataList.add(data);
- ptr += cnt;
+ ptr += cntBeforeTransform;
}
- return new LocalDataset<>(ctxList, dataList);
+ return new LocalDataset<>(envs, ctxList, dataList);
}
/** {@inheritDoc} */
- @Override public UpstreamTransformerChain<K, V> upstreamTransformersChain() {
- return upstreamTransformers;
+ @Override public DatasetBuilder<K, V> withUpstreamTransformer(UpstreamTransformerBuilder<K, V> builder) {
+ return new LocalDatasetBuilder<>(upstreamMap, filter, partitions, upstreamTransformerBuilder.andThen(builder));
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public DatasetBuilder<K, V> withFilter(IgniteBiPredicate<K, V> filterToAdd) {
return new LocalDatasetBuilder<>(upstreamMap,
(e1, e2) -> filter.apply(e1, e2) && filterToAdd.apply(e1, e2), partitions);
@@ -164,24 +178,16 @@ public class LocalDatasetBuilder<K, V> implements DatasetBuilder<K, V> {
* @param <T> Target type of entries.
*/
private static class IteratorWindow<K, T> implements Iterator<T> {
- /**
- * Delegate iterator.
- */
+ /** Delegate iterator. */
private final Iterator<K> delegate;
- /**
- * Transformer that transforms entries from one type to another.
- */
+ /** Transformer that transforms entries from one type to another. */
private final IgniteFunction<K, T> map;
- /**
- * Count of entries to produce.
- */
+ /** Count of entries to produce. */
private final int cnt;
- /**
- * Number of already produced entries.
- */
+ /** Number of already produced entries. */
private int ptr;
/**
@@ -197,16 +203,12 @@ public class LocalDatasetBuilder<K, V> implements DatasetBuilder<K, V> {
this.cnt = cnt;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public boolean hasNext() {
return delegate.hasNext() && ptr < cnt;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public T next() {
++ptr;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/DatasetWrapper.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/DatasetWrapper.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/DatasetWrapper.java
index 578a149..270c7eb 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/DatasetWrapper.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/DatasetWrapper.java
@@ -19,6 +19,7 @@ package org.apache.ignite.ml.dataset.primitive;
import java.io.Serializable;
import org.apache.ignite.ml.dataset.Dataset;
+import org.apache.ignite.ml.environment.LearningEnvironment;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.functions.IgniteBinaryOperator;
import org.apache.ignite.ml.math.functions.IgniteTriFunction;
@@ -46,13 +47,13 @@ public class DatasetWrapper<C extends Serializable, D extends AutoCloseable> imp
}
/** {@inheritDoc} */
- @Override public <R> R computeWithCtx(IgniteTriFunction<C, D, Integer, R> map, IgniteBinaryOperator<R> reduce,
+ @Override public <R> R computeWithCtx(IgniteTriFunction<C, D, LearningEnvironment, R> map, IgniteBinaryOperator<R> reduce,
R identity) {
return delegate.computeWithCtx(map, reduce, identity);
}
/** {@inheritDoc} */
- @Override public <R> R compute(IgniteBiFunction<D, Integer, R> map, IgniteBinaryOperator<R> reduce, R identity) {
+ @Override public <R> R compute(IgniteBiFunction<D, LearningEnvironment, R> map, IgniteBinaryOperator<R> reduce, R identity) {
return delegate.compute(map, reduce, identity);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/FeatureMatrixWithLabelsOnHeapDataBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/FeatureMatrixWithLabelsOnHeapDataBuilder.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/FeatureMatrixWithLabelsOnHeapDataBuilder.java
index be1724c..5273fa6 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/FeatureMatrixWithLabelsOnHeapDataBuilder.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/FeatureMatrixWithLabelsOnHeapDataBuilder.java
@@ -21,6 +21,7 @@ import java.io.Serializable;
import java.util.Iterator;
import org.apache.ignite.ml.dataset.PartitionDataBuilder;
import org.apache.ignite.ml.dataset.UpstreamEntry;
+import org.apache.ignite.ml.environment.LearningEnvironment;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.tree.data.DecisionTreeData;
@@ -56,7 +57,11 @@ public class FeatureMatrixWithLabelsOnHeapDataBuilder<K, V, C extends Serializab
}
/** {@inheritDoc} */
- @Override public FeatureMatrixWithLabelsOnHeapData build(Iterator<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize, C ctx) {
+ @Override public FeatureMatrixWithLabelsOnHeapData build(
+ LearningEnvironment env,
+ Iterator<UpstreamEntry<K, V>> upstreamData,
+ long upstreamDataSize,
+ C ctx) {
double[][] features = new double[Math.toIntExact(upstreamDataSize)][];
double[] labels = new double[Math.toIntExact(upstreamDataSize)];
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/context/EmptyContextBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/context/EmptyContextBuilder.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/context/EmptyContextBuilder.java
index 03b69b5..9fd77b5 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/context/EmptyContextBuilder.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/context/EmptyContextBuilder.java
@@ -21,6 +21,7 @@ import java.util.Iterator;
import org.apache.ignite.ml.dataset.PartitionContextBuilder;
import org.apache.ignite.ml.dataset.UpstreamEntry;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironment;
/**
* A partition {@code context} builder that makes {@link EmptyContext}.
@@ -33,7 +34,7 @@ public class EmptyContextBuilder<K, V> implements PartitionContextBuilder<K, V,
private static final long serialVersionUID = 6620781747993467186L;
/** {@inheritDoc} */
- @Override public EmptyContext build(Iterator<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize) {
+ @Override public EmptyContext build(LearningEnvironment env, Iterator<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize) {
return new EmptyContext();
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/data/SimpleDatasetDataBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/data/SimpleDatasetDataBuilder.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/data/SimpleDatasetDataBuilder.java
index cf5bc7a..b14d8a2 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/data/SimpleDatasetDataBuilder.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/data/SimpleDatasetDataBuilder.java
@@ -22,6 +22,7 @@ import java.util.Iterator;
import org.apache.ignite.ml.dataset.PartitionDataBuilder;
import org.apache.ignite.ml.dataset.UpstreamEntry;
import org.apache.ignite.ml.dataset.primitive.data.SimpleDatasetData;
+import org.apache.ignite.ml.environment.LearningEnvironment;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
@@ -50,7 +51,9 @@ public class SimpleDatasetDataBuilder<K, V, C extends Serializable>
}
/** {@inheritDoc} */
- @Override public SimpleDatasetData build(Iterator<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize, C ctx) {
+ @Override public SimpleDatasetData build(
+ LearningEnvironment env,
+ Iterator<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize, C ctx) {
// Prepares the matrix of features in flat column-major format.
int cols = -1;
double[] features = null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/data/SimpleLabeledDatasetDataBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/data/SimpleLabeledDatasetDataBuilder.java b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/data/SimpleLabeledDatasetDataBuilder.java
index 6286255..48166ee 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/data/SimpleLabeledDatasetDataBuilder.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/dataset/primitive/builder/data/SimpleLabeledDatasetDataBuilder.java
@@ -22,6 +22,7 @@ import java.util.Iterator;
import org.apache.ignite.ml.dataset.PartitionDataBuilder;
import org.apache.ignite.ml.dataset.UpstreamEntry;
import org.apache.ignite.ml.dataset.primitive.data.SimpleLabeledDatasetData;
+import org.apache.ignite.ml.environment.LearningEnvironment;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
@@ -56,7 +57,9 @@ public class SimpleLabeledDatasetDataBuilder<K, V, C extends Serializable>
}
/** {@inheritDoc} */
- @Override public SimpleLabeledDatasetData build(Iterator<UpstreamEntry<K, V>> upstreamData,
+ @Override public SimpleLabeledDatasetData build(
+ LearningEnvironment env,
+ Iterator<UpstreamEntry<K, V>> upstreamData,
long upstreamDataSize, C ctx) {
// Prepares the matrix of features in flat column-major format.
int featureCols = -1;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/environment/DefaultLearningEnvironmentBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/environment/DefaultLearningEnvironmentBuilder.java b/modules/ml/src/main/java/org/apache/ignite/ml/environment/DefaultLearningEnvironmentBuilder.java
new file mode 100644
index 0000000..4aef8f2
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/environment/DefaultLearningEnvironmentBuilder.java
@@ -0,0 +1,178 @@
+/*
+ * 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.ml.environment;
+
+import java.util.Random;
+import org.apache.ignite.ml.environment.logging.MLLogger;
+import org.apache.ignite.ml.environment.logging.NoOpLogger;
+import org.apache.ignite.ml.environment.parallelism.DefaultParallelismStrategy;
+import org.apache.ignite.ml.environment.parallelism.NoParallelismStrategy;
+import org.apache.ignite.ml.environment.parallelism.ParallelismStrategy;
+import org.apache.ignite.ml.math.functions.IgniteFunction;
+
+import static org.apache.ignite.ml.math.functions.IgniteFunction.constant;
+
+/**
+ * Builder for {@link LearningEnvironment}.
+ */
+public class DefaultLearningEnvironmentBuilder implements LearningEnvironmentBuilder {
+ /** Serial version id. */
+ private static final long serialVersionUID = 8502532880517447662L;
+
+ /** Dependency (partition -> Parallelism strategy). */
+ private IgniteFunction<Integer, ParallelismStrategy> parallelismStgy;
+
+ /** Dependency (partition -> Logging factory). */
+ private IgniteFunction<Integer, MLLogger.Factory> loggingFactory;
+
+ /** Dependency (partition -> Random number generator seed). */
+ private IgniteFunction<Integer, Long> seed;
+
+ /** Dependency (partition -> Random numbers generator supplier). */
+ private IgniteFunction<Integer, Random> rngSupplier;
+
+ /**
+ * Creates an instance of DefaultLearningEnvironmentBuilder.
+ */
+ DefaultLearningEnvironmentBuilder() {
+ parallelismStgy = constant(NoParallelismStrategy.INSTANCE);
+ loggingFactory = constant(NoOpLogger.factory());
+ seed = constant(new Random().nextLong());
+ rngSupplier = constant(new Random());
+ }
+
+ /** {@inheritDoc} */
+ @Override public LearningEnvironmentBuilder withRNGSeedDependency(IgniteFunction<Integer, Long> seed) {
+ this.seed = seed;
+
+ return this;
+ }
+
+ /** {@inheritDoc} */
+ @Override public LearningEnvironmentBuilder withRandomDependency(IgniteFunction<Integer, Random> rngSupplier) {
+ this.rngSupplier = rngSupplier;
+
+ return this;
+ }
+
+ /** {@inheritDoc} */
+ @Override public DefaultLearningEnvironmentBuilder withParallelismStrategyDependency(
+ IgniteFunction<Integer, ParallelismStrategy> stgy) {
+ this.parallelismStgy = stgy;
+
+ return this;
+ }
+
+ /** {@inheritDoc} */
+ @Override public DefaultLearningEnvironmentBuilder withParallelismStrategyTypeDependency(
+ IgniteFunction<Integer, ParallelismStrategy.Type> stgyType) {
+ this.parallelismStgy = part -> strategyByType(stgyType.apply(part));
+
+ return this;
+ }
+
+ /**
+ * Get parallelism strategy by {@link ParallelismStrategy.Type}.
+ *
+ * @param stgyType Strategy type.
+ * @return {@link ParallelismStrategy}.
+ */
+ private static ParallelismStrategy strategyByType(ParallelismStrategy.Type stgyType) {
+ switch (stgyType) {
+ case NO_PARALLELISM:
+ return NoParallelismStrategy.INSTANCE;
+ case ON_DEFAULT_POOL:
+ return new DefaultParallelismStrategy();
+ }
+ throw new IllegalStateException("Wrong type");
+ }
+
+
+ /** {@inheritDoc} */
+ @Override public DefaultLearningEnvironmentBuilder withLoggingFactoryDependency(
+ IgniteFunction<Integer, MLLogger.Factory> loggingFactory) {
+ this.loggingFactory = loggingFactory;
+ return this;
+ }
+
+ /** {@inheritDoc} */
+ @Override public LearningEnvironment buildForWorker(int part) {
+ Random random = rngSupplier.apply(part);
+ random.setSeed(seed.apply(part));
+ return new LearningEnvironmentImpl(part, random, parallelismStgy.apply(part), loggingFactory.apply(part));
+ }
+
+ /** Default LearningEnvironment implementation. */
+ private class LearningEnvironmentImpl implements LearningEnvironment {
+ /** Parallelism strategy. */
+ private final ParallelismStrategy parallelismStgy;
+
+ /** Logging factory. */
+ private final MLLogger.Factory loggingFactory;
+
+ /** Partition. */
+ private final int part;
+
+ /** Random numbers generator. */
+ private final Random randomNumGen;
+
+ /**
+ * Creates an instance of LearningEnvironmentImpl.
+ *
+ * @param part Partition.
+ * @param rng Random numbers generator.
+ * @param parallelismStgy Parallelism strategy.
+ * @param loggingFactory Logging factory.
+ */
+ private LearningEnvironmentImpl(
+ int part,
+ Random rng,
+ ParallelismStrategy parallelismStgy,
+ MLLogger.Factory loggingFactory) {
+ this.part = part;
+ this.parallelismStgy = parallelismStgy;
+ this.loggingFactory = loggingFactory;
+ randomNumGen = rng;
+ }
+
+ /** {@inheritDoc} */
+ @Override public ParallelismStrategy parallelismStrategy() {
+ return parallelismStgy;
+ }
+
+ /** {@inheritDoc} */
+ @Override public MLLogger logger() {
+ return loggingFactory.create(getClass());
+ }
+
+ /** {@inheritDoc} */
+ @Override public Random randomNumbersGenerator() {
+ return randomNumGen;
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> MLLogger logger(Class<T> clazz) {
+ return loggingFactory.create(clazz);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int partition() {
+ return part;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/environment/LearningEnvironment.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/environment/LearningEnvironment.java b/modules/ml/src/main/java/org/apache/ignite/ml/environment/LearningEnvironment.java
index f5fb693..f1e4f32 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/environment/LearningEnvironment.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/environment/LearningEnvironment.java
@@ -17,6 +17,8 @@
package org.apache.ignite.ml.environment;
+import java.util.Random;
+import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.environment.logging.MLLogger;
import org.apache.ignite.ml.environment.parallelism.ParallelismStrategy;
@@ -26,7 +28,7 @@ import org.apache.ignite.ml.environment.parallelism.ParallelismStrategy;
*/
public interface LearningEnvironment {
/** Default environment */
- public static final LearningEnvironment DEFAULT = builder().build();
+ public static final LearningEnvironment DEFAULT_TRAINER_ENV = LearningEnvironmentBuilder.defaultBuilder().buildForTrainer();
/**
* Returns Parallelism Strategy instance.
@@ -39,6 +41,13 @@ public interface LearningEnvironment {
public MLLogger logger();
/**
+ * Random numbers generator.
+ *
+ * @return Random numbers generator.
+ */
+ public Random randomNumbersGenerator();
+
+ /**
* Returns an instance of logger for specific class.
*
* @param forCls Logging class context.
@@ -46,9 +55,9 @@ public interface LearningEnvironment {
public <T> MLLogger logger(Class<T> forCls);
/**
- * Creates an instance of LearningEnvironmentBuilder.
+ * Gets current partition. If this is called not in one of compute tasks of {@link Dataset}, will return -1.
+ *
+ * @return Partition.
*/
- public static LearningEnvironmentBuilder builder() {
- return new LearningEnvironmentBuilder();
- }
+ public int partition();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/environment/LearningEnvironmentBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/environment/LearningEnvironmentBuilder.java b/modules/ml/src/main/java/org/apache/ignite/ml/environment/LearningEnvironmentBuilder.java
index 98f584f..8fcc6b2 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/environment/LearningEnvironmentBuilder.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/environment/LearningEnvironmentBuilder.java
@@ -17,109 +17,134 @@
package org.apache.ignite.ml.environment;
+import java.io.Serializable;
+import java.util.Random;
import org.apache.ignite.ml.environment.logging.MLLogger;
-import org.apache.ignite.ml.environment.logging.NoOpLogger;
-import org.apache.ignite.ml.environment.parallelism.DefaultParallelismStrategy;
-import org.apache.ignite.ml.environment.parallelism.NoParallelismStrategy;
import org.apache.ignite.ml.environment.parallelism.ParallelismStrategy;
+import org.apache.ignite.ml.math.functions.IgniteFunction;
+
+import static org.apache.ignite.ml.math.functions.IgniteFunction.constant;
/**
- * Builder for LearningEnvironment.
+ * Builder of learning environment.
*/
-public class LearningEnvironmentBuilder {
- /** Parallelism strategy. */
- private ParallelismStrategy parallelismStgy;
- /** Logging factory. */
- private MLLogger.Factory loggingFactory;
+public interface LearningEnvironmentBuilder extends Serializable {
+ /**
+ * Builds {@link LearningEnvironment} for worker on given partition.
+ *
+ * @param part Partition.
+ * @return {@link LearningEnvironment} for worker on given partition.
+ */
+ public LearningEnvironment buildForWorker(int part);
/**
- * Creates an instance of LearningEnvironmentBuilder.
+ * Builds learning environment for trainer.
+ *
+ * @return Learning environment for trainer.
*/
- public LearningEnvironmentBuilder() {
- parallelismStgy = NoParallelismStrategy.INSTANCE;
- loggingFactory = NoOpLogger.factory();
+ public default LearningEnvironment buildForTrainer() {
+ return buildForWorker(-1);
}
/**
- * Specifies Parallelism Strategy for LearningEnvironment.
+ * Specifies dependency (partition -> Parallelism Strategy Type for LearningEnvironment).
*
- * @param stgy Parallelism Strategy.
+ * @param stgyType Function describing dependency (partition -> Parallelism Strategy Type).
+ * @return This object.
*/
- public <T> LearningEnvironmentBuilder withParallelismStrategy(ParallelismStrategy stgy) {
- this.parallelismStgy = stgy;
+ public LearningEnvironmentBuilder withParallelismStrategyTypeDependency(
+ IgniteFunction<Integer, ParallelismStrategy.Type> stgyType);
- return this;
+ /**
+ * Specifies Parallelism Strategy Type for LearningEnvironment. Same strategy type will be used for all partitions.
+ *
+ * @param stgyType Parallelism Strategy Type.
+ * @return This object.
+ */
+ public default LearningEnvironmentBuilder withParallelismStrategyType(ParallelismStrategy.Type stgyType) {
+ return withParallelismStrategyTypeDependency(constant(stgyType));
}
/**
- * Specifies Parallelism Strategy for LearningEnvironment.
+ * Specifies dependency (partition -> Parallelism Strategy for LearningEnvironment).
*
- * @param stgyType Parallelism Strategy Type.
+ * @param stgy Function describing dependency (partition -> Parallelism Strategy).
+ * @return This object.
*/
- public LearningEnvironmentBuilder withParallelismStrategy(ParallelismStrategy.Type stgyType) {
- switch (stgyType) {
- case NO_PARALLELISM:
- this.parallelismStgy = NoParallelismStrategy.INSTANCE;
- break;
- case ON_DEFAULT_POOL:
- this.parallelismStgy = new DefaultParallelismStrategy();
- break;
- }
- return this;
+ public LearningEnvironmentBuilder withParallelismStrategyDependency(IgniteFunction<Integer, ParallelismStrategy> stgy);
+
+ /**
+ * Specifies Parallelism Strategy for LearningEnvironment. Same strategy type will be used for all partitions.
+ *
+ * @param stgy Parallelism Strategy.
+ * @param <T> Parallelism strategy type.
+ * @return This object.
+ */
+ public default <T extends ParallelismStrategy & Serializable> LearningEnvironmentBuilder withParallelismStrategy(T stgy) {
+ return withParallelismStrategyDependency(constant(stgy));
}
/**
- * Specifies Logging factory for LearningEnvironment.
+ * Specify dependency (partition -> logging factory).
*
- * @param loggingFactory Logging Factory.
+ * @param loggingFactory Function describing (partition -> logging factory).
+ * @return This object.
*/
- public LearningEnvironmentBuilder withLoggingFactory(MLLogger.Factory loggingFactory) {
- this.loggingFactory = loggingFactory;
- return this;
+ public LearningEnvironmentBuilder withLoggingFactoryDependency(IgniteFunction<Integer, MLLogger.Factory> loggingFactory);
+
+ /**
+ * Specify logging factory.
+ *
+ * @param loggingFactory Logging factory.
+ * @return This object.
+ */
+ public default <T extends MLLogger.Factory & Serializable> LearningEnvironmentBuilder withLoggingFactory(T loggingFactory) {
+ return withLoggingFactoryDependency(constant(loggingFactory));
}
/**
- * Create an instance of LearningEnvironment.
+ * Specify dependency (partition -> seed for random number generator). Same seed will be used for all partitions.
+ *
+ * @param seed Function describing dependency (partition -> seed for random number generator).
+ * @return This object.
*/
- public LearningEnvironment build() {
- return new LearningEnvironmentImpl(parallelismStgy, loggingFactory);
+ public LearningEnvironmentBuilder withRNGSeedDependency(IgniteFunction<Integer, Long> seed);
+
+ /**
+ * Specify seed for random number generator.
+ *
+ * @param seed Seed for random number generator.
+ * @return This object.
+ */
+ public default LearningEnvironmentBuilder withRNGSeed(long seed) {
+ return withRNGSeedDependency(constant(seed));
}
/**
- * Default LearningEnvironment implementation.
+ * Specify dependency (partition -> random numbers generator).
+ *
+ * @param rngSupplier Function describing dependency (partition -> random numbers generator).
+ * @return This object.
+ */
+ public LearningEnvironmentBuilder withRandomDependency(IgniteFunction<Integer, Random> rngSupplier);
+
+ /**
+ * Specify random numbers generator for learning environment. Same random will be used for all partitions.
+ *
+ * @param random Rrandom numbers generator for learning environment.
+ * @return This object.
+ */
+ public default LearningEnvironmentBuilder withRandom(Random random) {
+ return withRandomDependency(constant(random));
+ }
+
+ /**
+ * Get default {@link LearningEnvironmentBuilder}.
+ *
+ * @return Default {@link LearningEnvironmentBuilder}.
*/
- private class LearningEnvironmentImpl implements LearningEnvironment {
- /** Parallelism strategy. */
- private final ParallelismStrategy parallelismStgy;
- /** Logging factory. */
- private final MLLogger.Factory loggingFactory;
-
- /**
- * Creates an instance of LearningEnvironmentImpl.
- *
- * @param parallelismStgy Parallelism strategy.
- * @param loggingFactory Logging factory.
- */
- private LearningEnvironmentImpl(ParallelismStrategy parallelismStgy,
- MLLogger.Factory loggingFactory) {
- this.parallelismStgy = parallelismStgy;
- this.loggingFactory = loggingFactory;
- }
-
- /** {@inheritDoc} */
- @Override public ParallelismStrategy parallelismStrategy() {
- return parallelismStgy;
- }
-
- /** {@inheritDoc} */
- @Override public MLLogger logger() {
- return loggingFactory.create(getClass());
- }
-
- /** {@inheritDoc} */
- @Override public <T> MLLogger logger(Class<T> clazz) {
- return loggingFactory.create(clazz);
- }
+ public static LearningEnvironmentBuilder defaultBuilder() {
+ return new DefaultLearningEnvironmentBuilder();
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/environment/logging/ConsoleLogger.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/environment/logging/ConsoleLogger.java b/modules/ml/src/main/java/org/apache/ignite/ml/environment/logging/ConsoleLogger.java
index e064fc3..c124e06 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/environment/logging/ConsoleLogger.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/environment/logging/ConsoleLogger.java
@@ -82,6 +82,9 @@ public class ConsoleLogger implements MLLogger {
* ConsoleLogger factory.
*/
private static class Factory implements MLLogger.Factory {
+ /** Serial version uuid. */
+ private static final long serialVersionUID = 5864605548782107893L;
+
/** Max Verbose level. */
private final VerboseLevel maxVerboseLevel;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/environment/parallelism/ParallelismStrategy.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/environment/parallelism/ParallelismStrategy.java b/modules/ml/src/main/java/org/apache/ignite/ml/environment/parallelism/ParallelismStrategy.java
index e7228f8..329ce89 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/environment/parallelism/ParallelismStrategy.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/environment/parallelism/ParallelismStrategy.java
@@ -26,7 +26,6 @@ import org.apache.ignite.ml.math.functions.IgniteSupplier;
* bagging, learning submodels for One-vs-All model, Cross-Validation etc.
*/
public interface ParallelismStrategy {
-
/**
* The type of parallelism.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/knn/KNNUtils.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/knn/KNNUtils.java b/modules/ml/src/main/java/org/apache/ignite/ml/knn/KNNUtils.java
index d7bccd8..8239ebd 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/knn/KNNUtils.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/knn/KNNUtils.java
@@ -21,6 +21,7 @@ import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.PartitionDataBuilder;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.structures.LabeledVector;
@@ -35,12 +36,15 @@ public class KNNUtils {
/**
* Builds dataset.
*
+ * @param envBuilder Learning environment builder.
* @param datasetBuilder Dataset builder.
* @param featureExtractor Feature extractor.
* @param lbExtractor Label extractor.
* @return Dataset.
*/
- @Nullable public static <K, V> Dataset<EmptyContext, LabeledVectorSet<Double, LabeledVector>> buildDataset(DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, Double> lbExtractor) {
+ @Nullable public static <K, V> Dataset<EmptyContext, LabeledVectorSet<Double, LabeledVector>> buildDataset(
+ LearningEnvironmentBuilder envBuilder,
+ DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, Double> lbExtractor) {
PartitionDataBuilder<K, V, EmptyContext, LabeledVectorSet<Double, LabeledVector>> partDataBuilder
= new LabeledDatasetPartitionDataBuilderOnHeap<>(
featureExtractor,
@@ -51,7 +55,8 @@ public class KNNUtils {
if (datasetBuilder != null) {
dataset = datasetBuilder.build(
- (upstream, upstreamSize) -> new EmptyContext(),
+ envBuilder,
+ (env, upstream, upstreamSize) -> new EmptyContext(),
partDataBuilder
);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/knn/ann/ANNClassificationTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/knn/ann/ANNClassificationTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/knn/ann/ANNClassificationTrainer.java
index e56a10a..c32ca56 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/knn/ann/ANNClassificationTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/knn/ann/ANNClassificationTrainer.java
@@ -31,6 +31,7 @@ import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.PartitionDataBuilder;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.distances.DistanceMeasure;
import org.apache.ignite.ml.math.distances.EuclideanDistance;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
@@ -105,6 +106,12 @@ public class ANNClassificationTrainer extends SingleLabelDatasetTrainer<ANNClass
return mdl.getDistanceMeasure().equals(distance) && mdl.getCandidates().rowSize() == k;
}
+ /** {@inheritDoc} */
+ @Override public ANNClassificationTrainer withEnvironmentBuilder(
+ LearningEnvironmentBuilder envBuilder) {
+ return (ANNClassificationTrainer)super.withEnvironmentBuilder(envBuilder);
+ }
+
/** */
@NotNull private LabeledVectorSet<ProbableLabel, LabeledVector> buildLabelsForCandidates(List<Vector> centers,
CentroidStat centroidStat) {
@@ -180,7 +187,8 @@ public class ANNClassificationTrainer extends SingleLabelDatasetTrainer<ANNClass
);
try (Dataset<EmptyContext, LabeledVectorSet<Double, LabeledVector>> dataset = datasetBuilder.build(
- (upstream, upstreamSize) -> new EmptyContext(),
+ envBuilder,
+ (env, upstream, upstreamSize) -> new EmptyContext(),
partDataBuilder
)) {
return dataset.compute(data -> {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/knn/classification/KNNClassificationTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/knn/classification/KNNClassificationTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/knn/classification/KNNClassificationTrainer.java
index 1a3ff73..ed55318 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/knn/classification/KNNClassificationTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/knn/classification/KNNClassificationTrainer.java
@@ -18,6 +18,7 @@
package org.apache.ignite.ml.knn.classification;
import org.apache.ignite.ml.dataset.DatasetBuilder;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.knn.KNNUtils;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
@@ -46,7 +47,7 @@ public class KNNClassificationTrainer extends SingleLabelDatasetTrainer<KNNClass
DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor,
IgniteBiFunction<K, V, Double> lbExtractor) {
- KNNClassificationModel res = new KNNClassificationModel(KNNUtils.buildDataset(datasetBuilder,
+ KNNClassificationModel res = new KNNClassificationModel(KNNUtils.buildDataset(envBuilder, datasetBuilder,
featureExtractor, lbExtractor));
if (mdl != null)
res.copyStateFrom(mdl);
@@ -54,6 +55,11 @@ public class KNNClassificationTrainer extends SingleLabelDatasetTrainer<KNNClass
}
/** {@inheritDoc} */
+ @Override public KNNClassificationTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) {
+ return (KNNClassificationTrainer)super.withEnvironmentBuilder(envBuilder);
+ }
+
+ /** {@inheritDoc} */
@Override protected boolean checkState(KNNClassificationModel mdl) {
return true;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/knn/regression/KNNRegressionTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/knn/regression/KNNRegressionTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/knn/regression/KNNRegressionTrainer.java
index 7a42dc8..9b348f3 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/knn/regression/KNNRegressionTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/knn/regression/KNNRegressionTrainer.java
@@ -42,10 +42,13 @@ public class KNNRegressionTrainer extends SingleLabelDatasetTrainer<KNNRegressio
}
/** {@inheritDoc} */
- @Override public <K, V> KNNRegressionModel updateModel(KNNRegressionModel mdl, DatasetBuilder<K, V> datasetBuilder,
- IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, Double> lbExtractor) {
+ @Override public <K, V> KNNRegressionModel updateModel(
+ KNNRegressionModel mdl,
+ DatasetBuilder<K, V> datasetBuilder,
+ IgniteBiFunction<K, V, Vector> featureExtractor,
+ IgniteBiFunction<K, V, Double> lbExtractor) {
- KNNRegressionModel res = new KNNRegressionModel(KNNUtils.buildDataset(datasetBuilder,
+ KNNRegressionModel res = new KNNRegressionModel(KNNUtils.buildDataset(envBuilder, datasetBuilder,
featureExtractor, lbExtractor));
if (mdl != null)
res.copyStateFrom(mdl);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteFunction.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteFunction.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteFunction.java
index 9d19592..2673b90 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteFunction.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteFunction.java
@@ -26,5 +26,15 @@ import java.util.function.Function;
* @see java.util.function.Function
*/
public interface IgniteFunction<T, R> extends Function<T, R>, Serializable {
-
+ /**
+ * {@link IgniteFunction} returning specified constant.
+ *
+ * @param r Constant to return.
+ * @param <T> Type of input.
+ * @param <R> Type of output.
+ * @return {@link IgniteFunction} returning specified constant.
+ */
+ static <T, R> IgniteFunction<T, R> constant(R r) {
+ return t -> r;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/math/isolve/lsqr/LSQROnHeap.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/isolve/lsqr/LSQROnHeap.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/isolve/lsqr/LSQROnHeap.java
index 14356e1..e0376b8 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/isolve/lsqr/LSQROnHeap.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/isolve/lsqr/LSQROnHeap.java
@@ -23,6 +23,7 @@ import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.PartitionDataBuilder;
import org.apache.ignite.ml.dataset.primitive.data.SimpleLabeledDatasetData;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
/**
* Distributed implementation of LSQR algorithm based on {@link AbstractLSQR} and {@link Dataset}.
@@ -35,12 +36,15 @@ public class LSQROnHeap<K, V> extends AbstractLSQR implements AutoCloseable {
* Constructs a new instance of OnHeap LSQR algorithm implementation.
*
* @param datasetBuilder Dataset builder.
+ * @param envBuilder Learning environment builder.
* @param partDataBuilder Partition data builder.
*/
public LSQROnHeap(DatasetBuilder<K, V> datasetBuilder,
+ LearningEnvironmentBuilder envBuilder,
PartitionDataBuilder<K, V, LSQRPartitionContext, SimpleLabeledDatasetData> partDataBuilder) {
this.dataset = datasetBuilder.build(
- (upstream, upstreamSize) -> new LSQRPartitionContext(),
+ envBuilder,
+ (env, upstream, upstreamSize) -> new LSQRPartitionContext(),
partDataBuilder
);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/VectorUtils.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/VectorUtils.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/VectorUtils.java
index 5e1341b..3c580c3 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/VectorUtils.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/VectorUtils.java
@@ -40,6 +40,17 @@ public class VectorUtils {
}
/**
+ * Create new vector of specified size n with specified value.
+ *
+ * @param val Value.
+ * @param n Size;
+ * @return New vector of specified size n with specified value.
+ */
+ public static DenseVector fill(double val, int n) {
+ return (DenseVector)new DenseVector(n).assign(val);
+ }
+
+ /**
* Turn number into a local Vector of given size with one-hot encoding.
*
* @param num Number to turn into vector.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/multiclass/OneVsRestTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/multiclass/OneVsRestTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/multiclass/OneVsRestTrainer.java
index 7426506..f265318 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/multiclass/OneVsRestTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/multiclass/OneVsRestTrainer.java
@@ -115,7 +115,8 @@ public class OneVsRestTrainer<M extends Model<Vector, Double>>
List<Double> res = new ArrayList<>();
try (Dataset<EmptyContext, LabelPartitionDataOnHeap> dataset = datasetBuilder.build(
- (upstream, upstreamSize) -> new EmptyContext(),
+ envBuilder,
+ (env, upstream, upstreamSize) -> new EmptyContext(),
partDataBuilder
)) {
final Set<Double> clsLabels = dataset.compute(data -> {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/naivebayes/gaussian/GaussianNaiveBayesTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/naivebayes/gaussian/GaussianNaiveBayesTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/naivebayes/gaussian/GaussianNaiveBayesTrainer.java
index 7ee423d..cdaac5a 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/naivebayes/gaussian/GaussianNaiveBayesTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/naivebayes/gaussian/GaussianNaiveBayesTrainer.java
@@ -24,6 +24,7 @@ import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.UpstreamEntry;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.trainers.SingleLabelDatasetTrainer;
@@ -59,14 +60,20 @@ public class GaussianNaiveBayesTrainer extends SingleLabelDatasetTrainer<Gaussia
}
/** {@inheritDoc} */
+ @Override public GaussianNaiveBayesTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) {
+ return (GaussianNaiveBayesTrainer)super.withEnvironmentBuilder(envBuilder);
+ }
+
+ /** {@inheritDoc} */
@Override protected <K, V> GaussianNaiveBayesModel updateModel(GaussianNaiveBayesModel mdl,
DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor,
IgniteBiFunction<K, V, Double> lbExtractor) {
assert datasetBuilder != null;
try (Dataset<EmptyContext, GaussianNaiveBayesSumsHolder> dataset = datasetBuilder.build(
- (upstream, upstreamSize) -> new EmptyContext(),
- (upstream, upstreamSize, ctx) -> {
+ envBuilder,
+ (env, upstream, upstreamSize) -> new EmptyContext(),
+ (env, upstream, upstreamSize, ctx) -> {
GaussianNaiveBayesSumsHolder res = new GaussianNaiveBayesSumsHolder();
while (upstream.hasNext()) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/nn/MLPTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/nn/MLPTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/nn/MLPTrainer.java
index c75c5bb..ea0bb6c 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/nn/MLPTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/nn/MLPTrainer.java
@@ -124,6 +124,7 @@ public class MLPTrainer<P extends Serializable> extends MultiLabelDatasetTrainer
assert updatesStgy!= null;
try (Dataset<EmptyContext, SimpleLabeledDatasetData> dataset = datasetBuilder.build(
+ envBuilder,
new EmptyContextBuilder<>(),
new SimpleLabeledDatasetDataBuilder<>(featureExtractor, lbExtractor)
)) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/pipeline/Pipeline.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/pipeline/Pipeline.java b/modules/ml/src/main/java/org/apache/ignite/ml/pipeline/Pipeline.java
index 8bfcb34..1aeac6b 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/pipeline/Pipeline.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/pipeline/Pipeline.java
@@ -26,6 +26,7 @@ import org.apache.ignite.ml.Model;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.impl.cache.CacheBasedDatasetBuilder;
import org.apache.ignite.ml.dataset.impl.local.LocalDatasetBuilder;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.preprocessing.PreprocessingTrainer;
@@ -53,6 +54,9 @@ public class Pipeline<K, V, R> {
/** Final trainer stage. */
private DatasetTrainer finalStage;
+ /** Learning environment builder. */
+ private LearningEnvironmentBuilder envBuilder = LearningEnvironmentBuilder.defaultBuilder();
+
/**
* Adds feature extractor as a zero stage.
*
@@ -110,6 +114,15 @@ public class Pipeline<K, V, R> {
}
/**
+ * Set learning environment builder.
+ *
+ * @param envBuilder Learning environment builder.
+ */
+ public void setEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) {
+ this.envBuilder = envBuilder;
+ }
+
+ /**
* Fits the pipeline to the input mock data.
*
* @param data Data.
@@ -132,6 +145,7 @@ public class Pipeline<K, V, R> {
preprocessors.forEach(e -> {
finalFeatureExtractor = e.fit(
+ envBuilder,
datasetBuilder,
finalFeatureExtractor
);
[03/50] [abbrv] ignite git commit: IGNITE-9941 Fixed parsing of
boolean parameters returned from nconf.
Posted by sb...@apache.org.
IGNITE-9941 Fixed parsing of boolean parameters returned from nconf.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1502494b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1502494b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1502494b
Branch: refs/heads/ignite-10044
Commit: 1502494bca6e6d3059878949f23cae03b947eb24
Parents: 395811d
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Mon Dec 3 16:21:46 2018 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Mon Dec 3 16:21:46 2018 +0700
----------------------------------------------------------------------
modules/web-console/backend/app/settings.js | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1502494b/modules/web-console/backend/app/settings.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/settings.js b/modules/web-console/backend/app/settings.js
index 1c75041..233566b 100644
--- a/modules/web-console/backend/app/settings.js
+++ b/modules/web-console/backend/app/settings.js
@@ -53,6 +53,14 @@ module.exports = {
const dfltHost = packaged ? '0.0.0.0' : '127.0.0.1';
const dfltPort = packaged ? 80 : 3000;
+ // We need this function because nconf() can return String or Boolean.
+ // And in JS we cannot compare String with Boolean.
+ const _isTrue = (confParam) => {
+ const v = nconf.get(confParam);
+
+ return v === 'true' || v === true;
+ };
+
return {
agent: {
dists: nconf.get('agent:dists') || dfltAgentDists
@@ -62,7 +70,7 @@ module.exports = {
host: nconf.get('server:host') || dfltHost,
port: _normalizePort(nconf.get('server:port') || dfltPort),
// eslint-disable-next-line eqeqeq
- SSLOptions: nconf.get('server:ssl') == 'true' && {
+ SSLOptions: _isTrue('server:ssl') && {
enable301Redirects: true,
trustXFPHeader: true,
key: fs.readFileSync(nconf.get('server:key')),
@@ -70,7 +78,7 @@ module.exports = {
passphrase: nconf.get('server:keyPassphrase')
},
// eslint-disable-next-line eqeqeq
- disableSignup: nconf.get('server:disable:signup') == 'true'
+ disableSignup: _isTrue('server:disable:signup')
},
mail,
mongoUrl: nconf.get('mongodb:url') || 'mongodb://127.0.0.1/console',
[20/50] [abbrv] ignite git commit: IGNITE-8227 implement JUnit test
failure handler for TeamCity. - Fixes #4974.
Posted by sb...@apache.org.
IGNITE-8227 implement JUnit test failure handler for TeamCity. - Fixes #4974.
Signed-off-by: Dmitriy Pavlov <dp...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b94a3c2f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b94a3c2f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b94a3c2f
Branch: refs/heads/ignite-10044
Commit: b94a3c2fe3a272a31fad62b80505d16f87eab2dd
Parents: cdba7d9
Author: Dmitrii Ryabov <So...@gmail.com>
Authored: Tue Dec 4 18:20:34 2018 +0300
Committer: Dmitriy Pavlov <dp...@apache.org>
Committed: Tue Dec 4 18:20:34 2018 +0300
----------------------------------------------------------------------
.../client/ClientReconnectionSelfTest.java | 7 +++
...skExecutionAfterTopologyRestartSelfTest.java | 7 +++
.../ClientAbstractMultiNodeSelfTest.java | 7 +++
.../jdbc/thin/JdbcThinAbstractSelfTest.java | 7 +++
.../igfs/IgfsFragmentizerTopologySelfTest.java | 7 +++
...ridFailFastNodeFailureDetectionSelfTest.java | 7 +++
.../GridFailoverCustomTopologySelfTest.java | 7 +++
.../ignite/internal/GridFailoverSelfTest.java | 7 +++
.../GridFailoverTaskWithPredicateSelfTest.java | 7 +++
.../internal/GridFailoverTopologySelfTest.java | 7 +++
.../internal/GridTaskFailoverSelfTest.java | 7 +++
.../IgniteClientReconnectAbstractTest.java | 7 +++
.../IgniteClientReconnectApiExceptionTest.java | 1 -
.../IgniteComputeTopologyExceptionTest.java | 7 +++
...RoundRobinErrorAfterClientReconnectTest.java | 7 +++
.../GridDiscoveryManagerAliveCacheSelfTest.java | 7 +++
.../GridDiscoveryManagerAttributesSelfTest.java | 7 +++
.../IgniteTopologyPrintFormatSelfTest.java | 7 +++
.../OptimizedMarshallerNodeFailoverTest.java | 7 +++
.../cache/CacheDataRegionConfigurationTest.java | 7 +++
...cheNearUpdateTopologyChangeAbstractTest.java | 7 +++
.../CachePutEventListenerErrorSelfTest.java | 7 +++
.../CacheSerializableTransactionsTest.java | 7 +++
.../GridCacheAbstractFailoverSelfTest.java | 7 +++
.../cache/GridCacheAbstractFullApiSelfTest.java | 9 ++++
.../GridCacheAbstractRemoveFailureTest.java | 7 +++
.../cache/GridCachePutAllFailoverSelfTest.java | 7 +++
.../GridCacheVariableTopologySelfTest.java | 7 +++
.../GridCacheVersionTopologyChangeTest.java | 7 +++
...IgniteAbstractDynamicCacheStartFailTest.java | 7 +++
.../processors/cache/IgniteCacheGroupsTest.java | 7 +++
.../IgniteClientCacheStartFailoverTest.java | 7 +++
...ynamicCacheStartCoordinatorFailoverTest.java | 7 +++
...gniteTopologyValidatorAbstractCacheTest.java | 7 +++
.../IgniteTxExceptionAbstractSelfTest.java | 7 +++
...rtitionsExchangeCoordinatorFailoverTest.java | 7 +++
.../SetTxTimeoutOnPartitionMapExchangeTest.java | 7 +++
.../cache/WalModeChangeAdvancedSelfTest.java | 7 +++
...eAbstractDataStructuresFailoverSelfTest.java | 7 +++
...acheAsyncOperationsFailoverAbstractTest.java | 7 +++
.../distributed/CacheBaselineTopologyTest.java | 7 +++
.../distributed/CacheExchangeMergeTest.java | 7 +++
.../CacheGetInsideLockChangingTopologyTest.java | 7 +++
...CacheLoadingConcurrentGridStartSelfTest.java | 7 +++
.../CachePutAllFailoverAbstractTest.java | 7 +++
.../GridCacheAbstractNodeRestartSelfTest.java | 7 +++
...yMetadataUpdateChangingTopologySelfTest.java | 7 +++
.../distributed/IgniteCache150ClientsTest.java | 10 +++-
...heClientMultiNodeUpdateTopologyLockTest.java | 7 +++
...niteCacheClientNodeChangingTopologyTest.java | 7 +++
.../IgniteCacheClientReconnectTest.java | 7 +++
.../IgniteCacheFailedUpdateResponseTest.java | 7 +++
.../distributed/IgniteCacheGetRestartTest.java | 7 +++
.../IgniteCacheSizeFailoverTest.java | 7 +++
...teSynchronizationModesMultithreadedTest.java | 7 +++
...dCachePartitionedTopologyChangeSelfTest.java | 7 +++
...gniteAtomicLongChangingTopologySelfTest.java | 7 +++
.../IgniteCacheCrossCacheTxFailoverTest.java | 7 +++
.../dht/IgniteCacheLockFailoverSelfTest.java | 7 +++
.../IgniteCachePutRetryAbstractSelfTest.java | 7 +++
.../IgniteCacheTopologySplitAbstractTest.java | 7 +++
.../dht/IgniteCacheTxRecoveryRollbackTest.java | 7 +++
...eAtomicInvalidPartitionHandlingSelfTest.java | 7 +++
.../near/GridCacheNearOnlyTopologySelfTest.java | 7 +++
.../GridCacheRebalancingSyncSelfTest.java | 7 +++
.../cache/mvcc/CacheMvccAbstractTest.java | 7 +++
...eBaselineAffinityTopologyActivationTest.java | 7 +++
...heConfigurationFileConsistencyCheckTest.java | 7 +++
.../IgnitePdsCacheRebalancingAbstractTest.java | 7 +++
.../IgnitePdsContinuousRestartTest.java | 7 +++
...tePdsRebalancingOnNotStableTopologyTest.java | 7 +++
.../db/wal/IgniteWalFlushFailoverTest.java | 7 +++
...lFlushMultiNodeFailoverAbstractSelfTest.java | 7 +++
.../persistence/db/wal/WalCompactionTest.java | 7 +++
.../IgniteChangeGlobalStateFailOverTest.java | 7 +++
.../IgniteNoParrallelClusterIsAllowedTest.java | 7 +++
...gniteAbstractStandByClientReconnectTest.java | 7 +++
.../cache/query/CacheScanQueryFailoverTest.java | 7 +++
.../cache/query/IndexingSpiQueryTxSelfTest.java | 7 +++
...ContinuousQueryFailoverAbstractSelfTest.java | 7 +++
...heContinuousWithTransformerFailoverTest.java | 7 +++
.../ClientReconnectContinuousQueryTest.java | 7 +++
...IgniteCacheContinuousQueryReconnectTest.java | 7 +++
...OptimisticPrepareOnUnstableTopologyTest.java | 7 +++
.../cache/transactions/TxRollbackAsyncTest.java | 7 +++
.../TxRollbackOnTopologyChangeTest.java | 7 +++
.../continuous/GridEventConsumeSelfTest.java | 7 +++
...rClientReconnectAfterClusterRestartTest.java | 7 +++
.../igfs/IgfsBackupFailoverSelfTest.java | 7 +++
.../top/CacheTopologyCommandHandlerTest.java | 7 +++
...GridServiceProxyClientReconnectSelfTest.java | 7 +++
.../session/GridSessionJobFailoverSelfTest.java | 7 +++
...alingCollisionSpiCustomTopologySelfTest.java | 7 +++
.../tcp/TcpCommunicationSpiDropNodesTest.java | 7 +++
.../TcpCommunicationSpiFaultyClientTest.java | 7 +++
.../TcpCommunicationSpiSkipMessageSendTest.java | 7 +++
...gniteClientReconnectMassiveShutdownTest.java | 7 +++
...pClientDiscoveryMarshallerCheckSelfTest.java | 7 +++
.../tcp/TcpClientDiscoverySpiSelfTest.java | 7 +++
.../tcp/TcpDiscoveryMultiThreadedTest.java | 7 +++
...veryNodeAttributesUpdateOnReconnectTest.java | 7 +++
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 7 +++
.../TcpDiscoverySpiFailureTimeoutSelfTest.java | 7 +++
.../tcp/TcpDiscoverySpiReconnectDelayTest.java | 7 +++
...nLoadBalancingSpiTopologyChangeSelfTest.java | 7 +++
.../testframework/junits/GridAbstractTest.java | 9 +++-
.../junits/TestFailingFailureHandler.java | 50 ++++++++++++++++++++
.../ignite/util/GridCommandHandlerTest.java | 7 +++
.../util/GridTopologyHeapSizeSelfTest.java | 7 +++
.../HadoopMapReduceErrorResilienceTest.java | 7 +++
.../IgniteHadoopFileSystemAbstractSelfTest.java | 6 +++
.../taskexecutor/HadoopExecutorServiceTest.java | 7 +++
.../ClientReconnectAfterClusterRestartTest.java | 7 +++
.../cache/IgniteCrossCachesJoinsQueryTest.java | 7 +++
.../cache/QueryEntityCaseMismatchTest.java | 7 +++
...ynamicColumnsAbstractConcurrentSelfTest.java | 21 ++++++++
.../db/wal/IgniteWalRecoveryTest.java | 7 +++
.../query/SqlIllegalSchemaSelfTest.java | 7 +++
.../zk/internal/ZookeeperDiscoverySpiTest.java | 7 +++
119 files changed, 887 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java
index f1085b3..b1cd2d5 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java
@@ -21,6 +21,8 @@ import java.nio.channels.ClosedChannelException;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.client.impl.connection.GridClientConnectionResetException;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -50,6 +52,11 @@ public class ClientReconnectionSelfTest extends GridCommonAbstractTest {
super.afterTest();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @return Client for test.
* @throws GridClientException In case of error.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpTaskExecutionAfterTopologyRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpTaskExecutionAfterTopologyRestartSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpTaskExecutionAfterTopologyRestartSelfTest.java
index 4b63fff..7dac20e 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpTaskExecutionAfterTopologyRestartSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpTaskExecutionAfterTopologyRestartSelfTest.java
@@ -20,6 +20,8 @@ package org.apache.ignite.internal.client;
import java.util.Collections;
import org.apache.ignite.configuration.ConnectorConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
/**
@@ -51,6 +53,11 @@ public class ClientTcpTaskExecutionAfterTopologyRestartSelfTest extends GridComm
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java
index 7ccb9c3..024e9c0 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java
@@ -37,6 +37,8 @@ import org.apache.ignite.compute.ComputeTaskSplitAdapter;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.ConnectorConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.client.GridClient;
import org.apache.ignite.internal.client.GridClientCompute;
@@ -251,6 +253,11 @@ public abstract class ClientAbstractMultiNodeSelfTest extends GridCommonAbstract
}
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAbstractSelfTest.java
index 6d5f59a..9635420 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAbstractSelfTest.java
@@ -29,6 +29,8 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.odbc.ClientListenerProcessor;
import org.apache.ignite.internal.processors.port.GridPortRecord;
@@ -41,6 +43,11 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
*/
@SuppressWarnings("ThrowableNotThrown")
public class JdbcThinAbstractSelfTest extends GridCommonAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @param r Runnable to check support.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/igfs/IgfsFragmentizerTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/igfs/IgfsFragmentizerTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/igfs/IgfsFragmentizerTopologySelfTest.java
index 9cc5006..de97d2b 100644
--- a/modules/core/src/test/java/org/apache/ignite/igfs/IgfsFragmentizerTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/igfs/IgfsFragmentizerTopologySelfTest.java
@@ -18,11 +18,18 @@
package org.apache.ignite.igfs;
import org.apache.ignite.IgniteFileSystem;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
/**
* Tests coordinator transfer from one node to other.
*/
public class IgfsFragmentizerTopologySelfTest extends IgfsFragmentizerAbstractSelfTest {
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java
index 79dc81a..5d9b255 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java
@@ -22,6 +22,8 @@ import java.util.concurrent.CountDownLatch;
import org.apache.ignite.Ignite;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.messaging.MessagingListenActor;
@@ -66,6 +68,11 @@ public class GridFailFastNodeFailureDetectionSelfTest extends GridCommonAbstract
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverCustomTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverCustomTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverCustomTopologySelfTest.java
index 86bca80..6b733fb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverCustomTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverCustomTopologySelfTest.java
@@ -34,6 +34,8 @@ import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.compute.ComputeTaskAdapter;
import org.apache.ignite.compute.ComputeTaskFuture;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.resources.LoggerResource;
import org.apache.ignite.spi.failover.FailoverContext;
@@ -75,6 +77,11 @@ public class GridFailoverCustomTopologySelfTest extends GridCommonAbstractTest {
return cfg;
}
+
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
/**
* Tests that failover don't pick local node if it has been excluded from topology.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverSelfTest.java
index 5ed2245..257db75 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverSelfTest.java
@@ -35,6 +35,8 @@ import org.apache.ignite.compute.ComputeTaskSession;
import org.apache.ignite.compute.ComputeTaskSessionFullSupport;
import org.apache.ignite.compute.ComputeUserUndeclaredException;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.resources.TaskSessionResource;
import org.apache.ignite.spi.failover.always.AlwaysFailoverSpi;
@@ -63,6 +65,11 @@ public class GridFailoverSelfTest extends GridCommonAbstractTest {
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTaskWithPredicateSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTaskWithPredicateSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTaskWithPredicateSelfTest.java
index 84f31cb..797d48f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTaskWithPredicateSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTaskWithPredicateSelfTest.java
@@ -37,6 +37,8 @@ import org.apache.ignite.compute.ComputeTaskSession;
import org.apache.ignite.compute.ComputeTaskSessionFullSupport;
import org.apache.ignite.compute.ComputeUserUndeclaredException;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.resources.TaskSessionResource;
import org.apache.ignite.spi.failover.FailoverContext;
@@ -92,6 +94,11 @@ public class GridFailoverTaskWithPredicateSelfTest extends GridCommonAbstractTes
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Tests that failover doesn't happen on two-node grid when the Task is applicable only for the first node
* and fails on it.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTopologySelfTest.java
index dd78768..5515fe2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTopologySelfTest.java
@@ -32,6 +32,8 @@ import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.compute.ComputeJobResultPolicy;
import org.apache.ignite.compute.ComputeTask;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.spi.failover.FailoverContext;
import org.apache.ignite.spi.failover.always.AlwaysFailoverSpi;
@@ -87,6 +89,11 @@ public class GridFailoverTopologySelfTest extends GridCommonAbstractTest {
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Tests that failover don't pick local node if it has been excluded from topology.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverSelfTest.java
index bc0af82..6e446a0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverSelfTest.java
@@ -29,6 +29,8 @@ import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.compute.ComputeJobResultPolicy;
import org.apache.ignite.compute.ComputeTaskFuture;
import org.apache.ignite.compute.ComputeTaskSplitAdapter;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.resources.LoggerResource;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.testframework.junits.common.GridCommonTest;
@@ -71,6 +73,11 @@ public class GridTaskFailoverSelfTest extends GridCommonAbstractTest {
}
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/** */
@SuppressWarnings({"PublicInnerClass"})
public static class GridFailoverTestTask extends ComputeTaskSplitAdapter<Serializable, Integer> {
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
index 0d89da2..ff6efe1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
@@ -38,6 +38,8 @@ import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
import org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi;
import org.apache.ignite.internal.util.typedef.G;
@@ -100,6 +102,11 @@ public abstract class IgniteClientReconnectAbstractTest extends GridCommonAbstra
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @param latch Latch.
* @throws Exception If failed.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
index 8f68a1f..f77bf12 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
@@ -63,7 +63,6 @@ import static org.apache.ignite.events.EventType.EVT_CLIENT_NODE_RECONNECTED;
*
*/
public class IgniteClientReconnectApiExceptionTest extends IgniteClientReconnectAbstractTest {
-
/** Cache key for test put and invoke operation after reconnect */
private static final int CACHE_PUT_INVOKE_KEY = 10010;
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeTopologyExceptionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeTopologyExceptionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeTopologyExceptionTest.java
index a82373b..eeeaf91 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeTopologyExceptionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeTopologyExceptionTest.java
@@ -22,6 +22,8 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCompute;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.cluster.ClusterTopologyException;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgniteCallable;
@@ -43,6 +45,11 @@ public class IgniteComputeTopologyExceptionTest extends GridCommonAbstractTest {
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/IgniteRoundRobinErrorAfterClientReconnectTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteRoundRobinErrorAfterClientReconnectTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteRoundRobinErrorAfterClientReconnectTest.java
index 00a33a6..2b8bdea 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteRoundRobinErrorAfterClientReconnectTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteRoundRobinErrorAfterClientReconnectTest.java
@@ -21,6 +21,8 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.lang.IgnitePredicate;
@@ -62,6 +64,11 @@ public class IgniteRoundRobinErrorAfterClientReconnectTest extends GridCommonAbs
return 60000;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
index 8fad640..0c21325 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
@@ -28,6 +28,8 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.lang.IgnitePredicate;
@@ -133,6 +135,11 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends GridCommonAbstractTe
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
index d19ae72..762bc92 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
@@ -21,6 +21,8 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.DeploymentMode;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller;
@@ -91,6 +93,11 @@ public abstract class GridDiscoveryManagerAttributesSelfTest extends GridCommonA
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
index 4041d6e..a7f5d69 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
@@ -21,6 +21,8 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.ignite.Ignite;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.managers.GridManagerAdapter;
import org.apache.ignite.internal.util.typedef.F;
@@ -83,6 +85,11 @@ public class IgniteTopologyPrintFormatSelfTest extends GridCommonAbstractTest {
((MockLogger)log).clear();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/marshaller/optimized/OptimizedMarshallerNodeFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/marshaller/optimized/OptimizedMarshallerNodeFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/marshaller/optimized/OptimizedMarshallerNodeFailoverTest.java
index 7bd0a5d..31751c3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/marshaller/optimized/OptimizedMarshallerNodeFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/marshaller/optimized/OptimizedMarshallerNodeFailoverTest.java
@@ -26,6 +26,8 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -81,6 +83,11 @@ public class OptimizedMarshallerNodeFailoverTest extends GridCommonAbstractTest
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDataRegionConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDataRegionConfigurationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDataRegionConfigurationTest.java
index 614c900..94fbbc6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDataRegionConfigurationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDataRegionConfigurationTest.java
@@ -24,6 +24,8 @@ import org.apache.ignite.configuration.DataPageEvictionMode;
import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.mem.IgniteOutOfMemoryException;
import org.apache.ignite.testframework.GridTestUtils;
@@ -64,6 +66,11 @@ public class CacheDataRegionConfigurationTest extends GridCommonAbstractTest {
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/** */
private void checkStartGridException(Class<? extends Throwable> ex, String message) {
GridTestUtils.assertThrows(log(), new Callable<Object>() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearUpdateTopologyChangeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearUpdateTopologyChangeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearUpdateTopologyChangeAbstractTest.java
index 21b3c72..e8d3433 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearUpdateTopologyChangeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearUpdateTopologyChangeAbstractTest.java
@@ -25,6 +25,8 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.affinity.Affinity;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.testframework.GridTestUtils;
@@ -50,6 +52,11 @@ public abstract class CacheNearUpdateTopologyChangeAbstractTest extends IgniteCa
return new NearCacheConfiguration();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java
index 8891f64..e14f472 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java
@@ -28,6 +28,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgnitePredicate;
@@ -86,6 +88,11 @@ public class CachePutEventListenerErrorSelfTest extends GridCommonAbstractTest {
}
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
index 0afd4ba..2945a0e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
@@ -58,6 +58,8 @@ import org.apache.ignite.cache.store.CacheStoreAdapter;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.util.typedef.F;
@@ -141,6 +143,11 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
+ /** {@inheritDoc} */
@Override protected long getTestTimeout() {
return 5 * 60_000;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
index 5c204c7..b4abd66 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
@@ -27,6 +27,8 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CachePartialUpdateException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
@@ -126,6 +128,11 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/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 5f4f349..29e3fe4 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
@@ -70,6 +70,8 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.CacheEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.IgnitionEx;
@@ -269,6 +271,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
info("Grid " + i + ": " + grid(i).localNode().id());
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Checks that any invoke returns result.
*
@@ -6006,6 +6013,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
doTransformResourceInjectionInTx(ignite, cache, true, false);
doTransformResourceInjectionInTx(ignite, cache, true, true);
}
+
+ grid(0).services( grid(0).cluster()).cancel(SERVICE_NAME1);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/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 d7406c0..f71a377 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
@@ -38,6 +38,8 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.util.lang.GridTuple;
@@ -126,6 +128,11 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCommonAbstr
return DUR + 60_000;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @return Cache mode.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
index c15a0f8..af86195 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
@@ -46,6 +46,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.DeploymentMode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.F;
@@ -131,6 +133,11 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
System.clearProperty(IgniteSystemProperties.IGNITE_ENABLE_FORCIBLE_NODE_KILL);
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
index b9f7a35..24529ce 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
@@ -26,6 +26,8 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cluster.ClusterTopologyException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.util.typedef.CAX;
@@ -98,6 +100,11 @@ public class GridCacheVariableTopologySelfTest extends GridCommonAbstractTest {
assert G.allGrids().isEmpty();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @param cnt Number of grids to starts.
* @param startIdx Start grid index.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java
index ad781e8..5e92173 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java
@@ -32,6 +32,8 @@ import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
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;
@@ -66,6 +68,11 @@ public class GridCacheVersionTopologyChangeTest extends GridCommonAbstractTest {
super.afterTest();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteAbstractDynamicCacheStartFailTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteAbstractDynamicCacheStartFailTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteAbstractDynamicCacheStartFailTest.java
index d506224..018d04a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteAbstractDynamicCacheStartFailTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteAbstractDynamicCacheStartFailTest.java
@@ -63,6 +63,8 @@ import org.apache.ignite.cluster.BaselineNode;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.resources.IgniteInstanceResource;
@@ -95,6 +97,11 @@ public abstract class IgniteAbstractDynamicCacheStartFailTest extends GridCacheA
return 3;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Returns {@code true} if persistence is enabled.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
index e9999d7..3fe67d6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
@@ -75,6 +75,8 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.binary.BinaryMarshaller;
@@ -176,6 +178,11 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
super.afterTest();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheStartFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheStartFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheStartFailoverTest.java
index fa7d0a8..9ee38c0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheStartFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheStartFailoverTest.java
@@ -35,6 +35,8 @@ import org.apache.ignite.cache.CacheServerNotFoundException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.IgniteNodeAttributes;
@@ -96,6 +98,11 @@ public class IgniteClientCacheStartFailoverTest extends GridCommonAbstractTest {
super.afterTest();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java
index 0b7158d..87bc6b1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java
@@ -32,6 +32,8 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.GridJobExecuteResponse;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage;
@@ -96,6 +98,11 @@ public class IgniteDynamicCacheStartCoordinatorFailoverTest extends GridCommonAb
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Tests coordinator failover during cache start failure.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractCacheTest.java
index bb61632..2902695 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractCacheTest.java
@@ -29,6 +29,8 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.TopologyValidator;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.transactions.Transaction;
@@ -89,6 +91,11 @@ public abstract class IgniteTopologyValidatorAbstractCacheTest extends IgniteCac
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @param nodes Nodes.
* @return Number of server nodes.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
index ac294b0..8cb03c6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
@@ -32,6 +32,8 @@ import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
import org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException;
@@ -128,6 +130,11 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
lastKey = 0;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionsExchangeCoordinatorFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionsExchangeCoordinatorFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionsExchangeCoordinatorFailoverTest.java
index 1c847f9..9980753 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionsExchangeCoordinatorFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionsExchangeCoordinatorFailoverTest.java
@@ -24,6 +24,8 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.TestRecordingCommunicationSpi;
@@ -72,6 +74,11 @@ public class PartitionsExchangeCoordinatorFailoverTest extends GridCommonAbstrac
return 60 * 1000L;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Tests that new coordinator is able to finish old exchanges in case of in-complete coordinator initialization.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/SetTxTimeoutOnPartitionMapExchangeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/SetTxTimeoutOnPartitionMapExchangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/SetTxTimeoutOnPartitionMapExchangeTest.java
index 490b640..856a89b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/SetTxTimeoutOnPartitionMapExchangeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/SetTxTimeoutOnPartitionMapExchangeTest.java
@@ -32,6 +32,8 @@ import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -80,6 +82,11 @@ public class SetTxTimeoutOnPartitionMapExchangeTest extends GridCommonAbstractTe
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
*
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAdvancedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAdvancedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAdvancedSelfTest.java
index d95b715..5f2b4aa 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAdvancedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAdvancedSelfTest.java
@@ -26,6 +26,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteClientReconnectAbstractTest;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.testframework.GridTestUtils;
@@ -52,6 +54,11 @@ public class WalModeChangeAdvancedSelfTest extends WalModeChangeCommonAbstractSe
}
/** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
+ /** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
super.afterTest();
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
index 6e3a7bb..5b44510 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
@@ -51,6 +51,8 @@ import org.apache.ignite.configuration.AtomicConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.CollectionConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.NodeStoppingException;
@@ -158,6 +160,11 @@ public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends Ig
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Starts client node.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java
index 211320f..5e77816 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java
@@ -31,6 +31,8 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -93,6 +95,11 @@ public abstract class CacheAsyncOperationsFailoverAbstractTest extends GridCache
return null;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBaselineTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBaselineTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBaselineTopologyTest.java
index 053ed82..f4cc24a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBaselineTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBaselineTopologyTest.java
@@ -43,6 +43,8 @@ import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -146,6 +148,11 @@ public class CacheBaselineTopologyTest extends GridCommonAbstractTest {
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Verifies that rebalance on cache with Node Filter happens when BaselineTopology changes.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheExchangeMergeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheExchangeMergeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheExchangeMergeTest.java
index 9cd2489..f91116d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheExchangeMergeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheExchangeMergeTest.java
@@ -43,6 +43,8 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
@@ -182,6 +184,11 @@ public class CacheExchangeMergeTest extends GridCommonAbstractTest {
super.afterTest();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @param name Cache name.
* @param atomicityMode Cache atomicity mode.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetInsideLockChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetInsideLockChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetInsideLockChangingTopologyTest.java
index 80aa9ee..8a00f28 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetInsideLockChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetInsideLockChangingTopologyTest.java
@@ -33,6 +33,8 @@ import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.cache.GridCacheAlwaysEvictionPolicy;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -152,6 +154,11 @@ public class CacheGetInsideLockChangingTopologyTest extends GridCommonAbstractTe
System.clearProperty(IgniteSystemProperties.IGNITE_ENABLE_FORCIBLE_NODE_KILL);
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java
index 10d04bd..9a8511a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java
@@ -37,6 +37,8 @@ import org.apache.ignite.cache.store.CacheStoreAdapter;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl;
@@ -141,6 +143,11 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception if failed
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java
index 57a150f..ce60c8a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java
@@ -30,6 +30,8 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -92,6 +94,11 @@ public abstract class CachePutAllFailoverAbstractTest extends GridCacheAbstractS
return null;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
index 2116ecb..3fd0170 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
@@ -40,6 +40,8 @@ import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
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;
@@ -188,6 +190,11 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
idx = -1;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @return Cache atomicity mode.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
index edfeb96..c544330 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
@@ -34,6 +34,8 @@ import org.apache.ignite.cache.CacheEntryProcessor;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteNodeAttributes;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
@@ -89,6 +91,11 @@ public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridComm
startGrids(4);
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
index 6230501..535fb7e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
@@ -29,6 +29,8 @@ import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.ClientConnectorConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
@@ -108,6 +110,12 @@ public class IgniteCache150ClientsTest extends GridCommonAbstractTest {
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ // Test can be too slow because of a lot of clients.
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
@@ -164,7 +172,7 @@ public class IgniteCache150ClientsTest extends GridCommonAbstractTest {
}
}, CLIENTS, "start-client");
- fut.get();
+ fut.get(getTestTimeout());
log.info("Started all clients.");
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientMultiNodeUpdateTopologyLockTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientMultiNodeUpdateTopologyLockTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientMultiNodeUpdateTopologyLockTest.java
index 7711bbb..b2bf2a1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientMultiNodeUpdateTopologyLockTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientMultiNodeUpdateTopologyLockTest.java
@@ -25,6 +25,8 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.TestRecordingCommunicationSpi;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage;
@@ -75,6 +77,11 @@ public class IgniteCacheClientMultiNodeUpdateTopologyLockTest extends GridCommon
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/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 dd6e36e..37edfbf 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
@@ -52,6 +52,8 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
@@ -154,6 +156,11 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
[06/50] [abbrv] ignite git commit: IGNITE-10291: SQL: fixed index
re-build routine. Now indexes which appeared during node shutdown are rebuilt
as well. This closes #5525.
Posted by sb...@apache.org.
IGNITE-10291: SQL: fixed index re-build routine. Now indexes which appeared during node shutdown are rebuilt as well. This closes #5525.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9b0ce92d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9b0ce92d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9b0ce92d
Branch: refs/heads/ignite-10044
Commit: 9b0ce92d9f60004ec07cff137d7b0582c644a500
Parents: d19123d
Author: devozerov <vo...@gridgain.com>
Authored: Mon Dec 3 18:08:53 2018 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Dec 3 18:08:53 2018 +0300
----------------------------------------------------------------------
.../cache/IgniteCacheOffheapManager.java | 5 +-
.../cache/IgniteCacheOffheapManagerImpl.java | 4 +-
.../GridCacheDatabaseSharedManager.java | 14 +-
.../persistence/GridCacheOffheapManager.java | 15 +-
.../cache/persistence/IndexStorage.java | 26 ++-
.../cache/persistence/IndexStorageImpl.java | 37 +++-
.../UpgradePendingTreeToPerPartitionTask.java | 4 +-
.../processors/query/GridQueryIndexing.java | 16 +-
.../processors/query/GridQueryProcessor.java | 92 +++-------
...IgniteClientCacheInitializationFailTest.java | 10 +-
.../database/IndexStorageSelfTest.java | 21 ++-
.../processors/query/h2/IgniteH2Indexing.java | 113 +++++++++---
.../processors/query/h2/IndexBuildClosure.java | 54 ++++++
.../query/h2/IndexRebuildFullClosure.java | 49 +++++
.../query/h2/IndexRebuildPartialClosure.java | 76 ++++++++
.../query/h2/RebuildIndexFromHashClosure.java | 47 -----
.../processors/query/h2/database/H2Tree.java | 14 ++
.../query/h2/database/H2TreeIndex.java | 48 +++--
.../processors/query/h2/opt/GridH2Table.java | 56 +++++-
.../cache/IgniteDynamicSqlRestoreTest.java | 180 +++++++++++++++++--
.../query/h2/GridIndexRebuildSelfTest.java | 9 +-
21 files changed, 667 insertions(+), 223 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
index cdc44a5..ed3697a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
@@ -588,17 +588,18 @@ public interface IgniteCacheOffheapManager {
/**
* @param cacheId Cache ID.
* @param idxName Index name.
+ * @param segment Segment.
* @return Root page for index tree.
* @throws IgniteCheckedException If failed.
*/
- public RootPage rootPageForIndex(int cacheId, String idxName) throws IgniteCheckedException;
+ public RootPage rootPageForIndex(int cacheId, String idxName, int segment) throws IgniteCheckedException;
/**
* @param cacheId Cache ID.
* @param idxName Index name.
* @throws IgniteCheckedException If failed.
*/
- public void dropRootPageForIndex(int cacheId, String idxName) throws IgniteCheckedException;
+ public void dropRootPageForIndex(int cacheId, String idxName, int segment) throws IgniteCheckedException;
/**
* @param idxName Index name.
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
index e15009e..ca14f68 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
@@ -1142,14 +1142,14 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
}
/** {@inheritDoc} */
- @Override public RootPage rootPageForIndex(int cacheId, String idxName) throws IgniteCheckedException {
+ @Override public RootPage rootPageForIndex(int cacheId, String idxName, int segment) throws IgniteCheckedException {
long pageId = allocateForTree();
return new RootPage(new FullPageId(pageId, grp.groupId()), true);
}
/** {@inheritDoc} */
- @Override public void dropRootPageForIndex(int cacheId, String idxName) throws IgniteCheckedException {
+ @Override public void dropRootPageForIndex(int cacheId, String idxName, int segment) throws IgniteCheckedException {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index d610a51..9a03337 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -137,6 +137,7 @@ import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageParti
import org.apache.ignite.internal.processors.cache.persistence.wal.FileWALPointer;
import org.apache.ignite.internal.processors.cache.persistence.wal.crc.IgniteDataIntegrityViolationException;
import org.apache.ignite.internal.processors.port.GridPortRecord;
+import org.apache.ignite.internal.processors.query.GridQueryProcessor;
import org.apache.ignite.internal.util.GridMultiCollectionWrapper;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.future.CountDownFuture;
@@ -1342,16 +1343,19 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
/** {@inheritDoc} */
@Override public void rebuildIndexesIfNeeded(GridDhtPartitionsExchangeFuture fut) {
- if (cctx.kernalContext().query().moduleEnabled()) {
+ GridQueryProcessor qryProc = cctx.kernalContext().query();
+
+ if (qryProc.moduleEnabled()) {
for (final GridCacheContext cacheCtx : (Collection<GridCacheContext>)cctx.cacheContexts()) {
if (cacheCtx.startTopologyVersion().equals(fut.initialVersion())) {
final int cacheId = cacheCtx.cacheId();
final GridFutureAdapter<Void> usrFut = idxRebuildFuts.get(cacheId);
- if (!cctx.pageStore().hasIndexStore(cacheCtx.groupId()) && cacheCtx.affinityNode()
- && cacheCtx.group().persistenceEnabled()) {
- IgniteInternalFuture<?> rebuildFut = cctx.kernalContext().query()
- .rebuildIndexesFromHash(Collections.singleton(cacheCtx.cacheId()));
+ IgniteInternalFuture<?> rebuildFut = qryProc.rebuildIndexesFromHash(cacheCtx);
+
+ if (rebuildFut != null) {
+ log().info("Started indexes rebuilding for cache [name=" + cacheCtx.name()
+ + ", grpName=" + cacheCtx.group().name() + ']');
assert usrFut != null : "Missing user future for cache: " + cacheCtx.name();
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
index 44ae6f1..e1bd8dd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
@@ -142,6 +142,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
ctx.wal(),
globalRemoveId(),
grp.groupId(),
+ grp.sharedGroup(),
PageIdAllocator.INDEX_PARTITION,
PageIdAllocator.FLAG_IDX,
reuseList,
@@ -835,19 +836,13 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
}
/** {@inheritDoc} */
- @Override public RootPage rootPageForIndex(int cacheId, String idxName) throws IgniteCheckedException {
- if (grp.sharedGroup())
- idxName = Integer.toString(cacheId) + "_" + idxName;
-
- return indexStorage.getOrAllocateForTree(idxName);
+ @Override public RootPage rootPageForIndex(int cacheId, String idxName, int segment) throws IgniteCheckedException {
+ return indexStorage.allocateCacheIndex(cacheId, idxName, segment);
}
/** {@inheritDoc} */
- @Override public void dropRootPageForIndex(int cacheId, String idxName) throws IgniteCheckedException {
- if (grp.sharedGroup())
- idxName = Integer.toString(cacheId) + "_" + idxName;
-
- indexStorage.dropRootPage(idxName);
+ @Override public void dropRootPageForIndex(int cacheId, String idxName, int segment) throws IgniteCheckedException {
+ indexStorage.dropCacheIndex(cacheId, idxName, segment);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IndexStorage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IndexStorage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IndexStorage.java
index 5141b04..295ff00 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IndexStorage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IndexStorage.java
@@ -24,6 +24,17 @@ import org.apache.ignite.IgniteCheckedException;
*/
public interface IndexStorage {
/**
+ * Allocate page for cache index. Index name will be masked if needed.
+ *
+ * @param cacheId Cache ID.
+ * @param idxName Index name.
+ * @param segment Segment.
+ * @return Root page.
+ * @throws IgniteCheckedException If failed.
+ */
+ public RootPage allocateCacheIndex(Integer cacheId, String idxName, int segment) throws IgniteCheckedException;
+
+ /**
* Get or allocate initial page for an index.
*
* @param idxName Index name.
@@ -31,7 +42,18 @@ public interface IndexStorage {
* was newly allocated, and rootId that is counter which increments each time new page allocated.
* @throws IgniteCheckedException If failed.
*/
- public RootPage getOrAllocateForTree(String idxName) throws IgniteCheckedException;
+ public RootPage allocateIndex(String idxName) throws IgniteCheckedException;
+
+ /**
+ * Deallocate index page and remove from tree.
+ *
+ * @param cacheId Cache ID.
+ * @param idxName Index name.
+ * @param segment Segment.
+ * @return Root ID or -1 if no page was removed.
+ * @throws IgniteCheckedException If failed.
+ */
+ public RootPage dropCacheIndex(Integer cacheId, String idxName, int segment) throws IgniteCheckedException;
/**
* Deallocate index page and remove from tree.
@@ -40,7 +62,7 @@ public interface IndexStorage {
* @return Root ID or -1 if no page was removed.
* @throws IgniteCheckedException If failed.
*/
- public RootPage dropRootPage(String idxName) throws IgniteCheckedException;
+ public RootPage dropIndex(String idxName) throws IgniteCheckedException;
/**
* Destroy this meta store.
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IndexStorageImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IndexStorageImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IndexStorageImpl.java
index 6248765..b29553c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IndexStorageImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IndexStorageImpl.java
@@ -61,6 +61,9 @@ public class IndexStorageImpl implements IndexStorage {
/** Cache group ID. */
private final int grpId;
+ /** Whether group is shared. */
+ private final boolean grpShared;
+
/** */
private final int allocPartId;
@@ -76,6 +79,7 @@ public class IndexStorageImpl implements IndexStorage {
final IgniteWriteAheadLogManager wal,
final AtomicLong globalRmvId,
final int grpId,
+ boolean grpShared,
final int allocPartId,
final byte allocSpace,
final ReuseList reuseList,
@@ -86,6 +90,7 @@ public class IndexStorageImpl implements IndexStorage {
try {
this.pageMem = pageMem;
this.grpId = grpId;
+ this.grpShared = grpShared;
this.allocPartId = allocPartId;
this.allocSpace = allocSpace;
this.reuseList = reuseList;
@@ -99,7 +104,15 @@ public class IndexStorageImpl implements IndexStorage {
}
/** {@inheritDoc} */
- @Override public RootPage getOrAllocateForTree(final String idxName) throws IgniteCheckedException {
+ @Override public RootPage allocateCacheIndex(Integer cacheId, String idxName, int segment)
+ throws IgniteCheckedException {
+ String maskedIdxName = maskCacheIndexName(cacheId, idxName, segment);
+
+ return allocateIndex(maskedIdxName);
+ }
+
+ /** {@inheritDoc} */
+ @Override public RootPage allocateIndex(String idxName) throws IgniteCheckedException {
final MetaTree tree = metaTree;
synchronized (this) {
@@ -132,8 +145,15 @@ public class IndexStorageImpl implements IndexStorage {
}
/** {@inheritDoc} */
- @Override public RootPage dropRootPage(final String idxName)
+ @Override public RootPage dropCacheIndex(Integer cacheId, String idxName, int segment)
throws IgniteCheckedException {
+ String maskedIdxName = maskCacheIndexName(cacheId, idxName, segment);
+
+ return dropIndex(maskedIdxName);
+ }
+
+ /** {@inheritDoc} */
+ @Override public RootPage dropIndex(final String idxName) throws IgniteCheckedException {
byte[] idxNameBytes = idxName.getBytes(StandardCharsets.UTF_8);
final IndexItem row = metaTree.remove(new IndexItem(idxNameBytes, 0));
@@ -152,6 +172,19 @@ public class IndexStorageImpl implements IndexStorage {
}
/**
+ * Mask cache index name.
+ *
+ * @param idxName Index name.
+ * @return Masked name.
+ */
+ private String maskCacheIndexName(Integer cacheId, String idxName, int segment) {
+ if (grpShared)
+ idxName = Integer.toString(cacheId) + "_" + idxName;
+
+ return idxName + "%" + segment;
+ }
+
+ /**
*
*/
private static class MetaTree extends BPlusTree<IndexItem, IndexItem> {
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/migration/UpgradePendingTreeToPerPartitionTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/migration/UpgradePendingTreeToPerPartitionTask.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/migration/UpgradePendingTreeToPerPartitionTask.java
index 6fa039d..1cba69a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/migration/UpgradePendingTreeToPerPartitionTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/migration/UpgradePendingTreeToPerPartitionTask.java
@@ -131,14 +131,14 @@ public class UpgradePendingTreeToPerPartitionTask implements IgniteCallable<Bool
IndexStorage indexStorage = ((GridCacheOffheapManager)grp.offheap()).getIndexStorage();
//TODO: IGNITE-5874: replace with some check-method to avoid unnecessary page allocation.
- RootPage pendingRootPage = indexStorage.getOrAllocateForTree(PENDING_ENTRIES_TREE_NAME);
+ RootPage pendingRootPage = indexStorage.allocateIndex(PENDING_ENTRIES_TREE_NAME);
if (pendingRootPage.isAllocated()) {
log.info("No pending tree found for cache group: [grpId=" + grp.groupId() +
", grpName=" + grp.name() + ']');
// Nothing to do here as just allocated tree is obviously empty.
- indexStorage.dropRootPage(PENDING_ENTRIES_TREE_NAME);
+ indexStorage.dropIndex(PENDING_ENTRIES_TREE_NAME);
return;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
index c8c9502..2abafab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
@@ -27,6 +27,7 @@ import org.apache.ignite.cache.query.FieldsQueryCursor;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheContextInfo;
@@ -276,19 +277,12 @@ public interface GridQueryIndexing {
throws IgniteCheckedException;
/**
- * Rebuilds all indexes of given type from hash index.
+ * Rebuild indexes for the given cache if necessary.
*
- * @param cacheName Cache name.
- * @throws IgniteCheckedException If failed.
- */
- public void rebuildIndexesFromHash(String cacheName) throws IgniteCheckedException;
-
- /**
- * Marks all indexes of given type for rebuild from hash index, making them unusable until rebuild finishes.
- *
- * @param cacheName Cache name.
+ * @param cctx Cache context.
+ * @return Future completed when index rebuild finished.
*/
- public void markForRebuildFromHash(String cacheName);
+ public IgniteInternalFuture<?> rebuildIndexesFromHash(GridCacheContext cctx);
/**
* Returns backup filter.
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index db52f40..da5233a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -64,6 +64,7 @@ import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManager;
import org.apache.ignite.internal.processors.cache.GridCacheContextInfo;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
@@ -93,7 +94,6 @@ import org.apache.ignite.internal.processors.query.schema.operation.SchemaIndexD
import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.util.GridBoundedConcurrentLinkedHashSet;
import org.apache.ignite.internal.util.GridSpinBusyLock;
-import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
import org.apache.ignite.internal.util.lang.GridCloseableIterator;
import org.apache.ignite.internal.util.lang.GridClosureException;
@@ -106,8 +106,6 @@ import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.internal.util.worker.GridWorker;
-import org.apache.ignite.internal.util.worker.GridWorkerFuture;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteInClosure;
@@ -1776,78 +1774,46 @@ public class GridQueryProcessor extends GridProcessorAdapter {
/**
* Rebuilds indexes for provided caches from corresponding hash indexes.
*
- * @param cacheIds Cache IDs.
+ * @param cctx Cache context.
* @return Future that will be completed when rebuilding is finished.
*/
- public IgniteInternalFuture<?> rebuildIndexesFromHash(Set<Integer> cacheIds) {
- if (!busyLock.enterBusy())
- return new GridFinishedFuture<>(new NodeStoppingException("Failed to rebuild indexes from hash (grid is stopping)."));
-
- // Because of alt type ids, there can be few entries in 'types' for a single cache.
- // In order to avoid processing a cache more than once, let's track processed names.
- Set<String> processedCacheNames = new HashSet<>();
-
- try {
- GridCompoundFuture<Object, ?> fut = new GridCompoundFuture<Object, Object>();
-
- for (Map.Entry<QueryTypeIdKey, QueryTypeDescriptorImpl> e : types.entrySet()) {
- if (cacheIds.contains(CU.cacheId(e.getKey().cacheName())) &&
- processedCacheNames.add(e.getKey().cacheName()))
- fut.add(rebuildIndexesFromHash(e.getKey().cacheName(), e.getValue()));
- }
-
- fut.markInitialized();
-
- return fut;
- }
- finally {
- busyLock.leaveBusy();
- }
- }
-
- /**
- * @param cacheName Cache name.
- * @param desc Type descriptor.
- * @return Future that will be completed when rebuilding of all indexes is finished.
- */
- private IgniteInternalFuture<Object> rebuildIndexesFromHash(@Nullable final String cacheName,
- @Nullable final QueryTypeDescriptorImpl desc) {
+ public IgniteInternalFuture<?> rebuildIndexesFromHash(GridCacheContext cctx) {
+ // Indexing module is disabled, nothing to rebuild.
if (idx == null)
- return new GridFinishedFuture<>(new IgniteCheckedException("Indexing is disabled."));
-
- if (desc == null)
- return new GridFinishedFuture<>();
-
- final GridWorkerFuture<Object> fut = new GridWorkerFuture<>();
+ return null;
- idx.markForRebuildFromHash(cacheName);
+ // No data on non-affinity nodes.
+ if (!cctx.affinityNode())
+ return null;
- GridWorker w = new GridWorker(ctx.igniteInstanceName(), "index-rebuild-worker", log) {
- @Override protected void body() {
- try {
- idx.rebuildIndexesFromHash(cacheName);
+ // No indexes to rebuild when there are no QueryEntities.
+ if (!cctx.isQueryEnabled())
+ return null;
- fut.onDone();
- }
- catch (Exception e) {
- fut.onDone(e);
- }
- catch (Throwable e) {
- U.error(log, "Failed to rebuild indexes for type [cache=" + cacheName +
- ", name=" + desc.name() + ']', e);
+ // No need to rebuild if cache has no data.
+ boolean empty = true;
- fut.onDone(e);
+ for (IgniteCacheOffheapManager.CacheDataStore store : cctx.offheap().cacheDataStores()) {
+ if (!store.isEmpty()) {
+ empty = false;
- throw e;
- }
+ break;
}
- };
+ }
- fut.setWorker(w);
+ if (empty)
+ return null;
- ctx.getExecutorService().execute(w);
+ if (!busyLock.enterBusy())
+ return new GridFinishedFuture<>(new NodeStoppingException("Failed to rebuild indexes from hash " +
+ "(grid is stopping)."));
- return fut;
+ try {
+ return idx.rebuildIndexesFromHash(cctx);
+ }
+ finally {
+ busyLock.leaveBusy();
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
index ce7f4d7..11f5138 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
@@ -39,6 +39,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.mvcc.MvccQueryTracker;
@@ -336,13 +337,8 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT
}
/** {@inheritDoc} */
- @Override public void rebuildIndexesFromHash(String cacheName) throws IgniteCheckedException {
- // No-op
- }
-
- /** {@inheritDoc} */
- @Override public void markForRebuildFromHash(String cacheName) {
- // No-op
+ @Override public IgniteInternalFuture<?> rebuildIndexesFromHash(GridCacheContext cctx) {
+ return null;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IndexStorageSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IndexStorageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IndexStorageSelfTest.java
index bbdcd38..de2161a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IndexStorageSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IndexStorageSelfTest.java
@@ -96,15 +96,24 @@ public class IndexStorageSelfTest extends GridCommonAbstractTest {
IndexStorageImpl metaStore = storeMap.get(cacheId);
if (metaStore == null) {
- metaStore = new IndexStorageImpl(mem, null, new AtomicLong(), cacheId,
- PageIdAllocator.INDEX_PARTITION, PageMemory.FLAG_IDX,
- null, mem.allocatePage(cacheId, PageIdAllocator.INDEX_PARTITION, PageMemory.FLAG_IDX), true,
- null);
+ metaStore = new IndexStorageImpl(
+ mem,
+ null,
+ new AtomicLong(),
+ cacheId,
+ false,
+ PageIdAllocator.INDEX_PARTITION,
+ PageMemory.FLAG_IDX,
+ null,
+ mem.allocatePage(cacheId, PageIdAllocator.INDEX_PARTITION, PageMemory.FLAG_IDX),
+ true,
+ null
+ );
storeMap.put(cacheId, metaStore);
}
- final RootPage rootPage = metaStore.getOrAllocateForTree(idxName);
+ final RootPage rootPage = metaStore.allocateIndex(idxName);
assertTrue(rootPage.isAllocated());
@@ -118,7 +127,7 @@ public class IndexStorageSelfTest extends GridCommonAbstractTest {
String idxName = entry.getKey();
FullPageId rootPageId = entry.getValue().pageId();
- final RootPage rootPage = storeMap.get(cacheId).getOrAllocateForTree(idxName);
+ final RootPage rootPage = storeMap.get(cacheId).allocateIndex(idxName);
assertEquals("Invalid root page ID restored [cacheId=" + cacheId + ", idxName=" + idxName + ']',
rootPageId, rootPage.pageId());
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/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 e726857..e42fc6a 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
@@ -58,6 +58,7 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.GridTopic;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.pagemem.store.IgnitePageStoreManager;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
@@ -74,7 +75,7 @@ import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot;
import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
-import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
+import org.apache.ignite.internal.processors.query.h2.affinity.PartitionInfo;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
@@ -100,7 +101,6 @@ import org.apache.ignite.internal.processors.query.QueryIndexDescriptorImpl;
import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.processors.query.SqlClientContext;
import org.apache.ignite.internal.processors.query.UpdateSourceIterator;
-import org.apache.ignite.internal.processors.query.h2.affinity.PartitionInfo;
import org.apache.ignite.internal.processors.query.h2.database.H2RowFactory;
import org.apache.ignite.internal.processors.query.h2.database.H2TreeClientIndex;
import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
@@ -115,7 +115,6 @@ import org.apache.ignite.internal.processors.query.h2.dml.DmlUtils;
import org.apache.ignite.internal.processors.query.h2.dml.UpdatePlan;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2IndexBase;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryContext;
-import org.apache.ignite.internal.processors.query.h2.opt.GridH2Row;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlAlias;
@@ -166,6 +165,8 @@ import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.util.worker.GridWorker;
+import org.apache.ignite.internal.util.worker.GridWorkerFuture;
import org.apache.ignite.lang.IgniteBiClosure;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteFuture;
@@ -644,15 +645,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
// Populate index with existing cache data.
final GridH2RowDescriptor rowDesc = h2Tbl.rowDescriptor();
- SchemaIndexCacheVisitorClosure clo = new SchemaIndexCacheVisitorClosure() {
- @Override public void apply(CacheDataRow row) throws IgniteCheckedException {
- GridH2Row h2Row = rowDesc.createRow(row);
-
- h2Idx.putx(h2Row);
- }
- };
-
- cacheVisitor.visit(clo);
+ cacheVisitor.visit(new IndexBuildClosure(rowDesc, h2Idx));
// At this point index is in consistent state, promote it through H2 SQL statement, so that cached
// prepared statements are re-built.
@@ -2692,33 +2685,97 @@ public class IgniteH2Indexing implements GridQueryIndexing {
return rowCache.forGroup(grpId);
}
+ /** {@inheritDoc} */
+ @Override public IgniteInternalFuture<?> rebuildIndexesFromHash(GridCacheContext cctx) {
+ // No data in fresh in-memory cache.
+ if (!cctx.group().persistenceEnabled())
+ return null;
+
+ IgnitePageStoreManager pageStore = cctx.shared().pageStore();
+
+ assert pageStore != null;
+
+ SchemaIndexCacheVisitorClosure clo;
+
+ if (!pageStore.hasIndexStore(cctx.groupId())) {
+ // If there are no index store, rebuild all indexes.
+ clo = new IndexRebuildFullClosure(cctx.queries(), cctx.mvccEnabled());
+ }
+ else {
+ // Otherwise iterate over tables looking for missing indexes.
+ IndexRebuildPartialClosure clo0 = new IndexRebuildPartialClosure();
+
+ for (H2TableDescriptor tblDesc : tables(cctx.name())) {
+ assert tblDesc.table() != null;
+
+ tblDesc.table().collectIndexesForPartialRebuild(clo0);
+ }
+
+ if (clo0.hasIndexes())
+ clo = clo0;
+ else
+ return null;
+ }
+
+ // Closure prepared, do rebuild.
+ final GridWorkerFuture<?> fut = new GridWorkerFuture<>();
+
+ markIndexRebuild(cctx.name(), true);
+
+ GridWorker worker = new GridWorker(ctx.igniteInstanceName(), "index-rebuild-worker-" + cctx.name(), log) {
+ @Override protected void body() {
+ try {
+ rebuildIndexesFromHash0(cctx, clo);
+
+ markIndexRebuild(cctx.name(), false);
+
+ fut.onDone();
+ }
+ catch (Exception e) {
+ fut.onDone(e);
+ }
+ catch (Throwable e) {
+ U.error(log, "Failed to rebuild indexes for cache: " + cctx.name(), e);
+
+ fut.onDone(e);
+
+ throw e;
+ }
+ }
+ };
+
+ fut.setWorker(worker);
+
+ ctx.getExecutorService().execute(worker);
+
+ return fut;
+ }
+
/**
- * Rebuild indexes from hash index.
+ * Do index rebuild.
*
- * @param cacheName Cache name.
+ * @param cctx Cache context.
+ * @param clo Closure.
* @throws IgniteCheckedException If failed.
*/
- @Override public void rebuildIndexesFromHash(String cacheName) throws IgniteCheckedException {
- int cacheId = CU.cacheId(cacheName);
-
- GridCacheContext cctx = ctx.cache().context().cacheContext(cacheId);
-
- final GridCacheQueryManager qryMgr = cctx.queries();
-
+ protected void rebuildIndexesFromHash0(GridCacheContext cctx, SchemaIndexCacheVisitorClosure clo)
+ throws IgniteCheckedException {
SchemaIndexCacheVisitor visitor = new SchemaIndexCacheVisitorImpl(cctx);
- visitor.visit(new RebuildIndexFromHashClosure(qryMgr, cctx.mvccEnabled()));
-
- for (H2TableDescriptor tblDesc : tables(cacheName))
- tblDesc.table().markRebuildFromHashInProgress(false);
+ visitor.visit(clo);
}
- /** {@inheritDoc} */
- @Override public void markForRebuildFromHash(String cacheName) {
+ /**
+ * Mark tables for index rebuild, so that their indexes are not used.
+ *
+ * @param cacheName Cache name.
+ * @param val Value.
+ */
+ private void markIndexRebuild(String cacheName, boolean val) {
for (H2TableDescriptor tblDesc : tables(cacheName)) {
assert tblDesc.table() != null;
- tblDesc.table().markRebuildFromHashInProgress(true);
+ tblDesc.table().markRebuildFromHashInProgress(val);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IndexBuildClosure.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IndexBuildClosure.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IndexBuildClosure.java
new file mode 100644
index 0000000..8d1923f
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IndexBuildClosure.java
@@ -0,0 +1,54 @@
+/*
+ * 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.query.h2;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2IndexBase;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2Row;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
+import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorClosure;
+
+/**
+ * Index build closure.
+ */
+public class IndexBuildClosure implements SchemaIndexCacheVisitorClosure {
+ /** Row descriptor. */
+ private final GridH2RowDescriptor rowDesc;
+
+ /** Index. */
+ private final GridH2IndexBase idx;
+
+ /**
+ * Constructor.
+ *
+ * @param rowDesc Row descriptor.
+ * @param idx Target index.
+ */
+ public IndexBuildClosure(GridH2RowDescriptor rowDesc, GridH2IndexBase idx) {
+ this.rowDesc = rowDesc;
+ this.idx = idx;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void apply(CacheDataRow row) throws IgniteCheckedException {
+ GridH2Row row0 = rowDesc.createRow(row);
+
+ idx.putx(row0);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IndexRebuildFullClosure.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IndexRebuildFullClosure.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IndexRebuildFullClosure.java
new file mode 100644
index 0000000..8018839
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IndexRebuildFullClosure.java
@@ -0,0 +1,49 @@
+/*
+ * 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.query.h2;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
+import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorClosure;
+
+/**
+ * Closure to rebuild all indexes.
+ */
+public class IndexRebuildFullClosure implements SchemaIndexCacheVisitorClosure {
+ /** */
+ private final GridCacheQueryManager qryMgr;
+
+ /** MVCC status flag. */
+ private final boolean mvccEnabled;
+
+ /**
+ * @param qryMgr Query manager.
+ * @param mvccEnabled MVCC status flag.
+ */
+ public IndexRebuildFullClosure(GridCacheQueryManager qryMgr, boolean mvccEnabled) {
+ this.qryMgr = qryMgr;
+ this.mvccEnabled = mvccEnabled;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void apply(CacheDataRow row) throws IgniteCheckedException {
+ // prevRowAvailable is always true with MVCC on, and always false *on index rebuild* with MVCC off.
+ qryMgr.store(row, null, mvccEnabled);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IndexRebuildPartialClosure.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IndexRebuildPartialClosure.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IndexRebuildPartialClosure.java
new file mode 100644
index 0000000..2672f06
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IndexRebuildPartialClosure.java
@@ -0,0 +1,76 @@
+/*
+ * 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.query.h2;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2IndexBase;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2Row;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
+import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorClosure;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.Map;
+
+/**
+ * Closure to rebuild some cache indexes.
+ */
+public class IndexRebuildPartialClosure implements SchemaIndexCacheVisitorClosure {
+ /** Indexes. */
+ private final Map<GridH2Table, Collection<GridH2IndexBase>> tblIdxs = new IdentityHashMap<>();
+
+ /** {@inheritDoc} */
+ @Override public void apply(CacheDataRow row) throws IgniteCheckedException {
+ assert hasIndexes();
+
+ for (Map.Entry<GridH2Table, Collection<GridH2IndexBase>> tblIdxEntry : tblIdxs.entrySet()) {
+ GridH2Table tbl = tblIdxEntry.getKey();
+
+ GridH2Row row0 = tbl.rowDescriptor().createRow(row);
+
+ for (GridH2IndexBase idx : tblIdxEntry.getValue())
+ idx.putx(row0);
+ }
+ }
+
+ /**
+ * @param idx Index to be rebuilt.
+ */
+ public void addIndex(GridH2Table tbl, GridH2IndexBase idx) {
+ Collection<GridH2IndexBase> idxs = tblIdxs.get(tbl);
+
+ if (idxs == null) {
+ idxs = Collections.newSetFromMap(new IdentityHashMap<>());
+
+ idxs.add(idx);
+
+ tblIdxs.put(tbl, idxs);
+ }
+
+ idxs.add(idx);
+ }
+
+ /**
+ * @return {@code True} if there is at least one index to rebuild.
+ */
+ public boolean hasIndexes() {
+ return !tblIdxs.isEmpty();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/RebuildIndexFromHashClosure.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/RebuildIndexFromHashClosure.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/RebuildIndexFromHashClosure.java
deleted file mode 100644
index b635eac..0000000
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/RebuildIndexFromHashClosure.java
+++ /dev/null
@@ -1,47 +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.internal.processors.query.h2;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
-import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
-import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorClosure;
-
-/** */
-class RebuildIndexFromHashClosure implements SchemaIndexCacheVisitorClosure {
- /** */
- private final GridCacheQueryManager qryMgr;
-
- /** MVCC status flag. */
- private final boolean mvccEnabled;
-
- /**
- * @param qryMgr Query manager.
- * @param mvccEnabled MVCC status flag.
- */
- RebuildIndexFromHashClosure(GridCacheQueryManager qryMgr, boolean mvccEnabled) {
- this.qryMgr = qryMgr;
- this.mvccEnabled = mvccEnabled;
- }
-
- /** {@inheritDoc} */
- @Override public void apply(CacheDataRow row) throws IgniteCheckedException {
- // prevRowAvailable is always true with MVCC on, and always false *on index rebuild* with MVCC off.
- qryMgr.store(row, null, mvccEnabled);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
index 71cea7e..f2a69bb 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
@@ -108,8 +108,12 @@ public abstract class H2Tree extends BPlusTree<GridH2SearchRow, GridH2Row> {
/** */
private final IgniteLogger log;
+ /** Whether PK is stored in unwrapped form. */
private boolean unwrappedPk;
+ /** Whether index was created from scratch during owning node lifecycle. */
+ private final boolean created;
+
/**
* Constructor.
*
@@ -200,6 +204,8 @@ public abstract class H2Tree extends BPlusTree<GridH2SearchRow, GridH2Row> {
this.log = log;
initTree(initNew, inlineSize);
+
+ this.created = initNew;
}
/**
@@ -556,6 +562,14 @@ public abstract class H2Tree extends BPlusTree<GridH2SearchRow, GridH2Row> {
*/
public abstract int compareValues(Value v1, Value v2);
+ /**
+ * @return {@code True} if index was created during curren node's lifetime, {@code False} if it was restored from
+ * disk.
+ */
+ public boolean created() {
+ return created;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(H2Tree.class, this, "super", super.toString());
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
index 2c0a9d8..65be8d6 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
@@ -83,6 +83,9 @@ public class H2TreeIndex extends H2TreeIndexBase {
/** */
private final String idxName;
+ /** Tree name. */
+ private final String treeName;
+
/** */
private final IgniteLogger log;
@@ -125,14 +128,11 @@ public class H2TreeIndex extends H2TreeIndexBase {
this.table = tbl;
-
GridQueryTypeDescriptor typeDesc = tbl.rowDescriptor().type();
int typeId = cctx.binaryMarshaller() ? typeDesc.typeId() : typeDesc.valueClass().hashCode();
- String treeName = (tbl.rowDescriptor() == null ? "" : typeId + "_") + idxName;
-
- treeName = BPlusTree.treeName(treeName, "H2Tree");
+ treeName = BPlusTree.treeName((tbl.rowDescriptor() == null ? "" : typeId + "_") + idxName, "H2Tree");
IndexColumnsInfo unwrappedColsInfo = new IndexColumnsInfo(unwrappedColsList, inlineSize);
@@ -152,7 +152,7 @@ public class H2TreeIndex extends H2TreeIndexBase {
db.checkpointReadLock();
try {
- RootPage page = getMetaPage(treeName, i);
+ RootPage page = getMetaPage(i);
segments[i] = new H2Tree(
treeName,
@@ -203,6 +203,30 @@ public class H2TreeIndex extends H2TreeIndexBase {
}
/**
+ * Check if index exists in store.
+ *
+ * @return {@code True} if exists.
+ */
+ public boolean rebuildRequired() {
+ assert segments != null;
+
+ for (int i = 0; i < segments.length; i++) {
+ try {
+ H2Tree segment = segments[i];
+
+ if (segment.created())
+ return true;
+ }
+ catch (Exception e) {
+ throw new IgniteException("Failed to check index tree root page existence [cacheName=" + cctx.name() +
+ ", tblName=" + tblName + ", idxName=" + idxName + ", segment=" + i + ']');
+ }
+ }
+
+ return false;
+ }
+
+ /**
* @param cols Columns array.
* @return List of {@link InlineIndexHelper} objects.
*/
@@ -398,7 +422,7 @@ public class H2TreeIndex extends H2TreeIndexBase {
tree.destroy();
- dropMetaPage(tree.getName(), i);
+ dropMetaPage(i);
}
}
}
@@ -493,22 +517,20 @@ public class H2TreeIndex extends H2TreeIndexBase {
}
/**
- * @param name Name.
* @param segIdx Segment index.
* @return RootPage for meta page.
* @throws IgniteCheckedException If failed.
*/
- private RootPage getMetaPage(String name, int segIdx) throws IgniteCheckedException {
- return cctx.offheap().rootPageForIndex(cctx.cacheId(), name + "%" + segIdx);
+ private RootPage getMetaPage(int segIdx) throws IgniteCheckedException {
+ return cctx.offheap().rootPageForIndex(cctx.cacheId(), treeName, segIdx);
}
/**
- * @param name Name.
* @param segIdx Segment index.
* @throws IgniteCheckedException If failed.
*/
- private void dropMetaPage(String name, int segIdx) throws IgniteCheckedException {
- cctx.offheap().dropRootPageForIndex(cctx.cacheId(), name + "%" + segIdx);
+ private void dropMetaPage(int segIdx) throws IgniteCheckedException {
+ cctx.offheap().dropRootPageForIndex(cctx.cacheId(), treeName, segIdx);
}
/** {@inheritDoc} */
@@ -542,7 +564,7 @@ public class H2TreeIndex extends H2TreeIndexBase {
* @param cfgInlineSize Inline size from cache config.
*/
public IndexColumnsInfo(List<IndexColumn> colsList, int cfgInlineSize) {
- this.cols = colsList.toArray(new IndexColumn[colsList.size()]);
+ this.cols = colsList.toArray(new IndexColumn[0]);
this.inlineIdx = getAvailableInlineColumns(cols);
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
index ef31f20..59597be 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
@@ -26,7 +26,6 @@ import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.LongAdder;
import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteInterruptedException;
@@ -36,7 +35,9 @@ import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.query.QueryTable;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.QueryField;
+import org.apache.ignite.internal.processors.query.h2.IndexRebuildPartialClosure;
import org.apache.ignite.internal.processors.query.h2.database.H2RowFactory;
+import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndexBase;
import org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor;
import org.apache.ignite.internal.util.typedef.F;
@@ -89,7 +90,7 @@ public class GridH2Table extends TableBase {
private final Map<String, GridH2IndexBase> tmpIdxs = new HashMap<>();
/** */
- private final ReadWriteLock lock;
+ private final ReentrantReadWriteLock lock;
/** */
private boolean destroyed;
@@ -127,6 +128,7 @@ public class GridH2Table extends TableBase {
* @param idxsFactory Indexes factory.
* @param cacheInfo Cache context info.
*/
+ @SuppressWarnings("ConstantConditions")
public GridH2Table(CreateTableData createTblData, GridH2RowDescriptor desc, H2RowFactory rowFactory,
GridH2SystemIndexFactory idxsFactory, GridCacheContextInfo cacheInfo) {
super(createTblData);
@@ -175,11 +177,14 @@ public class GridH2Table extends TableBase {
assert idxs != null;
List<Index> clones = new ArrayList<>(idxs.size());
+
for (Index index : idxs) {
Index clone = createDuplicateIndexIfNeeded(index);
+
if (clone != null)
clones.add(clone);
}
+
idxs.addAll(clones);
boolean hasHashIndex = idxs.size() >= 2 && index(0).getIndexType().isHash();
@@ -565,12 +570,39 @@ public class GridH2Table extends TableBase {
}
/**
+ * Collect indexes for rebuild.
*
+ * @param clo Closure.
+ */
+ public void collectIndexesForPartialRebuild(IndexRebuildPartialClosure clo) {
+ for (int i = sysIdxsCnt; i < idxs.size(); i++) {
+ Index idx = idxs.get(i);
+
+ if (idx instanceof H2TreeIndex) {
+ H2TreeIndex idx0 = (H2TreeIndex)idx;
+
+ if (idx0.rebuildRequired())
+ clo.addIndex(this, idx0);
+ }
+ }
+ }
+
+ /**
+ * Mark or unmark index rebuild state.
*/
public void markRebuildFromHashInProgress(boolean value) {
assert !value || (idxs.size() >= 2 && index(1).getIndexType().isHash()) : "Table has no hash index.";
rebuildFromHashInProgress = value;
+
+ lock.writeLock().lock();
+
+ try {
+ incrementModificationCounter();
+ }
+ finally {
+ lock.writeLock().unlock();
+ }
}
/**
@@ -651,7 +683,7 @@ public class GridH2Table extends TableBase {
if (cloneIdx != null)
database.addSchemaObject(ses, cloneIdx);
- setModified();
+ incrementModificationCounter();
return idx;
}
@@ -955,7 +987,7 @@ public class GridH2Table extends TableBase {
desc.refreshMetadataFromTypeDescriptor();
- setModified();
+ incrementModificationCounter();
}
finally {
unlock(true);
@@ -963,9 +995,10 @@ public class GridH2Table extends TableBase {
}
/**
+ * Drop columns.
*
- * @param cols
- * @param ifExists
+ * @param cols Columns.
+ * @param ifExists If EXISTS flag.
*/
public void dropColumns(List<String> cols, boolean ifExists) {
assert !ifExists || cols.size() == 1;
@@ -1017,7 +1050,7 @@ public class GridH2Table extends TableBase {
((GridH2IndexBase)idx).refreshColumnIds();
}
- setModified();
+ incrementModificationCounter();
}
finally {
unlock(true);
@@ -1046,6 +1079,15 @@ public class GridH2Table extends TableBase {
}
/**
+ * Increment modification counter to force recompilation of existing prepared statements.
+ */
+ private void incrementModificationCounter() {
+ assert lock.isWriteLockedByCurrentThread();
+
+ setModified();
+ }
+
+ /**
* Set insert hack flag.
*
* @param val Value.
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicSqlRestoreTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicSqlRestoreTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicSqlRestoreTest.java
index f7dc7b4..d009f33 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicSqlRestoreTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicSqlRestoreTest.java
@@ -18,12 +18,20 @@
package org.apache.ignite.internal.processors.cache;
import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.sql.Timestamp;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.Ignition;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.query.SqlFieldsQuery;
@@ -33,8 +41,10 @@ import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.PA;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.NotNull;
@@ -44,6 +54,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
/**
*
*/
+@SuppressWarnings("Duplicates")
public class IgniteDynamicSqlRestoreTest extends GridCommonAbstractTest implements Serializable {
public static final String TEST_CACHE_NAME = "test";
@@ -117,7 +128,7 @@ public class IgniteDynamicSqlRestoreTest extends GridCommonAbstractTest implemen
//and: change data
try (IgniteDataStreamer<Object, Object> s = ig.dataStreamer(TEST_CACHE_NAME)) {
s.allowOverwrite(true);
- for (int i = 0; i < 5_000; i++)
+ for (int i = 0; i < 50; i++)
s.addData(i, null);
}
@@ -134,7 +145,7 @@ public class IgniteDynamicSqlRestoreTest extends GridCommonAbstractTest implemen
//then: everything is ok
try (IgniteDataStreamer<Object, Object> s = ig1.dataStreamer(TEST_CACHE_NAME)) {
s.allowOverwrite(true);
- for (int i = 0; i < 50_000; i++) {
+ for (int i = 0; i < 50; i++) {
BinaryObject bo = ig1.binary().builder(TEST_INDEX_OBJECT)
.setField("a", i, Object.class)
.setField("b", String.valueOf(i), Object.class)
@@ -147,12 +158,132 @@ public class IgniteDynamicSqlRestoreTest extends GridCommonAbstractTest implemen
IgniteCache<Object, Object> cache = ig1.cache(TEST_CACHE_NAME);
- assertThat(doExplainPlan(cache, "explain select * from TestIndexObject where a > 5"), containsString("myindexa"));
+ assertIndexUsed(cache, "explain select * from TestIndexObject where a > 5", "myindexa");
assertFalse(cache.query(new SqlFieldsQuery("SELECT a,b,c FROM TestIndexObject limit 1")).getAll().isEmpty());
}
}
/**
+ * @throws Exception If failed.
+ */
+ @SuppressWarnings("AssertWithSideEffects")
+ public void testIndexCreationWhenNodeStopped() throws Exception {
+ // Start topology.
+ startGrid(0);
+ Ignite srv2 = startGrid(1);
+ Ignite cli;
+
+ Ignition.setClientMode(true);
+
+ try {
+ cli = startGrid(2);
+ }
+ finally {
+ Ignition.setClientMode(false);
+ }
+
+ cli.cluster().active(true);
+
+ // Create table, add some data.
+ int entryCnt = 50;
+
+ try (Connection conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1:10802")) {
+ executeJdbc(conn,
+ " CREATE TABLE PERSON (\n" +
+ " FIRST_NAME VARCHAR,\n" +
+ " LAST_NAME VARCHAR,\n" +
+ " ADDRESS VARCHAR,\n" +
+ " LANG VARCHAR,\n" +
+ " BIRTH_DATE TIMESTAMP,\n" +
+ " CONSTRAINT PK_PESON PRIMARY KEY (FIRST_NAME,LAST_NAME,ADDRESS,LANG)\n" +
+ " ) WITH \"key_type=PersonKeyType, CACHE_NAME=PersonCache, value_type=PersonValueType, AFFINITY_KEY=FIRST_NAME,template=PARTITIONED,backups=1\"");
+
+ try (PreparedStatement stmt = conn.prepareStatement(
+ "insert into Person(LANG, FIRST_NAME, ADDRESS, LAST_NAME, BIRTH_DATE) values(?,?,?,?,?)")) {
+ for (int i = 0; i < entryCnt; i++) {
+ String s = String.valueOf(i);
+
+ stmt.setString(1, s);
+ stmt.setString(2, s);
+ stmt.setString(3, s);
+ stmt.setString(4, s);
+ stmt.setTimestamp(5, new Timestamp(System.currentTimeMillis()));
+
+ stmt.executeUpdate();
+ }
+ }
+ }
+
+ // Stop second node.
+ srv2.close();
+
+ // Create an index on remaining node.
+ try (Connection conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1:10802")) {
+ executeJdbc(conn, "create index PERSON_FIRST_NAME_IDX on PERSON(FIRST_NAME)");
+ }
+
+ // Restart second node.
+ startGrid(1);
+
+ // Await for index rebuild on started node.
+ assert GridTestUtils.waitForCondition(new PA() {
+ @Override public boolean apply() {
+ try (Connection conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1:10801")) {
+ try (PreparedStatement stmt = conn.prepareStatement(
+ "EXPLAIN SELECT * FROM Person USE INDEX(PERSON_FIRST_NAME_IDX) WHERE FIRST_NAME=?")) {
+ stmt.setString(1, String.valueOf(1));
+
+ StringBuilder fullPlan = new StringBuilder();
+
+ try (ResultSet rs = stmt.executeQuery()) {
+ while (rs.next())
+ fullPlan.append(rs.getString(1)).append("; ");
+ }
+
+ System.out.println("PLAN: " + fullPlan);
+
+ return fullPlan.toString().contains("PUBLIC.PERSON_FIRST_NAME_IDX");
+ }
+ }
+ catch (Exception e) {
+ throw new RuntimeException("Query failed.", e);
+ }
+ }
+ }, 5_000);
+
+ // Make sure that data could be queried.
+ try (Connection conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1:10802")) {
+ try (PreparedStatement stmt = conn.prepareStatement(
+ "SELECT COUNT(*) FROM Person USE INDEX(PERSON_FIRST_NAME_IDX) WHERE FIRST_NAME=?")) {
+ for (int i = 0; i < entryCnt; i ++) {
+ stmt.setString(1, String.valueOf(i));
+
+ try (ResultSet rs = stmt.executeQuery()) {
+ rs.next();
+
+ long cnt = rs.getLong(1);
+
+ assertEquals(1L, cnt);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Execute a statement through JDBC connection.
+ *
+ * @param conn Connection.
+ * @param sql Statement.
+ * @throws Exception If failed.
+ */
+ private static void executeJdbc(Connection conn, String sql) throws Exception {
+ try (Statement stmt = conn.createStatement()) {
+ stmt.execute(sql);
+ }
+ }
+
+ /**
* @throws Exception if failed.
*/
public void testTakeConfigFromJoiningNodeOnInactiveGrid() throws Exception {
@@ -186,7 +317,7 @@ public class IgniteDynamicSqlRestoreTest extends GridCommonAbstractTest implemen
//then: config for cache was applying successful
IgniteCache<Object, Object> cache = ig.cache(TEST_CACHE_NAME);
- assertThat(doExplainPlan(cache, "explain select * from TestIndexObject where a > 5"), containsString("myindexa"));
+ assertIndexUsed(cache, "explain select * from TestIndexObject where a > 5", "myindexa");
assertFalse(cache.query(new SqlFieldsQuery("SELECT a,b,c FROM TestIndexObject limit 1")).getAll().isEmpty());
}
}
@@ -233,7 +364,7 @@ public class IgniteDynamicSqlRestoreTest extends GridCommonAbstractTest implemen
IgniteCache<Object, Object> cache = ig.cache(TEST_CACHE_NAME);
- assertThat(doExplainPlan(cache, "explain select * from TestIndexObject where a > 5"), containsString("myindexa"));
+ assertIndexUsed(cache, "explain select * from TestIndexObject where a > 5", "myindexa");
assertFalse(cache.query(new SqlFieldsQuery("SELECT a,b,c FROM TestIndexObject limit 1")).getAll().isEmpty());
}
}
@@ -241,6 +372,7 @@ public class IgniteDynamicSqlRestoreTest extends GridCommonAbstractTest implemen
/**
* @throws Exception if failed.
*/
+ @SuppressWarnings("ArraysAsListWithZeroOrOneArgument")
public void testMergeChangedConfigOnInactiveGrid() throws Exception {
{
//given: two started nodes with test table
@@ -288,7 +420,7 @@ public class IgniteDynamicSqlRestoreTest extends GridCommonAbstractTest implemen
//then: config should be merged
try (IgniteDataStreamer<Object, Object> s = ig1.dataStreamer(TEST_CACHE_NAME)) {
s.allowOverwrite(true);
- for (int i = 0; i < 5_000; i++) {
+ for (int i = 0; i < 50; i++) {
BinaryObject bo = ig1.binary().builder("TestIndexObject")
.setField("a", i, Object.class)
.setField("b", String.valueOf(i), Object.class)
@@ -300,13 +432,32 @@ public class IgniteDynamicSqlRestoreTest extends GridCommonAbstractTest implemen
IgniteCache<Object, Object> cache = ig1.cache(TEST_CACHE_NAME);
//then: index "myindexa" and column "b" restored from node "1"
- assertThat(doExplainPlan(cache, "explain select * from TestIndexObject where a > 5"), containsString("myindexa"));
- assertThat(doExplainPlan(cache, "explain select * from TestIndexObject where b > 5"), containsString("myindexb"));
+ assertIndexUsed(cache, "explain select * from TestIndexObject where a > 5", "myindexa");
+ assertIndexUsed(cache, "explain select * from TestIndexObject where b > 5", "myindexb");
assertFalse(cache.query(new SqlFieldsQuery("SELECT a,b FROM TestIndexObject limit 1")).getAll().isEmpty());
}
}
/**
+ * Make sure that index is used for the given statement.
+ *
+ * @param cache Cache.
+ * @param sql Statement.
+ * @param idx Index.
+ * @throws IgniteCheckedException If failed.
+ */
+ private void assertIndexUsed(IgniteCache<Object, Object> cache, String sql, String idx)
+ throws IgniteCheckedException {
+ assert GridTestUtils.waitForCondition(new PA() {
+ @Override public boolean apply() {
+ String plan = doExplainPlan(cache, sql);
+
+ return plan.contains(idx);
+ }
+ }, 10_000);
+ }
+
+ /**
* @throws Exception if failed.
*/
public void testTakeChangedConfigOnActiveGrid() throws Exception {
@@ -341,7 +492,7 @@ public class IgniteDynamicSqlRestoreTest extends GridCommonAbstractTest implemen
//then: config should be merged
try (IgniteDataStreamer<Object, Object> s = ig.dataStreamer(TEST_CACHE_NAME)) {
s.allowOverwrite(true);
- for (int i = 0; i < 5_000; i++) {
+ for (int i = 0; i < 50; i++) {
BinaryObject bo = ig.binary().builder("TestIndexObject")
.setField("a", i, Object.class)
.setField("b", String.valueOf(i), Object.class)
@@ -355,7 +506,7 @@ public class IgniteDynamicSqlRestoreTest extends GridCommonAbstractTest implemen
cache.indexReadyFuture().get();
- assertThat(doExplainPlan(cache, "explain select * from TestIndexObject where a > 5"), containsString("myindexa"));
+ assertIndexUsed(cache, "explain select * from TestIndexObject where a > 5", "myindexa");
assertFalse(cache.query(new SqlFieldsQuery("SELECT a,b,c FROM TestIndexObject limit 1")).getAll().isEmpty());
}
}
@@ -363,6 +514,7 @@ public class IgniteDynamicSqlRestoreTest extends GridCommonAbstractTest implemen
/**
* @throws Exception if failed.
*/
+ @SuppressWarnings("ConstantConditions")
public void testFailJoiningNodeBecauseDifferentSql() throws Exception {
{
//given: two started nodes with test table
@@ -407,6 +559,7 @@ public class IgniteDynamicSqlRestoreTest extends GridCommonAbstractTest implemen
/**
* @throws Exception if failed.
*/
+ @SuppressWarnings("ConstantConditions")
public void testFailJoiningNodeBecauseFieldInlineSizeIsDifferent() throws Exception {
{
//given: two started nodes with test table
@@ -417,13 +570,13 @@ public class IgniteDynamicSqlRestoreTest extends GridCommonAbstractTest implemen
IgniteCache cache = ig.getOrCreateCache(getTestTableConfiguration());
- cache.query(new SqlFieldsQuery("create index myindexa on TestIndexObject(a) INLINE_SIZE 1000")).getAll();
+ cache.query(new SqlFieldsQuery("create index myindexa on TestIndexObject(a) INLINE_SIZE 100")).getAll();
//stop one node and create index on other node
stopGrid(1);
cache.query(new SqlFieldsQuery("drop index myindexa")).getAll();
- cache.query(new SqlFieldsQuery("create index myindexa on TestIndexObject(a) INLINE_SIZE 2000")).getAll();
+ cache.query(new SqlFieldsQuery("create index myindexa on TestIndexObject(a) INLINE_SIZE 200")).getAll();
//and: stopped all grid
stopAllGrids();
@@ -447,6 +600,7 @@ public class IgniteDynamicSqlRestoreTest extends GridCommonAbstractTest implemen
/**
* @throws Exception if failed.
*/
+ @SuppressWarnings("ConstantConditions")
public void testFailJoiningNodeBecauseNeedConfigUpdateOnActiveGrid() throws Exception {
{
startGrid(0);
@@ -497,7 +651,7 @@ public class IgniteDynamicSqlRestoreTest extends GridCommonAbstractTest implemen
*/
private void fillTestData(Ignite ig) {
try (IgniteDataStreamer<Object, Object> s = ig.dataStreamer(TEST_CACHE_NAME)) {
- for (int i = 0; i < 50_000; i++) {
+ for (int i = 0; i < 500; i++) {
BinaryObject bo = ig.binary().builder("TestIndexObject")
.setField("a", i, Object.class)
.setField("b", String.valueOf(i), Object.class)
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b0ce92d/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildSelfTest.java
index c5f1441..d8ba060 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildSelfTest.java
@@ -24,12 +24,14 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManager;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
import org.apache.ignite.internal.processors.cache.index.DynamicIndexAbstractSelfTest;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager;
import org.apache.ignite.internal.processors.query.GridQueryProcessor;
+import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorClosure;
import org.apache.ignite.internal.util.lang.GridCursor;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -38,7 +40,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
*/
public class GridIndexRebuildSelfTest extends DynamicIndexAbstractSelfTest {
/** Data size. */
- protected static final int AMOUNT = 300;
+ protected static final int AMOUNT = 50;
/** Data size. */
protected static final String CACHE_NAME = "T";
@@ -228,13 +230,14 @@ public class GridIndexRebuildSelfTest extends DynamicIndexAbstractSelfTest {
private boolean firstRbld = true;
/** {@inheritDoc} */
- @Override public void rebuildIndexesFromHash(String cacheName) throws IgniteCheckedException {
+ @Override protected void rebuildIndexesFromHash0(GridCacheContext cctx, SchemaIndexCacheVisitorClosure clo)
+ throws IgniteCheckedException {
if (!firstRbld)
U.await(INSTANCE.rebuildLatch);
else
firstRbld = false;
- super.rebuildIndexesFromHash(cacheName);
+ super.rebuildIndexesFromHash0(cctx, clo);
}
}
}
[11/50] [abbrv] ignite git commit: IGNITE-10405: [ML] Refactor
GaussianNaiveBayesTrainerExample to read data sample from file
Posted by sb...@apache.org.
IGNITE-10405: [ML] Refactor GaussianNaiveBayesTrainerExample to
read data sample from file
This closes #5551
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c6a05f8f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c6a05f8f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c6a05f8f
Branch: refs/heads/ignite-10044
Commit: c6a05f8f2d190b67c1e06ed1a2856ed414198132
Parents: 0cd303f
Author: zaleslaw <za...@gmail.com>
Authored: Tue Dec 4 14:18:16 2018 +0300
Committer: Yury Babak <yb...@gridgain.com>
Committed: Tue Dec 4 14:18:16 2018 +0300
----------------------------------------------------------------------
.../GaussianNaiveBayesTrainerExample.java | 25 ++--
.../ignite/examples/ml/util/SandboxMLCache.java | 19 ---
.../ignite/examples/util/IrisDataset.java | 129 -------------------
3 files changed, 12 insertions(+), 161 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c6a05f8f/examples/src/main/java/org/apache/ignite/examples/ml/naivebayes/GaussianNaiveBayesTrainerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/naivebayes/GaussianNaiveBayesTrainerExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/naivebayes/GaussianNaiveBayesTrainerExample.java
index b5e36ea..7cbc6d1 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/naivebayes/GaussianNaiveBayesTrainerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/naivebayes/GaussianNaiveBayesTrainerExample.java
@@ -17,6 +17,7 @@
package org.apache.ignite.examples.ml.naivebayes;
+import java.io.FileNotFoundException;
import java.util.Arrays;
import javax.cache.Cache;
import org.apache.ignite.Ignite;
@@ -24,14 +25,12 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.Ignition;
import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.ScanQuery;
+import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
import org.apache.ignite.examples.ml.util.SandboxMLCache;
import org.apache.ignite.ml.math.primitives.vector.Vector;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
import org.apache.ignite.ml.naivebayes.gaussian.GaussianNaiveBayesModel;
import org.apache.ignite.ml.naivebayes.gaussian.GaussianNaiveBayesTrainer;
-import static org.apache.ignite.examples.util.IrisDataset.irisDatasetFirstAndSecondClasses;
-
/**
* Run naive Bayes classification model based on <a href="https://en.wikipedia.org/wiki/Naive_Bayes_classifier"> naive
* Bayes classifier</a> algorithm ({@link GaussianNaiveBayesTrainer}) over distributed cache.
@@ -49,15 +48,15 @@ import static org.apache.ignite.examples.util.IrisDataset.irisDatasetFirstAndSec
*/
public class GaussianNaiveBayesTrainerExample {
/** Run example. */
- public static void main(String[] args) throws InterruptedException {
+ public static void main(String[] args) throws FileNotFoundException {
System.out.println();
System.out.println(">>> Naive Bayes classification model over partitioned dataset usage example started.");
// Start ignite grid.
try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
System.out.println(">>> Ignite grid started.");
- IgniteCache<Integer, double[]> dataCache = new SandboxMLCache(ignite)
- .fillCacheWith(irisDatasetFirstAndSecondClasses);
+ IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
+ .fillCacheWith(MLSandboxDatasets.TWO_CLASSED_IRIS);
System.out.println(">>> Create new naive Bayes classification trainer object.");
GaussianNaiveBayesTrainer trainer = new GaussianNaiveBayesTrainer();
@@ -66,8 +65,8 @@ public class GaussianNaiveBayesTrainerExample {
GaussianNaiveBayesModel mdl = trainer.fit(
ignite,
dataCache,
- (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
- (k, v) -> v[0]
+ (k, v) -> v.copyOfRange(1, v.size()),
+ (k, v) -> v.get(0)
);
System.out.println(">>> Naive Bayes model: " + mdl);
@@ -78,11 +77,11 @@ public class GaussianNaiveBayesTrainerExample {
// Build confusion matrix. See https://en.wikipedia.org/wiki/Confusion_matrix
int[][] confusionMtx = {{0, 0}, {0, 0}};
- try (QueryCursor<Cache.Entry<Integer, double[]>> observations = dataCache.query(new ScanQuery<>())) {
- for (Cache.Entry<Integer, double[]> observation : observations) {
- double[] val = observation.getValue();
- Vector inputs = VectorUtils.of(Arrays.copyOfRange(val, 1, val.length));
- double groundTruth = val[0];
+ try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(new ScanQuery<>())) {
+ for (Cache.Entry<Integer, Vector> observation : observations) {
+ Vector val = observation.getValue();
+ Vector inputs = val.copyOfRange(1, val.size());
+ double groundTruth = val.get(0);
double prediction = mdl.apply(inputs);
http://git-wip-us.apache.org/repos/asf/ignite/blob/c6a05f8f/examples/src/main/java/org/apache/ignite/examples/ml/util/SandboxMLCache.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/util/SandboxMLCache.java b/examples/src/main/java/org/apache/ignite/examples/ml/util/SandboxMLCache.java
index a8431de..20b22ef 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/util/SandboxMLCache.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/util/SandboxMLCache.java
@@ -69,25 +69,6 @@ public class SandboxMLCache {
/**
* Fills cache with data and returns it.
*
- * @param data Data to fill the cache with.
- * @return Filled Ignite Cache.
- */
- public IgniteCache<Integer, Vector> getVectors(double[][] data) {
- CacheConfiguration<Integer, Vector> cacheConfiguration = new CacheConfiguration<>();
- cacheConfiguration.setName("TEST_" + UUID.randomUUID());
- cacheConfiguration.setAffinity(new RendezvousAffinityFunction(false, 10));
-
- IgniteCache<Integer, Vector> cache = ignite.createCache(cacheConfiguration);
-
- for (int i = 0; i < data.length; i++)
- cache.put(i, VectorUtils.of(data[i]));
-
- return cache;
- }
-
- /**
- * Fills cache with data and returns it.
- *
* @param dataset The chosen dataset.
* @return Filled Ignite Cache.
* @throws FileNotFoundException If file not found.
http://git-wip-us.apache.org/repos/asf/ignite/blob/c6a05f8f/examples/src/main/java/org/apache/ignite/examples/util/IrisDataset.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/util/IrisDataset.java b/examples/src/main/java/org/apache/ignite/examples/util/IrisDataset.java
deleted file mode 100644
index 53080e8..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/util/IrisDataset.java
+++ /dev/null
@@ -1,129 +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.examples.util;
-
-/** Contains data from the <a href="https://en.wikipedia.org/wiki/Iris_flower_data_set"></a>Iris dataset</a>. */
-public final class IrisDataset {
-
- /** The 1st and 2nd classes from the Iris dataset. */
- public static final double[][] irisDatasetFirstAndSecondClasses = {
- {0, 5.1, 3.5, 1.4, 0.2},
- {0, 4.9, 3, 1.4, 0.2},
- {0, 4.7, 3.2, 1.3, 0.2},
- {0, 4.6, 3.1, 1.5, 0.2},
- {0, 5, 3.6, 1.4, 0.2},
- {0, 5.4, 3.9, 1.7, 0.4},
- {0, 4.6, 3.4, 1.4, 0.3},
- {0, 5, 3.4, 1.5, 0.2},
- {0, 4.4, 2.9, 1.4, 0.2},
- {0, 4.9, 3.1, 1.5, 0.1},
- {0, 5.4, 3.7, 1.5, 0.2},
- {0, 4.8, 3.4, 1.6, 0.2},
- {0, 4.8, 3, 1.4, 0.1},
- {0, 4.3, 3, 1.1, 0.1},
- {0, 5.8, 4, 1.2, 0.2},
- {0, 5.7, 4.4, 1.5, 0.4},
- {0, 5.4, 3.9, 1.3, 0.4},
- {0, 5.1, 3.5, 1.4, 0.3},
- {0, 5.7, 3.8, 1.7, 0.3},
- {0, 5.1, 3.8, 1.5, 0.3},
- {0, 5.4, 3.4, 1.7, 0.2},
- {0, 5.1, 3.7, 1.5, 0.4},
- {0, 4.6, 3.6, 1, 0.2},
- {0, 5.1, 3.3, 1.7, 0.5},
- {0, 4.8, 3.4, 1.9, 0.2},
- {0, 5, 3, 1.6, 0.2},
- {0, 5, 3.4, 1.6, 0.4},
- {0, 5.2, 3.5, 1.5, 0.2},
- {0, 5.2, 3.4, 1.4, 0.2},
- {0, 4.7, 3.2, 1.6, 0.2},
- {0, 4.8, 3.1, 1.6, 0.2},
- {0, 5.4, 3.4, 1.5, 0.4},
- {0, 5.2, 4.1, 1.5, 0.1},
- {0, 5.5, 4.2, 1.4, 0.2},
- {0, 4.9, 3.1, 1.5, 0.1},
- {0, 5, 3.2, 1.2, 0.2},
- {0, 5.5, 3.5, 1.3, 0.2},
- {0, 4.9, 3.1, 1.5, 0.1},
- {0, 4.4, 3, 1.3, 0.2},
- {0, 5.1, 3.4, 1.5, 0.2},
- {0, 5, 3.5, 1.3, 0.3},
- {0, 4.5, 2.3, 1.3, 0.3},
- {0, 4.4, 3.2, 1.3, 0.2},
- {0, 5, 3.5, 1.6, 0.6},
- {0, 5.1, 3.8, 1.9, 0.4},
- {0, 4.8, 3, 1.4, 0.3},
- {0, 5.1, 3.8, 1.6, 0.2},
- {0, 4.6, 3.2, 1.4, 0.2},
- {0, 5.3, 3.7, 1.5, 0.2},
- {0, 5, 3.3, 1.4, 0.2},
- {1, 7, 3.2, 4.7, 1.4},
- {1, 6.4, 3.2, 4.5, 1.5},
- {1, 6.9, 3.1, 4.9, 1.5},
- {1, 5.5, 2.3, 4, 1.3},
- {1, 6.5, 2.8, 4.6, 1.5},
- {1, 5.7, 2.8, 4.5, 1.3},
- {1, 6.3, 3.3, 4.7, 1.6},
- {1, 4.9, 2.4, 3.3, 1},
- {1, 6.6, 2.9, 4.6, 1.3},
- {1, 5.2, 2.7, 3.9, 1.4},
- {1, 5, 2, 3.5, 1},
- {1, 5.9, 3, 4.2, 1.5},
- {1, 6, 2.2, 4, 1},
- {1, 6.1, 2.9, 4.7, 1.4},
- {1, 5.6, 2.9, 3.6, 1.3},
- {1, 6.7, 3.1, 4.4, 1.4},
- {1, 5.6, 3, 4.5, 1.5},
- {1, 5.8, 2.7, 4.1, 1},
- {1, 6.2, 2.2, 4.5, 1.5},
- {1, 5.6, 2.5, 3.9, 1.1},
- {1, 5.9, 3.2, 4.8, 1.8},
- {1, 6.1, 2.8, 4, 1.3},
- {1, 6.3, 2.5, 4.9, 1.5},
- {1, 6.1, 2.8, 4.7, 1.2},
- {1, 6.4, 2.9, 4.3, 1.3},
- {1, 6.6, 3, 4.4, 1.4},
- {1, 6.8, 2.8, 4.8, 1.4},
- {1, 6.7, 3, 5, 1.7},
- {1, 6, 2.9, 4.5, 1.5},
- {1, 5.7, 2.6, 3.5, 1},
- {1, 5.5, 2.4, 3.8, 1.1},
- {1, 5.5, 2.4, 3.7, 1},
- {1, 5.8, 2.7, 3.9, 1.2},
- {1, 6, 2.7, 5.1, 1.6},
- {1, 5.4, 3, 4.5, 1.5},
- {1, 6, 3.4, 4.5, 1.6},
- {1, 6.7, 3.1, 4.7, 1.5},
- {1, 6.3, 2.3, 4.4, 1.3},
- {1, 5.6, 3, 4.1, 1.3},
- {1, 5.5, 2.5, 4, 1.3},
- {1, 5.5, 2.6, 4.4, 1.2},
- {1, 6.1, 3, 4.6, 1.4},
- {1, 5.8, 2.6, 4, 1.2},
- {1, 5, 2.3, 3.3, 1},
- {1, 5.6, 2.7, 4.2, 1.3},
- {1, 5.7, 3, 4.2, 1.2},
- {1, 5.7, 2.9, 4.2, 1.3},
- {1, 6.2, 2.9, 4.3, 1.3},
- {1, 5.1, 2.5, 3, 1.1},
- {1, 5.7, 2.8, 4.1, 1.3},
- };
-
- /** */
- private IrisDataset() {
- }
-}
[16/50] [abbrv] ignite git commit: IGNITE-8379 Fix PDS Compatibility
tests, javadocs.
Posted by sb...@apache.org.
IGNITE-8379 Fix PDS Compatibility tests, javadocs.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/72517181
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/72517181
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/72517181
Branch: refs/heads/ignite-10044
Commit: 72517181fc29d2b8eb3af93994b968675f3d29a6
Parents: ff6b8ee
Author: Dmitriy Pavlov <dp...@apache.org>
Authored: Tue Dec 4 17:19:24 2018 +0300
Committer: Dmitriy Pavlov <dp...@apache.org>
Committed: Tue Dec 4 17:19:24 2018 +0300
----------------------------------------------------------------------
.../persistence/IgnitePKIndexesMigrationToUnwrapPkTest.java | 4 ++--
.../junits/IgniteCompatibilityAbstractTest.java | 9 +++++++--
2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/72517181/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgnitePKIndexesMigrationToUnwrapPkTest.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgnitePKIndexesMigrationToUnwrapPkTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgnitePKIndexesMigrationToUnwrapPkTest.java
index da77dd8..60b6464 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgnitePKIndexesMigrationToUnwrapPkTest.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/IgnitePKIndexesMigrationToUnwrapPkTest.java
@@ -60,8 +60,8 @@ public class IgnitePKIndexesMigrationToUnwrapPkTest extends IgnitePersistenceCom
}
/** {@inheritDoc} */
- @Override @NotNull protected Set<String> getExcluded(Collection<Dependency> dependencies) {
- Set<String> excluded = super.getExcluded(dependencies);
+ @Override protected Set<String> getExcluded(String ver, Collection<Dependency> dependencies) {
+ Set<String> excluded = super.getExcluded(ver, dependencies);
excluded.add("h2");
http://git-wip-us.apache.org/repos/asf/ignite/blob/72517181/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
index 2d73bd8..b0e4001 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
@@ -169,7 +169,7 @@ public abstract class IgniteCompatibilityAbstractTest extends GridCommonAbstract
final Collection<Dependency> dependencies = getDependencies(ver);
- Set<String> excluded = getExcluded(dependencies);
+ Set<String> excluded = getExcluded(ver, dependencies);
StringBuilder pathBuilder = new StringBuilder();
@@ -247,10 +247,15 @@ public abstract class IgniteCompatibilityAbstractTest extends GridCommonAbstract
}
/**
+ * These dependencies will not be translated from current code dependencies into separate node's classpath.
+ *
+ * Include here all dependencies which will be set up manually, leave all version independent dependencies.
+ *
+ * @param ver Ignite version.
* @param dependencies Dependencies to filter.
* @return Set of paths to exclude.
*/
- @NotNull protected Set<String> getExcluded(Collection<Dependency> dependencies) {
+ protected Set<String> getExcluded(String ver, Collection<Dependency> dependencies) {
Set<String> excluded = new HashSet<>();
for (Dependency dependency : dependencies) {
[34/50] [abbrv] ignite git commit: IGNITE-10049: MVCC: Create "Cache
4" test suite for MVCC mode. This closes #5499.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CashEventWithTxLabelTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CashEventWithTxLabelTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CashEventWithTxLabelTest.java
deleted file mode 100644
index da25288..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CashEventWithTxLabelTest.java
+++ /dev/null
@@ -1,487 +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.internal.processors.cache;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Consumer;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheEntryProcessor;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.events.CacheEvent;
-import org.apache.ignite.events.Event;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.util.lang.IgnitePair;
-import org.apache.ignite.lang.IgnitePredicate;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.apache.ignite.transactions.Transaction;
-import org.apache.ignite.transactions.TransactionConcurrency;
-import org.apache.ignite.transactions.TransactionIsolation;
-import org.junit.Assert;
-
-import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT;
-import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ;
-import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED;
-
-/**
- * Test to check passing transaction's label for EVT_CACHE_OBJECT_READ, EVT_CACHE_OBJECT_PUT,
- * EVT_CACHE_OBJECT_REMOVED events.
- */
-public class CashEventWithTxLabelTest extends GridCommonAbstractTest {
- /** Types event to be checked. */
- private static final int[] CACHE_EVENT_TYPES = {EVT_CACHE_OBJECT_READ, EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_REMOVED};
-
- /** Transaction label. */
- private static final String TX_LABEL = "TX_LABEL";
-
- /** Number of server nodes. */
- private static final int SRVS = 3;
-
- /** Number of client nodes. */
- private static final int CLIENTS = 1;
-
- /** Cache name. */
- public static final String CACHE_NAME = "cache";
-
- /** Client or server mode to start Ignite instance. */
- private static boolean client;
-
- /** Key related to primary node. */
- private Integer primaryKey = 0;
-
- /** Key related to backup node. */
- private Integer backupKey = 0;
-
- /** Current cash backup count. */
- private int backupCnt;
-
- /** Current transaction isolation level. */
- private TransactionIsolation isolation;
-
- /** Current transaction concurrency level. */
- private TransactionConcurrency concurrency;
-
- /** All failed tests information, */
- private ArrayList<String> errors = new ArrayList<>();
-
- /** Count of errors on previous iteration of testing. */
- private int prevErrCnt = 0;
-
- /** List to keep all events with no tx label between run tests */
- private static List<CacheEvent> wrongEvts = Collections.synchronizedList(new ArrayList<>());
-
- /** Simple entry processor to use for tests */
- private static CacheEntryProcessor entryProcessor = (CacheEntryProcessor)(entry, objects) -> entry.getValue();
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- return super.getConfiguration(igniteInstanceName).setClientMode(client);
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- super.beforeTestsStarted();
-
- client = false;
-
- startGridsMultiThreaded(SRVS);
-
- client = true;
-
- startGridsMultiThreaded(SRVS, CLIENTS);
-
- client = false;
-
- waitForDiscovery(primary(), backup1(), backup2(), client());
-
- registerEventListeners(primary(), backup1(), backup2(), client());
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- super.afterTestsStopped();
-
- stopAllGrids();
- }
-
- /**
- * Check all cases for passing transaction label in cash event.
- *
- * @throws Exception If failed.
- */
- public void testPassTxLabelInCashEventForAllCases() throws Exception {
- Ignite[] nodes = {client(), primary(), backup1(), backup2()};
-
- for (int backupCnt = 0; backupCnt < SRVS; backupCnt++) {
- this.backupCnt = backupCnt;
-
- prepareCache(backupCnt);
-
- for (TransactionIsolation isolation : TransactionIsolation.values()) {
- this.isolation = isolation;
-
- for (TransactionConcurrency concurrency : TransactionConcurrency.values()) {
- this.concurrency = concurrency;
-
- for (int i = 0; i < nodes.length - 1; i++) {
- Ignite nodeForPut = nodes[i];
- Ignite nodeForGet = nodes[i + 1];
-
- singleWriteReadRemoveTest(nodeForPut, nodeForGet);
-
- multiWriteReadRemoveTest(nodeForPut, nodeForGet);
-
- singleNodeBatchWriteReadRemoveTest(nodeForPut, nodeForGet);
-
- multiNodeBatchWriteReadRemoveTest(nodeForPut, nodeForGet);
-
- writeInvokeRemoveTest(nodeForPut, nodeForGet);
-
- writeInvokeAllRemoveTest(nodeForPut, nodeForGet);
- }
- }
- }
- }
-
- String listOfFailedTests = String.join(",\n", errors);
-
- Assert.assertTrue("Have been received " + prevErrCnt + " cache events with incorrect txlabel.\n" +
- "Failed tests:" + listOfFailedTests,
- errors.isEmpty());
- }
-
- /**
- * Check error after run test. In case error occured information about failed test will be added to errors list.
- *
- * @param testName Name of test which result will be checked.
- * @param node1 First node
- * @param node2 Second node
- */
- private void checkResult(String testName, Ignite node1, Ignite node2) {
- int currErrCnt = wrongEvts.size();
-
- if (prevErrCnt != currErrCnt) {
- prevErrCnt = currErrCnt;
-
- errors.add(String.format("%s backCnt-%s, %s, %s, node1-%s, node2-%s",
- testName, backupCnt, isolation, concurrency, nodeType(node1), nodeType(node2)));
- }
- }
-
- /**
- * @param node Ignite node
- * @return Node type in the test
- */
- private String nodeType(Ignite node) {
- if (client().equals(node))
- return "CLIENT";
- else if (primary().equals(node))
- return "PRIMARY";
- else if (backup1().equals(node))
- return "BACKUP1";
- else if (backup2().equals(node))
- return "BACKUP2";
- else
- return "UNKNOWN";
- }
-
- /**
- * Test single put, get, remove operations.
- *
- * @param instanceToPut Ignite instance to put test data.
- * @param instanceToGet Ignite instance to get test data.
- */
- private void singleWriteReadRemoveTest(Ignite instanceToPut, Ignite instanceToGet) {
- runTransactionally(instanceToPut, (Ignite ign) -> {
- ign.cache(CACHE_NAME).put(primaryKey, 3);
- });
-
- runTransactionally(instanceToGet, (Ignite ign) -> {
- ign.cache(CACHE_NAME).get(primaryKey);
- });
-
- runTransactionally(instanceToGet, (Ignite ign) -> {
- ign.cache(CACHE_NAME).remove(primaryKey);
- });
-
- checkResult("singleWriteReadRemoveTest", instanceToPut, instanceToGet);
- }
-
- /**
- * Test multi put, get, remove operations
- *
- * @param instanceToPut Ignite instance to put test data.
- * @param instanceToGet Ignite instance to get test data.
- */
- private void multiWriteReadRemoveTest(Ignite instanceToPut, Ignite instanceToGet) {
- runTransactionally(instanceToPut, (Ignite ign) -> {
- ign.cache(CACHE_NAME).put(primaryKey, 2);
- ign.cache(CACHE_NAME).put(backupKey, 3);
- });
-
- runTransactionally(instanceToGet, (Ignite ign) -> {
- ign.cache(CACHE_NAME).get(primaryKey);
- ign.cache(CACHE_NAME).get(backupKey);
- });
-
- runTransactionally(instanceToGet, (Ignite ign) -> {
- ign.cache(CACHE_NAME).remove(primaryKey);
- ign.cache(CACHE_NAME).remove(backupKey);
- });
-
- checkResult("multiWriteReadRemoveTest", instanceToPut, instanceToGet);
- }
-
- /**
- * Test multi nodes batch write-read
- *
- * @param instanceToPut Ignite instance to put test data.
- * @param instanceToGet Ignite instance to get test data.
- */
- private void multiNodeBatchWriteReadRemoveTest(Ignite instanceToPut, Ignite instanceToGet) {
- Map<Integer, Integer> keyValuesMap = IntStream.range(0, 100).boxed()
- .collect(Collectors.toMap(Function.identity(), Function.identity()));
-
- runTransactionally(instanceToPut, (Ignite ign) -> {
- ign.cache(CACHE_NAME).putAll(keyValuesMap);
- });
-
- runTransactionally(instanceToGet, (Ignite ign) -> {
- ign.cache(CACHE_NAME).getAll(keyValuesMap.keySet());
- });
-
- runTransactionally(instanceToGet, (Ignite ign) -> {
- ign.cache(CACHE_NAME).removeAll(keyValuesMap.keySet());
- });
-
- checkResult("multiNodeBatchWriteReadRemoveTest", instanceToPut, instanceToGet);
- }
-
- /**
- * Test single node batch write-read-remove
- *
- * @param instanceToPut Ignite instance to put test data.
- * @param instanceToGet Ignite instance to get test data.
- */
- private void singleNodeBatchWriteReadRemoveTest(Ignite instanceToPut, Ignite instanceToGet) {
- IgnitePair<Integer> keys = evaluatePrimaryAndBackupKeys(primaryKey + 1, backupKey + 1);
-
- Map<Integer, Integer> keyValuesMap = new HashMap<>();
- keyValuesMap.put(primaryKey, 1);
- keyValuesMap.put(keys.get1(), 2);
-
- runTransactionally(instanceToPut, (Ignite ign) -> {
- ign.cache(CACHE_NAME).putAll(keyValuesMap);
- });
-
- runTransactionally(instanceToGet, (Ignite ign) -> {
- ign.cache(CACHE_NAME).getAll(keyValuesMap.keySet());
- });
-
- runTransactionally(instanceToGet, (Ignite ign) -> {
- ign.cache(CACHE_NAME).removeAll(keyValuesMap.keySet());
- });
-
- checkResult("oneNodeBatchWriteReadRemoveTest", instanceToPut, instanceToGet);
- }
-
- /**
- * Test put-invoke-remove
- *
- * @param instanceToPut Ignite instance to put test data.
- * @param instanceToGet Ignite instance to get test data.
- */
- @SuppressWarnings("unchecked")
- private void writeInvokeRemoveTest(Ignite instanceToPut, Ignite instanceToGet) {
- runTransactionally(instanceToGet, (Ignite ign) -> {
- ign.cache(CACHE_NAME).put(primaryKey, 3);
- });
-
- runTransactionally(instanceToPut, (Ignite ign) -> {
- ign.cache(CACHE_NAME).invoke(primaryKey, entryProcessor);
- ign.cache(CACHE_NAME).invoke(backupKey, entryProcessor);
- });
-
- runTransactionally(instanceToGet, (Ignite ign) -> {
- ign.cache(CACHE_NAME).remove(primaryKey);
- });
-
- checkResult("writeInvokeRemoveTest", instanceToPut, instanceToGet);
- }
-
- /**
- * Test putAll-invokeAll-removeAll
- *
- * @param instanceToPut Ignite instance to put test data.
- * @param instanceToGet Ignite instance to get test data.
- */
- @SuppressWarnings("unchecked")
- private void writeInvokeAllRemoveTest(Ignite instanceToPut, Ignite instanceToGet) {
- Map<Integer, Integer> keyValuesMap = IntStream.range(0, 100).boxed()
- .collect(Collectors.toMap(Function.identity(), Function.identity()));
-
- runTransactionally(instanceToGet, (Ignite ign) -> {
- ign.cache(CACHE_NAME).putAll(keyValuesMap);
- });
-
- runTransactionally(instanceToPut, (Ignite ign) -> {
- ign.cache(CACHE_NAME).invokeAll(keyValuesMap.keySet(), entryProcessor);
- });
-
- runTransactionally(instanceToGet, (Ignite ign) -> {
- ign.cache(CACHE_NAME).removeAll(keyValuesMap.keySet());
- });
-
- checkResult("WriteInvokeAllRemoveTest", instanceToPut, instanceToGet);
- }
-
- /**
- * Run command in transaction.
- *
- * @param startNode Ignite node to start transaction and run passed command.
- * @param cmdInTx Command which should be done in transaction.
- */
- private void runTransactionally(Ignite startNode, Consumer<Ignite> cmdInTx) {
- try (Transaction tx = startNode.transactions().withLabel(TX_LABEL).txStart(concurrency, isolation)) {
- cmdInTx.accept(startNode);
-
- tx.commit();
- }
- }
-
- /**
- * Add event listener to passed Ignite instances for cache event types.
- *
- * @param igns Ignite instances.
- */
- private void registerEventListeners(Ignite... igns) {
- if (igns != null) {
- for (Ignite ign : igns) {
- ign.events().enableLocal(CACHE_EVENT_TYPES);
- ign.events().localListen((IgnitePredicate<Event>)event -> {
- CacheEvent cacheEvt = (CacheEvent)event;
-
- if (!TX_LABEL.equals(cacheEvt.txLabel())) {
- log.error("Has been received event with incorrect label " + cacheEvt.txLabel() + " ," +
- " expected " + TX_LABEL + " label");
-
- wrongEvts.add(cacheEvt);
- }
-
- return true;
- }, CACHE_EVENT_TYPES);
- }
- }
- }
-
- /**
- * Create cache with passed number of backups and determinate primary and backup keys. If cache was created before
- * it will be removed before create new one.
- *
- * @param cacheBackups Number of backups for cache.
- * @throws InterruptedException In case of fail.
- */
- private void prepareCache(int cacheBackups) throws InterruptedException {
- IgniteCache<Object, Object> cache = client().cache(CACHE_NAME);
-
- if (cache != null)
- cache.destroy();
-
- client().createCache(
- new CacheConfiguration<Integer, Integer>()
- .setName(CACHE_NAME)
- .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
- .setCacheMode(CacheMode.PARTITIONED)
- .setBackups(cacheBackups)
- );
-
- awaitPartitionMapExchange();
-
- IgnitePair<Integer> keys = evaluatePrimaryAndBackupKeys(0, 0);
-
- primaryKey = keys.get1();
- backupKey = keys.get2();
- }
-
- /**
- * Evaluate primary and backup keys.
- *
- * @param primaryKeyStart Value from need to start calculate primary key.
- * @param backupKeyStart Value from need to start calculate backup key.
- * @return Pair of result. The first result is found primary key. The second is found backup key.
- */
- private IgnitePair<Integer> evaluatePrimaryAndBackupKeys(final int primaryKeyStart, final int backupKeyStart) {
- int primaryKey = primaryKeyStart;
- int backupKey = backupKeyStart;
-
- while (!client().affinity(CACHE_NAME).isPrimary(((IgniteKernal)primary()).localNode(), primaryKey))
- primaryKey++;
-
- while (!client().affinity(CACHE_NAME).isBackup(((IgniteKernal)primary()).localNode(), backupKey)
- && backupKey < 100 + backupKeyStart)
- backupKey++;
-
- return new IgnitePair<>(primaryKey, backupKey);
- }
-
- /**
- * Return primary node.
- *
- * @return Primary node.
- */
- private Ignite primary() {
- return ignite(0);
- }
-
- /**
- * Return first backup node.
- *
- * @return First backup node.
- */
- private Ignite backup1() {
- return ignite(1);
- }
-
- /**
- * Return second backup node.
- *
- * @return Second backup node.
- */
- private Ignite backup2() {
- return ignite(2);
- }
-
- /**
- * Return client node.
- *
- * @return Client node.
- */
- private Ignite client() {
- return ignite(3);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java
index 8f0e20f..d609ec7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java
@@ -25,6 +25,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
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.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -46,6 +47,13 @@ public class CrossCacheLockTest extends GridCommonAbstractTest {
private static final String CACHE2 = "cache2";
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
index 346e9f9..2e64c52 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
@@ -53,6 +53,7 @@ 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.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.jetbrains.annotations.Nullable;
@@ -92,7 +93,8 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest {
assert cnt >= 1 : "At least one grid must be started";
- initStoreStrategy();
+ if (!MvccFeatureChecker.forcedMvcc() || MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.CACHE_STORE))
+ initStoreStrategy();
startGrids(cnt);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java
index df3430f..c837e21 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java
@@ -39,6 +39,7 @@ import org.apache.ignite.internal.util.typedef.PE;
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.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
@@ -52,6 +53,13 @@ public class GridCacheMarshallingNodeJoinSelfTest extends GridCommonAbstractTest
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java
index 800f4ba..2027117 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java
@@ -29,6 +29,7 @@ import org.apache.ignite.testframework.GridTestUtils;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.testframework.MvccFeatureChecker.assertMvccWriteConflict;
/**
* Multinode update test.
@@ -97,8 +98,20 @@ public abstract class GridCacheMultinodeUpdateAbstractSelfTest extends GridCache
final IgniteCache<Integer, Integer> cache = grid(idx).cache(DEFAULT_CACHE_NAME);
- for (int i = 0; i < ITERATIONS_PER_THREAD && !failed; i++)
- cache.invoke(key, new IncProcessor());
+ for (int i = 0; i < ITERATIONS_PER_THREAD && !failed; i++) {
+ boolean updated = false;
+
+ while (!updated) {
+ try {
+ cache.invoke(key, new IncProcessor());
+
+ updated = true;
+ }
+ catch (Exception e) {
+ assertMvccWriteConflict(e);
+ }
+ }
+ }
return null;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java
index fbfb994..aa9f029 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
/**
*
@@ -39,6 +40,9 @@ public class GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest extends GridCa
/** {@inheritDoc} */
@Override public void testInvoke() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-809");
+ if (!MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-809");
+ else
+ super.testInvoke();
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java
index 4cdc7a4..c0738a3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -27,6 +28,13 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
*/
public class GridCacheMultinodeUpdateNearEnabledSelfTest extends GridCacheMultinodeUpdateAbstractSelfTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected NearCacheConfiguration nearConfiguration() {
return new NearCacheConfiguration();
}
@@ -38,6 +46,9 @@ public class GridCacheMultinodeUpdateNearEnabledSelfTest extends GridCacheMultin
/** {@inheritDoc} */
@Override public void testInvoke() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-809");
+ if (!MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-809");
+ else
+ super.testInvoke();
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
index c63f242..124e284 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
@@ -42,6 +42,7 @@ import org.apache.ignite.marshaller.jdk.JdkMarshaller;
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.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -66,6 +67,13 @@ public class GridCacheStoreManagerDeserializationTest extends GridCommonAbstract
/** Test cache name. */
protected static final String CACHE_NAME = "cache_name";
+ /** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
/**
* @return Cache mode.
*/
@@ -123,7 +131,7 @@ public class GridCacheStoreManagerDeserializationTest extends GridCommonAbstract
cc.setBackups(0);
- cc.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+ cc.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
return cc;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
index 0fd3fb9..ccecfb7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
@@ -33,6 +33,7 @@ import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
@@ -109,6 +110,30 @@ public class GridCacheVersionMultinodeTest extends GridCacheAbstractSelfTest {
/**
* @throws Exception If failed.
*/
+ public void testVersionMvccTx() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-8582");
+
+ atomicityMode = TRANSACTIONAL_SNAPSHOT;
+
+ checkVersion();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testVersionMvccTxNearEnabled() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-7187");
+
+ atomicityMode = TRANSACTIONAL_SNAPSHOT;
+
+ near = true;
+
+ checkVersion();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testVersionAtomicPrimary() throws Exception {
atomicityMode = ATOMIC;
@@ -138,17 +163,19 @@ public class GridCacheVersionMultinodeTest extends GridCacheAbstractSelfTest {
checkVersion(String.valueOf(i), null); // Update.
}
- if (atomicityMode == TRANSACTIONAL) {
+ if (atomicityMode != ATOMIC) {
for (int i = 100; i < 200; i++) {
checkVersion(String.valueOf(i), PESSIMISTIC); // Create.
checkVersion(String.valueOf(i), PESSIMISTIC); // Update.
}
- for (int i = 200; i < 300; i++) {
- checkVersion(String.valueOf(i), OPTIMISTIC); // Create.
+ if (atomicityMode != TRANSACTIONAL_SNAPSHOT) {
+ for (int i = 200; i < 300; i++) {
+ checkVersion(String.valueOf(i), OPTIMISTIC); // Create.
- checkVersion(String.valueOf(i), OPTIMISTIC); // Update.
+ checkVersion(String.valueOf(i), OPTIMISTIC); // Update.
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java
index 406e5af..cb4410a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java
@@ -17,8 +17,11 @@
package org.apache.ignite.internal.processors.cache;
+import org.apache.ignite.testframework.MvccFeatureChecker;
+
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheMode.LOCAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
@@ -28,6 +31,13 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED;
*/
public class IgniteCacheInvokeReadThroughSingleNodeTest extends IgniteCacheInvokeReadThroughAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected void startNodes() throws Exception {
startGrid(0);
}
@@ -87,4 +97,40 @@ public class IgniteCacheInvokeReadThroughSingleNodeTest extends IgniteCacheInvok
public void testInvokeReadThroughTxLocal() throws Exception {
invokeReadThrough(cacheConfiguration(LOCAL, TRANSACTIONAL, 0, false));
}
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughMvccTx() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-8582");
+
+ invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, false));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughMvccTxNearCache() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-8582");
+
+ invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, true));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughMvccTxReplicated() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-8582");
+
+ invokeReadThrough(cacheConfiguration(REPLICATED, TRANSACTIONAL_SNAPSHOT, 0, false));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughMvccTxLocal() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-8582");
+
+ invokeReadThrough(cacheConfiguration(LOCAL, TRANSACTIONAL_SNAPSHOT, 0, false));
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java
index 8fd3758..3866a18 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java
@@ -17,8 +17,11 @@
package org.apache.ignite.internal.processors.cache;
+import org.apache.ignite.testframework.MvccFeatureChecker;
+
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
@@ -27,6 +30,13 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED;
*/
public class IgniteCacheInvokeReadThroughTest extends IgniteCacheInvokeReadThroughAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected void startNodes() throws Exception {
startGridsMultiThreaded(4);
@@ -104,4 +114,49 @@ public class IgniteCacheInvokeReadThroughTest extends IgniteCacheInvokeReadThrou
public void testInvokeReadThroughTxReplicated() throws Exception {
invokeReadThrough(cacheConfiguration(REPLICATED, TRANSACTIONAL, 0, false));
}
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughMvccTx0() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-8582");
+
+ invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 0, false));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughMvccTx1() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-8582");
+
+ invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, false));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughMvccTx2() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-8582");
+
+ invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 2, false));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughMvccTxNearCache() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-8582");
+
+ invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, true));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInvokeReadThroughMvccTxReplicated() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-8582");
+
+ invokeReadThrough(cacheConfiguration(REPLICATED, TRANSACTIONAL_SNAPSHOT, 0, false));
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java
index 423c4a1..834be7f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java
@@ -39,6 +39,7 @@ import org.apache.ignite.lang.IgniteRunnable;
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.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
@@ -65,6 +66,13 @@ public class IgniteCacheReadThroughStoreCallTest extends GridCommonAbstractTest
protected boolean client;
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java
index 2909f0a..27bf171 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -26,6 +27,12 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
*/
public class IgniteCacheTxCopyOnReadDisabledTest extends IgniteCacheCopyOnReadDisabledAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+ /** {@inheritDoc} */
@Override protected CacheAtomicityMode atomicityMode() {
return TRANSACTIONAL;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalPeekModesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalPeekModesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalPeekModesTest.java
index 3439590..26dbb7e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalPeekModesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalPeekModesTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -28,6 +29,13 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
*/
public class IgniteCacheTxLocalPeekModesTest extends IgniteCachePeekModesAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected CacheAtomicityMode atomicityMode() {
return TRANSACTIONAL;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalStoreValueTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalStoreValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalStoreValueTest.java
index b398726..a25fd90 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalStoreValueTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalStoreValueTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -29,6 +30,13 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
*/
public class IgniteCacheTxLocalStoreValueTest extends IgniteCacheStoreValueAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected int gridCount() {
return 1;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java
index fc719fa..4dc2cf3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java
@@ -18,12 +18,20 @@
package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
/**
*
*/
public class IgniteCacheTxNearEnabledStoreValueTest extends IgniteCacheTxStoreValueTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected NearCacheConfiguration nearConfiguration() {
return new NearCacheConfiguration();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java
index aa4faaf..bd03983 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java
@@ -17,11 +17,20 @@
package org.apache.ignite.internal.processors.cache;
+import org.apache.ignite.testframework.MvccFeatureChecker;
+
/**
* Tests peek modes with near tx cache.
*/
public class IgniteCacheTxNearPeekModesTest extends IgniteCacheTxPeekModesTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected boolean hasNearCache() {
return true;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPeekModesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPeekModesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPeekModesTest.java
index ea22f53..b43ab9a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPeekModesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPeekModesTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -43,10 +44,10 @@ public class IgniteCacheTxPeekModesTest extends IgniteCachePeekModesAbstractTest
}
/** {@inheritDoc} */
- @Override public void testLocalPeek() throws Exception {
- // TODO: uncomment and re-open ticket if fails.
-// fail("https://issues.apache.org/jira/browse/IGNITE-1824");
+ @Override public void testLocalEntries() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-10167");
- super.testLocalPeek();
+ super.testLocalEntries();
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java
index f3f52eb..f137e52 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -29,6 +30,13 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
*/
public class IgniteCacheTxStoreValueTest extends IgniteCacheStoreValueAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.INTERCEPTOR);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected int gridCount() {
return 4;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
index 11f5138..c6179fb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
@@ -79,12 +79,18 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT
/** Tx cache name. */
private static final String TX_CACHE_NAME = "tx-cache";
+ /** Mvcc tx cache name. */
+ private static final String MVCC_TX_CACHE_NAME = "mvcc-tx-cache";
+
/** Near atomic cache name. */
private static final String NEAR_ATOMIC_CACHE_NAME = "near-atomic-cache";
/** Near tx cache name. */
private static final String NEAR_TX_CACHE_NAME = "near-tx-cache";
+ /** Near mvcc tx cache name. */
+ private static final String NEAR_MVCC_TX_CACHE_NAME = "near-mvcc-tx-cache";
+
/** Failed caches. */
private static final Set<String> FAILED_CACHES;
@@ -95,6 +101,8 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT
set.add(TX_CACHE_NAME);
set.add(NEAR_ATOMIC_CACHE_NAME);
set.add(NEAR_TX_CACHE_NAME);
+ set.add(MVCC_TX_CACHE_NAME);
+ set.add(NEAR_MVCC_TX_CACHE_NAME);
FAILED_CACHES = Collections.unmodifiableSet(set);
}
@@ -122,7 +130,13 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT
ccfg2.setName(TX_CACHE_NAME);
ccfg2.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
- cfg.setCacheConfiguration(ccfg1, ccfg2);
+ CacheConfiguration<Integer, String> ccfg3 = new CacheConfiguration<>();
+
+ ccfg3.setIndexedTypes(Integer.class, String.class);
+ ccfg3.setName(MVCC_TX_CACHE_NAME);
+ ccfg3.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT);
+
+ cfg.setCacheConfiguration(ccfg1, ccfg2, ccfg3);
}
else {
GridQueryProcessor.idxCls = FailedIndexing.class;
@@ -150,6 +164,13 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT
/**
* @throws Exception If failed.
*/
+ public void testMvccTransactionalCacheInitialization() throws Exception {
+ checkCacheInitialization(MVCC_TX_CACHE_NAME);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testAtomicNearCacheInitialization() throws Exception {
checkCacheInitialization(NEAR_ATOMIC_CACHE_NAME);
}
@@ -162,6 +183,15 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT
}
/**
+ * @throws Exception If failed.
+ */
+ public void testMvccTransactionalNearCacheInitialization() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-7187");
+
+ checkCacheInitialization(NEAR_MVCC_TX_CACHE_NAME);
+ }
+
+ /**
* @param cacheName Cache name.
* @throws Exception If failed.
*/
@@ -199,12 +229,15 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT
IgniteCache<Integer, String> cache;
// Start cache with near enabled.
- if (NEAR_ATOMIC_CACHE_NAME.equals(cacheName) || NEAR_TX_CACHE_NAME.equals(cacheName)) {
+ if (NEAR_ATOMIC_CACHE_NAME.equals(cacheName) || NEAR_TX_CACHE_NAME.equals(cacheName) ||
+ NEAR_MVCC_TX_CACHE_NAME.equals(cacheName)) {
CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<Integer, String>(cacheName)
.setNearConfiguration(new NearCacheConfiguration<Integer, String>());
if (NEAR_TX_CACHE_NAME.equals(cacheName))
ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+ else if (NEAR_MVCC_TX_CACHE_NAME.equals(cacheName))
+ ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT);
cache = client.getOrCreateCache(ccfg);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java
index 53c1cb2..4d74172 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java
@@ -21,6 +21,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -60,6 +61,7 @@ public class IgniteDynamicCacheFilterTest extends GridCommonAbstractTest {
ccfg.setRebalanceMode(SYNC);
ccfg.setNodeFilter(new TestNodeFilter("A"));
+ ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
if (attrVal != null) {
Map<String, Object> attrs = new HashMap<>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java
index 87bc6b1..ce29c31 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java
@@ -27,6 +27,7 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.affinity.AffinityFunctionContext;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cluster.ClusterNode;
@@ -125,6 +126,8 @@ public class IgniteDynamicCacheStartCoordinatorFailoverTest extends GridCommonAb
cfg.setName("test-coordinator-failover");
+ cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+
cfg.setAffinity(new BrokenAffinityFunction(false, getTestIgniteInstanceName(2)));
GridTestUtils.runAsync(new Callable<Object>() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java
index c3e3e88..a00fd24 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java
@@ -45,6 +45,7 @@ import org.jetbrains.annotations.NotNull;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
/**
@@ -400,7 +401,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst
{
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
- ccfg.setName("cache-4");
+ ccfg.setName("cache-6");
ccfg.setAtomicityMode(TRANSACTIONAL);
ccfg.setBackups(1);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
@@ -408,6 +409,39 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst
res.add(ccfg);
}
+ {
+ CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+ ccfg.setName("cache-7");
+ ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
+ ccfg.setBackups(0);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ res.add(ccfg);
+ }
+
+ {
+ CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+ ccfg.setName("cache-8");
+ ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
+ ccfg.setBackups(1);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ res.add(ccfg);
+ }
+
+ {
+ CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+ ccfg.setName("cache-9");
+ ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
+ ccfg.setBackups(1);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ res.add(ccfg);
+ }
+
return res;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
index 53de23f..b5b83ad 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
@@ -281,6 +281,13 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
+ public void testStartStopCacheSimpleTransactionalMvcc() throws Exception {
+ checkStartStopCacheSimple(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testStartStopCacheSimpleAtomic() throws Exception {
checkStartStopCacheSimple(CacheAtomicityMode.ATOMIC);
}
@@ -295,6 +302,13 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
+ public void testStartStopCachesSimpleTransactionalMvcc() throws Exception {
+ checkStartStopCachesSimple(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testStartStopCachesSimpleAtomic() throws Exception {
checkStartStopCachesSimple(CacheAtomicityMode.ATOMIC);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheWithConfigStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheWithConfigStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheWithConfigStartSelfTest.java
index ec6b82d..d366306 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheWithConfigStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheWithConfigStartSelfTest.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.processors.cache;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
@@ -63,6 +64,7 @@ public class IgniteDynamicCacheWithConfigStartSelfTest extends GridCommonAbstrac
CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(CACHE_NAME);
ccfg.setIndexedTypes(String.class, String.class);
+ ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
return ccfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java
index 0cb0856..69bf233 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java
@@ -44,7 +44,10 @@ import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.Nullable;
-import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
+import static org.apache.ignite.cache.CacheAtomicityMode.values;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_IGNITE_INSTANCE_NAME;
@@ -394,8 +397,9 @@ public class IgniteDynamicClientCacheStartSelfTest extends GridCommonAbstractTes
cfgs.addAll(cacheConfigurations(null, ATOMIC));
cfgs.addAll(cacheConfigurations(null, TRANSACTIONAL));
+ cfgs.addAll(cacheConfigurations(null, TRANSACTIONAL_SNAPSHOT));
- assertEquals(6, cfgs.size());
+ assertEquals(9, cfgs.size());
Collection<IgniteCache> caches = client.getOrCreateCaches(cfgs);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java
index b037a7b..f4d3b25 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java
@@ -30,6 +30,7 @@ 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.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
@@ -250,6 +251,8 @@ public class IgniteStartCacheInTransactionSelfTest extends GridCommonAbstractTes
if (atomicityMode() != TRANSACTIONAL)
return;
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
final Ignite ignite = grid(0);
final String key = "key";
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffinityEarlyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffinityEarlyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffinityEarlyTest.java
index 46669ac..2f04870 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffinityEarlyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffinityEarlyTest.java
@@ -156,7 +156,7 @@ public class CacheAffinityEarlyTest extends GridCommonAbstractTest {
CacheConfiguration ccfg = defaultCacheConfiguration();
ccfg.setCacheMode(CacheMode.PARTITIONED);
- ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+ ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
ccfg.setBackups(1);
ccfg.setNearConfiguration(null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGroupsPreloadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGroupsPreloadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGroupsPreloadTest.java
index 8859638..af223f4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGroupsPreloadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGroupsPreloadTest.java
@@ -106,6 +106,17 @@ public class CacheGroupsPreloadTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
+ public void testCachePreloadMvcc2() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-7187");
+
+ atomicityMode = CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
+
+ cachePreloadTest();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testCachePreload3() throws Exception {
cacheMode = CacheMode.REPLICATED;
@@ -125,6 +136,16 @@ public class CacheGroupsPreloadTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
+ public void testCachePreloadMvcc4() throws Exception {
+ cacheMode = CacheMode.REPLICATED;
+ atomicityMode = CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
+
+ cachePreloadTest();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testCachePreload5() throws Exception {
sameGrp = false;
@@ -144,6 +165,18 @@ public class CacheGroupsPreloadTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
+ public void testCachePreloadMvcc6() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-7187");
+
+ sameGrp = false;
+ atomicityMode = CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
+
+ cachePreloadTest();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testCachePreload7() throws Exception {
sameGrp = false;
cacheMode = CacheMode.REPLICATED;
@@ -165,6 +198,17 @@ public class CacheGroupsPreloadTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
+ public void testCachePreloadMvcc8() throws Exception {
+ sameGrp = false;
+ cacheMode = CacheMode.REPLICATED;
+ atomicityMode = CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
+
+ cachePreloadTest();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
private void cachePreloadTest() throws Exception {
IgniteCache<Object, Object> cache = startGrid(0).cache(CACHE1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java
index d59f470..54889e4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java
@@ -46,6 +46,7 @@ import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.testframework.MvccFeatureChecker.assertMvccWriteConflict;
/**
*
@@ -184,7 +185,18 @@ public class CacheStartOnJoinTest extends GridCommonAbstractTest {
if (createCache) {
for (int c = 0; c < 5; c++) {
for (IgniteCache cache : node.getOrCreateCaches(cacheConfigurations())) {
- cache.put(c, c);
+ boolean updated = false;
+
+ while (!updated) {
+ try {
+ cache.put(c, c);
+
+ updated = true;
+ }
+ catch (Exception e) {
+ assertMvccWriteConflict(e);
+ }
+ }
assertEquals(c, cache.get(c));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutMultiNodeSelfTest.java
index 23fc941..0b021a8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutMultiNodeSelfTest.java
@@ -34,6 +34,7 @@ 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.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
/**
@@ -94,8 +95,18 @@ public class IgniteCacheCreatePutMultiNodeSelfTest extends GridCommonAbstractTes
IgniteCache<Integer, Integer> cache = getCache(ignite, cacheName);
- for (int i = 0; i < 100; i++)
- cache.getAndPut(i, i);
+ for (int i = 0; i < 100; i++) {
+ while (true) {
+ try {
+ cache.getAndPut(i, i);
+
+ break;
+ }
+ catch (Exception e) {
+ MvccFeatureChecker.assertMvccWriteConflict(e);
+ }
+ }
+ }
barrier.await();
@@ -139,7 +150,7 @@ public class IgniteCacheCreatePutMultiNodeSelfTest extends GridCommonAbstractTes
CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(cacheName);
ccfg.setCacheMode(CacheMode.PARTITIONED);
- ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+ ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
ccfg.setBackups(1);
ccfg.setNearConfiguration(null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java
index 646084c..5d6e895 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java
@@ -37,9 +37,11 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.apache.ignite.testframework.MvccFeatureChecker.assertMvccWriteConflict;
/**
*
@@ -149,6 +151,7 @@ public class IgniteCacheCreatePutTest extends GridCommonAbstractTest {
ignite0.createCache(cacheConfiguration("atomic-cache", ATOMIC));
ignite0.createCache(cacheConfiguration("tx-cache", TRANSACTIONAL));
+ ignite0.createCache(cacheConfiguration("mvcc-tx-cache", TRANSACTIONAL_SNAPSHOT));
final long stopTime = System.currentTimeMillis() + 60_000;
@@ -162,6 +165,7 @@ public class IgniteCacheCreatePutTest extends GridCommonAbstractTest {
IgniteCache cache1 = node.cache("atomic-cache");
IgniteCache cache2 = node.cache("tx-cache");
+ IgniteCache cache3 = node.cache("mvcc-tx-cache");
ThreadLocalRandom rnd = ThreadLocalRandom.current();
@@ -174,6 +178,13 @@ public class IgniteCacheCreatePutTest extends GridCommonAbstractTest {
cache2.put(key, key);
+ try {
+ cache3.put(key, key);
+ }
+ catch (Exception e) {
+ assertMvccWriteConflict(e); // Do not retry.
+ }
+
if (iter++ % 1000 == 0)
log.info("Update iteration: " + iter);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java
index 3eca6b3..7414b88 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java
@@ -40,11 +40,13 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.failure.FailureHandler;
import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
@@ -53,7 +55,7 @@ import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_REA
import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
/**
- * Checks that no future hangs on non-srializable exceptions and values.
+ * Checks that no future hangs on non-serializable exceptions and values.
*/
public class IgniteCacheFailedUpdateResponseTest extends GridCommonAbstractTest {
/** Atomic cache. */
@@ -62,25 +64,34 @@ public class IgniteCacheFailedUpdateResponseTest extends GridCommonAbstractTest
/** Tx cache. */
private static final String TX_CACHE = "tx";
+ /** Mvcc tx cache. */
+ private static final String MVCC_TX_CACHE = "mvcc-tx";
+
/** Atomic cache. */
private IgniteCache<Object, Object> atomicCache;
/** Tx cache. */
private IgniteCache<Object, Object> txCache;
+ /** Mvcc tx cache. */
+ private IgniteCache<Object, Object> mvccTxCache;
+
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheConfiguration atomicCfg = new CacheConfiguration(ATOMIC_CACHE);
CacheConfiguration txCfg = new CacheConfiguration(TX_CACHE);
+ CacheConfiguration mvccTxCfg = new CacheConfiguration(MVCC_TX_CACHE);
atomicCfg.setBackups(1);
txCfg.setBackups(1);
+ mvccTxCfg.setBackups(1);
txCfg.setAtomicityMode(TRANSACTIONAL);
+ mvccTxCfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
- cfg.setCacheConfiguration(atomicCfg, txCfg);
+ cfg.setCacheConfiguration(atomicCfg, txCfg, mvccTxCfg);
cfg.setClientMode(igniteInstanceName.contains("client"));
@@ -100,6 +111,7 @@ public class IgniteCacheFailedUpdateResponseTest extends GridCommonAbstractTest
@Override protected void beforeTest() throws Exception {
atomicCache = grid("client").cache(ATOMIC_CACHE);
txCache = grid("client").cache(TX_CACHE);
+ mvccTxCache = grid("client").cache(MVCC_TX_CACHE);
}
/** {@inheritDoc} */
@@ -142,10 +154,31 @@ public class IgniteCacheFailedUpdateResponseTest extends GridCommonAbstractTest
}
/**
+ * @throws Exception If failed.
+ */
+ public void testInvokeMvccTx() throws Exception {
+ testInvoke(mvccTxCache);
+ testInvokeAll(mvccTxCache);
+
+ IgniteEx client = grid("client");
+
+ Callable<Object> clos = new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ testInvoke(mvccTxCache);
+ testInvokeAll(mvccTxCache);
+
+ return null;
+ }
+ };
+
+ doInTransaction(client, PESSIMISTIC, REPEATABLE_READ, clos);
+ }
+
+ /**
* @param cache Cache.
*/
private void testInvoke(final IgniteCache<Object, Object> cache) throws Exception {
- Class<? extends Exception> exp = grid("client").transactions().tx() == null
+ Class<? extends Exception> exp = grid("client").transactions().tx() == null || ((IgniteCacheProxy)cache).context().mvccEnabled()
? EntryProcessorException.class
: NonSerializableException.class;
@@ -181,7 +214,7 @@ public class IgniteCacheFailedUpdateResponseTest extends GridCommonAbstractTest
assertNotNull(epRes);
// In transactions EP will be invoked locally.
- Class<? extends Exception> exp = grid("client").transactions().tx() == null
+ Class<? extends Exception> exp = grid("client").transactions().tx() == null || ((IgniteCacheProxy)cache).context().mvccEnabled()
? EntryProcessorException.class
: NonSerializableException.class;
[47/50] [abbrv] ignite git commit: IGNITE-10535: SQL: moved reducer
partition resolution logic to separate classes. This closes #5575.
Posted by sb...@apache.org.
IGNITE-10535: SQL: moved reducer partition resolution logic to separate classes. This closes #5575.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6613376d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6613376d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6613376d
Branch: refs/heads/ignite-10044
Commit: 6613376d2cdd9bbe68dd7b3167cfd5c16a39f67e
Parents: bf75ef2
Author: devozerov <vo...@gridgain.com>
Authored: Thu Dec 6 17:47:50 2018 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Dec 6 17:47:50 2018 +0300
----------------------------------------------------------------------
.../h2/twostep/GridReduceQueryExecutor.java | 648 +------------------
.../h2/twostep/ReducePartitionMapResult.java | 73 +++
.../query/h2/twostep/ReducePartitionMapper.java | 638 ++++++++++++++++++
.../h2/twostep/ReducePartitionsSpecializer.java | 61 ++
4 files changed, 787 insertions(+), 633 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6613376d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 36287b3..905a4a3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -22,16 +22,12 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -47,7 +43,6 @@ import org.apache.ignite.IgniteClientDisconnectedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteSystemProperties;
-import org.apache.ignite.cache.PartitionLossPolicy;
import org.apache.ignite.cache.query.QueryCancelledException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.events.DiscoveryEvent;
@@ -61,7 +56,6 @@ import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxSelectForUpdateFuture;
import org.apache.ignite.internal.processors.cache.distributed.near.TxTopologyVersionFuture;
@@ -89,8 +83,6 @@ import org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2DmlReque
import org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2DmlResponse;
import org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2QueryRequest;
import org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2SelectForUpdateTxDetails;
-import org.apache.ignite.internal.util.GridIntIterator;
-import org.apache.ignite.internal.util.GridIntList;
import org.apache.ignite.internal.util.GridSpinBusyLock;
import org.apache.ignite.internal.util.typedef.C2;
import org.apache.ignite.internal.util.typedef.CIX2;
@@ -113,9 +105,6 @@ import org.jetbrains.annotations.Nullable;
import static java.util.Collections.singletonList;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_SQL_RETRY_TIMEOUT;
-import static org.apache.ignite.cache.PartitionLossPolicy.READ_ONLY_SAFE;
-import static org.apache.ignite.cache.PartitionLossPolicy.READ_WRITE_SAFE;
-import static org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion.NONE;
import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.checkActive;
import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.mvccEnabled;
import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.tx;
@@ -138,9 +127,6 @@ public class GridReduceQueryExecutor {
private static final String MERGE_INDEX_SORTED = "merge_sorted";
/** */
- private static final Set<ClusterNode> UNMAPPED_PARTS = Collections.emptySet();
-
- /** */
private GridKernalContext ctx;
/** */
@@ -174,7 +160,12 @@ public class GridReduceQueryExecutor {
}
};
+ /** Partition mapper. */
+ private ReducePartitionMapper mapper;
+
/**
+ * Constructor.
+ *
* @param qryIdGen Query ID generator.
* @param busyLock Busy lock.
*/
@@ -194,6 +185,8 @@ public class GridReduceQueryExecutor {
log = ctx.log(GridReduceQueryExecutor.class);
+ mapper = new ReducePartitionMapper(ctx, log);
+
ctx.io().addMessageListener(GridTopic.TOPIC_QUERY, new GridMessageListener() {
@SuppressWarnings("deprecation")
@Override public void onMessage(UUID nodeId, Object msg, byte plc) {
@@ -370,32 +363,6 @@ public class GridReduceQueryExecutor {
}
/**
- * @param cacheIds Cache IDs.
- * @return {@code true} If preloading is active.
- */
- private boolean isPreloadingActive(List<Integer> cacheIds) {
- for (Integer cacheId : cacheIds) {
- if (null == cacheContext(cacheId))
- throw new CacheException(String.format("Cache not found on local node [cacheId=%d]", cacheId));
-
- if (hasMovingPartitions(cacheContext(cacheId)))
- return true;
- }
-
- return false;
- }
-
- /**
- * @param cctx Cache context.
- * @return {@code True} If cache has partitions in {@link GridDhtPartitionState#MOVING} state.
- */
- private boolean hasMovingPartitions(GridCacheContext<?, ?> cctx) {
- assert cctx != null;
-
- return !cctx.isLocal() && cctx.topology().hasMovingPartitions();
- }
-
- /**
* @param cacheId Cache ID.
* @return Cache context.
*/
@@ -404,154 +371,6 @@ public class GridReduceQueryExecutor {
}
/**
- * @param topVer Topology version.
- * @param cctx Cache context.
- * @param parts Partitions.
- */
- private Map<ClusterNode, IntArray> stableDataNodesMap(AffinityTopologyVersion topVer,
- final GridCacheContext<?, ?> cctx, @Nullable final int[] parts) {
-
- Map<ClusterNode, IntArray> mapping = new HashMap<>();
-
- // Explicit partitions mapping is not applicable to replicated cache.
- if (cctx.isReplicated()) {
- for (ClusterNode clusterNode : cctx.affinity().assignment(topVer).nodes())
- mapping.put(clusterNode, null);
-
- return mapping;
- }
-
- List<List<ClusterNode>> assignment = cctx.affinity().assignment(topVer).assignment();
-
- boolean needPartsFilter = parts != null;
-
- GridIntIterator iter = needPartsFilter ? new GridIntList(parts).iterator() :
- U.forRange(0, cctx.affinity().partitions());
-
- while(iter.hasNext()) {
- int partId = iter.next();
-
- List<ClusterNode> partNodes = assignment.get(partId);
-
- if (!partNodes.isEmpty()) {
- ClusterNode prim = partNodes.get(0);
-
- if (!needPartsFilter) {
- mapping.put(prim, null);
-
- continue;
- }
-
- IntArray partIds = mapping.get(prim);
-
- if (partIds == null) {
- partIds = new IntArray();
-
- mapping.put(prim, partIds);
- }
-
- partIds.add(partId);
- }
- }
-
- return mapping;
- }
-
- /**
- * Load failed partition reservation.
- *
- * @param msg Message.
- */
- private void logRetry(String msg) {
- log.info(msg);
- }
-
- /**
- * @param isReplicatedOnly If we must only have replicated caches.
- * @param topVer Topology version.
- * @param cacheIds Participating cache IDs.
- * @param parts Partitions.
- * @param qryId Query ID.
- * @return Data nodes or {@code null} if repartitioning started and we need to retry.
- */
- private Map<ClusterNode, IntArray> stableDataNodes(boolean isReplicatedOnly, AffinityTopologyVersion topVer,
- List<Integer> cacheIds, int[] parts, long qryId) {
- GridCacheContext<?, ?> cctx = cacheContext(cacheIds.get(0));
-
- // If the first cache is not partitioned, find it (if it's present) and move it to index 0.
- if (!cctx.isPartitioned()) {
- for (int cacheId = 1; cacheId < cacheIds.size(); cacheId++) {
- GridCacheContext<?, ?> currCctx = cacheContext(cacheIds.get(cacheId));
-
- if (currCctx.isPartitioned()) {
- Collections.swap(cacheIds, 0, cacheId);
-
- cctx = currCctx;
-
- break;
- }
- }
- }
-
- Map<ClusterNode, IntArray> map = stableDataNodesMap(topVer, cctx, parts);
-
- Set<ClusterNode> nodes = map.keySet();
-
- if (F.isEmpty(map))
- throw new CacheException("Failed to find data nodes for cache: " + cctx.name());
-
- for (int i = 1; i < cacheIds.size(); i++) {
- GridCacheContext<?,?> extraCctx = cacheContext(cacheIds.get(i));
-
- String extraCacheName = extraCctx.name();
-
- if (extraCctx.isLocal())
- continue; // No consistency guaranties for local caches.
-
- if (isReplicatedOnly && !extraCctx.isReplicated())
- throw new CacheException("Queries running on replicated cache should not contain JOINs " +
- "with partitioned tables [replicatedCache=" + cctx.name() +
- ", partitionedCache=" + extraCacheName + "]");
-
- Set<ClusterNode> extraNodes = stableDataNodesMap(topVer, extraCctx, parts).keySet();
-
- if (F.isEmpty(extraNodes))
- throw new CacheException("Failed to find data nodes for cache: " + extraCacheName);
-
- boolean disjoint;
-
- if (extraCctx.isReplicated()) {
- if (isReplicatedOnly) {
- nodes.retainAll(extraNodes);
-
- disjoint = map.isEmpty();
- }
- else
- disjoint = !extraNodes.containsAll(nodes);
- }
- else
- disjoint = !extraNodes.equals(nodes);
-
- if (disjoint) {
- if (isPreloadingActive(cacheIds)) {
- logRetry("Failed to calculate nodes for SQL query (got disjoint node map during rebalance) " +
- "[qryId=" + qryId + ", affTopVer=" + topVer + ", cacheIds=" + cacheIds +
- ", parts=" + (parts == null ? "[]" : Arrays.toString(parts)) +
- ", replicatedOnly=" + isReplicatedOnly + ", lastCache=" + extraCctx.name() +
- ", lastCacheId=" + extraCctx.cacheId() + ']');
-
- return null; // Retry.
- }
- else
- throw new CacheException("Caches have distinct sets of data nodes [cache1=" + cctx.name() +
- ", cache2=" + extraCacheName + "]");
- }
- }
-
- return map;
- }
-
- /**
* @param schemaName Schema name.
* @param qry Query.
* @param keepBinary Keep binary.
@@ -686,8 +505,8 @@ public class GridReduceQueryExecutor {
if (qry.isLocal())
nodes = singletonList(ctx.discovery().localNode());
else {
- NodesForPartitionsResult nodesParts =
- nodesForPartitions(cacheIds, topVer, parts, isReplicatedOnly, qryReqId);
+ ReducePartitionMapResult nodesParts =
+ mapper.nodesForPartitions(cacheIds, topVer, parts, isReplicatedOnly, qryReqId);
nodes = nodesParts.nodes();
partsMap = nodesParts.partitionsMap();
@@ -843,7 +662,7 @@ public class GridReduceQueryExecutor {
req.mvccSnapshot(mvccTracker.snapshot());
final C2<ClusterNode, Message, Message> pspec =
- (parts == null ? null : new ExplicitPartitionsSpecializer(qryMap));
+ (parts == null ? null : new ReducePartitionsSpecializer(qryMap));
final C2<ClusterNode, Message, Message> spec;
@@ -905,7 +724,7 @@ public class GridReduceQueryExecutor {
else // Send failed.
retry = true;
- Iterator<List<?>> resIter = null;
+ Iterator<List<?>> resIter;
if (!retry) {
if (skipMergeTbl) {
@@ -1050,7 +869,8 @@ public class GridReduceQueryExecutor {
final long reqId = qryIdGen.incrementAndGet();
- NodesForPartitionsResult nodesParts = nodesForPartitions(cacheIds, topVer, parts, isReplicatedOnly, reqId);
+ ReducePartitionMapResult nodesParts =
+ mapper.nodesForPartitions(cacheIds, topVer, parts, isReplicatedOnly, reqId);
final GridRunningQueryInfo qryInfo = new GridRunningQueryInfo(reqId, selectQry, GridCacheQueryType.SQL_FIELDS,
schemaName, U.currentTimeMillis(), cancel, false);
@@ -1105,8 +925,8 @@ public class GridReduceQueryExecutor {
Map<ClusterNode, IntArray> partsMap = (nodesParts.queryPartitionsMap() != null) ?
nodesParts.queryPartitionsMap() : nodesParts.partitionsMap();
- ExplicitPartitionsSpecializer partsSpec = (parts == null) ? null :
- new ExplicitPartitionsSpecializer(partsMap);
+ ReducePartitionsSpecializer partsSpec = (parts == null) ? null :
+ new ReducePartitionsSpecializer(partsMap);
final Collection<ClusterNode> finalNodes = nodes;
@@ -1290,286 +1110,6 @@ public class GridReduceQueryExecutor {
}
/**
- * Calculates data nodes for replicated caches on unstable topology.
- *
- * @param cacheIds Cache IDs.
- * @param qryId Query ID.
- * @return Collection of all data nodes owning all the caches or {@code null} for retry.
- */
- private Collection<ClusterNode> replicatedUnstableDataNodes(List<Integer> cacheIds, long qryId) {
- int i = 0;
-
- GridCacheContext<?, ?> cctx = cacheContext(cacheIds.get(i++));
-
- // The main cache is allowed to be partitioned.
- if (!cctx.isReplicated()) {
- assert cacheIds.size() > 1: "no extra replicated caches with partitioned main cache";
-
- // Just replace the main cache with the first one extra.
- cctx = cacheContext(cacheIds.get(i++));
-
- assert cctx.isReplicated(): "all the extra caches must be replicated here";
- }
-
- Set<ClusterNode> nodes = replicatedUnstableDataNodes(cctx, qryId);
-
- if (F.isEmpty(nodes))
- return null; // Retry.
-
- for (;i < cacheIds.size(); i++) {
- GridCacheContext<?, ?> extraCctx = cacheContext(cacheIds.get(i));
-
- if (extraCctx.isLocal())
- continue;
-
- if (!extraCctx.isReplicated())
- throw new CacheException("Queries running on replicated cache should not contain JOINs " +
- "with tables in partitioned caches [replicatedCache=" + cctx.name() + ", " +
- "partitionedCache=" + extraCctx.name() + "]");
-
- Set<ClusterNode> extraOwners = replicatedUnstableDataNodes(extraCctx, qryId);
-
- if (F.isEmpty(extraOwners))
- return null; // Retry.
-
- nodes.retainAll(extraOwners);
-
- if (nodes.isEmpty()) {
- logRetry("Failed to calculate nodes for SQL query (got disjoint node map for REPLICATED caches " +
- "during rebalance) [qryId=" + qryId + ", cacheIds=" + cacheIds +
- ", lastCache=" + extraCctx.name() + ", lastCacheId=" + extraCctx.cacheId() + ']');
-
- return null; // Retry.
- }
- }
-
- return nodes;
- }
-
- /**
- * @param grpId Cache group ID.
- * @param topVer Topology version.
- * @return Collection of data nodes.
- */
- private Collection<ClusterNode> dataNodes(int grpId, AffinityTopologyVersion topVer) {
- Collection<ClusterNode> res = ctx.discovery().cacheGroupAffinityNodes(grpId, topVer);
-
- return res != null ? res : Collections.<ClusterNode>emptySet();
- }
-
- /**
- * Collects all the nodes owning all the partitions for the given replicated cache.
- *
- * @param cctx Cache context.
- * @param qryId Query ID.
- * @return Owning nodes or {@code null} if we can't find owners for some partitions.
- */
- private Set<ClusterNode> replicatedUnstableDataNodes(GridCacheContext<?,?> cctx, long qryId) {
- assert cctx.isReplicated() : cctx.name() + " must be replicated";
-
- String cacheName = cctx.name();
-
- Set<ClusterNode> dataNodes = new HashSet<>(dataNodes(cctx.groupId(), NONE));
-
- if (dataNodes.isEmpty())
- throw new CacheException("Failed to find data nodes for cache: " + cacheName);
-
- // Find all the nodes owning all the partitions for replicated cache.
- for (int p = 0, parts = cctx.affinity().partitions(); p < parts; p++) {
- List<ClusterNode> owners = cctx.topology().owners(p);
-
- if (F.isEmpty(owners)) {
- logRetry("Failed to calculate nodes for SQL query (partition of a REPLICATED cache has no owners) [" +
- "qryId=" + qryId + ", cacheName=" + cctx.name() + ", cacheId=" + cctx.cacheId() +
- ", part=" + p + ']');
-
- return null; // Retry.
- }
-
- dataNodes.retainAll(owners);
-
- if (dataNodes.isEmpty()) {
- logRetry("Failed to calculate nodes for SQL query (partitions of a REPLICATED has no common owners) [" +
- "qryId=" + qryId + ", cacheName=" + cctx.name() + ", cacheId=" + cctx.cacheId() +
- ", lastPart=" + p + ']');
-
- return null; // Retry.
- }
- }
-
- return dataNodes;
- }
-
- /**
- * Calculates partition mapping for partitioned cache on unstable topology.
- *
- * @param cacheIds Cache IDs.
- * @param qryId Query ID.
- * @return Partition mapping or {@code null} if we can't calculate it due to repartitioning and we need to retry.
- */
- @SuppressWarnings("unchecked")
- private Map<ClusterNode, IntArray> partitionedUnstableDataNodes(List<Integer> cacheIds, long qryId) {
- // If the main cache is replicated, just replace it with the first partitioned.
- GridCacheContext<?,?> cctx = findFirstPartitioned(cacheIds);
-
- final int partsCnt = cctx.affinity().partitions();
-
- if (cacheIds.size() > 1) { // Check correct number of partitions for partitioned caches.
- for (Integer cacheId : cacheIds) {
- GridCacheContext<?, ?> extraCctx = cacheContext(cacheId);
-
- if (extraCctx.isReplicated() || extraCctx.isLocal())
- continue;
-
- int parts = extraCctx.affinity().partitions();
-
- if (parts != partsCnt)
- throw new CacheException("Number of partitions must be the same for correct collocation [cache1=" +
- cctx.name() + ", parts1=" + partsCnt + ", cache2=" + extraCctx.name() +
- ", parts2=" + parts + "]");
- }
- }
-
- Set<ClusterNode>[] partLocs = new Set[partsCnt];
-
- // Fill partition locations for main cache.
- for (int p = 0; p < partsCnt; p++) {
- List<ClusterNode> owners = cctx.topology().owners(p);
-
- if (F.isEmpty(owners)) {
- // Handle special case: no mapping is configured for a partition.
- if (F.isEmpty(cctx.affinity().assignment(NONE).get(p))) {
- partLocs[p] = UNMAPPED_PARTS; // Mark unmapped partition.
-
- continue;
- }
- else if (!F.isEmpty(dataNodes(cctx.groupId(), NONE))) {
- logRetry("Failed to calculate nodes for SQL query (partition has no owners, but corresponding " +
- "cache group has data nodes) [qryId=" + qryId + ", cacheIds=" + cacheIds +
- ", cacheName=" + cctx.name() + ", cacheId=" + cctx.cacheId() + ", part=" + p +
- ", cacheGroupId=" + cctx.groupId() + ']');
-
- return null; // Retry.
- }
-
- throw new CacheException("Failed to find data nodes [cache=" + cctx.name() + ", part=" + p + "]");
- }
-
- partLocs[p] = new HashSet<>(owners);
- }
-
- if (cacheIds.size() > 1) {
- // Find owner intersections for each participating partitioned cache partition.
- // We need this for logical collocation between different partitioned caches with the same affinity.
- for (Integer cacheId : cacheIds) {
- GridCacheContext<?, ?> extraCctx = cacheContext(cacheId);
-
- // This is possible if we have replaced a replicated cache with a partitioned one earlier.
- if (cctx == extraCctx)
- continue;
-
- if (extraCctx.isReplicated() || extraCctx.isLocal())
- continue;
-
- for (int p = 0, parts = extraCctx.affinity().partitions(); p < parts; p++) {
- List<ClusterNode> owners = extraCctx.topology().owners(p);
-
- if (partLocs[p] == UNMAPPED_PARTS)
- continue; // Skip unmapped partitions.
-
- if (F.isEmpty(owners)) {
- if (!F.isEmpty(dataNodes(extraCctx.groupId(), NONE))) {
- logRetry("Failed to calculate nodes for SQL query (partition has no owners, but " +
- "corresponding cache group has data nodes) [qryId=" + qryId +
- ", cacheIds=" + cacheIds + ", cacheName=" + extraCctx.name() +
- ", cacheId=" + extraCctx.cacheId() + ", part=" + p +
- ", cacheGroupId=" + extraCctx.groupId() + ']');
-
- return null; // Retry.
- }
-
- throw new CacheException("Failed to find data nodes [cache=" + extraCctx.name() +
- ", part=" + p + "]");
- }
-
- if (partLocs[p] == null)
- partLocs[p] = new HashSet<>(owners);
- else {
- partLocs[p].retainAll(owners); // Intersection of owners.
-
- if (partLocs[p].isEmpty()) {
- logRetry("Failed to calculate nodes for SQL query (caches have no common data nodes for " +
- "partition) [qryId=" + qryId + ", cacheIds=" + cacheIds +
- ", lastCacheName=" + extraCctx.name() + ", lastCacheId=" + extraCctx.cacheId() +
- ", part=" + p + ']');
-
- return null; // Intersection is empty -> retry.
- }
- }
- }
- }
-
- // Filter nodes where not all the replicated caches loaded.
- for (Integer cacheId : cacheIds) {
- GridCacheContext<?, ?> extraCctx = cacheContext(cacheId);
-
- if (!extraCctx.isReplicated())
- continue;
-
- Set<ClusterNode> dataNodes = replicatedUnstableDataNodes(extraCctx, qryId);
-
- if (F.isEmpty(dataNodes))
- return null; // Retry.
-
- int part = 0;
-
- for (Set<ClusterNode> partLoc : partLocs) {
- if (partLoc == UNMAPPED_PARTS)
- continue; // Skip unmapped partition.
-
- partLoc.retainAll(dataNodes);
-
- if (partLoc.isEmpty()) {
- logRetry("Failed to calculate nodes for SQL query (caches have no common data nodes for " +
- "partition) [qryId=" + qryId + ", cacheIds=" + cacheIds +
- ", lastReplicatedCacheName=" + extraCctx.name() +
- ", lastReplicatedCacheId=" + extraCctx.cacheId() + ", part=" + part + ']');
-
- return null; // Retry.
- }
-
- part++;
- }
- }
- }
-
- // Collect the final partitions mapping.
- Map<ClusterNode, IntArray> res = new HashMap<>();
-
- // Here partitions in all IntArray's will be sorted in ascending order, this is important.
- for (int p = 0; p < partLocs.length; p++) {
- Set<ClusterNode> pl = partLocs[p];
-
- // Skip unmapped partitions.
- if (pl == UNMAPPED_PARTS)
- continue;
-
- assert !F.isEmpty(pl) : pl;
-
- ClusterNode n = pl.size() == 1 ? F.first(pl) : F.rand(pl);
-
- IntArray parts = res.get(n);
-
- if (parts == null)
- res.put(n, parts = new IntArray());
-
- parts.add(p);
- }
-
- return res;
- }
-
- /**
* @param c Connection.
* @param qry Query.
* @param params Query parameters.
@@ -1681,63 +1221,6 @@ public class GridReduceQueryExecutor {
}
/**
- * Evaluates nodes and nodes to partitions map given a list of cache ids, topology version and partitions.
- *
- * @param cacheIds Cache ids.
- * @param topVer Topology version.
- * @param parts Partitions array.
- * @param isReplicatedOnly Allow only replicated caches.
- * @param qryId Query ID.
- * @return Result.
- */
- private NodesForPartitionsResult nodesForPartitions(List<Integer> cacheIds, AffinityTopologyVersion topVer,
- int[] parts, boolean isReplicatedOnly, long qryId) {
- Collection<ClusterNode> nodes = null;
- Map<ClusterNode, IntArray> partsMap = null;
- Map<ClusterNode, IntArray> qryMap = null;
-
- for (int cacheId : cacheIds) {
- GridCacheContext<?, ?> cctx = cacheContext(cacheId);
-
- PartitionLossPolicy plc = cctx.config().getPartitionLossPolicy();
-
- if (plc != READ_ONLY_SAFE && plc != READ_WRITE_SAFE)
- continue;
-
- Collection<Integer> lostParts = cctx.topology().lostPartitions();
-
- for (int part : lostParts) {
- if (parts == null || Arrays.binarySearch(parts, part) >= 0) {
- throw new CacheException("Failed to execute query because cache partition has been " +
- "lost [cacheName=" + cctx.name() + ", part=" + part + ']');
- }
- }
- }
-
- if (isPreloadingActive(cacheIds)) {
- if (isReplicatedOnly)
- nodes = replicatedUnstableDataNodes(cacheIds, qryId);
- else {
- partsMap = partitionedUnstableDataNodes(cacheIds, qryId);
-
- if (partsMap != null) {
- qryMap = narrowForQuery(partsMap, parts);
-
- nodes = qryMap == null ? null : qryMap.keySet();
- }
- }
- }
- else {
- qryMap = stableDataNodes(isReplicatedOnly, topVer, cacheIds, parts, qryId);
-
- if (qryMap != null)
- nodes = qryMap.keySet();
- }
-
- return new NodesForPartitionsResult(nodes, partsMap, qryMap);
- }
-
- /**
* @param conn Connection.
* @param qry Query.
* @param explain Explain.
@@ -1881,32 +1364,6 @@ public class GridReduceQueryExecutor {
}
}
- /** */
- private Map<ClusterNode, IntArray> narrowForQuery(Map<ClusterNode, IntArray> partsMap, int[] parts) {
- if (parts == null)
- return partsMap;
-
- Map<ClusterNode, IntArray> cp = U.newHashMap(partsMap.size());
-
- for (Map.Entry<ClusterNode, IntArray> entry : partsMap.entrySet()) {
- IntArray filtered = new IntArray(parts.length);
-
- IntArray orig = entry.getValue();
-
- for (int i = 0; i < orig.size(); i++) {
- int p = orig.get(i);
-
- if (Arrays.binarySearch(parts, p) >= 0)
- filtered.add(p);
- }
-
- if (filtered.size() > 0)
- cp.put(entry.getKey(), filtered);
- }
-
- return cp.isEmpty() ? null : cp;
- }
-
/**
* @param qryTimeout Query timeout.
* @return Query retry timeout.
@@ -1917,79 +1374,4 @@ public class GridReduceQueryExecutor {
return IgniteSystemProperties.getLong(IGNITE_SQL_RETRY_TIMEOUT, DFLT_RETRY_TIMEOUT);
}
-
- /** */
- private static class ExplicitPartitionsSpecializer implements C2<ClusterNode, Message, Message> {
- /** Partitions map. */
- private final Map<ClusterNode, IntArray> partsMap;
-
- /**
- * @param partsMap Partitions map.
- */
- public ExplicitPartitionsSpecializer(Map<ClusterNode, IntArray> partsMap) {
- this.partsMap = partsMap;
- }
-
- /** {@inheritDoc} */
- @Override public Message apply(ClusterNode node, Message msg) {
- if (msg instanceof GridH2QueryRequest) {
- GridH2QueryRequest rq = new GridH2QueryRequest((GridH2QueryRequest)msg);
-
- rq.queryPartitions(toArray(partsMap.get(node)));
-
- return rq;
- } else if (msg instanceof GridH2DmlRequest) {
- GridH2DmlRequest rq = new GridH2DmlRequest((GridH2DmlRequest)msg);
-
- rq.queryPartitions(toArray(partsMap.get(node)));
-
- return rq;
- }
-
- return msg;
- }
- }
-
- /**
- * Result of nodes to partitions mapping for a query or update.
- */
- static class NodesForPartitionsResult {
- /** */
- final Collection<ClusterNode> nodes;
-
- /** */
- final Map<ClusterNode, IntArray> partsMap;
-
- /** */
- final Map<ClusterNode, IntArray> qryMap;
-
- /** */
- NodesForPartitionsResult(Collection<ClusterNode> nodes, Map<ClusterNode, IntArray> partsMap,
- Map<ClusterNode, IntArray> qryMap) {
- this.nodes = nodes;
- this.partsMap = partsMap;
- this.qryMap = qryMap;
- }
-
- /**
- * @return Collection of nodes a message shall be sent to.
- */
- Collection<ClusterNode> nodes() {
- return nodes;
- }
-
- /**
- * @return Maps a node to partition array.
- */
- Map<ClusterNode, IntArray> partitionsMap() {
- return partsMap;
- }
-
- /**
- * @return Maps a node to partition array.
- */
- Map<ClusterNode, IntArray> queryPartitionsMap() {
- return qryMap;
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6613376d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/ReducePartitionMapResult.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/ReducePartitionMapResult.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/ReducePartitionMapResult.java
new file mode 100644
index 0000000..83bbf8e
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/ReducePartitionMapResult.java
@@ -0,0 +1,73 @@
+/*
+ * 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.query.h2.twostep;
+
+import org.apache.ignite.cluster.ClusterNode;
+import org.h2.util.IntArray;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * Result of nodes to partitions mapping for a query or update.
+ */
+public class ReducePartitionMapResult {
+ /** */
+ private final Collection<ClusterNode> nodes;
+
+ /** */
+ private final Map<ClusterNode, IntArray> partsMap;
+
+ /** */
+ private final Map<ClusterNode, IntArray> qryMap;
+
+ /**
+ * Constructor.
+ *
+ * @param nodes Nodes.
+ * @param partsMap Partitions map.
+ * @param qryMap Nodes map.
+ */
+ public ReducePartitionMapResult(Collection<ClusterNode> nodes, Map<ClusterNode, IntArray> partsMap,
+ Map<ClusterNode, IntArray> qryMap) {
+ this.nodes = nodes;
+ this.partsMap = partsMap;
+ this.qryMap = qryMap;
+ }
+
+ /**
+ * @return Collection of nodes a message shall be sent to.
+ */
+ public Collection<ClusterNode> nodes() {
+ return nodes;
+ }
+
+ /**
+ * @return Maps a node to partition array.
+ */
+ public Map<ClusterNode, IntArray> partitionsMap() {
+ return partsMap;
+ }
+
+ /**
+ * @return Maps a node to partition array.
+ */
+ public Map<ClusterNode, IntArray> queryPartitionsMap() {
+ return qryMap;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6613376d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/ReducePartitionMapper.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/ReducePartitionMapper.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/ReducePartitionMapper.java
new file mode 100644
index 0000000..1112d19
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/ReducePartitionMapper.java
@@ -0,0 +1,638 @@
+/*
+ * 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.query.h2.twostep;
+
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.PartitionLossPolicy;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState;
+import org.apache.ignite.internal.util.GridIntIterator;
+import org.apache.ignite.internal.util.GridIntList;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.h2.util.IntArray;
+import org.jetbrains.annotations.Nullable;
+
+import javax.cache.CacheException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.apache.ignite.cache.PartitionLossPolicy.READ_ONLY_SAFE;
+import static org.apache.ignite.cache.PartitionLossPolicy.READ_WRITE_SAFE;
+import static org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion.NONE;
+
+/**
+ * Reduce partition mapper.
+ */
+public class ReducePartitionMapper {
+ /** */
+ private static final Set<ClusterNode> UNMAPPED_PARTS = Collections.emptySet();
+
+ /** Kernal context. */
+ private final GridKernalContext ctx;
+
+ /** */
+ private final IgniteLogger log;
+
+ /**
+ * Constructor.
+ *
+ * @param ctx Kernal context.
+ */
+ public ReducePartitionMapper(GridKernalContext ctx, IgniteLogger log) {
+ this.ctx = ctx;
+ this.log = log;
+ }
+
+ /**
+ * Evaluates nodes and nodes to partitions map given a list of cache ids, topology version and partitions.
+ *
+ * @param cacheIds Cache ids.
+ * @param topVer Topology version.
+ * @param parts Partitions array.
+ * @param isReplicatedOnly Allow only replicated caches.
+ * @param qryId Query ID.
+ * @return Result.
+ */
+ public ReducePartitionMapResult nodesForPartitions(List<Integer> cacheIds, AffinityTopologyVersion topVer,
+ int[] parts, boolean isReplicatedOnly, long qryId) {
+ Collection<ClusterNode> nodes = null;
+ Map<ClusterNode, IntArray> partsMap = null;
+ Map<ClusterNode, IntArray> qryMap = null;
+
+ for (int cacheId : cacheIds) {
+ GridCacheContext<?, ?> cctx = cacheContext(cacheId);
+
+ PartitionLossPolicy plc = cctx.config().getPartitionLossPolicy();
+
+ if (plc != READ_ONLY_SAFE && plc != READ_WRITE_SAFE)
+ continue;
+
+ Collection<Integer> lostParts = cctx.topology().lostPartitions();
+
+ for (int part : lostParts) {
+ if (parts == null || Arrays.binarySearch(parts, part) >= 0) {
+ throw new CacheException("Failed to execute query because cache partition has been " +
+ "lost [cacheName=" + cctx.name() + ", part=" + part + ']');
+ }
+ }
+ }
+
+ if (isPreloadingActive(cacheIds)) {
+ if (isReplicatedOnly)
+ nodes = replicatedUnstableDataNodes(cacheIds, qryId);
+ else {
+ partsMap = partitionedUnstableDataNodes(cacheIds, qryId);
+
+ if (partsMap != null) {
+ qryMap = narrowForQuery(partsMap, parts);
+
+ nodes = qryMap == null ? null : qryMap.keySet();
+ }
+ }
+ }
+ else {
+ qryMap = stableDataNodes(isReplicatedOnly, topVer, cacheIds, parts, qryId);
+
+ if (qryMap != null)
+ nodes = qryMap.keySet();
+ }
+
+ return new ReducePartitionMapResult(nodes, partsMap, qryMap);
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @return Cache context.
+ */
+ private GridCacheContext<?,?> cacheContext(Integer cacheId) {
+ return ctx.cache().context().cacheContext(cacheId);
+ }
+
+ /**
+ * @param cacheIds Cache IDs.
+ * @return {@code true} If preloading is active.
+ */
+ private boolean isPreloadingActive(List<Integer> cacheIds) {
+ for (Integer cacheId : cacheIds) {
+ if (null == cacheContext(cacheId))
+ throw new CacheException(String.format("Cache not found on local node [cacheId=%d]", cacheId));
+
+ if (hasMovingPartitions(cacheContext(cacheId)))
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @param cctx Cache context.
+ * @return {@code True} If cache has partitions in {@link GridDhtPartitionState#MOVING} state.
+ */
+ private static boolean hasMovingPartitions(GridCacheContext<?, ?> cctx) {
+ assert cctx != null;
+
+ return !cctx.isLocal() && cctx.topology().hasMovingPartitions();
+ }
+
+ /**
+ * @param isReplicatedOnly If we must only have replicated caches.
+ * @param topVer Topology version.
+ * @param cacheIds Participating cache IDs.
+ * @param parts Partitions.
+ * @param qryId Query ID.
+ * @return Data nodes or {@code null} if repartitioning started and we need to retry.
+ */
+ private Map<ClusterNode, IntArray> stableDataNodes(boolean isReplicatedOnly, AffinityTopologyVersion topVer,
+ List<Integer> cacheIds, int[] parts, long qryId) {
+ GridCacheContext<?, ?> cctx = cacheContext(cacheIds.get(0));
+
+ // If the first cache is not partitioned, find it (if it's present) and move it to index 0.
+ if (!cctx.isPartitioned()) {
+ for (int cacheId = 1; cacheId < cacheIds.size(); cacheId++) {
+ GridCacheContext<?, ?> currCctx = cacheContext(cacheIds.get(cacheId));
+
+ if (currCctx.isPartitioned()) {
+ Collections.swap(cacheIds, 0, cacheId);
+
+ cctx = currCctx;
+
+ break;
+ }
+ }
+ }
+
+ Map<ClusterNode, IntArray> map = stableDataNodesMap(topVer, cctx, parts);
+
+ Set<ClusterNode> nodes = map.keySet();
+
+ if (F.isEmpty(map))
+ throw new CacheException("Failed to find data nodes for cache: " + cctx.name());
+
+ for (int i = 1; i < cacheIds.size(); i++) {
+ GridCacheContext<?,?> extraCctx = cacheContext(cacheIds.get(i));
+
+ String extraCacheName = extraCctx.name();
+
+ if (extraCctx.isLocal())
+ continue; // No consistency guaranties for local caches.
+
+ if (isReplicatedOnly && !extraCctx.isReplicated())
+ throw new CacheException("Queries running on replicated cache should not contain JOINs " +
+ "with partitioned tables [replicatedCache=" + cctx.name() +
+ ", partitionedCache=" + extraCacheName + "]");
+
+ Set<ClusterNode> extraNodes = stableDataNodesMap(topVer, extraCctx, parts).keySet();
+
+ if (F.isEmpty(extraNodes))
+ throw new CacheException("Failed to find data nodes for cache: " + extraCacheName);
+
+ boolean disjoint;
+
+ if (extraCctx.isReplicated()) {
+ if (isReplicatedOnly) {
+ nodes.retainAll(extraNodes);
+
+ disjoint = map.isEmpty();
+ }
+ else
+ disjoint = !extraNodes.containsAll(nodes);
+ }
+ else
+ disjoint = !extraNodes.equals(nodes);
+
+ if (disjoint) {
+ if (isPreloadingActive(cacheIds)) {
+ logRetry("Failed to calculate nodes for SQL query (got disjoint node map during rebalance) " +
+ "[qryId=" + qryId + ", affTopVer=" + topVer + ", cacheIds=" + cacheIds +
+ ", parts=" + (parts == null ? "[]" : Arrays.toString(parts)) +
+ ", replicatedOnly=" + isReplicatedOnly + ", lastCache=" + extraCctx.name() +
+ ", lastCacheId=" + extraCctx.cacheId() + ']');
+
+ return null; // Retry.
+ }
+ else
+ throw new CacheException("Caches have distinct sets of data nodes [cache1=" + cctx.name() +
+ ", cache2=" + extraCacheName + "]");
+ }
+ }
+
+ return map;
+ }
+
+ /**
+ * @param topVer Topology version.
+ * @param cctx Cache context.
+ * @param parts Partitions.
+ */
+ private Map<ClusterNode, IntArray> stableDataNodesMap(AffinityTopologyVersion topVer,
+ final GridCacheContext<?, ?> cctx, @Nullable final int[] parts) {
+
+ Map<ClusterNode, IntArray> mapping = new HashMap<>();
+
+ // Explicit partitions mapping is not applicable to replicated cache.
+ if (cctx.isReplicated()) {
+ for (ClusterNode clusterNode : cctx.affinity().assignment(topVer).nodes())
+ mapping.put(clusterNode, null);
+
+ return mapping;
+ }
+
+ List<List<ClusterNode>> assignment = cctx.affinity().assignment(topVer).assignment();
+
+ boolean needPartsFilter = parts != null;
+
+ GridIntIterator iter = needPartsFilter ? new GridIntList(parts).iterator() :
+ U.forRange(0, cctx.affinity().partitions());
+
+ while(iter.hasNext()) {
+ int partId = iter.next();
+
+ List<ClusterNode> partNodes = assignment.get(partId);
+
+ if (!partNodes.isEmpty()) {
+ ClusterNode prim = partNodes.get(0);
+
+ if (!needPartsFilter) {
+ mapping.put(prim, null);
+
+ continue;
+ }
+
+ IntArray partIds = mapping.get(prim);
+
+ if (partIds == null) {
+ partIds = new IntArray();
+
+ mapping.put(prim, partIds);
+ }
+
+ partIds.add(partId);
+ }
+ }
+
+ return mapping;
+ }
+
+ /**
+ * Calculates partition mapping for partitioned cache on unstable topology.
+ *
+ * @param cacheIds Cache IDs.
+ * @param qryId Query ID.
+ * @return Partition mapping or {@code null} if we can't calculate it due to repartitioning and we need to retry.
+ */
+ @SuppressWarnings("unchecked")
+ private Map<ClusterNode, IntArray> partitionedUnstableDataNodes(List<Integer> cacheIds, long qryId) {
+ // If the main cache is replicated, just replace it with the first partitioned.
+ GridCacheContext<?,?> cctx = findFirstPartitioned(cacheIds);
+
+ final int partsCnt = cctx.affinity().partitions();
+
+ if (cacheIds.size() > 1) { // Check correct number of partitions for partitioned caches.
+ for (Integer cacheId : cacheIds) {
+ GridCacheContext<?, ?> extraCctx = cacheContext(cacheId);
+
+ if (extraCctx.isReplicated() || extraCctx.isLocal())
+ continue;
+
+ int parts = extraCctx.affinity().partitions();
+
+ if (parts != partsCnt)
+ throw new CacheException("Number of partitions must be the same for correct collocation [cache1=" +
+ cctx.name() + ", parts1=" + partsCnt + ", cache2=" + extraCctx.name() +
+ ", parts2=" + parts + "]");
+ }
+ }
+
+ Set<ClusterNode>[] partLocs = new Set[partsCnt];
+
+ // Fill partition locations for main cache.
+ for (int p = 0; p < partsCnt; p++) {
+ List<ClusterNode> owners = cctx.topology().owners(p);
+
+ if (F.isEmpty(owners)) {
+ // Handle special case: no mapping is configured for a partition.
+ if (F.isEmpty(cctx.affinity().assignment(NONE).get(p))) {
+ partLocs[p] = UNMAPPED_PARTS; // Mark unmapped partition.
+
+ continue;
+ }
+ else if (!F.isEmpty(dataNodes(cctx.groupId(), NONE))) {
+ logRetry("Failed to calculate nodes for SQL query (partition has no owners, but corresponding " +
+ "cache group has data nodes) [qryId=" + qryId + ", cacheIds=" + cacheIds +
+ ", cacheName=" + cctx.name() + ", cacheId=" + cctx.cacheId() + ", part=" + p +
+ ", cacheGroupId=" + cctx.groupId() + ']');
+
+ return null; // Retry.
+ }
+
+ throw new CacheException("Failed to find data nodes [cache=" + cctx.name() + ", part=" + p + "]");
+ }
+
+ partLocs[p] = new HashSet<>(owners);
+ }
+
+ if (cacheIds.size() > 1) {
+ // Find owner intersections for each participating partitioned cache partition.
+ // We need this for logical collocation between different partitioned caches with the same affinity.
+ for (Integer cacheId : cacheIds) {
+ GridCacheContext<?, ?> extraCctx = cacheContext(cacheId);
+
+ // This is possible if we have replaced a replicated cache with a partitioned one earlier.
+ if (cctx == extraCctx)
+ continue;
+
+ if (extraCctx.isReplicated() || extraCctx.isLocal())
+ continue;
+
+ for (int p = 0, parts = extraCctx.affinity().partitions(); p < parts; p++) {
+ List<ClusterNode> owners = extraCctx.topology().owners(p);
+
+ if (partLocs[p] == UNMAPPED_PARTS)
+ continue; // Skip unmapped partitions.
+
+ if (F.isEmpty(owners)) {
+ if (!F.isEmpty(dataNodes(extraCctx.groupId(), NONE))) {
+ logRetry("Failed to calculate nodes for SQL query (partition has no owners, but " +
+ "corresponding cache group has data nodes) [qryId=" + qryId +
+ ", cacheIds=" + cacheIds + ", cacheName=" + extraCctx.name() +
+ ", cacheId=" + extraCctx.cacheId() + ", part=" + p +
+ ", cacheGroupId=" + extraCctx.groupId() + ']');
+
+ return null; // Retry.
+ }
+
+ throw new CacheException("Failed to find data nodes [cache=" + extraCctx.name() +
+ ", part=" + p + "]");
+ }
+
+ if (partLocs[p] == null)
+ partLocs[p] = new HashSet<>(owners);
+ else {
+ partLocs[p].retainAll(owners); // Intersection of owners.
+
+ if (partLocs[p].isEmpty()) {
+ logRetry("Failed to calculate nodes for SQL query (caches have no common data nodes for " +
+ "partition) [qryId=" + qryId + ", cacheIds=" + cacheIds +
+ ", lastCacheName=" + extraCctx.name() + ", lastCacheId=" + extraCctx.cacheId() +
+ ", part=" + p + ']');
+
+ return null; // Intersection is empty -> retry.
+ }
+ }
+ }
+ }
+
+ // Filter nodes where not all the replicated caches loaded.
+ for (Integer cacheId : cacheIds) {
+ GridCacheContext<?, ?> extraCctx = cacheContext(cacheId);
+
+ if (!extraCctx.isReplicated())
+ continue;
+
+ Set<ClusterNode> dataNodes = replicatedUnstableDataNodes(extraCctx, qryId);
+
+ if (F.isEmpty(dataNodes))
+ return null; // Retry.
+
+ int part = 0;
+
+ for (Set<ClusterNode> partLoc : partLocs) {
+ if (partLoc == UNMAPPED_PARTS)
+ continue; // Skip unmapped partition.
+
+ partLoc.retainAll(dataNodes);
+
+ if (partLoc.isEmpty()) {
+ logRetry("Failed to calculate nodes for SQL query (caches have no common data nodes for " +
+ "partition) [qryId=" + qryId + ", cacheIds=" + cacheIds +
+ ", lastReplicatedCacheName=" + extraCctx.name() +
+ ", lastReplicatedCacheId=" + extraCctx.cacheId() + ", part=" + part + ']');
+
+ return null; // Retry.
+ }
+
+ part++;
+ }
+ }
+ }
+
+ // Collect the final partitions mapping.
+ Map<ClusterNode, IntArray> res = new HashMap<>();
+
+ // Here partitions in all IntArray's will be sorted in ascending order, this is important.
+ for (int p = 0; p < partLocs.length; p++) {
+ Set<ClusterNode> pl = partLocs[p];
+
+ // Skip unmapped partitions.
+ if (pl == UNMAPPED_PARTS)
+ continue;
+
+ assert !F.isEmpty(pl) : pl;
+
+ ClusterNode n = pl.size() == 1 ? F.first(pl) : F.rand(pl);
+
+ IntArray parts = res.get(n);
+
+ if (parts == null)
+ res.put(n, parts = new IntArray());
+
+ parts.add(p);
+ }
+
+ return res;
+ }
+
+ /**
+ * Calculates data nodes for replicated caches on unstable topology.
+ *
+ * @param cacheIds Cache IDs.
+ * @param qryId Query ID.
+ * @return Collection of all data nodes owning all the caches or {@code null} for retry.
+ */
+ private Collection<ClusterNode> replicatedUnstableDataNodes(List<Integer> cacheIds, long qryId) {
+ int i = 0;
+
+ GridCacheContext<?, ?> cctx = cacheContext(cacheIds.get(i++));
+
+ // The main cache is allowed to be partitioned.
+ if (!cctx.isReplicated()) {
+ assert cacheIds.size() > 1: "no extra replicated caches with partitioned main cache";
+
+ // Just replace the main cache with the first one extra.
+ cctx = cacheContext(cacheIds.get(i++));
+
+ assert cctx.isReplicated(): "all the extra caches must be replicated here";
+ }
+
+ Set<ClusterNode> nodes = replicatedUnstableDataNodes(cctx, qryId);
+
+ if (F.isEmpty(nodes))
+ return null; // Retry.
+
+ for (;i < cacheIds.size(); i++) {
+ GridCacheContext<?, ?> extraCctx = cacheContext(cacheIds.get(i));
+
+ if (extraCctx.isLocal())
+ continue;
+
+ if (!extraCctx.isReplicated())
+ throw new CacheException("Queries running on replicated cache should not contain JOINs " +
+ "with tables in partitioned caches [replicatedCache=" + cctx.name() + ", " +
+ "partitionedCache=" + extraCctx.name() + "]");
+
+ Set<ClusterNode> extraOwners = replicatedUnstableDataNodes(extraCctx, qryId);
+
+ if (F.isEmpty(extraOwners))
+ return null; // Retry.
+
+ nodes.retainAll(extraOwners);
+
+ if (nodes.isEmpty()) {
+ logRetry("Failed to calculate nodes for SQL query (got disjoint node map for REPLICATED caches " +
+ "during rebalance) [qryId=" + qryId + ", cacheIds=" + cacheIds +
+ ", lastCache=" + extraCctx.name() + ", lastCacheId=" + extraCctx.cacheId() + ']');
+
+ return null; // Retry.
+ }
+ }
+
+ return nodes;
+ }
+
+ /**
+ * Collects all the nodes owning all the partitions for the given replicated cache.
+ *
+ * @param cctx Cache context.
+ * @param qryId Query ID.
+ * @return Owning nodes or {@code null} if we can't find owners for some partitions.
+ */
+ private Set<ClusterNode> replicatedUnstableDataNodes(GridCacheContext<?,?> cctx, long qryId) {
+ assert cctx.isReplicated() : cctx.name() + " must be replicated";
+
+ String cacheName = cctx.name();
+
+ Set<ClusterNode> dataNodes = new HashSet<>(dataNodes(cctx.groupId(), NONE));
+
+ if (dataNodes.isEmpty())
+ throw new CacheException("Failed to find data nodes for cache: " + cacheName);
+
+ // Find all the nodes owning all the partitions for replicated cache.
+ for (int p = 0, parts = cctx.affinity().partitions(); p < parts; p++) {
+ List<ClusterNode> owners = cctx.topology().owners(p);
+
+ if (F.isEmpty(owners)) {
+ logRetry("Failed to calculate nodes for SQL query (partition of a REPLICATED cache has no owners) [" +
+ "qryId=" + qryId + ", cacheName=" + cctx.name() + ", cacheId=" + cctx.cacheId() +
+ ", part=" + p + ']');
+
+ return null; // Retry.
+ }
+
+ dataNodes.retainAll(owners);
+
+ if (dataNodes.isEmpty()) {
+ logRetry("Failed to calculate nodes for SQL query (partitions of a REPLICATED has no common owners) [" +
+ "qryId=" + qryId + ", cacheName=" + cctx.name() + ", cacheId=" + cctx.cacheId() +
+ ", lastPart=" + p + ']');
+
+ return null; // Retry.
+ }
+ }
+
+ return dataNodes;
+ }
+
+ /**
+ * @param grpId Cache group ID.
+ * @param topVer Topology version.
+ * @return Collection of data nodes.
+ */
+ private Collection<ClusterNode> dataNodes(int grpId, AffinityTopologyVersion topVer) {
+ Collection<ClusterNode> res = ctx.discovery().cacheGroupAffinityNodes(grpId, topVer);
+
+ return res != null ? res : Collections.<ClusterNode>emptySet();
+ }
+
+ /**
+ *
+ * @param partsMap Partitions map.
+ * @param parts Partitions.
+ * @return Result.
+ */
+ private static Map<ClusterNode, IntArray> narrowForQuery(Map<ClusterNode, IntArray> partsMap, int[] parts) {
+ if (parts == null)
+ return partsMap;
+
+ Map<ClusterNode, IntArray> cp = U.newHashMap(partsMap.size());
+
+ for (Map.Entry<ClusterNode, IntArray> entry : partsMap.entrySet()) {
+ IntArray filtered = new IntArray(parts.length);
+
+ IntArray orig = entry.getValue();
+
+ for (int i = 0; i < orig.size(); i++) {
+ int p = orig.get(i);
+
+ if (Arrays.binarySearch(parts, p) >= 0)
+ filtered.add(p);
+ }
+
+ if (filtered.size() > 0)
+ cp.put(entry.getKey(), filtered);
+ }
+
+ return cp.isEmpty() ? null : cp;
+ }
+
+ /**
+ * @param cacheIds Cache IDs.
+ * @return The first partitioned cache context.
+ */
+ private GridCacheContext<?,?> findFirstPartitioned(List<Integer> cacheIds) {
+ for (int i = 0; i < cacheIds.size(); i++) {
+ GridCacheContext<?, ?> cctx = cacheContext(cacheIds.get(i));
+
+ if (i == 0 && cctx.isLocal())
+ throw new CacheException("Cache is LOCAL: " + cctx.name());
+
+ if (!cctx.isReplicated() && !cctx.isLocal())
+ return cctx;
+ }
+
+ throw new IllegalStateException("Failed to find partitioned cache.");
+ }
+
+ /**
+ * Load failed partition reservation.
+ *
+ * @param msg Message.
+ */
+ private void logRetry(String msg) {
+ log.info(msg);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6613376d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/ReducePartitionsSpecializer.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/ReducePartitionsSpecializer.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/ReducePartitionsSpecializer.java
new file mode 100644
index 0000000..592efee
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/ReducePartitionsSpecializer.java
@@ -0,0 +1,61 @@
+/*
+ * 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.query.h2.twostep;
+
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2DmlRequest;
+import org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2QueryRequest;
+import org.apache.ignite.internal.util.typedef.C2;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.h2.util.IntArray;
+
+import java.util.Map;
+
+/**
+ * Reducer partitions specializer.
+ */
+public class ReducePartitionsSpecializer implements C2<ClusterNode, Message, Message> {
+ /** Partitions map. */
+ private final Map<ClusterNode, IntArray> partsMap;
+
+ /**
+ * @param partsMap Partitions map.
+ */
+ public ReducePartitionsSpecializer(Map<ClusterNode, IntArray> partsMap) {
+ this.partsMap = partsMap;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Message apply(ClusterNode node, Message msg) {
+ if (msg instanceof GridH2QueryRequest) {
+ GridH2QueryRequest rq = new GridH2QueryRequest((GridH2QueryRequest)msg);
+
+ rq.queryPartitions(GridReduceQueryExecutor.toArray(partsMap.get(node)));
+
+ return rq;
+ } else if (msg instanceof GridH2DmlRequest) {
+ GridH2DmlRequest rq = new GridH2DmlRequest((GridH2DmlRequest)msg);
+
+ rq.queryPartitions(GridReduceQueryExecutor.toArray(partsMap.get(node)));
+
+ return rq;
+ }
+
+ return msg;
+ }
+}
[37/50] [abbrv] ignite git commit: IGNITE-10368: MVCC: Create "Cache
9" test suite for MVCC mode. This closes #5556.
Posted by sb...@apache.org.
IGNITE-10368: MVCC: Create "Cache 9" test suite for MVCC mode. This closes #5556.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bc895ac6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bc895ac6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bc895ac6
Branch: refs/heads/ignite-10044
Commit: bc895ac62f8049ac52f007cf80b23d1296198ad9
Parents: 9edd786
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Wed Dec 5 16:26:35 2018 +0300
Committer: Igor Seliverstov <gv...@gmail.com>
Committed: Wed Dec 5 16:26:35 2018 +0300
----------------------------------------------------------------------
.../processors/cache/CachePutIfAbsentTest.java | 4 +
.../distributed/IgniteCachePrimarySyncTest.java | 53 +++++++----
.../IgniteTxCachePrimarySyncTest.java | 96 +++++++++++++++++---
...teSynchronizationModesMultithreadedTest.java | 78 +++++++++-------
.../IgniteTxConcurrentRemoveObjectsTest.java | 52 ++++++++---
.../testsuites/IgniteCacheMvccTestSuite9.java | 57 ++++++++++++
.../testsuites/IgniteCacheTestSuite9.java | 33 ++++---
7 files changed, 283 insertions(+), 90 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc895ac6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java
index 00ba25f..a70d3c3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java
@@ -30,6 +30,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
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.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
@@ -129,6 +130,9 @@ public class CachePutIfAbsentTest extends GridCommonAbstractTest {
for (TransactionConcurrency concurrency : TransactionConcurrency.values()) {
for (TransactionIsolation isolation : TransactionIsolation.values()) {
+ if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation))
+ continue;
+
try (Transaction tx = txs.txStart(concurrency, isolation)) {
Object old = cache.getAndPutIfAbsent(key, 3);
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc895ac6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java
index e9e22ee..2482a8e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java
@@ -27,6 +27,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
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.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
@@ -35,6 +36,7 @@ import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC;
import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
@@ -53,6 +55,15 @@ public class IgniteCachePrimarySyncTest extends GridCommonAbstractTest {
private static final int SRVS = 4;
/** */
+ private static final String ATOMIC_CACHE = "atomicCache";
+
+ /** */
+ private static final String TX_CACHE = "txCache";
+
+ /** */
+ private static final String MVCC_CACHE = "mvccCache";
+
+ /** */
private boolean clientMode;
/** {@inheritDoc} */
@@ -61,19 +72,22 @@ public class IgniteCachePrimarySyncTest extends GridCommonAbstractTest {
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
- CacheConfiguration<Object, Object> ccfg1 = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
- ccfg1.setName("cache1");
- ccfg1.setAtomicityMode(ATOMIC);
- ccfg1.setBackups(2);
- ccfg1.setWriteSynchronizationMode(PRIMARY_SYNC);
+ CacheConfiguration<Object, Object> ccfg1 = new CacheConfiguration<>(ATOMIC_CACHE)
+ .setAtomicityMode(ATOMIC)
+ .setBackups(2)
+ .setWriteSynchronizationMode(PRIMARY_SYNC);
+
+ CacheConfiguration<Object, Object> ccfg2 = new CacheConfiguration<>(TX_CACHE)
+ .setAtomicityMode(TRANSACTIONAL)
+ .setBackups(2)
+ .setWriteSynchronizationMode(PRIMARY_SYNC);
- CacheConfiguration<Object, Object> ccfg2 = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
- ccfg2.setName("cache2");
- ccfg2.setAtomicityMode(TRANSACTIONAL);
- ccfg2.setBackups(2);
- ccfg2.setWriteSynchronizationMode(PRIMARY_SYNC);
+ CacheConfiguration<Object, Object> ccfg3 = new CacheConfiguration<>(MVCC_CACHE)
+ .setAtomicityMode(TRANSACTIONAL_SNAPSHOT)
+ .setBackups(2)
+ .setWriteSynchronizationMode(PRIMARY_SYNC);
- cfg.setCacheConfiguration(ccfg1, ccfg2);
+ cfg.setCacheConfiguration(ccfg1, ccfg2, ccfg3);
cfg.setClientMode(clientMode);
@@ -97,17 +111,24 @@ public class IgniteCachePrimarySyncTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testPutGet() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-10520");
+
Ignite ignite = ignite(SRVS);
- checkPutGet(ignite.cache("cache1"), null, null, null);
+ checkPutGet(ignite.cache(ATOMIC_CACHE), null, null, null);
+
+ checkPutGet(ignite.cache(TX_CACHE), null, null, null);
+
+ checkPutGet(ignite.cache(MVCC_CACHE), null, null, null);
- checkPutGet(ignite.cache("cache2"), null, null, null);
+ checkPutGet(ignite.cache(TX_CACHE), ignite.transactions(), OPTIMISTIC, REPEATABLE_READ);
- checkPutGet(ignite.cache("cache2"), ignite.transactions(), OPTIMISTIC, REPEATABLE_READ);
+ checkPutGet(ignite.cache(TX_CACHE), ignite.transactions(), OPTIMISTIC, SERIALIZABLE);
- checkPutGet(ignite.cache("cache2"), ignite.transactions(), OPTIMISTIC, SERIALIZABLE);
+ checkPutGet(ignite.cache(TX_CACHE), ignite.transactions(), PESSIMISTIC, READ_COMMITTED);
- checkPutGet(ignite.cache("cache2"), ignite.transactions(), PESSIMISTIC, READ_COMMITTED);
+ checkPutGet(ignite.cache(MVCC_CACHE), ignite.transactions(), PESSIMISTIC, REPEATABLE_READ);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc895ac6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
index bdf0b12..ceed9b8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
@@ -58,6 +58,8 @@ 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.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
+import org.apache.ignite.testframework.MvccFeatureChecker.Feature;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
@@ -134,6 +136,9 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testSingleKeyCommitFromPrimary() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-10518");
+
singleKeyCommitFromPrimary(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 1, true, false));
singleKeyCommitFromPrimary(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 2, false, false));
@@ -148,6 +153,16 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
private void singleKeyCommitFromPrimary(CacheConfiguration<Object, Object> ccfg) throws Exception {
+ if (MvccFeatureChecker.forcedMvcc()) {
+ if (ccfg.getCacheStoreFactory() != null &&
+ !MvccFeatureChecker.isSupported(Feature.CACHE_STORE))
+ return;
+
+ if (ccfg.getNearConfiguration() != null &&
+ !MvccFeatureChecker.isSupported(Feature.NEAR_CACHE))
+ return;
+ }
+
Ignite ignite = ignite(0);
IgniteCache<Object, Object> cache = ignite.createCache(ccfg);
@@ -164,6 +179,9 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
for (final TransactionConcurrency concurrency : TransactionConcurrency.values()) {
for (final TransactionIsolation isolation : TransactionIsolation.values()) {
+ if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation))
+ continue;
+
singleKeyCommitFromPrimary(node, ccfg, new IgniteBiInClosure<Integer, IgniteCache<Object, Object>>() {
@Override public void apply(Integer key, IgniteCache<Object, Object> cache) {
Ignite ignite = cache.unwrap(Ignite.class);
@@ -266,12 +284,19 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
private void singleKeyPrimaryNodeLeft(CacheConfiguration<Object, Object> ccfg) throws Exception {
+ if (MvccFeatureChecker.forcedMvcc()) {
+ if (ccfg.getCacheStoreFactory() != null &&
+ !MvccFeatureChecker.isSupported(Feature.CACHE_STORE))
+ return;
+ }
+
Ignite ignite = ignite(0);
IgniteCache<Object, Object> cache = ignite.createCache(ccfg);
try {
- ignite(NODES - 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>());
+ if (!MvccFeatureChecker.forcedMvcc() || MvccFeatureChecker.isSupported(Feature.NEAR_CACHE))
+ ignite(NODES - 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>());
for (int i = 0; i < NODES; i++) {
Ignite node = ignite(i);
@@ -284,6 +309,9 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
for (final TransactionConcurrency concurrency : TransactionConcurrency.values()) {
for (final TransactionIsolation isolation : TransactionIsolation.values()) {
+ if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation))
+ continue;
+
singleKeyPrimaryNodeLeft(node, ccfg, new IgniteBiInClosure<Integer, IgniteCache<Object, Object>>() {
@Override public void apply(Integer key, IgniteCache<Object, Object> cache) {
Ignite ignite = cache.unwrap(Ignite.class);
@@ -372,6 +400,9 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testSingleKeyCommit() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-10518");
+
singleKeyCommit(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 1, true, false));
singleKeyCommit(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 2, false, false));
@@ -386,12 +417,23 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
private void singleKeyCommit(CacheConfiguration<Object, Object> ccfg) throws Exception {
+ if (MvccFeatureChecker.forcedMvcc()) {
+ if (ccfg.getCacheStoreFactory() != null &&
+ !MvccFeatureChecker.isSupported(Feature.CACHE_STORE))
+ return;
+
+ if (ccfg.getNearConfiguration() != null &&
+ !MvccFeatureChecker.isSupported(Feature.NEAR_CACHE))
+ return;
+ }
+
Ignite ignite = ignite(0);
IgniteCache<Object, Object> cache = ignite.createCache(ccfg);
try {
- ignite(NODES - 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>());
+ if (!MvccFeatureChecker.forcedMvcc() || MvccFeatureChecker.isSupported(Feature.NEAR_CACHE))
+ ignite(NODES - 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>());
for (int i = 1; i < NODES; i++) {
Ignite node = ignite(i);
@@ -406,6 +448,9 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
for (final TransactionConcurrency concurrency : TransactionConcurrency.values()) {
for (final TransactionIsolation isolation : TransactionIsolation.values()) {
+ if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation))
+ continue;
+
singleKeyCommit(node, ccfg, new IgniteBiInClosure<Integer, IgniteCache<Object, Object>>() {
@Override public void apply(Integer key, IgniteCache<Object, Object> cache) {
Ignite ignite = cache.unwrap(Ignite.class);
@@ -528,12 +573,23 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
private void checkWaitPrimaryResponse(CacheConfiguration<Object, Object> ccfg) throws Exception {
+ if (MvccFeatureChecker.forcedMvcc()) {
+ if (ccfg.getCacheStoreFactory() != null &&
+ !MvccFeatureChecker.isSupported(Feature.CACHE_STORE))
+ return;
+
+ if (ccfg.getNearConfiguration() != null &&
+ !MvccFeatureChecker.isSupported(Feature.NEAR_CACHE))
+ return;
+ }
+
Ignite ignite = ignite(0);
IgniteCache<Object, Object> cache = ignite.createCache(ccfg);
try {
- ignite(NODES - 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>());
+ if (!MvccFeatureChecker.forcedMvcc() || MvccFeatureChecker.isSupported(Feature.NEAR_CACHE))
+ ignite(NODES - 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>());
for (int i = 1; i < NODES; i++) {
Ignite node = ignite(i);
@@ -561,6 +617,9 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
for (final TransactionConcurrency concurrency : TransactionConcurrency.values()) {
for (final TransactionIsolation isolation : TransactionIsolation.values()) {
+ if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation))
+ continue;
+
checkWaitPrimaryResponse(node, ccfg, new IgniteBiInClosure<Integer, IgniteCache<Object, Object>>() {
@Override public void apply(Integer key, IgniteCache<Object, Object> cache) {
Ignite ignite = cache.unwrap(Ignite.class);
@@ -652,6 +711,9 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testOnePhaseMessages() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ return; // Not supported. Commit flow differs for Mvcc mode.
+
checkOnePhaseMessages(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 1, false, false));
}
@@ -678,6 +740,9 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
for (final TransactionConcurrency concurrency : TransactionConcurrency.values()) {
for (final TransactionIsolation isolation : TransactionIsolation.values()) {
+ if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation))
+ continue;
+
checkOnePhaseMessages(node, ccfg, new IgniteBiInClosure<Integer, IgniteCache<Object, Object>>() {
@Override public void apply(Integer key, IgniteCache<Object, Object> cache) {
Ignite ignite = cache.unwrap(Ignite.class);
@@ -760,12 +825,13 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
List<IgniteCache<Object, Object>> caches = new ArrayList<>();
try {
- caches.add(createCache(ignite, cacheConfiguration("fullSync1", FULL_SYNC, 1, false, false), true));
- caches.add(createCache(ignite, cacheConfiguration("fullSync2", FULL_SYNC, 1, false, false), true));
- caches.add(createCache(ignite, cacheConfiguration("fullAsync1", FULL_ASYNC, 1, false, false), true));
- caches.add(createCache(ignite, cacheConfiguration("fullAsync2", FULL_ASYNC, 1, false, false), true));
- caches.add(createCache(ignite, cacheConfiguration("primarySync1", PRIMARY_SYNC, 1, false, false), true));
- caches.add(createCache(ignite, cacheConfiguration("primarySync2", PRIMARY_SYNC, 1, false, false), true));
+
+ caches.add(createCache(ignite, cacheConfiguration("fullSync1", FULL_SYNC, 1, false, false)));
+ caches.add(createCache(ignite, cacheConfiguration("fullSync2", FULL_SYNC, 1, false, false)));
+ caches.add(createCache(ignite, cacheConfiguration("fullAsync1", FULL_ASYNC, 1, false, false)));
+ caches.add(createCache(ignite, cacheConfiguration("fullAsync2", FULL_ASYNC, 1, false, false)));
+ caches.add(createCache(ignite, cacheConfiguration("primarySync1", PRIMARY_SYNC, 1, false, false)));
+ caches.add(createCache(ignite, cacheConfiguration("primarySync2", PRIMARY_SYNC, 1, false, false)));
for (int i = 0; i < NODES; i++) {
checkTxSyncMode(ignite(i), true);
@@ -805,7 +871,8 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
* @param key Cache key.
* @throws Exception If failed.
*/
- private void waitKeyUpdated(Ignite ignite, int expNodes, final String cacheName, final Object key) throws Exception {
+ private void waitKeyUpdated(Ignite ignite, int expNodes, final String cacheName,
+ final Object key) throws Exception {
Affinity<Object> aff = ignite.affinity(cacheName);
final Collection<ClusterNode> nodes = aff.mapKeyToPrimaryAndBackups(key);
@@ -834,14 +901,12 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
/**
* @param ignite Node.
* @param ccfg Cache configuration.
- * @param nearCache If {@code true} creates near cache on one of client nodes.
* @return Created cache.
*/
- private <K, V> IgniteCache<K, V> createCache(Ignite ignite, CacheConfiguration<K, V> ccfg,
- boolean nearCache) {
+ private <K, V> IgniteCache<K, V> createCache(Ignite ignite, CacheConfiguration<K, V> ccfg) {
IgniteCache<K, V> cache = ignite.createCache(ccfg);
- if (nearCache)
+ if (!MvccFeatureChecker.forcedMvcc() || MvccFeatureChecker.isSupported(Feature.NEAR_CACHE))
ignite(NODES - 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>());
return cache;
@@ -866,6 +931,9 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
for (TransactionConcurrency concurrency : TransactionConcurrency.values()) {
for (TransactionIsolation isolation : TransactionIsolation.values()) {
+ if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation))
+ continue;
+
try (Transaction tx = txs.txStart(concurrency, isolation)) {
fullSync1.put(key++, 1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc895ac6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
index bd552c2..86d20db 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
@@ -32,7 +32,6 @@ import javax.cache.integration.CacheWriterException;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.cache.store.CacheStoreAdapter;
@@ -51,6 +50,7 @@ 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.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionOptimisticException;
@@ -107,24 +107,26 @@ public class IgniteTxCacheWriteSynchronizationModesMultithreadedTest extends Gri
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
- super.beforeTestsStarted();
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-9470");
- System.setProperty(IgniteSystemProperties.IGNITE_ENABLE_FORCIBLE_NODE_KILL,"true");
+ super.beforeTestsStarted();
- startGrids(SRVS);
+ startGridsMultiThreaded(SRVS);
clientMode = true;
- for (int i = 0; i < CLIENTS; i++) {
- Ignite client = startGrid(SRVS + i);
+ startGridsMultiThreaded(SRVS, CLIENTS);
- assertTrue(client.configuration().isClientMode());
- }
+ for (int i = 0; i < CLIENTS; i++)
+ assertTrue(grid(SRVS + i).configuration().isClientMode());
}
/** {@inheritDoc} */
@Override protected void afterTestsStopped() throws Exception {
- System.clearProperty(IgniteSystemProperties.IGNITE_ENABLE_FORCIBLE_NODE_KILL);
+ stopAllGrids();
+
+ super.afterTestsStopped();
}
/** {@inheritDoc} */
@@ -202,6 +204,14 @@ public class IgniteTxCacheWriteSynchronizationModesMultithreadedTest extends Gri
boolean store,
boolean nearCache,
boolean restart) throws Exception {
+ if (MvccFeatureChecker.forcedMvcc()) {
+ if (store && !MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.CACHE_STORE))
+ return;
+
+ if (nearCache && !MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE))
+ return;
+ }
+
final Ignite ignite = ignite(0);
createCache(ignite, cacheConfiguration(DEFAULT_CACHE_NAME, syncMode, backups, store), nearCache);
@@ -278,36 +288,38 @@ public class IgniteTxCacheWriteSynchronizationModesMultithreadedTest extends Gri
}
});
- commitMultithreaded(new IgniteBiInClosure<Ignite, IgniteCache<Integer, Integer>>() {
- @Override public void apply(Ignite ignite, IgniteCache<Integer, Integer> cache) {
- ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
- Map<Integer, Integer> map = new LinkedHashMap<>();
-
- for (int i = 0; i < 10; i++) {
- Integer key = rnd.nextInt(MULTITHREADED_TEST_KEYS);
-
- map.put(key, rnd.nextInt());
- }
+ if (!MvccFeatureChecker.forcedMvcc()) {
+ commitMultithreaded(new IgniteBiInClosure<Ignite, IgniteCache<Integer, Integer>>() {
+ @Override public void apply(Ignite ignite, IgniteCache<Integer, Integer> cache) {
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
- while (true) {
- try (Transaction tx = ignite.transactions().txStart(OPTIMISTIC, SERIALIZABLE)) {
- for (Map.Entry<Integer, Integer> e : map.entrySet())
- cache.put(e.getKey(), e.getValue());
+ Map<Integer, Integer> map = new LinkedHashMap<>();
- tx.commit();
+ for (int i = 0; i < 10; i++) {
+ Integer key = rnd.nextInt(MULTITHREADED_TEST_KEYS);
- break;
- }
- catch (TransactionOptimisticException ignored) {
- // Retry.
+ map.put(key, rnd.nextInt());
}
- catch (CacheException | IgniteException ignored) {
- break;
+
+ while (true) {
+ try (Transaction tx = ignite.transactions().txStart(OPTIMISTIC, SERIALIZABLE)) {
+ for (Map.Entry<Integer, Integer> e : map.entrySet())
+ cache.put(e.getKey(), e.getValue());
+
+ tx.commit();
+
+ break;
+ }
+ catch (TransactionOptimisticException ignored) {
+ // Retry.
+ }
+ catch (CacheException | IgniteException ignored) {
+ break;
+ }
}
}
- }
- });
+ });
+ }
}
finally {
stop.set(true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc895ac6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConcurrentRemoveObjectsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConcurrentRemoveObjectsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConcurrentRemoveObjectsTest.java
index a5b2cb7..cd5cbe6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConcurrentRemoveObjectsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConcurrentRemoveObjectsTest.java
@@ -36,9 +36,11 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_CACHE_REMOVED_ENTRIES_TTL;
-import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
/**
@@ -67,25 +69,22 @@ public class IgniteTxConcurrentRemoveObjectsTest extends GridCommonAbstractTest
oldIgniteCacheRmvEntriesTtl = Long.getLong(IGNITE_CACHE_REMOVED_ENTRIES_TTL, 10_000);
System.setProperty(IGNITE_CACHE_REMOVED_ENTRIES_TTL, Long.toString(newIgniteCacheRemovedEntriesTtl));
+
+ startGrid(0);
}
/** {@inheritDoc} */
@Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
System.setProperty(IGNITE_CACHE_REMOVED_ENTRIES_TTL, Long.toString(oldIgniteCacheRmvEntriesTtl));
super.afterTestsStopped();
}
/** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- super.beforeTest();
-
- stopAllGrids();
- }
-
- /** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
- stopAllGrids();
+ grid(0).destroyCache(DEFAULT_CACHE_NAME);
super.afterTest();
}
@@ -102,7 +101,7 @@ public class IgniteTxConcurrentRemoveObjectsTest extends GridCommonAbstractTest
/**
* @return Cache configuration.
*/
- private CacheConfiguration<Integer, String> getCacheCfg() {
+ private CacheConfiguration<Integer, String> cacheConfiguration() {
CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<>();
ccfg.setName(DEFAULT_CACHE_NAME);
@@ -115,16 +114,39 @@ public class IgniteTxConcurrentRemoveObjectsTest extends GridCommonAbstractTest
}
/**
+ * @throws Exception If failed.
+ */
+ public void testOptimisticTxLeavesObjectsInLocalPartition() throws Exception {
+ checkTxLeavesObjectsInLocalPartition(cacheConfiguration(), TransactionConcurrency.OPTIMISTIC, SERIALIZABLE);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPessimisticTxLeavesObjectsInLocalPartition() throws Exception {
+ checkTxLeavesObjectsInLocalPartition(cacheConfiguration(), TransactionConcurrency.PESSIMISTIC, SERIALIZABLE);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMvccTxLeavesObjectsInLocalPartition() throws Exception {
+ checkTxLeavesObjectsInLocalPartition(cacheConfiguration().setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT),
+ TransactionConcurrency.PESSIMISTIC, REPEATABLE_READ);
+ }
+
+ /**
* Too many deletes in single transaction may overflow {@link GridDhtLocalPartition#rmvQueue} and entries will be
* deleted synchronously in {@link GridDhtLocalPartition#onDeferredDelete(int, KeyCacheObject, GridCacheVersion)}.
* This should not corrupt internal map state in {@link GridDhtLocalPartition}.
*
* @throws Exception If failed.
*/
- public void testTxLeavesObjectsInLocalPartition() throws Exception {
- IgniteEx igniteEx = startGrid(getConfiguration());
+ public void checkTxLeavesObjectsInLocalPartition(CacheConfiguration<Integer, String> ccfg,
+ TransactionConcurrency optimistic, TransactionIsolation isolation) throws Exception {
+ IgniteEx igniteEx = grid(0);
- igniteEx.getOrCreateCache(getCacheCfg());
+ igniteEx.getOrCreateCache(ccfg);
try (IgniteDataStreamer<Integer, String> dataStreamer = igniteEx.dataStreamer(DEFAULT_CACHE_NAME)) {
for (int i = 0; i < CACHE_ENTRIES_COUNT; i++)
@@ -141,8 +163,8 @@ public class IgniteTxConcurrentRemoveObjectsTest extends GridCommonAbstractTest
assertEquals(CACHE_ENTRIES_COUNT, client.getOrCreateCache(DEFAULT_CACHE_NAME).size());
- try (Transaction tx = client.transactions().txStart(OPTIMISTIC, SERIALIZABLE)) {
- IgniteCache<Integer, String> cache = client.getOrCreateCache(getCacheCfg());
+ try (Transaction tx = client.transactions().txStart(optimistic, isolation)) {
+ IgniteCache<Integer, String> cache = client.getOrCreateCache(cacheConfiguration());
for (int v = 0; v < CACHE_ENTRIES_COUNT; v++) {
cache.get(v);
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc895ac6/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite9.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite9.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite9.java
new file mode 100644
index 0000000..17a9421
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite9.java
@@ -0,0 +1,57 @@
+/*
+ * 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.testsuites;
+
+import java.util.Collection;
+import java.util.HashSet;
+import junit.framework.TestSuite;
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.internal.processors.cache.IgniteCacheGetCustomCollectionsSelfTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheLoadRebalanceEvictionSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.CacheAtomicPrimarySyncBackPressureTest;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteTxConcurrentRemoveObjectsTest;
+
+/**
+ * Test suite.
+ */
+public class IgniteCacheMvccTestSuite9 extends TestSuite {
+ /**
+ * @return IgniteCache test suite.
+ */
+ public static TestSuite suite() {
+ System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true");
+
+ Collection<Class> ignoredTests = new HashSet<>();
+
+ // Skip classes that already contains Mvcc tests
+ ignoredTests.add(IgniteTxConcurrentRemoveObjectsTest.class);
+
+ // Atomic caches.
+ ignoredTests.add(CacheAtomicPrimarySyncBackPressureTest.class);
+
+ // Other non-tx tests.
+ ignoredTests.add(IgniteCacheGetCustomCollectionsSelfTest.class);
+ ignoredTests.add(IgniteCacheLoadRebalanceEvictionSelfTest.class);
+
+ TestSuite suite = new TestSuite("IgniteCache Mvcc Test Suite part 9");
+
+ suite.addTest(IgniteCacheTestSuite9.suite(ignoredTests));
+
+ return suite;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc895ac6/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite9.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite9.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite9.java
index 157673e..23d71c1 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite9.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite9.java
@@ -17,6 +17,7 @@
package org.apache.ignite.testsuites;
+import java.util.Collection;
import junit.framework.TestSuite;
import org.apache.ignite.internal.processors.cache.CachePutIfAbsentTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheGetCustomCollectionsSelfTest;
@@ -28,6 +29,7 @@ import org.apache.ignite.internal.processors.cache.distributed.IgniteTxCachePrim
import org.apache.ignite.internal.processors.cache.distributed.IgniteTxCacheWriteSynchronizationModesMultithreadedTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteTxConcurrentRemoveObjectsTest;
import org.apache.ignite.internal.processors.cache.transactions.TxDataConsistencyOnCommitFailureTest;
+import org.apache.ignite.testframework.GridTestUtils;
/**
* Test suite.
@@ -35,25 +37,32 @@ import org.apache.ignite.internal.processors.cache.transactions.TxDataConsistenc
public class IgniteCacheTestSuite9 extends TestSuite {
/**
* @return IgniteCache test suite.
- * @throws Exception Thrown in case of the failure.
*/
- public static TestSuite suite() throws Exception {
+ public static TestSuite suite() {
+ return suite(null);
+ }
+
+ /**
+ * @param ignoredTests Ignored tests.
+ * @return IgniteCache test suite.
+ */
+ public static TestSuite suite(Collection<Class> ignoredTests) {
TestSuite suite = new TestSuite("IgniteCache Test Suite part 9");
- suite.addTestSuite(IgniteCacheGetCustomCollectionsSelfTest.class);
- suite.addTestSuite(IgniteCacheLoadRebalanceEvictionSelfTest.class);
- suite.addTestSuite(IgniteCachePrimarySyncTest.class);
- suite.addTestSuite(IgniteTxCachePrimarySyncTest.class);
- suite.addTestSuite(IgniteTxCacheWriteSynchronizationModesMultithreadedTest.class);
- suite.addTestSuite(CachePutIfAbsentTest.class);
+ GridTestUtils.addTestIfNeeded(suite, IgniteCacheGetCustomCollectionsSelfTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, IgniteCacheLoadRebalanceEvictionSelfTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, IgniteCachePrimarySyncTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, IgniteTxCachePrimarySyncTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, IgniteTxCacheWriteSynchronizationModesMultithreadedTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, CachePutIfAbsentTest.class, ignoredTests);
- suite.addTestSuite(CacheAtomicPrimarySyncBackPressureTest.class);
+ GridTestUtils.addTestIfNeeded(suite, CacheAtomicPrimarySyncBackPressureTest.class, ignoredTests);
- suite.addTestSuite(IgniteTxConcurrentRemoveObjectsTest.class);
+ GridTestUtils.addTestIfNeeded(suite, IgniteTxConcurrentRemoveObjectsTest.class, ignoredTests);
- suite.addTestSuite(TxDataConsistencyOnCommitFailureTest.class);
+ GridTestUtils.addTestIfNeeded(suite, TxDataConsistencyOnCommitFailureTest.class, ignoredTests);
- suite.addTestSuite(CacheOperationsInterruptTest.class);
+ GridTestUtils.addTestIfNeeded(suite, CacheOperationsInterruptTest.class, ignoredTests);
return suite;
}
[43/50] [abbrv] ignite git commit: IGNITE-8370 Web Console: Updated
type.
Posted by sb...@apache.org.
IGNITE-8370 Web Console: Updated type.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/24a50e10
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/24a50e10
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/24a50e10
Branch: refs/heads/ignite-10044
Commit: 24a50e1045a759aff584b5d651cc46ce9047394b
Parents: 63b1422
Author: Ilya Borisov <kl...@gmail.com>
Authored: Thu Dec 6 11:41:48 2018 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Dec 6 11:41:48 2018 +0700
----------------------------------------------------------------------
modules/web-console/frontend/app/types/index.ts | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/24a50e10/modules/web-console/frontend/app/types/index.ts
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/types/index.ts b/modules/web-console/frontend/app/types/index.ts
index 333c00b..df6a169 100644
--- a/modules/web-console/frontend/app/types/index.ts
+++ b/modules/web-console/frontend/app/types/index.ts
@@ -23,11 +23,12 @@ interface ITfMetatagsConfig {
export interface IIgniteNg1StateDeclaration extends Ng1StateDeclaration {
/**
- * Whether to store state as last visited in local storage or not.
- * true - will be saved
- * false (default) - won't be saved
+ * Whether to store state as last visited in local storage or not:
+ * `true` - will be saved
+ * `false` (default) - won't be saved
* @type {boolean}
*/
unsaved?: boolean,
- tfMetaTags: ITfMetatagsConfig
+ tfMetaTags: ITfMetatagsConfig,
+ permission?: string
}
[02/50] [abbrv] ignite git commit: IGNITE-10277 Fixed prepare-commit
WAL ordering for one-phase commit - Fixes #5448.
Posted by sb...@apache.org.
IGNITE-10277 Fixed prepare-commit WAL ordering for one-phase commit - Fixes #5448.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/395811dd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/395811dd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/395811dd
Branch: refs/heads/ignite-10044
Commit: 395811ddc11ed9d8bfb8972b110a4b7f0555f294
Parents: 493e0aa
Author: Anton Kalashnikov <ka...@yandex.ru>
Authored: Mon Dec 3 11:02:51 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Dec 3 11:02:51 2018 +0300
----------------------------------------------------------------------
.../dht/GridDhtTransactionalCacheAdapter.java | 4 ++-
.../cache/distributed/dht/GridDhtTxLocal.java | 7 ++++-
.../distributed/dht/GridDhtTxPrepareFuture.java | 19 +++++++++++---
...arOptimisticSerializableTxPrepareFuture.java | 11 +++++---
.../near/GridNearOptimisticTxPrepareFuture.java | 5 ++--
.../GridNearPessimisticTxPrepareFuture.java | 5 ++--
.../cache/transactions/IgniteTxAdapter.java | 27 ++++++++++++++++++--
.../cache/transactions/IgniteTxHandler.java | 24 ++++++++++++++---
8 files changed, 84 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/395811dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
index 4693232..dcd7be5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
@@ -1122,7 +1122,8 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
null,
req.subjectId(),
req.taskNameHash(),
- req.txLabel());
+ req.txLabel(),
+ null);
if (req.syncCommit())
tx.syncMode(FULL_SYNC);
@@ -2158,6 +2159,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
null,
txSubjectId,
txTaskNameHash,
+ null,
null);
// if (req.syncCommit())
http://git-wip-us.apache.org/repos/asf/ignite/blob/395811dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
index 6bad093..53c4942 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
@@ -36,6 +36,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.distributed.GridCacheMappedVersion;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishResponse;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareRequest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
@@ -122,6 +123,7 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
* @param txSize Expected transaction size.
* @param txNodes Transaction nodes mapping.
* @param lb Transaction label.
+ * @param parentTx Transaction from which this transaction was copied by(if it was).
*/
public GridDhtTxLocal(
GridCacheSharedContext cctx,
@@ -146,7 +148,8 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
Map<UUID, Collection<UUID>> txNodes,
UUID subjId,
int taskNameHash,
- @Nullable String lb
+ @Nullable String lb,
+ GridNearTxLocal parentTx
) {
super(
cctx,
@@ -180,6 +183,8 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
threadId = nearThreadId;
+ setParentTx(parentTx);
+
assert !F.eq(xidVer, nearXidVer);
initResult();
http://git-wip-us.apache.org/repos/asf/ignite/blob/395811dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 92e0ce8..58edc9d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -1003,7 +1003,7 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
* @return {@code True} if {@code done} flag was changed as a result of this call.
*/
private boolean onComplete(@Nullable GridNearTxPrepareResponse res) {
- if ((last || tx.isSystemInvalidate()) && !(tx.near() && tx.local()))
+ if (!tx.onePhaseCommit() && ((last || tx.isSystemInvalidate()) && !(tx.near() && tx.local())))
tx.state(PREPARED);
if (super.onDone(res, res == null ? err : null)) {
@@ -1311,8 +1311,14 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
if (isDone())
return;
- if (last)
+ if (last) {
+ recheckOnePhaseCommit();
+
+ if (tx.onePhaseCommit())
+ tx.chainState(PREPARED);
+
sendPrepareRequests();
+ }
}
finally {
markInitialized();
@@ -1320,9 +1326,9 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
}
/**
- *
+ * Checking that one phase commit for transaction still actual.
*/
- private void sendPrepareRequests() {
+ private void recheckOnePhaseCommit() {
if (tx.onePhaseCommit() && !tx.nearMap().isEmpty()) {
for (GridDistributedTxMapping nearMapping : tx.nearMap().values()) {
if (!tx.dhtMap().containsKey(nearMapping.primary().id())) {
@@ -1332,7 +1338,12 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
}
}
}
+ }
+ /**
+ *
+ */
+ private void sendPrepareRequests() {
assert !tx.txState().mvccEnabled() || !tx.onePhaseCommit() || tx.mvccSnapshot() != null;
int miniId = 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/395811dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
index 2280619..46bab86 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
@@ -269,7 +269,8 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
private boolean onComplete() {
Throwable err0 = err;
- if (err0 == null || tx.needCheckBackup())
+ if ((!tx.onePhaseCommit() || tx.mappings().get(cctx.localNodeId()) == null) &&
+ (err0 == null || tx.needCheckBackup()))
tx.state(PREPARED);
if (super.onDone(tx, err0)) {
@@ -350,9 +351,13 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
hasNearCache = true;
}
- for (IgniteTxEntry read : reads)
+ for (IgniteTxEntry read : reads) {
map(read, topVer, mappings, txMapping, remap, topLocked);
+ if (read.context().isNear())
+ hasNearCache = true;
+ }
+
if (keyLockFut != null)
keyLockFut.onAllKeysAdded();
@@ -575,7 +580,7 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
final MiniFuture fut,
final boolean nearEntries) {
IgniteInternalFuture<GridNearTxPrepareResponse> prepFut = nearEntries ?
- cctx.tm().txHandler().prepareNearTxLocal(req) :
+ cctx.tm().txHandler().prepareNearTxLocal(tx, req) :
cctx.tm().txHandler().prepareColocatedTx(tx, req);
prepFut.listen(new CI1<IgniteInternalFuture<GridNearTxPrepareResponse>>() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/395811dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index d3639c9..140f593 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -297,7 +297,8 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
private boolean onComplete() {
Throwable err0 = err;
- if (err0 == null || tx.needCheckBackup())
+ if ((!tx.onePhaseCommit() || tx.mappings().get(cctx.localNodeId()) == null) &&
+ (err0 == null || tx.needCheckBackup()))
tx.state(PREPARED);
if (super.onDone(tx, err0)) {
@@ -567,7 +568,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
assert !(m.hasColocatedCacheEntries() && m.hasNearCacheEntries()) : m;
IgniteInternalFuture<GridNearTxPrepareResponse> prepFut =
- m.hasNearCacheEntries() ? cctx.tm().txHandler().prepareNearTxLocal(req)
+ m.hasNearCacheEntries() ? cctx.tm().txHandler().prepareNearTxLocal(tx, req)
: cctx.tm().txHandler().prepareColocatedTx(tx, req);
prepFut.listen(new CI1<IgniteInternalFuture<GridNearTxPrepareResponse>>() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/395811dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
index a480a99..d2e1586 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
@@ -254,7 +254,7 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
add((IgniteInternalFuture)fut);
IgniteInternalFuture<GridNearTxPrepareResponse> prepFut = nearEntries ?
- cctx.tm().txHandler().prepareNearTxLocal(req) :
+ cctx.tm().txHandler().prepareNearTxLocal(tx, req) :
cctx.tm().txHandler().prepareColocatedTx(tx, req);
prepFut.listen(new CI1<IgniteInternalFuture<GridNearTxPrepareResponse>>() {
@@ -438,7 +438,8 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
err = this.err;
- if (err == null || tx.needCheckBackup())
+ if ((!tx.onePhaseCommit() || tx.mappings().get(cctx.localNodeId()) == null) &&
+ (err == null || tx.needCheckBackup()))
tx.state(PREPARED);
if (super.onDone(tx, err)) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/395811dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index ec1b646..c8b0459 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -17,6 +17,8 @@
package org.apache.ignite.internal.processors.cache.transactions;
+import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.processor.EntryProcessor;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
@@ -37,8 +39,6 @@ import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
-import javax.cache.expiry.ExpiryPolicy;
-import javax.cache.processor.EntryProcessor;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
@@ -287,6 +287,9 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement
@GridToStringExclude
private volatile TxCounters txCounters;
+ /** Transaction from which this transaction was copied by(if it was). */
+ private GridNearTxLocal parentTx;
+
/**
* Empty constructor required for {@link Externalizable}.
*/
@@ -406,6 +409,13 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement
}
/**
+ * @param parentTx Transaction from which this transaction was copied by.
+ */
+ public void setParentTx(GridNearTxLocal parentTx) {
+ this.parentTx = parentTx;
+ }
+
+ /**
* @return Mvcc info.
*/
@Override @Nullable public MvccSnapshot mvccSnapshot() {
@@ -1044,6 +1054,19 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement
return state(state, false);
}
+ /**
+ * Changing state for this transaction as well as chained(parent) transactions.
+ *
+ * @param state Transaction state.
+ * @return {@code True} if transition was valid, {@code false} otherwise.
+ */
+ public boolean chainState(TransactionState state) {
+ if (parentTx != null)
+ parentTx.state(state);
+
+ return state(state);
+ }
+
/** {@inheritDoc} */
@Override public IgniteInternalFuture<IgniteInternalTx> finishFuture() {
GridFutureAdapter<IgniteInternalTx> fut = finFut;
http://git-wip-us.apache.org/repos/asf/ignite/blob/395811dd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index aefd54c..319073b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -342,14 +342,17 @@ public class IgniteTxHandler {
}
/**
+ * @param originTx Transaction for copy.
* @param req Request.
* @return Prepare future.
*/
- public IgniteInternalFuture<GridNearTxPrepareResponse> prepareNearTxLocal(final GridNearTxPrepareRequest req) {
+ public IgniteInternalFuture<GridNearTxPrepareResponse> prepareNearTxLocal(
+ final GridNearTxLocal originTx,
+ final GridNearTxPrepareRequest req) {
// Make sure not to provide Near entries to DHT cache.
req.cloneEntries();
- return prepareNearTx(ctx.localNode(), req);
+ return prepareNearTx(originTx, ctx.localNode(), req);
}
/**
@@ -361,6 +364,20 @@ public class IgniteTxHandler {
final ClusterNode nearNode,
final GridNearTxPrepareRequest req
) {
+ return prepareNearTx(null, nearNode, req);
+ }
+
+ /**
+ * @param originTx Transaction for copy.
+ * @param nearNode Node that initiated transaction.
+ * @param req Near prepare request.
+ * @return Prepare future or {@code null} if need retry operation.
+ */
+ @Nullable private IgniteInternalFuture<GridNearTxPrepareResponse> prepareNearTx(
+ final GridNearTxLocal originTx,
+ final ClusterNode nearNode,
+ final GridNearTxPrepareRequest req
+ ) {
IgniteTxEntry firstEntry;
try {
@@ -509,7 +526,8 @@ public class IgniteTxHandler {
req.transactionNodes(),
req.subjectId(),
req.taskNameHash(),
- req.txLabel()
+ req.txLabel(),
+ originTx
);
tx = ctx.tm().onCreated(null, tx);
[46/50] [abbrv] ignite git commit: IGNITE-10355 Tx rollback failure
on put operations with caches whose topology fails validation - Fixes #5453.
Posted by sb...@apache.org.
IGNITE-10355 Tx rollback failure on put operations with caches whose topology fails validation - Fixes #5453.
Signed-off-by: Ivan Rakov <ir...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bf75ef22
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bf75ef22
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bf75ef22
Branch: refs/heads/ignite-10044
Commit: bf75ef22d194c84c5cef99f5f28be221a4a468a8
Parents: d267236
Author: Dmitriy Sorokin <d....@gmail.com>
Authored: Thu Dec 6 17:43:27 2018 +0300
Committer: Ivan Rakov <ir...@apache.org>
Committed: Thu Dec 6 17:43:27 2018 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheUtils.java | 2 +-
.../cache/distributed/near/GridNearTxLocal.java | 21 +++++++++++++-------
2 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bf75ef22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 12b6566..ebc1d11 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -1317,7 +1317,7 @@ public class GridCacheUtils {
if (e instanceof CachePartialUpdateCheckedException)
return new CachePartialUpdateException((CachePartialUpdateCheckedException)e);
- else if (e instanceof ClusterTopologyServerNotFoundException)
+ else if (e.hasCause(ClusterTopologyServerNotFoundException.class))
return new CacheServerNotFoundException(e.getMessage(), e);
else if (e instanceof SchemaOperationException)
return new CacheException(e.getMessage(), e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/bf75ef22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index 9f1f86d..ef74de4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -3917,16 +3917,23 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements GridTimeou
fut.listen(new IgniteInClosure<IgniteInternalFuture<IgniteInternalTx>>() {
@Override public void apply(IgniteInternalFuture<IgniteInternalTx> fut0) {
if (FINISH_FUT_UPD.compareAndSet(tx, fut, rollbackFut)) {
- if (tx.state() == COMMITTED) {
- if (log.isDebugEnabled())
- log.debug("Failed to rollback, transaction is already committed: " + tx);
+ switch (tx.state()) {
+ case COMMITTED:
+ if (log.isDebugEnabled())
+ log.debug("Failed to rollback, transaction is already committed: " + tx);
+
+ // Fall-through.
- rollbackFut.forceFinish();
+ case ROLLED_BACK:
+ rollbackFut.forceFinish();
+
+ assert rollbackFut.isDone() : rollbackFut;
+
+ break;
- assert rollbackFut.isDone() : rollbackFut;
+ default: // First finish attempt was unsuccessful. Try again.
+ rollbackFut.finish(false, clearThreadMap, onTimeout);
}
- else // First finish attempt was unsuccessful. Try again.
- rollbackFut.finish(false, clearThreadMap, onTimeout);
}
else {
finishFut.listen(new IgniteInClosure<IgniteInternalFuture<IgniteInternalTx>>() {
[24/50] [abbrv] ignite git commit: IGNITE-8379 new compatibility
tests added for latest releases.
Posted by sb...@apache.org.
IGNITE-8379 new compatibility tests added for latest releases.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d8886a0c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d8886a0c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d8886a0c
Branch: refs/heads/ignite-10044
Commit: d8886a0c69cc9277e6d3142e53a8435b2ffbc340
Parents: bb56dc6
Author: Dmitriy Pavlov <dp...@apache.org>
Authored: Tue Dec 4 20:14:14 2018 +0300
Committer: Dmitriy Pavlov <dp...@apache.org>
Committed: Tue Dec 4 20:14:14 2018 +0300
----------------------------------------------------------------------
.../PersistenceBasicCompatibilityTest.java | 27 ++++++++++++++++++++
1 file changed, 27 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d8886a0c/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/PersistenceBasicCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/PersistenceBasicCompatibilityTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/PersistenceBasicCompatibilityTest.java
index f27caa3..a94c459 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/PersistenceBasicCompatibilityTest.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/PersistenceBasicCompatibilityTest.java
@@ -101,6 +101,33 @@ public class PersistenceBasicCompatibilityTest extends IgnitePersistenceCompatib
/**
* Tests opportunity to read data from previous Ignite DB version.
*
+ * @throws Exception If failed.
+ */
+ public void testNodeStartByOldVersionPersistenceData_2_4() throws Exception {
+ doTestStartupWithOldVersion("2.4.0");
+ }
+
+ /**
+ * Tests opportunity to read data from previous Ignite DB version.
+ *
+ * @throws Exception If failed.
+ */
+ public void testNodeStartByOldVersionPersistenceData_2_5() throws Exception {
+ doTestStartupWithOldVersion("2.5.0");
+ }
+
+ /**
+ * Tests opportunity to read data from previous Ignite DB version.
+ *
+ * @throws Exception If failed.
+ */
+ public void testNodeStartByOldVersionPersistenceData_2_6() throws Exception {
+ doTestStartupWithOldVersion("2.6.0");
+ }
+
+ /**
+ * Tests opportunity to read data from previous Ignite DB version.
+ *
* @param igniteVer 3-digits version of ignite
* @throws Exception If failed.
*/
[29/50] [abbrv] ignite git commit: IGNITE-10380: Drop Multi-label
Classification for Logistic Regression and SVM
Posted by sb...@apache.org.
IGNITE-10380: Drop Multi-label Classification for
Logistic Regression and SVM
This closes #5559
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/098caf44
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/098caf44
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/098caf44
Branch: refs/heads/ignite-10044
Commit: 098caf4469469763224e80fd9cd4ac5629b771bf
Parents: 46ff268
Author: zaleslaw <za...@gmail.com>
Authored: Wed Dec 5 13:02:41 2018 +0300
Committer: Yury Babak <yb...@gridgain.com>
Committed: Wed Dec 5 13:02:41 2018 +0300
----------------------------------------------------------------------
...ggedLogisticRegressionSGDTrainerExample.java | 2 +-
.../LogisticRegressionSGDTrainerExample.java | 4 +-
...gressionMultiClassClassificationExample.java | 164 ---------
.../logistic/multiclass/package-info.java | 22 --
.../ml/svm/SVMBinaryClassificationExample.java | 112 ++++++
.../binary/SVMBinaryClassificationExample.java | 112 ------
.../examples/ml/svm/binary/package-info.java | 22 --
.../SVMMultiClassClassificationExample.java | 153 --------
.../ml/svm/multiclass/package-info.java | 22 --
.../ml/tutorial/Step_9_Go_to_LogReg.java | 4 +-
.../logistic/LogisticRegressionModel.java | 205 +++++++++++
.../logistic/LogisticRegressionSGDTrainer.java | 246 +++++++++++++
.../binomial/LogisticRegressionModel.java | 205 -----------
.../binomial/LogisticRegressionSGDTrainer.java | 246 -------------
.../logistic/binomial/package-info.java | 22 --
.../LogRegressionMultiClassModel.java | 115 ------
.../LogRegressionMultiClassTrainer.java | 269 --------------
.../logistic/multiclass/package-info.java | 22 --
.../svm/SVMLinearBinaryClassificationModel.java | 194 ----------
.../SVMLinearBinaryClassificationTrainer.java | 356 -------------------
.../ml/svm/SVMLinearClassificationModel.java | 194 ++++++++++
.../ml/svm/SVMLinearClassificationTrainer.java | 356 +++++++++++++++++++
.../SVMLinearMultiClassClassificationModel.java | 114 ------
...VMLinearMultiClassClassificationTrainer.java | 269 --------------
.../ignite/ml/common/CollectionsTest.java | 19 +-
.../ignite/ml/common/LocalModelsTest.java | 54 +--
.../ml/multiclass/OneVsRestTrainerTest.java | 4 +-
.../ignite/ml/pipeline/PipelineMdlTest.java | 2 +-
.../apache/ignite/ml/pipeline/PipelineTest.java | 2 +-
.../ml/regressions/RegressionsTestSuite.java | 4 +-
.../linear/LinearRegressionModelTest.java | 23 +-
.../logistic/LogRegMultiClassTrainerTest.java | 141 --------
.../logistic/LogisticRegressionModelTest.java | 1 -
.../LogisticRegressionSGDTrainerTest.java | 2 -
.../ignite/ml/svm/SVMBinaryTrainerTest.java | 14 +-
.../org/apache/ignite/ml/svm/SVMModelTest.java | 36 +-
.../ignite/ml/svm/SVMMultiClassTrainerTest.java | 100 ------
.../org/apache/ignite/ml/svm/SVMTestSuite.java | 1 -
.../apache/ignite/ml/trainers/BaggingTest.java | 4 +-
39 files changed, 1151 insertions(+), 2686 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/bagged/BaggedLogisticRegressionSGDTrainerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/bagged/BaggedLogisticRegressionSGDTrainerExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/bagged/BaggedLogisticRegressionSGDTrainerExample.java
index 44fb77e..98745a4 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/bagged/BaggedLogisticRegressionSGDTrainerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/bagged/BaggedLogisticRegressionSGDTrainerExample.java
@@ -30,7 +30,7 @@ import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.nn.UpdatesStrategy;
import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDParameterUpdate;
import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDUpdateCalculator;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionSGDTrainer;
+import org.apache.ignite.ml.regressions.logistic.LogisticRegressionSGDTrainer;
import org.apache.ignite.ml.selection.cv.CrossValidation;
import org.apache.ignite.ml.selection.scoring.metric.Accuracy;
import org.apache.ignite.ml.trainers.DatasetTrainer;
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/binary/LogisticRegressionSGDTrainerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/binary/LogisticRegressionSGDTrainerExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/binary/LogisticRegressionSGDTrainerExample.java
index 52ee330..8530045 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/binary/LogisticRegressionSGDTrainerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/binary/LogisticRegressionSGDTrainerExample.java
@@ -31,8 +31,8 @@ import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.nn.UpdatesStrategy;
import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDParameterUpdate;
import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDUpdateCalculator;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionModel;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionSGDTrainer;
+import org.apache.ignite.ml.regressions.logistic.LogisticRegressionModel;
+import org.apache.ignite.ml.regressions.logistic.LogisticRegressionSGDTrainer;
/**
* Run logistic regression model based on <a href="https://en.wikipedia.org/wiki/Stochastic_gradient_descent">
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/multiclass/LogRegressionMultiClassClassificationExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/multiclass/LogRegressionMultiClassClassificationExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/multiclass/LogRegressionMultiClassClassificationExample.java
deleted file mode 100644
index 962fdac..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/multiclass/LogRegressionMultiClassClassificationExample.java
+++ /dev/null
@@ -1,164 +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.examples.ml.regression.logistic.multiclass;
-
-import java.io.FileNotFoundException;
-import java.util.Arrays;
-import javax.cache.Cache;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.query.QueryCursor;
-import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
-import org.apache.ignite.examples.ml.util.SandboxMLCache;
-import org.apache.ignite.ml.math.functions.IgniteBiFunction;
-import org.apache.ignite.ml.math.primitives.vector.Vector;
-import org.apache.ignite.ml.nn.UpdatesStrategy;
-import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDParameterUpdate;
-import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDUpdateCalculator;
-import org.apache.ignite.ml.preprocessing.minmaxscaling.MinMaxScalerTrainer;
-import org.apache.ignite.ml.regressions.logistic.multiclass.LogRegressionMultiClassModel;
-import org.apache.ignite.ml.regressions.logistic.multiclass.LogRegressionMultiClassTrainer;
-
-/**
- * Run Logistic Regression multi-class classification trainer ({@link LogRegressionMultiClassModel}) over distributed
- * dataset to build two models: one with minmaxscaling and one without minmaxscaling.
- * <p>
- * Code in this example launches Ignite grid and fills the cache with test data points (preprocessed
- * <a href="https://archive.ics.uci.edu/ml/datasets/Glass+Identification">Glass dataset</a>).</p>
- * <p>
- * After that it trains two logistic regression models based on the specified data - one model is with minmaxscaling
- * and one without minmaxscaling.</p>
- * <p>
- * Finally, this example loops over the test set of data points, applies the trained models to predict the target value,
- * compares prediction to expected outcome (ground truth), and builds
- * <a href="https://en.wikipedia.org/wiki/Confusion_matrix">confusion matrices</a>.</p>
- * <p>
- * You can change the test data used in this example and re-run it to explore this algorithm further.</p>
- */
-public class LogRegressionMultiClassClassificationExample {
- /** Run example. */
- public static void main(String[] args) throws FileNotFoundException {
- System.out.println();
- System.out.println(">>> Logistic Regression Multi-class classification model over cached dataset usage example started.");
- // Start ignite grid.
- try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
- System.out.println(">>> Ignite grid started.");
-
- IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
- .fillCacheWith(MLSandboxDatasets.GLASS_IDENTIFICATION);
-
- LogRegressionMultiClassTrainer<?> trainer = new LogRegressionMultiClassTrainer<>()
- .withUpdatesStgy(new UpdatesStrategy<>(
- new SimpleGDUpdateCalculator(0.2),
- SimpleGDParameterUpdate::sumLocal,
- SimpleGDParameterUpdate::avg
- ))
- .withAmountOfIterations(100000)
- .withAmountOfLocIterations(10)
- .withBatchSize(100)
- .withSeed(123L);
-
- LogRegressionMultiClassModel mdl = trainer.fit(
- ignite,
- dataCache,
- (k, v) -> v.copyOfRange(1, v.size()),
- (k, v) -> v.get(0)
- );
-
- System.out.println(">>> SVM Multi-class model");
- System.out.println(mdl.toString());
-
- MinMaxScalerTrainer<Integer, Vector> normalizationTrainer = new MinMaxScalerTrainer<>();
-
- IgniteBiFunction<Integer, Vector, Vector> preprocessor = normalizationTrainer.fit(
- ignite,
- dataCache,
- (k, v) -> v.copyOfRange(1, v.size())
- );
-
- LogRegressionMultiClassModel mdlWithNormalization = trainer.fit(
- ignite,
- dataCache,
- preprocessor,
- (k, v) -> v.get(0)
- );
-
- System.out.println(">>> Logistic Regression Multi-class model with normalization");
- System.out.println(mdlWithNormalization.toString());
-
- System.out.println(">>> ----------------------------------------------------------------");
- System.out.println(">>> | Prediction\t| Prediction with Normalization\t| Ground Truth\t|");
- System.out.println(">>> ----------------------------------------------------------------");
-
- int amountOfErrors = 0;
- int amountOfErrorsWithNormalization = 0;
- int totalAmount = 0;
-
- // Build confusion matrix. See https://en.wikipedia.org/wiki/Confusion_matrix
- int[][] confusionMtx = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
- int[][] confusionMtxWithNormalization = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
-
- try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(new ScanQuery<>())) {
- for (Cache.Entry<Integer, Vector> observation : observations) {
- Vector val = observation.getValue();
- Vector inputs = val.copyOfRange(1, val.size());
- double groundTruth = val.get(0);
-
- double prediction = mdl.apply(inputs);
- double predictionWithNormalization = mdlWithNormalization.apply(inputs);
-
- totalAmount++;
-
- // Collect data for model
- if(groundTruth != prediction)
- amountOfErrors++;
-
- int idx1 = (int)prediction == 1 ? 0 : ((int)prediction == 3 ? 1 : 2);
- int idx2 = (int)groundTruth == 1 ? 0 : ((int)groundTruth == 3 ? 1 : 2);
-
- confusionMtx[idx1][idx2]++;
-
- // Collect data for model with normalization
- if(groundTruth != predictionWithNormalization)
- amountOfErrorsWithNormalization++;
-
- idx1 = (int)predictionWithNormalization == 1 ? 0 : ((int)predictionWithNormalization == 3 ? 1 : 2);
- idx2 = (int)groundTruth == 1 ? 0 : ((int)groundTruth == 3 ? 1 : 2);
-
- confusionMtxWithNormalization[idx1][idx2]++;
-
- System.out.printf(">>> | %.4f\t\t| %.4f\t\t\t\t\t\t| %.4f\t\t|\n", prediction, predictionWithNormalization, groundTruth);
- }
- System.out.println(">>> ----------------------------------------------------------------");
- System.out.println("\n>>> -----------------Logistic Regression model-------------");
- System.out.println("\n>>> Absolute amount of errors " + amountOfErrors);
- System.out.println("\n>>> Accuracy " + (1 - amountOfErrors / (double)totalAmount));
- System.out.println("\n>>> Confusion matrix is " + Arrays.deepToString(confusionMtx));
-
- System.out.println("\n>>> -----------------Logistic Regression model with Normalization-------------");
- System.out.println("\n>>> Absolute amount of errors " + amountOfErrorsWithNormalization);
- System.out.println("\n>>> Accuracy " + (1 - amountOfErrorsWithNormalization / (double)totalAmount));
- System.out.println("\n>>> Confusion matrix is " + Arrays.deepToString(confusionMtxWithNormalization));
-
- System.out.println(">>> Logistic Regression Multi-class classification model over cached dataset usage example completed.");
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/multiclass/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/multiclass/package-info.java b/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/multiclass/package-info.java
deleted file mode 100644
index c7b7fe8..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/multiclass/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * ML multi-class logistic regression examples.
- */
-package org.apache.ignite.examples.ml.regression.logistic.multiclass;
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/examples/src/main/java/org/apache/ignite/examples/ml/svm/SVMBinaryClassificationExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/svm/SVMBinaryClassificationExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/svm/SVMBinaryClassificationExample.java
new file mode 100644
index 0000000..d9d1805
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/svm/SVMBinaryClassificationExample.java
@@ -0,0 +1,112 @@
+/*
+ * 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.examples.ml.svm;
+
+import java.io.FileNotFoundException;
+import java.util.Arrays;
+import javax.cache.Cache;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.ScanQuery;
+import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
+import org.apache.ignite.examples.ml.util.SandboxMLCache;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.svm.SVMLinearClassificationModel;
+import org.apache.ignite.ml.svm.SVMLinearClassificationTrainer;
+
+/**
+ * Run SVM binary-class classification model ({@link SVMLinearClassificationModel}) over distributed dataset.
+ * <p>
+ * Code in this example launches Ignite grid and fills the cache with test data points (based on the
+ * <a href="https://en.wikipedia.org/wiki/Iris_flower_data_set"></a>Iris dataset</a>).</p>
+ * <p>
+ * After that it trains the model based on the specified data using KMeans algorithm.</p>
+ * <p>
+ * Finally, this example loops over the test set of data points, applies the trained model to predict what cluster
+ * does this point belong to, compares prediction to expected outcome (ground truth), and builds
+ * <a href="https://en.wikipedia.org/wiki/Confusion_matrix">confusion matrix</a>.</p>
+ * <p>
+ * You can change the test data used in this example and re-run it to explore this algorithm further.</p>
+ */
+public class SVMBinaryClassificationExample {
+ /** Run example. */
+ public static void main(String[] args) throws FileNotFoundException {
+ System.out.println();
+ System.out.println(">>> SVM Binary classification model over cached dataset usage example started.");
+ // Start ignite grid.
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ System.out.println(">>> Ignite grid started.");
+
+ IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
+ .fillCacheWith(MLSandboxDatasets.TWO_CLASSED_IRIS);
+
+ SVMLinearClassificationTrainer trainer = new SVMLinearClassificationTrainer();
+
+ SVMLinearClassificationModel mdl = trainer.fit(
+ ignite,
+ dataCache,
+ (k, v) -> v.copyOfRange(1, v.size()),
+ (k, v) -> v.get(0)
+ );
+
+ System.out.println(">>> SVM model " + mdl);
+
+ System.out.println(">>> ---------------------------------");
+ System.out.println(">>> | Prediction\t| Ground Truth\t|");
+ System.out.println(">>> ---------------------------------");
+
+ int amountOfErrors = 0;
+ int totalAmount = 0;
+
+ // Build confusion matrix. See https://en.wikipedia.org/wiki/Confusion_matrix
+ int[][] confusionMtx = {{0, 0}, {0, 0}};
+
+ try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(new ScanQuery<>())) {
+ for (Cache.Entry<Integer, Vector> observation : observations) {
+ Vector val = observation.getValue();
+ Vector inputs = val.copyOfRange(1, val.size());
+ double groundTruth = val.get(0);
+
+ double prediction = mdl.apply(inputs);
+
+ totalAmount++;
+ if(groundTruth != prediction)
+ amountOfErrors++;
+
+ int idx1 = prediction == 0.0 ? 0 : 1;
+ int idx2 = groundTruth == 0.0 ? 0 : 1;
+
+ confusionMtx[idx1][idx2]++;
+
+ System.out.printf(">>> | %.4f\t\t| %.4f\t\t|\n", prediction, groundTruth);
+ }
+
+ System.out.println(">>> ---------------------------------");
+
+ System.out.println("\n>>> Absolute amount of errors " + amountOfErrors);
+ System.out.println("\n>>> Accuracy " + (1 - amountOfErrors / (double)totalAmount));
+ }
+
+ System.out.println("\n>>> Confusion matrix is " + Arrays.deepToString(confusionMtx));
+
+ System.out.println(">>> Linear regression model over cache based dataset usage example completed.");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/examples/src/main/java/org/apache/ignite/examples/ml/svm/binary/SVMBinaryClassificationExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/svm/binary/SVMBinaryClassificationExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/svm/binary/SVMBinaryClassificationExample.java
deleted file mode 100644
index 679bd77..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/ml/svm/binary/SVMBinaryClassificationExample.java
+++ /dev/null
@@ -1,112 +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.examples.ml.svm.binary;
-
-import java.io.FileNotFoundException;
-import java.util.Arrays;
-import javax.cache.Cache;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.query.QueryCursor;
-import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
-import org.apache.ignite.examples.ml.util.SandboxMLCache;
-import org.apache.ignite.ml.math.primitives.vector.Vector;
-import org.apache.ignite.ml.svm.SVMLinearBinaryClassificationModel;
-import org.apache.ignite.ml.svm.SVMLinearBinaryClassificationTrainer;
-
-/**
- * Run SVM binary-class classification model ({@link SVMLinearBinaryClassificationModel}) over distributed dataset.
- * <p>
- * Code in this example launches Ignite grid and fills the cache with test data points (based on the
- * <a href="https://en.wikipedia.org/wiki/Iris_flower_data_set"></a>Iris dataset</a>).</p>
- * <p>
- * After that it trains the model based on the specified data using KMeans algorithm.</p>
- * <p>
- * Finally, this example loops over the test set of data points, applies the trained model to predict what cluster
- * does this point belong to, compares prediction to expected outcome (ground truth), and builds
- * <a href="https://en.wikipedia.org/wiki/Confusion_matrix">confusion matrix</a>.</p>
- * <p>
- * You can change the test data used in this example and re-run it to explore this algorithm further.</p>
- */
-public class SVMBinaryClassificationExample {
- /** Run example. */
- public static void main(String[] args) throws FileNotFoundException {
- System.out.println();
- System.out.println(">>> SVM Binary classification model over cached dataset usage example started.");
- // Start ignite grid.
- try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
- System.out.println(">>> Ignite grid started.");
-
- IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
- .fillCacheWith(MLSandboxDatasets.TWO_CLASSED_IRIS);
-
- SVMLinearBinaryClassificationTrainer trainer = new SVMLinearBinaryClassificationTrainer();
-
- SVMLinearBinaryClassificationModel mdl = trainer.fit(
- ignite,
- dataCache,
- (k, v) -> v.copyOfRange(1, v.size()),
- (k, v) -> v.get(0)
- );
-
- System.out.println(">>> SVM model " + mdl);
-
- System.out.println(">>> ---------------------------------");
- System.out.println(">>> | Prediction\t| Ground Truth\t|");
- System.out.println(">>> ---------------------------------");
-
- int amountOfErrors = 0;
- int totalAmount = 0;
-
- // Build confusion matrix. See https://en.wikipedia.org/wiki/Confusion_matrix
- int[][] confusionMtx = {{0, 0}, {0, 0}};
-
- try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(new ScanQuery<>())) {
- for (Cache.Entry<Integer, Vector> observation : observations) {
- Vector val = observation.getValue();
- Vector inputs = val.copyOfRange(1, val.size());
- double groundTruth = val.get(0);
-
- double prediction = mdl.apply(inputs);
-
- totalAmount++;
- if(groundTruth != prediction)
- amountOfErrors++;
-
- int idx1 = prediction == 0.0 ? 0 : 1;
- int idx2 = groundTruth == 0.0 ? 0 : 1;
-
- confusionMtx[idx1][idx2]++;
-
- System.out.printf(">>> | %.4f\t\t| %.4f\t\t|\n", prediction, groundTruth);
- }
-
- System.out.println(">>> ---------------------------------");
-
- System.out.println("\n>>> Absolute amount of errors " + amountOfErrors);
- System.out.println("\n>>> Accuracy " + (1 - amountOfErrors / (double)totalAmount));
- }
-
- System.out.println("\n>>> Confusion matrix is " + Arrays.deepToString(confusionMtx));
-
- System.out.println(">>> Linear regression model over cache based dataset usage example completed.");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/examples/src/main/java/org/apache/ignite/examples/ml/svm/binary/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/svm/binary/package-info.java b/examples/src/main/java/org/apache/ignite/examples/ml/svm/binary/package-info.java
deleted file mode 100644
index 22c9ad7..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/ml/svm/binary/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * SVM Binary Classification Examples.
- */
-package org.apache.ignite.examples.ml.svm.binary;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/examples/src/main/java/org/apache/ignite/examples/ml/svm/multiclass/SVMMultiClassClassificationExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/svm/multiclass/SVMMultiClassClassificationExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/svm/multiclass/SVMMultiClassClassificationExample.java
deleted file mode 100644
index 987ac41..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/ml/svm/multiclass/SVMMultiClassClassificationExample.java
+++ /dev/null
@@ -1,153 +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.examples.ml.svm.multiclass;
-
-import java.io.FileNotFoundException;
-import java.util.Arrays;
-import javax.cache.Cache;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.query.QueryCursor;
-import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
-import org.apache.ignite.examples.ml.util.SandboxMLCache;
-import org.apache.ignite.ml.math.functions.IgniteBiFunction;
-import org.apache.ignite.ml.math.primitives.vector.Vector;
-import org.apache.ignite.ml.preprocessing.minmaxscaling.MinMaxScalerTrainer;
-import org.apache.ignite.ml.svm.SVMLinearMultiClassClassificationModel;
-import org.apache.ignite.ml.svm.SVMLinearMultiClassClassificationTrainer;
-
-/**
- * Run SVM multi-class classification trainer ({@link SVMLinearMultiClassClassificationModel}) over distributed dataset
- * to build two models: one with minmaxscaling and one without minmaxscaling.
- * <p>
- * Code in this example launches Ignite grid and fills the cache with test data points (preprocessed
- * <a href="https://archive.ics.uci.edu/ml/datasets/Glass+Identification">Glass dataset</a>).</p>
- * <p>
- * After that it trains two SVM multi-class models based on the specified data - one model is with minmaxscaling
- * and one without minmaxscaling.</p>
- * <p>
- * Finally, this example loops over the test set of data points, applies the trained models to predict what cluster
- * does this point belong to, compares prediction to expected outcome (ground truth), and builds
- * <a href="https://en.wikipedia.org/wiki/Confusion_matrix">confusion matrix</a>.</p>
- * <p>
- * You can change the test data used in this example and re-run it to explore this algorithm further.</p>
- * NOTE: the smallest 3rd class could be classified via linear SVM here.
- */
-public class SVMMultiClassClassificationExample {
- /** Run example. */
- public static void main(String[] args) throws FileNotFoundException {
- System.out.println();
- System.out.println(">>> SVM Multi-class classification model over cached dataset usage example started.");
- // Start ignite grid.
- try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
- System.out.println(">>> Ignite grid started.");
-
- IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
- .fillCacheWith(MLSandboxDatasets.GLASS_IDENTIFICATION);
-
- SVMLinearMultiClassClassificationTrainer trainer = new SVMLinearMultiClassClassificationTrainer();
-
- SVMLinearMultiClassClassificationModel mdl = trainer.fit(
- ignite,
- dataCache,
- (k, v) -> v.copyOfRange(1, v.size()),
- (k, v) -> v.get(0)
- );
-
- System.out.println(">>> SVM Multi-class model");
- System.out.println(mdl.toString());
-
- MinMaxScalerTrainer<Integer, Vector> minMaxScalerTrainer = new MinMaxScalerTrainer<>();
-
- IgniteBiFunction<Integer, Vector, Vector> preprocessor = minMaxScalerTrainer.fit(
- ignite,
- dataCache,
- (k, v) -> v.copyOfRange(1, v.size())
- );
-
- SVMLinearMultiClassClassificationModel mdlWithScaling = trainer.fit(
- ignite,
- dataCache,
- preprocessor,
- (k, v) -> v.get(0)
- );
-
- System.out.println(">>> SVM Multi-class model with MinMaxScaling");
- System.out.println(mdlWithScaling.toString());
-
- System.out.println(">>> ----------------------------------------------------------------");
- System.out.println(">>> | Prediction\t| Prediction with MinMaxScaling\t| Ground Truth\t|");
- System.out.println(">>> ----------------------------------------------------------------");
-
- int amountOfErrors = 0;
- int amountOfErrorsWithMinMaxScaling = 0;
- int totalAmount = 0;
-
- // Build confusion matrix. See https://en.wikipedia.org/wiki/Confusion_matrix
- int[][] confusionMtx = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
- int[][] confusionMtxWithMinMaxScaling = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
-
- try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(new ScanQuery<>())) {
- for (Cache.Entry<Integer, Vector> observation : observations) {
- Vector val = observation.getValue();
- Vector inputs = val.copyOfRange(1, val.size());
- double groundTruth = val.get(0);
-
- double prediction = mdl.apply(inputs);
- double predictionWithMinMaxScaling = mdlWithScaling.apply(inputs);
-
- totalAmount++;
-
- // Collect data for model
- if(groundTruth != prediction)
- amountOfErrors++;
-
- int idx1 = (int)prediction == 1 ? 0 : ((int)prediction == 3 ? 1 : 2);
- int idx2 = (int)groundTruth == 1 ? 0 : ((int)groundTruth == 3 ? 1 : 2);
-
- confusionMtx[idx1][idx2]++;
-
- // Collect data for model with minmaxscaling
- if (groundTruth != predictionWithMinMaxScaling)
- amountOfErrorsWithMinMaxScaling++;
-
- idx1 = (int)predictionWithMinMaxScaling == 1 ? 0 : ((int)predictionWithMinMaxScaling == 3 ? 1 : 2);
- idx2 = (int)groundTruth == 1 ? 0 : ((int)groundTruth == 3 ? 1 : 2);
-
- confusionMtxWithMinMaxScaling[idx1][idx2]++;
-
- System.out.printf(">>> | %.4f\t\t| %.4f\t\t\t\t\t\t| %.4f\t\t|\n", prediction, predictionWithMinMaxScaling, groundTruth);
- }
- System.out.println(">>> ----------------------------------------------------------------");
- System.out.println("\n>>> -----------------SVM model-------------");
- System.out.println("\n>>> Absolute amount of errors " + amountOfErrors);
- System.out.println("\n>>> Accuracy " + (1 - amountOfErrors / (double)totalAmount));
- System.out.println("\n>>> Confusion matrix is " + Arrays.deepToString(confusionMtx));
-
- System.out.println("\n>>> -----------------SVM model with MinMaxScaling-------------");
- System.out.println("\n>>> Absolute amount of errors " + amountOfErrorsWithMinMaxScaling);
- System.out.println("\n>>> Accuracy " + (1 - amountOfErrorsWithMinMaxScaling / (double)totalAmount));
- System.out.println("\n>>> Confusion matrix is " + Arrays.deepToString(confusionMtxWithMinMaxScaling));
-
- System.out.println(">>> Linear regression model over cache based dataset usage example completed.");
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/examples/src/main/java/org/apache/ignite/examples/ml/svm/multiclass/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/svm/multiclass/package-info.java b/examples/src/main/java/org/apache/ignite/examples/ml/svm/multiclass/package-info.java
deleted file mode 100644
index 8b685a4..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/ml/svm/multiclass/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * SVM Multi-class Classification Examples.
- */
-package org.apache.ignite.examples.ml.svm.multiclass;
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/examples/src/main/java/org/apache/ignite/examples/ml/tutorial/Step_9_Go_to_LogReg.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/tutorial/Step_9_Go_to_LogReg.java b/examples/src/main/java/org/apache/ignite/examples/ml/tutorial/Step_9_Go_to_LogReg.java
index b98b0eb..2c6a820 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/tutorial/Step_9_Go_to_LogReg.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/tutorial/Step_9_Go_to_LogReg.java
@@ -32,8 +32,8 @@ import org.apache.ignite.ml.preprocessing.encoding.EncoderType;
import org.apache.ignite.ml.preprocessing.imputing.ImputerTrainer;
import org.apache.ignite.ml.preprocessing.minmaxscaling.MinMaxScalerTrainer;
import org.apache.ignite.ml.preprocessing.normalization.NormalizationTrainer;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionModel;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionSGDTrainer;
+import org.apache.ignite.ml.regressions.logistic.LogisticRegressionModel;
+import org.apache.ignite.ml.regressions.logistic.LogisticRegressionSGDTrainer;
import org.apache.ignite.ml.selection.cv.CrossValidation;
import org.apache.ignite.ml.selection.scoring.evaluator.Evaluator;
import org.apache.ignite.ml.selection.scoring.metric.Accuracy;
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionModel.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionModel.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionModel.java
new file mode 100644
index 0000000..5cc44f8
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionModel.java
@@ -0,0 +1,205 @@
+/*
+ * 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.ml.regressions.logistic;
+
+import java.io.Serializable;
+import java.util.Objects;
+import org.apache.ignite.ml.Exportable;
+import org.apache.ignite.ml.Exporter;
+import org.apache.ignite.ml.Model;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+
+/**
+ * Logistic regression (logit model) is a generalized linear model used for binomial regression.
+ */
+public class LogisticRegressionModel implements Model<Vector, Double>, Exportable<LogisticRegressionModel>, Serializable {
+ /** */
+ private static final long serialVersionUID = -133984600091550776L;
+
+ /** Multiplier of the objects's vector required to make prediction. */
+ private Vector weights;
+
+ /** Intercept of the linear regression model. */
+ private double intercept;
+
+ /** Output label format. 0 and 1 for false value and raw sigmoid regression value otherwise. */
+ private boolean isKeepingRawLabels = false;
+
+ /** Threshold to assign '1' label to the observation if raw value more than this threshold. */
+ private double threshold = 0.5;
+
+ /** */
+ public LogisticRegressionModel(Vector weights, double intercept) {
+ this.weights = weights;
+ this.intercept = intercept;
+ }
+
+ /**
+ * Set up the output label format.
+ *
+ * @param isKeepingRawLabels The parameter value.
+ * @return Model with new isKeepingRawLabels parameter value.
+ */
+ public LogisticRegressionModel withRawLabels(boolean isKeepingRawLabels) {
+ this.isKeepingRawLabels = isKeepingRawLabels;
+ return this;
+ }
+
+ /**
+ * Set up the threshold.
+ *
+ * @param threshold The parameter value.
+ * @return Model with new threshold parameter value.
+ */
+ public LogisticRegressionModel withThreshold(double threshold) {
+ this.threshold = threshold;
+ return this;
+ }
+
+ /**
+ * Set up the weights.
+ *
+ * @param weights The parameter value.
+ * @return Model with new weights parameter value.
+ */
+ public LogisticRegressionModel withWeights(Vector weights) {
+ this.weights = weights;
+ return this;
+ }
+
+ /**
+ * Set up the intercept.
+ *
+ * @param intercept The parameter value.
+ * @return Model with new intercept parameter value.
+ */
+ public LogisticRegressionModel withIntercept(double intercept) {
+ this.intercept = intercept;
+ return this;
+ }
+
+ /**
+ * Gets the output label format mode.
+ *
+ * @return The parameter value.
+ */
+ public boolean isKeepingRawLabels() {
+ return isKeepingRawLabels;
+ }
+
+ /**
+ * Gets the threshold.
+ *
+ * @return The parameter value.
+ */
+ public double threshold() {
+ return threshold;
+ }
+
+ /**
+ * Gets the weights.
+ *
+ * @return The parameter value.
+ */
+ public Vector weights() {
+ return weights;
+ }
+
+ /**
+ * Gets the intercept.
+ *
+ * @return The parameter value.
+ */
+ public double intercept() {
+ return intercept;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Double apply(Vector input) {
+
+ final double res = sigmoid(input.dot(weights) + intercept);
+
+ if (isKeepingRawLabels)
+ return res;
+ else
+ return res - threshold > 0 ? 1.0 : 0;
+ }
+
+ /**
+ * Sigmoid function.
+ * @param z The regression value.
+ * @return The result.
+ */
+ private static double sigmoid(double z) {
+ return 1.0 / (1.0 + Math.exp(-z));
+ }
+
+ /** {@inheritDoc} */
+ @Override public <P> void saveModel(Exporter<LogisticRegressionModel, P> exporter, P path) {
+ exporter.save(this, path);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ LogisticRegressionModel mdl = (LogisticRegressionModel)o;
+
+ return Double.compare(mdl.intercept, intercept) == 0
+ && Double.compare(mdl.threshold, threshold) == 0
+ && Boolean.compare(mdl.isKeepingRawLabels, isKeepingRawLabels) == 0
+ && Objects.equals(weights, mdl.weights);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return Objects.hash(weights, intercept, isKeepingRawLabels, threshold);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ if (weights.size() < 20) {
+ StringBuilder builder = new StringBuilder();
+
+ for (int i = 0; i < weights.size(); i++) {
+ double nextItem = i == weights.size() - 1 ? intercept : weights.get(i + 1);
+
+ builder.append(String.format("%.4f", Math.abs(weights.get(i))))
+ .append("*x")
+ .append(i)
+ .append(nextItem > 0 ? " + " : " - ");
+ }
+
+ builder.append(String.format("%.4f", Math.abs(intercept)));
+ return builder.toString();
+ }
+
+ return "LogisticRegressionModel [" +
+ "weights=" + weights +
+ ", intercept=" + intercept +
+ ']';
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString(boolean pretty) {
+ return toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionSGDTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionSGDTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionSGDTrainer.java
new file mode 100644
index 0000000..cdbfe4c
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionSGDTrainer.java
@@ -0,0 +1,246 @@
+/*
+ * 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.ml.regressions.logistic;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import org.apache.ignite.ml.dataset.Dataset;
+import org.apache.ignite.ml.dataset.DatasetBuilder;
+import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.dataset.primitive.data.SimpleLabeledDatasetData;
+import org.apache.ignite.ml.math.functions.IgniteBiFunction;
+import org.apache.ignite.ml.math.functions.IgniteFunction;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
+import org.apache.ignite.ml.nn.Activators;
+import org.apache.ignite.ml.nn.MLPTrainer;
+import org.apache.ignite.ml.nn.MultilayerPerceptron;
+import org.apache.ignite.ml.nn.UpdatesStrategy;
+import org.apache.ignite.ml.nn.architecture.MLPArchitecture;
+import org.apache.ignite.ml.optimization.LossFunctions;
+import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDParameterUpdate;
+import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDUpdateCalculator;
+import org.apache.ignite.ml.trainers.SingleLabelDatasetTrainer;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Trainer of the logistic regression model based on stochastic gradient descent algorithm.
+ */
+public class LogisticRegressionSGDTrainer<P extends Serializable> extends SingleLabelDatasetTrainer<LogisticRegressionModel> {
+ /** Update strategy. */
+ private UpdatesStrategy updatesStgy = new UpdatesStrategy<>(
+ new SimpleGDUpdateCalculator(0.2),
+ SimpleGDParameterUpdate::sumLocal,
+ SimpleGDParameterUpdate::avg
+ );
+
+ /** Max number of iteration. */
+ private int maxIterations = 100;
+
+ /** Batch size. */
+ private int batchSize = 100;
+
+ /** Number of local iterations. */
+ private int locIterations = 100;
+
+ /** Seed for random generator. */
+ private long seed = 1234L;
+
+ /** {@inheritDoc} */
+ @Override public <K, V> LogisticRegressionModel fit(DatasetBuilder<K, V> datasetBuilder,
+ IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, Double> lbExtractor) {
+
+ return updateModel(null, datasetBuilder, featureExtractor, lbExtractor);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected <K, V> LogisticRegressionModel updateModel(LogisticRegressionModel mdl,
+ DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor,
+ IgniteBiFunction<K, V, Double> lbExtractor) {
+
+ IgniteFunction<Dataset<EmptyContext, SimpleLabeledDatasetData>, MLPArchitecture> archSupplier = dataset -> {
+ Integer cols = dataset.compute(data -> {
+ if (data.getFeatures() == null)
+ return null;
+ return data.getFeatures().length / data.getRows();
+ }, (a, b) -> {
+ // If both are null then zero will be propagated, no good.
+ if (a == null)
+ return b;
+ return a;
+ });
+
+ MLPArchitecture architecture = new MLPArchitecture(cols);
+ architecture = architecture.withAddedLayer(1, true, Activators.SIGMOID);
+
+ return architecture;
+ };
+
+ MLPTrainer<?> trainer = new MLPTrainer<>(
+ archSupplier,
+ LossFunctions.L2,
+ updatesStgy,
+ maxIterations,
+ batchSize,
+ locIterations,
+ seed
+ );
+
+ IgniteBiFunction<K, V, double[]> lbExtractorWrapper = (k, v) -> new double[] {lbExtractor.apply(k, v)};
+ MultilayerPerceptron mlp;
+ if (mdl != null) {
+ mlp = restoreMLPState(mdl);
+ mlp = trainer.update(mlp, datasetBuilder, featureExtractor, lbExtractorWrapper);
+ }
+ else
+ mlp = trainer.fit(datasetBuilder, featureExtractor, lbExtractorWrapper);
+
+ double[] params = mlp.parameters().getStorage().data();
+
+ return new LogisticRegressionModel(new DenseVector(Arrays.copyOf(params, params.length - 1)),
+ params[params.length - 1]
+ );
+ }
+
+ /**
+ * @param mdl Model.
+ * @return state of MLP from last learning.
+ */
+ @NotNull private MultilayerPerceptron restoreMLPState(LogisticRegressionModel mdl) {
+ Vector weights = mdl.weights();
+ double intercept = mdl.intercept();
+
+ MLPArchitecture architecture1 = new MLPArchitecture(weights.size());
+ architecture1 = architecture1.withAddedLayer(1, true, Activators.SIGMOID);
+
+ MLPArchitecture architecture = architecture1;
+ MultilayerPerceptron perceptron = new MultilayerPerceptron(architecture);
+
+ Vector mlpState = weights.like(weights.size() + 1);
+ weights.nonZeroes().forEach(ith -> mlpState.set(ith.index(), ith.get()));
+ mlpState.set(mlpState.size() - 1, intercept);
+ perceptron.setParameters(mlpState);
+
+ return perceptron;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean checkState(LogisticRegressionModel mdl) {
+ return true;
+ }
+
+ /**
+ * Set up the max amount of iterations before convergence.
+ *
+ * @param maxIterations The parameter value.
+ * @return Model with new max number of iterations before convergence parameter value.
+ */
+ public LogisticRegressionSGDTrainer<P> withMaxIterations(int maxIterations) {
+ this.maxIterations = maxIterations;
+ return this;
+ }
+
+ /**
+ * Set up the batchSize parameter.
+ *
+ * @param batchSize The size of learning batch.
+ * @return Trainer with new batch size parameter value.
+ */
+ public LogisticRegressionSGDTrainer<P> withBatchSize(int batchSize) {
+ this.batchSize = batchSize;
+ return this;
+ }
+
+ /**
+ * Set up the amount of local iterations of SGD algorithm.
+ *
+ * @param amountOfLocIterations The parameter value.
+ * @return Trainer with new locIterations parameter value.
+ */
+ public LogisticRegressionSGDTrainer<P> withLocIterations(int amountOfLocIterations) {
+ this.locIterations = amountOfLocIterations;
+ return this;
+ }
+
+ /**
+ * Set up the random seed parameter.
+ *
+ * @param seed Seed for random generator.
+ * @return Trainer with new seed parameter value.
+ */
+ public LogisticRegressionSGDTrainer<P> withSeed(long seed) {
+ this.seed = seed;
+ return this;
+ }
+
+ /**
+ * Set up the regularization parameter.
+ *
+ * @param updatesStgy Update strategy.
+ * @return Trainer with new update strategy parameter value.
+ */
+ public LogisticRegressionSGDTrainer withUpdatesStgy(UpdatesStrategy updatesStgy) {
+ this.updatesStgy = updatesStgy;
+ return this;
+ }
+
+ /**
+ * Get the update strategy.
+ *
+ * @return The property value.
+ */
+ public UpdatesStrategy getUpdatesStgy() {
+ return updatesStgy;
+ }
+
+ /**
+ * Get the max amount of iterations.
+ *
+ * @return The property value.
+ */
+ public int getMaxIterations() {
+ return maxIterations;
+ }
+
+ /**
+ * Get the batch size.
+ *
+ * @return The property value.
+ */
+ public int getBatchSize() {
+ return batchSize;
+ }
+
+ /**
+ * Get the amount of local iterations.
+ *
+ * @return The property value.
+ */
+ public int getLocIterations() {
+ return locIterations;
+ }
+
+ /**
+ * Get the seed for random generator.
+ *
+ * @return The property value.
+ */
+ public long getSeed() {
+ return seed;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/binomial/LogisticRegressionModel.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/binomial/LogisticRegressionModel.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/binomial/LogisticRegressionModel.java
deleted file mode 100644
index f206532..0000000
--- a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/binomial/LogisticRegressionModel.java
+++ /dev/null
@@ -1,205 +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.ml.regressions.logistic.binomial;
-
-import java.io.Serializable;
-import java.util.Objects;
-import org.apache.ignite.ml.Exportable;
-import org.apache.ignite.ml.Exporter;
-import org.apache.ignite.ml.Model;
-import org.apache.ignite.ml.math.primitives.vector.Vector;
-
-/**
- * Logistic regression (logit model) is a generalized linear model used for binomial regression.
- */
-public class LogisticRegressionModel implements Model<Vector, Double>, Exportable<LogisticRegressionModel>, Serializable {
- /** */
- private static final long serialVersionUID = -133984600091550776L;
-
- /** Multiplier of the objects's vector required to make prediction. */
- private Vector weights;
-
- /** Intercept of the linear regression model. */
- private double intercept;
-
- /** Output label format. 0 and 1 for false value and raw sigmoid regression value otherwise. */
- private boolean isKeepingRawLabels = false;
-
- /** Threshold to assign '1' label to the observation if raw value more than this threshold. */
- private double threshold = 0.5;
-
- /** */
- public LogisticRegressionModel(Vector weights, double intercept) {
- this.weights = weights;
- this.intercept = intercept;
- }
-
- /**
- * Set up the output label format.
- *
- * @param isKeepingRawLabels The parameter value.
- * @return Model with new isKeepingRawLabels parameter value.
- */
- public LogisticRegressionModel withRawLabels(boolean isKeepingRawLabels) {
- this.isKeepingRawLabels = isKeepingRawLabels;
- return this;
- }
-
- /**
- * Set up the threshold.
- *
- * @param threshold The parameter value.
- * @return Model with new threshold parameter value.
- */
- public LogisticRegressionModel withThreshold(double threshold) {
- this.threshold = threshold;
- return this;
- }
-
- /**
- * Set up the weights.
- *
- * @param weights The parameter value.
- * @return Model with new weights parameter value.
- */
- public LogisticRegressionModel withWeights(Vector weights) {
- this.weights = weights;
- return this;
- }
-
- /**
- * Set up the intercept.
- *
- * @param intercept The parameter value.
- * @return Model with new intercept parameter value.
- */
- public LogisticRegressionModel withIntercept(double intercept) {
- this.intercept = intercept;
- return this;
- }
-
- /**
- * Gets the output label format mode.
- *
- * @return The parameter value.
- */
- public boolean isKeepingRawLabels() {
- return isKeepingRawLabels;
- }
-
- /**
- * Gets the threshold.
- *
- * @return The parameter value.
- */
- public double threshold() {
- return threshold;
- }
-
- /**
- * Gets the weights.
- *
- * @return The parameter value.
- */
- public Vector weights() {
- return weights;
- }
-
- /**
- * Gets the intercept.
- *
- * @return The parameter value.
- */
- public double intercept() {
- return intercept;
- }
-
- /** {@inheritDoc} */
- @Override public Double apply(Vector input) {
-
- final double res = sigmoid(input.dot(weights) + intercept);
-
- if (isKeepingRawLabels)
- return res;
- else
- return res - threshold > 0 ? 1.0 : 0;
- }
-
- /**
- * Sigmoid function.
- * @param z The regression value.
- * @return The result.
- */
- private static double sigmoid(double z) {
- return 1.0 / (1.0 + Math.exp(-z));
- }
-
- /** {@inheritDoc} */
- @Override public <P> void saveModel(Exporter<LogisticRegressionModel, P> exporter, P path) {
- exporter.save(this, path);
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
-
- LogisticRegressionModel mdl = (LogisticRegressionModel)o;
-
- return Double.compare(mdl.intercept, intercept) == 0
- && Double.compare(mdl.threshold, threshold) == 0
- && Boolean.compare(mdl.isKeepingRawLabels, isKeepingRawLabels) == 0
- && Objects.equals(weights, mdl.weights);
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return Objects.hash(weights, intercept, isKeepingRawLabels, threshold);
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- if (weights.size() < 20) {
- StringBuilder builder = new StringBuilder();
-
- for (int i = 0; i < weights.size(); i++) {
- double nextItem = i == weights.size() - 1 ? intercept : weights.get(i + 1);
-
- builder.append(String.format("%.4f", Math.abs(weights.get(i))))
- .append("*x")
- .append(i)
- .append(nextItem > 0 ? " + " : " - ");
- }
-
- builder.append(String.format("%.4f", Math.abs(intercept)));
- return builder.toString();
- }
-
- return "LogisticRegressionModel [" +
- "weights=" + weights +
- ", intercept=" + intercept +
- ']';
- }
-
- /** {@inheritDoc} */
- @Override public String toString(boolean pretty) {
- return toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/binomial/LogisticRegressionSGDTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/binomial/LogisticRegressionSGDTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/binomial/LogisticRegressionSGDTrainer.java
deleted file mode 100644
index 47fa59d..0000000
--- a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/binomial/LogisticRegressionSGDTrainer.java
+++ /dev/null
@@ -1,246 +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.ml.regressions.logistic.binomial;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import org.apache.ignite.ml.dataset.Dataset;
-import org.apache.ignite.ml.dataset.DatasetBuilder;
-import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
-import org.apache.ignite.ml.dataset.primitive.data.SimpleLabeledDatasetData;
-import org.apache.ignite.ml.math.functions.IgniteBiFunction;
-import org.apache.ignite.ml.math.functions.IgniteFunction;
-import org.apache.ignite.ml.math.primitives.vector.Vector;
-import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
-import org.apache.ignite.ml.nn.Activators;
-import org.apache.ignite.ml.nn.MLPTrainer;
-import org.apache.ignite.ml.nn.MultilayerPerceptron;
-import org.apache.ignite.ml.nn.UpdatesStrategy;
-import org.apache.ignite.ml.nn.architecture.MLPArchitecture;
-import org.apache.ignite.ml.optimization.LossFunctions;
-import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDParameterUpdate;
-import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDUpdateCalculator;
-import org.apache.ignite.ml.trainers.SingleLabelDatasetTrainer;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Trainer of the logistic regression model based on stochastic gradient descent algorithm.
- */
-public class LogisticRegressionSGDTrainer<P extends Serializable> extends SingleLabelDatasetTrainer<LogisticRegressionModel> {
- /** Update strategy. */
- private UpdatesStrategy updatesStgy = new UpdatesStrategy<>(
- new SimpleGDUpdateCalculator(0.2),
- SimpleGDParameterUpdate::sumLocal,
- SimpleGDParameterUpdate::avg
- );
-
- /** Max number of iteration. */
- private int maxIterations = 100;
-
- /** Batch size. */
- private int batchSize = 100;
-
- /** Number of local iterations. */
- private int locIterations = 100;
-
- /** Seed for random generator. */
- private long seed = 1234L;
-
- /** {@inheritDoc} */
- @Override public <K, V> LogisticRegressionModel fit(DatasetBuilder<K, V> datasetBuilder,
- IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, Double> lbExtractor) {
-
- return updateModel(null, datasetBuilder, featureExtractor, lbExtractor);
- }
-
- /** {@inheritDoc} */
- @Override protected <K, V> LogisticRegressionModel updateModel(LogisticRegressionModel mdl,
- DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor,
- IgniteBiFunction<K, V, Double> lbExtractor) {
-
- IgniteFunction<Dataset<EmptyContext, SimpleLabeledDatasetData>, MLPArchitecture> archSupplier = dataset -> {
- Integer cols = dataset.compute(data -> {
- if (data.getFeatures() == null)
- return null;
- return data.getFeatures().length / data.getRows();
- }, (a, b) -> {
- // If both are null then zero will be propagated, no good.
- if (a == null)
- return b;
- return a;
- });
-
- MLPArchitecture architecture = new MLPArchitecture(cols);
- architecture = architecture.withAddedLayer(1, true, Activators.SIGMOID);
-
- return architecture;
- };
-
- MLPTrainer<?> trainer = new MLPTrainer<>(
- archSupplier,
- LossFunctions.L2,
- updatesStgy,
- maxIterations,
- batchSize,
- locIterations,
- seed
- );
-
- IgniteBiFunction<K, V, double[]> lbExtractorWrapper = (k, v) -> new double[] {lbExtractor.apply(k, v)};
- MultilayerPerceptron mlp;
- if (mdl != null) {
- mlp = restoreMLPState(mdl);
- mlp = trainer.update(mlp, datasetBuilder, featureExtractor, lbExtractorWrapper);
- }
- else
- mlp = trainer.fit(datasetBuilder, featureExtractor, lbExtractorWrapper);
-
- double[] params = mlp.parameters().getStorage().data();
-
- return new LogisticRegressionModel(new DenseVector(Arrays.copyOf(params, params.length - 1)),
- params[params.length - 1]
- );
- }
-
- /**
- * @param mdl Model.
- * @return state of MLP from last learning.
- */
- @NotNull private MultilayerPerceptron restoreMLPState(LogisticRegressionModel mdl) {
- Vector weights = mdl.weights();
- double intercept = mdl.intercept();
-
- MLPArchitecture architecture1 = new MLPArchitecture(weights.size());
- architecture1 = architecture1.withAddedLayer(1, true, Activators.SIGMOID);
-
- MLPArchitecture architecture = architecture1;
- MultilayerPerceptron perceptron = new MultilayerPerceptron(architecture);
-
- Vector mlpState = weights.like(weights.size() + 1);
- weights.nonZeroes().forEach(ith -> mlpState.set(ith.index(), ith.get()));
- mlpState.set(mlpState.size() - 1, intercept);
- perceptron.setParameters(mlpState);
-
- return perceptron;
- }
-
- /** {@inheritDoc} */
- @Override protected boolean checkState(LogisticRegressionModel mdl) {
- return true;
- }
-
- /**
- * Set up the max amount of iterations before convergence.
- *
- * @param maxIterations The parameter value.
- * @return Model with new max number of iterations before convergence parameter value.
- */
- public LogisticRegressionSGDTrainer<P> withMaxIterations(int maxIterations) {
- this.maxIterations = maxIterations;
- return this;
- }
-
- /**
- * Set up the batchSize parameter.
- *
- * @param batchSize The size of learning batch.
- * @return Trainer with new batch size parameter value.
- */
- public LogisticRegressionSGDTrainer<P> withBatchSize(int batchSize) {
- this.batchSize = batchSize;
- return this;
- }
-
- /**
- * Set up the amount of local iterations of SGD algorithm.
- *
- * @param amountOfLocIterations The parameter value.
- * @return Trainer with new locIterations parameter value.
- */
- public LogisticRegressionSGDTrainer<P> withLocIterations(int amountOfLocIterations) {
- this.locIterations = amountOfLocIterations;
- return this;
- }
-
- /**
- * Set up the random seed parameter.
- *
- * @param seed Seed for random generator.
- * @return Trainer with new seed parameter value.
- */
- public LogisticRegressionSGDTrainer<P> withSeed(long seed) {
- this.seed = seed;
- return this;
- }
-
- /**
- * Set up the regularization parameter.
- *
- * @param updatesStgy Update strategy.
- * @return Trainer with new update strategy parameter value.
- */
- public LogisticRegressionSGDTrainer withUpdatesStgy(UpdatesStrategy updatesStgy) {
- this.updatesStgy = updatesStgy;
- return this;
- }
-
- /**
- * Get the update strategy.
- *
- * @return The property value.
- */
- public UpdatesStrategy getUpdatesStgy() {
- return updatesStgy;
- }
-
- /**
- * Get the max amount of iterations.
- *
- * @return The property value.
- */
- public int getMaxIterations() {
- return maxIterations;
- }
-
- /**
- * Get the batch size.
- *
- * @return The property value.
- */
- public int getBatchSize() {
- return batchSize;
- }
-
- /**
- * Get the amount of local iterations.
- *
- * @return The property value.
- */
- public int getLocIterations() {
- return locIterations;
- }
-
- /**
- * Get the seed for random generator.
- *
- * @return The property value.
- */
- public long getSeed() {
- return seed;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/binomial/package-info.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/binomial/package-info.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/binomial/package-info.java
deleted file mode 100644
index d32b1ee..0000000
--- a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/binomial/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * Contains binomial logistic regression.
- */
-package org.apache.ignite.ml.regressions.logistic.binomial;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/LogRegressionMultiClassModel.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/LogRegressionMultiClassModel.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/LogRegressionMultiClassModel.java
deleted file mode 100644
index a7c9118..0000000
--- a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/LogRegressionMultiClassModel.java
+++ /dev/null
@@ -1,115 +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.ml.regressions.logistic.multiclass;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.TreeMap;
-import org.apache.ignite.ml.Exportable;
-import org.apache.ignite.ml.Exporter;
-import org.apache.ignite.ml.Model;
-import org.apache.ignite.ml.math.primitives.vector.Vector;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionModel;
-
-/** Base class for multi-classification model for set of Logistic Regression classifiers. */
-public class LogRegressionMultiClassModel implements Model<Vector, Double>, Exportable<LogRegressionMultiClassModel>, Serializable {
- /** */
- private static final long serialVersionUID = -114986533350117L;
-
- /** List of models associated with each class. */
- private Map<Double, LogisticRegressionModel> models;
-
- /** */
- public LogRegressionMultiClassModel() {
- this.models = new HashMap<>();
- }
-
- /** {@inheritDoc} */
- @Override public Double apply(Vector input) {
- TreeMap<Double, Double> maxMargins = new TreeMap<>();
-
- models.forEach((k, v) -> maxMargins.put(1.0 / (1.0 + Math.exp(-(input.dot(v.weights()) + v.intercept()))), k));
-
- return maxMargins.lastEntry().getValue();
- }
-
- /** {@inheritDoc} */
- @Override public <P> void saveModel(Exporter<LogRegressionMultiClassModel, P> exporter, P path) {
- exporter.save(this, path);
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (o == null || getClass() != o.getClass())
- return false;
-
- LogRegressionMultiClassModel mdl = (LogRegressionMultiClassModel)o;
-
- return Objects.equals(models, mdl.models);
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return Objects.hash(models);
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- StringBuilder wholeStr = new StringBuilder();
-
- models.forEach((clsLb, mdl) ->
- wholeStr
- .append("The class with label ")
- .append(clsLb)
- .append(" has classifier: ")
- .append(mdl.toString())
- .append(System.lineSeparator())
- );
-
- return wholeStr.toString();
- }
-
- /** {@inheritDoc} */
- @Override public String toString(boolean pretty) {
- return toString();
- }
-
- /**
- * Adds a specific Log Regression binary classifier to the bunch of same classifiers.
- *
- * @param clsLb The class label for the added model.
- * @param mdl The model.
- */
- public void add(double clsLb, LogisticRegressionModel mdl) {
- models.put(clsLb, mdl);
- }
-
- /**
- * @param clsLb Class label.
- * @return model for class label if it exists.
- */
- public Optional<LogisticRegressionModel> getModel(Double clsLb) {
- return Optional.ofNullable(models.get(clsLb));
- }
-}
[23/50] [abbrv] ignite git commit: IGNITE-10523 Ignite Compatibility:
add check that started node is of expected version. - Fixes #5570.
Posted by sb...@apache.org.
IGNITE-10523 Ignite Compatibility: add check that started node is of expected version. - Fixes #5570.
Signed-off-by: Dmitriy Pavlov <dp...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bb56dc6d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bb56dc6d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bb56dc6d
Branch: refs/heads/ignite-10044
Commit: bb56dc6d4843c426b0d5f0015abe8dc3af794276
Parents: 7f758bf
Author: Vyacheslav Daradur <da...@gmail.com>
Authored: Tue Dec 4 20:13:31 2018 +0300
Committer: Dmitriy Pavlov <dp...@apache.org>
Committed: Tue Dec 4 20:13:31 2018 +0300
----------------------------------------------------------------------
.../junits/IgniteCompatibilityAbstractTest.java | 3 ++-
.../junits/IgniteCompatibilityNodeRunner.java | 14 ++++++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb56dc6d/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
index b0e4001..826edba 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityAbstractTest.java
@@ -153,7 +153,8 @@ public abstract class IgniteCompatibilityAbstractTest extends GridCommonAbstract
@Override protected String params(IgniteConfiguration cfg, boolean resetDiscovery) throws Exception {
return cfgCloPath + " " + igniteInstanceName + " "
+ getId() + " "
- + (rmJvmInstance == null ? getId() : ((IgniteProcessProxy)rmJvmInstance).getId())
+ + (rmJvmInstance == null ? getId() : ((IgniteProcessProxy)rmJvmInstance).getId()) + " "
+ + ver
+ (cloPath == null ? "" : " " + cloPath);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb56dc6d/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java
index 165cb4c..5421850 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java
@@ -36,6 +36,7 @@ import org.apache.ignite.internal.util.GridJavaProcess;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.multijvm.IgniteNodeRunner;
import org.jetbrains.annotations.NotNull;
@@ -59,7 +60,8 @@ public class IgniteCompatibilityNodeRunner extends IgniteNodeRunner {
* args[2] - required - id of the starting node;
* args[3] - required - sync-id of a node for synchronization of startup. Must be equals
* to arg[2] in case of starting the first node in the Ignite cluster;
- * args[4] - optional - path to closure for actions after node startup.
+ * args[4] - required - expected Ignite's version to check at startup;
+ * args[5] - optional - path to closure for actions after node startup.
* </pre>
*
* @param args Command-line arguments.
@@ -73,7 +75,7 @@ public class IgniteCompatibilityNodeRunner extends IgniteNodeRunner {
if (args.length < 3) {
throw new IllegalArgumentException("At least four arguments expected:" +
- " [path/to/closure/file] [ignite-instance-name] [node-id] [sync-node-id] [optional/path/to/closure/file]");
+ " [path/to/closure/file] [ignite-instance-name] [node-id] [sync-node-id] [node-ver] [optional/path/to/closure/file]");
}
final Thread watchdog = delayedDumpClasspath();
@@ -86,6 +88,7 @@ public class IgniteCompatibilityNodeRunner extends IgniteNodeRunner {
final UUID nodeId = UUID.fromString(args[2]);
final UUID syncNodeId = UUID.fromString(args[3]);
+ final IgniteProductVersion expNodeVer = IgniteProductVersion.fromString(args[4]);
// Ignite instance name and id must be set according to arguments
// it's used for nodes managing: start, stop etc.
@@ -96,11 +99,14 @@ public class IgniteCompatibilityNodeRunner extends IgniteNodeRunner {
assert ignite.cluster().node(syncNodeId) != null : "Node has not joined [id=" + nodeId + "]";
+ assert ignite.cluster().localNode().version().compareToIgnoreTimestamp(expNodeVer) == 0 : "Node is of unexpected " +
+ "version: [act=" + ignite.cluster().localNode().version() + ", exp=" + expNodeVer + ']';
+
// It needs to set private static field 'ignite' of the IgniteNodeRunner class via reflection
GridTestUtils.setFieldValue(new IgniteNodeRunner(), "ignite", ignite);
- if (args.length == 5) {
- IgniteInClosure<Ignite> clo = readClosureFromFileAndDelete(args[4]);
+ if (args.length == 6) {
+ IgniteInClosure<Ignite> clo = readClosureFromFileAndDelete(args[5]);
clo.apply(ignite);
}
[39/50] [abbrv] ignite git commit: IGNITE-10437 Fixed flaky
GridCacheWriteBehindStoreMultithreadedSelfTest.testFlushFromTheSameThreadWithCoalescing
- Fixes #5522.
Posted by sb...@apache.org.
IGNITE-10437 Fixed flaky GridCacheWriteBehindStoreMultithreadedSelfTest.testFlushFromTheSameThreadWithCoalescing - Fixes #5522.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5990bcdc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5990bcdc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5990bcdc
Branch: refs/heads/ignite-10044
Commit: 5990bcdc53e9d4d59f724ff6dd6d54e9158339ee
Parents: 5fa79c6
Author: Dmitrii Ryabov <So...@gmail.com>
Authored: Wed Dec 5 19:42:58 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Dec 5 19:42:58 2018 +0300
----------------------------------------------------------------------
...heWriteBehindStoreMultithreadedSelfTest.java | 35 ++++++++++++--------
1 file changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5990bcdc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreMultithreadedSelfTest.java
index 4fce452..a9558aa 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreMultithreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreMultithreadedSelfTest.java
@@ -187,33 +187,42 @@ public class GridCacheWriteBehindStoreMultithreadedSelfTest extends GridCacheWri
// 50 milliseconds should be enough.
delegate.setOperationDelay(50);
- initStore(2, writeCoalescing);
+ Set<Integer> exp = null;
- Set<Integer> exp;
+ int start = 0;
+ int end = 0;
- int start = store.getWriteBehindTotalCriticalOverflowCount();
+ long startTime = System.currentTimeMillis();
- try {
- //We will have in total 5 * CACHE_SIZE keys that should be enough to grow map size to critical value.
- exp = runPutGetRemoveMultithreaded(5, CACHE_SIZE);
- }
- finally {
- log.info(">>> Done inserting, shutting down the store");
+ while (end - start == 0 && System.currentTimeMillis() - startTime < getTestTimeout()) {
+ initStore(2, writeCoalescing);
- shutdownStore();
+ start = store.getWriteBehindTotalCriticalOverflowCount();
+
+ try {
+ //We will have in total 5 * CACHE_SIZE keys that should be enough to grow map size to critical value.
+ exp = runPutGetRemoveMultithreaded(5, CACHE_SIZE);
+ }
+ finally {
+ log.info(">>> Done inserting, shutting down the store");
+
+ shutdownStore();
+ }
+
+ end = store.getWriteBehindTotalCriticalOverflowCount();
}
// Restore delay.
delegate.setOperationDelay(0);
- Map<Integer, String> map = delegate.getMap();
-
- int end = store.getWriteBehindTotalCriticalOverflowCount();
+ assertNotNull(exp);
log.info(">>> There are " + exp.size() + " keys in store, " + (end - start) + " overflows detected");
assertTrue("No cache overflows detected (a bug or too few keys or too few delay?)", end > start);
+ Map<Integer, String> map = delegate.getMap();
+
Collection<Integer> extra = new HashSet<>(map.keySet());
extra.removeAll(exp);
[36/50] [abbrv] ignite git commit: IGNITE-10410: MVCC: Create "Cache
7" test suite for MVCC mode. This closes #5549.
Posted by sb...@apache.org.
IGNITE-10410: MVCC: Create "Cache 7" test suite for MVCC mode. This closes #5549.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9edd7861
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9edd7861
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9edd7861
Branch: refs/heads/ignite-10044
Commit: 9edd7861f6e08a27966d68f9b1400a8cf873c137
Parents: cf32fc7
Author: rkondakov <ko...@mail.ru>
Authored: Wed Dec 5 16:11:45 2018 +0300
Committer: Igor Seliverstov <gv...@gmail.com>
Committed: Wed Dec 5 16:11:45 2018 +0300
----------------------------------------------------------------------
.../cache/CacheGroupMetricsMBeanTest.java | 20 ++++--
.../cache/CacheMetricsManageTest.java | 11 ++-
...ynamicCacheStartFailWithPersistenceTest.java | 4 ++
.../cache/MvccCacheGroupMetricsMBeanTest.java | 29 ++++++++
.../cache/WalModeChangeAbstractSelfTest.java | 3 +
.../cache/WalModeChangeAdvancedSelfTest.java | 4 ++
.../CacheDataLossOnPartitionMoveTest.java | 6 +-
.../CachePageWriteLockUnlockTest.java | 6 +-
...cheRebalancingPartitionCountersMvccTest.java | 29 ++++++++
...idCacheRebalancingPartitionCountersTest.java | 9 +++
...cheRebalancingWithAsyncClearingMvccTest.java | 36 ++++++++++
...idCacheRebalancingWithAsyncClearingTest.java | 9 +++
.../PageEvictionMultinodeAbstractTest.java | 4 ++
...tinuousQueryAsyncFailoverMvccTxSelfTest.java | 5 --
...heContinuousQueryFailoverMvccTxSelfTest.java | 5 --
...IntegrityWithPrimaryIndexCorruptionTest.java | 9 +++
.../TxRollbackAsyncNearCacheTest.java | 9 +++
.../cache/transactions/TxRollbackAsyncTest.java | 43 +++++++----
...WithSmallTimeoutAndContentionOneKeyTest.java | 10 +++
.../testsuites/IgniteCacheMvccTestSuite7.java | 76 ++++++++++++++++++++
.../testsuites/IgniteCacheTestSuite4.java | 2 +-
.../testsuites/IgniteCacheTestSuite7.java | 56 +++++++--------
.../ignite/testsuites/IgnitePdsTestSuite4.java | 3 +
23 files changed, 324 insertions(+), 64 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsMBeanTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsMBeanTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsMBeanTest.java
index f8108eb..3cd730f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsMBeanTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsMBeanTest.java
@@ -34,6 +34,7 @@ import javax.management.ObjectName;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.cache.affinity.AffinityFunctionContext;
@@ -132,21 +133,25 @@ public class CacheGroupMetricsMBeanTest extends GridCommonAbstractTest implement
.setGroupName("group1")
.setCacheMode(CacheMode.PARTITIONED)
.setBackups(3)
- .setAffinity(new RoundRobinVariableSizeAffinityFunction());
+ .setAffinity(new RoundRobinVariableSizeAffinityFunction())
+ .setAtomicityMode(atomicityMode());
CacheConfiguration cCfg2 = new CacheConfiguration()
.setName("cache2")
.setGroupName("group2")
- .setCacheMode(CacheMode.REPLICATED);
+ .setCacheMode(CacheMode.REPLICATED)
+ .setAtomicityMode(atomicityMode());
CacheConfiguration cCfg3 = new CacheConfiguration()
.setName("cache3")
.setGroupName("group2")
- .setCacheMode(CacheMode.REPLICATED);
+ .setCacheMode(CacheMode.REPLICATED)
+ .setAtomicityMode(atomicityMode());
CacheConfiguration cCfg4 = new CacheConfiguration()
.setName("cache4")
- .setCacheMode(CacheMode.PARTITIONED);
+ .setCacheMode(CacheMode.PARTITIONED)
+ .setAtomicityMode(atomicityMode());
cfg.setCacheConfiguration(cCfg1, cCfg2, cCfg3, cCfg4);
@@ -163,6 +168,13 @@ public class CacheGroupMetricsMBeanTest extends GridCommonAbstractTest implement
return cfg;
}
+ /**
+ * @return Cache atomicity mode.
+ */
+ protected CacheAtomicityMode atomicityMode() {
+ return CacheAtomicityMode.ATOMIC;
+ }
+
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
stopAllGrids();
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsManageTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsManageTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsManageTest.java
index ae00ac9..94830be 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsManageTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsManageTest.java
@@ -52,6 +52,7 @@ 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.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
/**
@@ -80,6 +81,9 @@ public class CacheMetricsManageTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testJmxNoPdsStatisticsEnable() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-9224");
+
testJmxStatisticsEnable(false);
}
@@ -87,6 +91,9 @@ public class CacheMetricsManageTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testJmxPdsStatisticsEnable() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-10421");
+
testJmxStatisticsEnable(true);
}
@@ -101,7 +108,7 @@ public class CacheMetricsManageTest extends GridCommonAbstractTest {
.setName(CACHE1)
.setGroupName(GROUP)
.setCacheMode(CacheMode.PARTITIONED)
- .setAtomicityMode(CacheAtomicityMode.ATOMIC);
+ .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
mgr1.createCache(CACHE1, cfg1);
@@ -490,7 +497,7 @@ public class CacheMetricsManageTest extends GridCommonAbstractTest {
.setName(CACHE1)
.setGroupName(GROUP)
.setCacheMode(CacheMode.PARTITIONED)
- .setAtomicityMode(CacheAtomicityMode.ATOMIC)
+ .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
cfg.setCacheConfiguration(cacheCfg);
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartFailWithPersistenceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartFailWithPersistenceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartFailWithPersistenceTest.java
index 8643b66..4826119 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartFailWithPersistenceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartFailWithPersistenceTest.java
@@ -24,6 +24,7 @@ import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.testframework.MvccFeatureChecker;
/**
* Tests the recovery after a dynamic cache start failure, with enabled persistence.
@@ -57,6 +58,9 @@ public class IgniteDynamicCacheStartFailWithPersistenceTest extends IgniteAbstra
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-10421");
+
cleanPersistenceDir();
startGrids(gridCount());
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MvccCacheGroupMetricsMBeanTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MvccCacheGroupMetricsMBeanTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MvccCacheGroupMetricsMBeanTest.java
new file mode 100644
index 0000000..2642eb5
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MvccCacheGroupMetricsMBeanTest.java
@@ -0,0 +1,29 @@
+/*
+ * 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 org.apache.ignite.cache.CacheAtomicityMode;
+
+/**
+ *
+ */
+public class MvccCacheGroupMetricsMBeanTest extends CacheGroupMetricsMBeanTest {
+ /** {@inheritDoc} */
+ @Override protected CacheAtomicityMode atomicityMode() {
+ return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAbstractSelfTest.java
index 8c8ce53..467d6ff 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAbstractSelfTest.java
@@ -27,6 +27,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.lang.IgniteInClosureX;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -187,6 +188,8 @@ public abstract class WalModeChangeAbstractSelfTest extends WalModeChangeCommonA
// Doesn't make sense for JDBC.
return;
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
forAllNodes(new IgniteInClosureX<Ignite>() {
@Override public void applyx(Ignite ignite) throws IgniteCheckedException {
createCache(ignite, cacheConfig(LOCAL).setDataRegionName(REGION_VOLATILE));
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAdvancedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAdvancedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAdvancedSelfTest.java
index 5f2b4aa..f1e6e92 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAdvancedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAdvancedSelfTest.java
@@ -32,6 +32,7 @@ import org.apache.ignite.internal.IgniteClientReconnectAbstractTest;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.GridTestUtils.SF;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -141,6 +142,9 @@ public class WalModeChangeAdvancedSelfTest extends WalModeChangeCommonAbstractSe
* @throws Exception If failed.
*/
public void testJoin() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-10421");
+
checkJoin(false);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheDataLossOnPartitionMoveTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheDataLossOnPartitionMoveTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheDataLossOnPartitionMoveTest.java
index 9ff0725..acbfa8c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheDataLossOnPartitionMoveTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheDataLossOnPartitionMoveTest.java
@@ -36,13 +36,14 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.TestRecordingCommunicationSpi;
import org.apache.ignite.internal.processors.cache.GridCacheUtils;
-import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage;
+import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.testframework.GridTestNode;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.Nullable;
@@ -119,6 +120,9 @@ public class CacheDataLossOnPartitionMoveTest extends GridCommonAbstractTest {
* @throws Exception if failed.
*/
public void testDataLossOnPartitionMove() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-10421");
+
try {
Ignite ignite = startGridsMultiThreaded(GRIDS_CNT / 2, false);
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePageWriteLockUnlockTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePageWriteLockUnlockTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePageWriteLockUnlockTest.java
index 41c5882..5b24761 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePageWriteLockUnlockTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePageWriteLockUnlockTest.java
@@ -21,6 +21,7 @@ import java.util.Iterator;
import javax.cache.Cache;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.DataRegionConfiguration;
@@ -51,8 +52,9 @@ public class CachePageWriteLockUnlockTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
- cfg.setCacheConfiguration(new CacheConfiguration(DEFAULT_CACHE_NAME).
- setAffinity(new RendezvousAffinityFunction(false, 32)));
+ cfg.setCacheConfiguration(new CacheConfiguration(DEFAULT_CACHE_NAME)
+ .setAffinity(new RendezvousAffinityFunction(false, 32))
+ .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL));
cfg.setActiveOnStart(false);
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionCountersMvccTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionCountersMvccTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionCountersMvccTest.java
new file mode 100644
index 0000000..4166cfc
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionCountersMvccTest.java
@@ -0,0 +1,29 @@
+/*
+ * 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.distributed.rebalancing;
+
+import org.apache.ignite.cache.CacheAtomicityMode;
+
+/**
+ *
+ */
+public class GridCacheRebalancingPartitionCountersMvccTest extends GridCacheRebalancingPartitionCountersTest {
+ /** {@inheritDoc} */
+ @Override protected CacheAtomicityMode atomicityMode() {
+ return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionCountersTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionCountersTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionCountersTest.java
index 258e36e..6523eb9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionCountersTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionCountersTest.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.DataRegionConfiguration;
@@ -61,6 +62,7 @@ public class GridCacheRebalancingPartitionCountersTest extends GridCommonAbstrac
.setMaxSize(100L * 1024 * 1024))
.setWalMode(WALMode.LOG_ONLY))
.setCacheConfiguration(new CacheConfiguration(CACHE_NAME)
+ .setAtomicityMode(atomicityMode())
.setBackups(2)
.setRebalanceBatchSize(4096) // Force to create several supply messages during rebalancing.
.setAffinity(
@@ -80,6 +82,13 @@ public class GridCacheRebalancingPartitionCountersTest extends GridCommonAbstrac
}
/**
+ * @return Cache atomicity mode.
+ */
+ protected CacheAtomicityMode atomicityMode() {
+ return CacheAtomicityMode.ATOMIC;
+ }
+
+ /**
*
*/
private boolean contains(int[] arr, int a) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingMvccTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingMvccTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingMvccTest.java
new file mode 100644
index 0000000..a61d6d0
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingMvccTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.distributed.rebalancing;
+
+import org.apache.ignite.cache.CacheAtomicityMode;
+
+/**
+ *
+ */
+public class GridCacheRebalancingWithAsyncClearingMvccTest extends GridCacheRebalancingWithAsyncClearingTest {
+ /** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-10421");
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected CacheAtomicityMode atomicityMode() {
+ return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingTest.java
index 328653d..2b69439 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingTest.java
@@ -21,6 +21,7 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.PartitionLossPolicy;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
@@ -65,6 +66,7 @@ public class GridCacheRebalancingWithAsyncClearingTest extends GridCommonAbstrac
);
cfg.setCacheConfiguration(new CacheConfiguration<>(CACHE_NAME)
+ .setAtomicityMode(atomicityMode())
.setBackups(2)
.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
.setIndexedTypes(Integer.class, Integer.class)
@@ -94,6 +96,13 @@ public class GridCacheRebalancingWithAsyncClearingTest extends GridCommonAbstrac
}
/**
+ * @return Atomicity mode.
+ */
+ protected CacheAtomicityMode atomicityMode() {
+ return CacheAtomicityMode.ATOMIC;
+ }
+
+ /**
* Test that partition clearing doesn't block partitions map exchange.
*
* @throws Exception If failed.
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeAbstractTest.java
index 777c2d7..e30f1cf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeAbstractTest.java
@@ -25,6 +25,7 @@ import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
/**
*
@@ -46,6 +47,9 @@ public abstract class PageEvictionMultinodeAbstractTest extends PageEvictionAbst
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-10448");
+
startGridsMultiThreaded(4, false);
clientGrid = startGrid("client");
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFailoverMvccTxSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFailoverMvccTxSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFailoverMvccTxSelfTest.java
index 7c15f38..aa60aeb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFailoverMvccTxSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFailoverMvccTxSelfTest.java
@@ -47,11 +47,6 @@ public class CacheContinuousQueryAsyncFailoverMvccTxSelfTest extends CacheConti
}
/** {@inheritDoc} */
- @Override public void testLeftPrimaryAndBackupNodes() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-10047");
- }
-
- /** {@inheritDoc} */
@Override public void testFailoverStartStopBackup() throws Exception {
fail("https://issues.apache.org/jira/browse/IGNITE-10391");
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverMvccTxSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverMvccTxSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverMvccTxSelfTest.java
index 2d578f2..df27087 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverMvccTxSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverMvccTxSelfTest.java
@@ -42,11 +42,6 @@ public class CacheContinuousQueryFailoverMvccTxSelfTest extends CacheContinuousQ
}
/** {@inheritDoc} */
- @Override public void testLeftPrimaryAndBackupNodes() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-10047");
- }
-
- /** {@inheritDoc} */
@Override public void testFailoverStartStopBackup() throws Exception {
fail("https://issues.apache.org/jira/browse/IGNITE-10391");
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TransactionIntegrityWithPrimaryIndexCorruptionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TransactionIntegrityWithPrimaryIndexCorruptionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TransactionIntegrityWithPrimaryIndexCorruptionTest.java
index fd31ee5..616bf97 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TransactionIntegrityWithPrimaryIndexCorruptionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TransactionIntegrityWithPrimaryIndexCorruptionTest.java
@@ -34,6 +34,7 @@ import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
import org.apache.ignite.internal.processors.cache.persistence.tree.util.PageHandler;
import org.apache.ignite.internal.processors.cache.tree.SearchRow;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState.OWNING;
@@ -45,6 +46,14 @@ public class TransactionIntegrityWithPrimaryIndexCorruptionTest extends Abstract
private static volatile boolean corruptionEnabled;
/** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-10470");
+
+ super.beforeTest();
+ }
+
+ /** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
corruptionEnabled = false;
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncNearCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncNearCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncNearCacheTest.java
index 5caa1a0..dc115e1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncNearCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncNearCacheTest.java
@@ -17,6 +17,8 @@
package org.apache.ignite.internal.processors.cache.transactions;
+import org.apache.ignite.testframework.MvccFeatureChecker;
+
/**
* Tests an ability to async rollback near transactions.
*/
@@ -25,4 +27,11 @@ public class TxRollbackAsyncNearCacheTest extends TxRollbackAsyncTest {
@Override protected boolean nearCacheEnabled() {
return true;
}
+
+ /** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+ super.setUp();
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java
index d2e9804..8076746 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java
@@ -59,6 +59,7 @@ import org.apache.ignite.internal.TestRecordingCommunicationSpi;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxEnlistRequest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishRequest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -99,7 +100,6 @@ import static org.apache.ignite.testframework.GridTestUtils.runAsync;
import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
-import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
import static org.apache.ignite.transactions.TransactionState.ROLLED_BACK;
@@ -127,14 +127,6 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
public static final String LABEL = "wLockTx";
/** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- if (MvccFeatureChecker.forcedMvcc())
- fail("https://issues.apache.org/jira/browse/IGNITE-10410");
-
- super.beforeTestsStarted();
- }
-
- /** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
@@ -228,6 +220,9 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
*
*/
public void testRollbackSimple() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-7952");
+
startClient();
for (Ignite ignite : G.allGrids()) {
@@ -242,7 +237,7 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
*/
private void testRollbackSimple0(Ignite near) throws Exception {
// Normal rollback after put.
- Transaction tx = near.transactions().txStart(PESSIMISTIC, READ_COMMITTED);
+ Transaction tx = near.transactions().txStart(PESSIMISTIC, REPEATABLE_READ);
near.cache(CACHE_NAME).put(0, 0);
@@ -406,7 +401,7 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
txReadyFut.onDone(tx);
// Will block on lock request until rolled back asynchronously.
- Object o = tryLockNode.cache(CACHE_NAME).get(0);
+ Object o = tryLockNode.cache(CACHE_NAME).getAndPut(0, 0);
assertNull(o); // If rolled back by close, previous get will return null.
}
@@ -496,6 +491,9 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
*
*/
public void testEnlistManyReadOptimistic() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ return; // Optimistic transactions are not supported by MVCC.
+
testEnlistMany(false, SERIALIZABLE, OPTIMISTIC);
}
@@ -503,6 +501,9 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
*
*/
public void testEnlistManyWriteOptimistic() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ return; // Optimistic transactions are not supported by MVCC.
+
testEnlistMany(true, SERIALIZABLE, OPTIMISTIC);
}
@@ -547,13 +548,20 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
* Rollback tx while near lock request is delayed.
*/
public void testRollbackDelayNearLockRequest() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-9470");
+
final Ignite client = startClient();
final Ignite prim = primaryNode(0, CACHE_NAME);
final TestRecordingCommunicationSpi spi = (TestRecordingCommunicationSpi)client.configuration().getCommunicationSpi();
- spi.blockMessages(GridNearLockRequest.class, prim.name());
+ boolean mvcc = MvccFeatureChecker.forcedMvcc();
+
+ Class msgCls = mvcc ? GridNearTxEnlistRequest.class : GridNearLockRequest.class;
+
+ spi.blockMessages(msgCls, prim.name());
final IgniteInternalFuture<Void> rollbackFut = runAsync(new Callable<Void>() {
@Override public Void call() throws Exception {
@@ -571,7 +579,7 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
fail();
}
catch (CacheException e) {
- assertTrue(X.hasCause(e, TransactionRollbackException.class));
+ assertTrue(X.getFullStackTrace(e),X.hasCause(e, TransactionRollbackException.class));
}
rollbackFut.get();
@@ -646,6 +654,9 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
*
*/
public void testMixedAsyncRollbackTypes() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-10434");
+
final Ignite client = startClient();
final AtomicBoolean stop = new AtomicBoolean();
@@ -676,6 +687,8 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
for (Ignite ignite : G.allGrids())
perNodeTxs.put(ignite, new ArrayBlockingQueue<>(1000));
+ boolean mvcc = MvccFeatureChecker.forcedMvcc();
+
IgniteInternalFuture<?> txFut = multithreadedAsync(() -> {
while (!stop.get()) {
int nodeId = r.nextInt(GRID_CNT + 1);
@@ -683,8 +696,8 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
// Choose random node to start tx on.
Ignite node = nodeId == GRID_CNT || nearCacheEnabled() ? client : grid(nodeId);
- TransactionConcurrency conc = TC_VALS[r.nextInt(TC_VALS.length)];
- TransactionIsolation isolation = TI_VALS[r.nextInt(TI_VALS.length)];
+ TransactionConcurrency conc = mvcc ? PESSIMISTIC : TC_VALS[r.nextInt(TC_VALS.length)];
+ TransactionIsolation isolation = mvcc ? REPEATABLE_READ :TI_VALS[r.nextInt(TI_VALS.length)];
// Timeout is necessary otherwise deadlock is possible due to randomness of lock acquisition.
long timeout = r.nextInt(50) + 50;
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxWithSmallTimeoutAndContentionOneKeyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxWithSmallTimeoutAndContentionOneKeyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxWithSmallTimeoutAndContentionOneKeyTest.java
index 62f4635..cac0427 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxWithSmallTimeoutAndContentionOneKeyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxWithSmallTimeoutAndContentionOneKeyTest.java
@@ -40,6 +40,7 @@ import org.apache.ignite.internal.util.typedef.internal.SB;
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.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
@@ -112,6 +113,9 @@ public class TxWithSmallTimeoutAndContentionOneKeyTest extends GridCommonAbstrac
* @return Random transaction type.
*/
protected TransactionConcurrency transactionConcurrency() {
+ if (MvccFeatureChecker.forcedMvcc())
+ return PESSIMISTIC;
+
ThreadLocalRandom random = ThreadLocalRandom.current();
return random.nextBoolean() ? OPTIMISTIC : PESSIMISTIC;
@@ -121,6 +125,9 @@ public class TxWithSmallTimeoutAndContentionOneKeyTest extends GridCommonAbstrac
* @return Random transaction isolation level.
*/
protected TransactionIsolation transactionIsolation(){
+ if (MvccFeatureChecker.forcedMvcc())
+ return REPEATABLE_READ;
+
ThreadLocalRandom random = ThreadLocalRandom.current();
switch (random.nextInt(3)) {
@@ -150,6 +157,9 @@ public class TxWithSmallTimeoutAndContentionOneKeyTest extends GridCommonAbstrac
* @throws Exception If failed.
*/
public void test() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-10455");
+
startGrids(4);
client = true;
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite7.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite7.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite7.java
new file mode 100644
index 0000000..403b5a0
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite7.java
@@ -0,0 +1,76 @@
+/*
+ * 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.testsuites;
+
+import java.util.HashSet;
+import junit.framework.TestSuite;
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.internal.processors.authentication.Authentication1kUsersNodeRestartTest;
+import org.apache.ignite.internal.processors.authentication.AuthenticationConfigurationClusterTest;
+import org.apache.ignite.internal.processors.authentication.AuthenticationOnNotActiveClusterTest;
+import org.apache.ignite.internal.processors.authentication.AuthenticationProcessorNPEOnStartTest;
+import org.apache.ignite.internal.processors.authentication.AuthenticationProcessorNodeRestartTest;
+import org.apache.ignite.internal.processors.authentication.AuthenticationProcessorSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheDataRegionConfigurationTest;
+import org.apache.ignite.internal.processors.cache.CacheGroupMetricsMBeanTest;
+import org.apache.ignite.internal.processors.cache.MvccCacheGroupMetricsMBeanTest;
+import org.apache.ignite.internal.processors.cache.distributed.Cache64kPartitionsTest;
+import org.apache.ignite.internal.processors.cache.distributed.rebalancing.GridCacheRebalancingPartitionCountersMvccTest;
+import org.apache.ignite.internal.processors.cache.distributed.rebalancing.GridCacheRebalancingPartitionCountersTest;
+import org.apache.ignite.internal.processors.cache.persistence.db.CheckpointBufferDeadlockTest;
+
+/**
+ *
+ */
+public class IgniteCacheMvccTestSuite7 extends TestSuite {
+ /**
+ * @return IgniteCache test suite.
+ */
+ public static TestSuite suite() {
+ System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true");
+
+ HashSet<Class> ignoredTests = new HashSet<>(128);
+
+ // Other non-tx tests.
+ ignoredTests.add(CheckpointBufferDeadlockTest.class);//
+ ignoredTests.add(AuthenticationConfigurationClusterTest.class);//
+ ignoredTests.add(AuthenticationProcessorSelfTest.class);
+ ignoredTests.add(AuthenticationOnNotActiveClusterTest.class);
+ ignoredTests.add(AuthenticationProcessorNodeRestartTest.class);
+ ignoredTests.add(AuthenticationProcessorNPEOnStartTest.class);
+ ignoredTests.add(Authentication1kUsersNodeRestartTest.class);
+ ignoredTests.add(CacheDataRegionConfigurationTest.class);
+ ignoredTests.add(Cache64kPartitionsTest.class);
+
+ // Skip classes which Mvcc implementations are added in this method below.
+ // TODO IGNITE-10175: refactor these tests (use assume) to support both mvcc and non-mvcc modes after moving to JUnit4/5.
+ ignoredTests.add(CacheGroupMetricsMBeanTest.class); // See MvccCacheGroupMetricsMBeanTest
+ ignoredTests.add(GridCacheRebalancingPartitionCountersTest.class); // See GridCacheRebalancingPartitionCountersMvccTest
+
+ TestSuite suite = new TestSuite("IgniteCache Mvcc Test Suite part 7");
+
+ suite.addTest(IgniteCacheTestSuite7.suite(ignoredTests));
+
+ // Add Mvcc clones.
+ suite.addTestSuite(MvccCacheGroupMetricsMBeanTest.class);
+ suite.addTestSuite(GridCacheRebalancingPartitionCountersMvccTest.class);
+
+
+ return suite;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index 378c9e9..05aa54c 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite7.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite7.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite7.java
index d0734a8..f7e1020 100755
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite7.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite7.java
@@ -34,7 +34,6 @@ import org.apache.ignite.internal.processors.cache.WalModeChangeCoordinatorNotAf
import org.apache.ignite.internal.processors.cache.WalModeChangeSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.Cache64kPartitionsTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheDataLossOnPartitionMoveTest;
-import org.apache.ignite.internal.processors.cache.distributed.CachePageWriteLockUnlockTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheRentingStateRepairTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCacheStartWithLoadTest;
import org.apache.ignite.internal.processors.cache.distributed.rebalancing.GridCacheRebalancingPartitionCountersTest;
@@ -45,6 +44,7 @@ import org.apache.ignite.internal.processors.cache.persistence.db.CheckpointBuff
import org.apache.ignite.internal.processors.cache.transactions.TransactionIntegrityWithPrimaryIndexCorruptionTest;
import org.apache.ignite.internal.processors.cache.transactions.TxRollbackAsyncWithPersistenceTest;
import org.apache.ignite.internal.processors.cache.transactions.TxWithSmallTimeoutAndContentionOneKeyTest;
+import org.apache.ignite.testframework.GridTestUtils;
/**
* Test suite.
@@ -63,46 +63,44 @@ public class IgniteCacheTestSuite7 extends TestSuite {
* @return Test suite.
* @throws Exception Thrown in case of the failure.
*/
- public static TestSuite suite(Set<Class> ignoredTests) throws Exception {
+ public static TestSuite suite(Set<Class> ignoredTests) {
TestSuite suite = new TestSuite("IgniteCache With Persistence Test Suite");
- suite.addTestSuite(CheckpointBufferDeadlockTest.class);
- suite.addTestSuite(IgniteCacheStartWithLoadTest.class);
+ GridTestUtils.addTestIfNeeded(suite, CheckpointBufferDeadlockTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, IgniteCacheStartWithLoadTest.class, ignoredTests);
- suite.addTestSuite(AuthenticationConfigurationClusterTest.class);
- suite.addTestSuite(AuthenticationProcessorSelfTest.class);
- suite.addTestSuite(AuthenticationOnNotActiveClusterTest.class);
- suite.addTestSuite(AuthenticationProcessorNodeRestartTest.class);
- suite.addTestSuite(AuthenticationProcessorNPEOnStartTest.class);
- suite.addTestSuite(Authentication1kUsersNodeRestartTest.class);
+ GridTestUtils.addTestIfNeeded(suite, AuthenticationConfigurationClusterTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, AuthenticationProcessorSelfTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, AuthenticationOnNotActiveClusterTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, AuthenticationProcessorNodeRestartTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, AuthenticationProcessorNPEOnStartTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, Authentication1kUsersNodeRestartTest.class, ignoredTests);
- suite.addTestSuite(CacheDataRegionConfigurationTest.class);
+ GridTestUtils.addTestIfNeeded(suite, CacheDataRegionConfigurationTest.class, ignoredTests);
- suite.addTestSuite(WalModeChangeAdvancedSelfTest.class);
- suite.addTestSuite(WalModeChangeSelfTest.class);
- suite.addTestSuite(WalModeChangeCoordinatorNotAffinityNodeSelfTest.class);
+ GridTestUtils.addTestIfNeeded(suite, WalModeChangeAdvancedSelfTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, WalModeChangeSelfTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, WalModeChangeCoordinatorNotAffinityNodeSelfTest.class, ignoredTests);
- suite.addTestSuite(Cache64kPartitionsTest.class);
- suite.addTestSuite(GridCacheRebalancingPartitionCountersTest.class);
- suite.addTestSuite(GridCacheRebalancingWithAsyncClearingTest.class);
+ GridTestUtils.addTestIfNeeded(suite, Cache64kPartitionsTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, GridCacheRebalancingPartitionCountersTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, GridCacheRebalancingWithAsyncClearingTest.class, ignoredTests);
- suite.addTestSuite(IgnitePdsCacheAssignmentNodeRestartsTest.class);
- suite.addTestSuite(TxRollbackAsyncWithPersistenceTest.class);
+ GridTestUtils.addTestIfNeeded(suite, IgnitePdsCacheAssignmentNodeRestartsTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, TxRollbackAsyncWithPersistenceTest.class, ignoredTests);
- suite.addTestSuite(CacheGroupMetricsMBeanTest.class);
- suite.addTestSuite(CacheMetricsManageTest.class);
- suite.addTestSuite(PageEvictionMultinodeMixedRegionsTest.class);
+ GridTestUtils.addTestIfNeeded(suite, CacheGroupMetricsMBeanTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, CacheMetricsManageTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, PageEvictionMultinodeMixedRegionsTest.class, ignoredTests);
- suite.addTestSuite(IgniteDynamicCacheStartFailWithPersistenceTest.class);
+ GridTestUtils.addTestIfNeeded(suite, IgniteDynamicCacheStartFailWithPersistenceTest.class, ignoredTests);
- suite.addTestSuite(TxWithSmallTimeoutAndContentionOneKeyTest.class);
+ GridTestUtils.addTestIfNeeded(suite, TxWithSmallTimeoutAndContentionOneKeyTest.class, ignoredTests);
- suite.addTestSuite(CacheRentingStateRepairTest.class);
+ GridTestUtils.addTestIfNeeded(suite, CacheRentingStateRepairTest.class, ignoredTests);
- suite.addTestSuite(TransactionIntegrityWithPrimaryIndexCorruptionTest.class);
- suite.addTestSuite(CacheDataLossOnPartitionMoveTest.class);
-
- suite.addTestSuite(CachePageWriteLockUnlockTest.class);
+ GridTestUtils.addTestIfNeeded(suite, TransactionIntegrityWithPrimaryIndexCorruptionTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, CacheDataLossOnPartitionMoveTest.class, ignoredTests);
return suite;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9edd7861/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
index ad6bbbf..11f0219 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
@@ -20,6 +20,7 @@ package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
import org.apache.ignite.cache.ResetLostPartitionTest;
import org.apache.ignite.internal.processors.cache.IgniteClusterActivateDeactivateTestWithPersistenceAndMemoryReuse;
+import org.apache.ignite.internal.processors.cache.distributed.CachePageWriteLockUnlockTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsContinuousRestartTestWithSharedGroupAndIndexes;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsRecoveryAfterFileCorruptionTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsTaskCancelingTest;
@@ -51,6 +52,8 @@ public class IgnitePdsTestSuite4 extends TestSuite {
suite.addTestSuite(ResetLostPartitionTest.class);
+ suite.addTestSuite(CachePageWriteLockUnlockTest.class);
+
suite.addTestSuite(IgnitePdsCacheWalDisabledOnRebalancingTest.class);
return suite;
[21/50] [abbrv] ignite git commit: IGNITE-10525 Web Console: "Import
models" dialog should be a singleton.
Posted by sb...@apache.org.
IGNITE-10525 Web Console: "Import models" dialog should be a singleton.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ea872cc5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ea872cc5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ea872cc5
Branch: refs/heads/ignite-10044
Commit: ea872cc51c6fef019ac368bfe17e9db035c6256e
Parents: b94a3c2
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Tue Dec 4 22:33:45 2018 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Dec 4 22:33:45 2018 +0700
----------------------------------------------------------------------
.../components/modal-import-models/service.js | 32 ++++++++++++++++----
1 file changed, 26 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ea872cc5/modules/web-console/frontend/app/components/page-configure/components/modal-import-models/service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure/components/modal-import-models/service.js b/modules/web-console/frontend/app/components/page-configure/components/modal-import-models/service.js
index e17721db..c45abaa 100644
--- a/modules/web-console/frontend/app/components/page-configure/components/modal-import-models/service.js
+++ b/modules/web-console/frontend/app/components/page-configure/components/modal-import-models/service.js
@@ -16,15 +16,23 @@
*/
export default class ModalImportModels {
- static $inject = ['$modal', '$uiRouter', 'AgentManager'];
+ static $inject = ['$modal', '$q', '$uiRouter', 'AgentManager'];
- constructor($modal, $uiRouter, AgentManager) {
+ deferred;
+
+ constructor($modal, $q, $uiRouter, AgentManager) {
this.$modal = $modal;
+ this.$q = $q;
this.$uiRouter = $uiRouter;
this.AgentManager = AgentManager;
}
_goToDynamicState() {
+ if (this.deferred)
+ return this.deferred.promise;
+
+ this.deferred = this.$q.defer();
+
if (this._state)
this.$uiRouter.stateRegistry.deregister(this._state);
@@ -36,7 +44,6 @@ export default class ModalImportModels {
},
onExit: () => {
this.AgentManager.stopWatch();
-
this._modal && this._modal.hide();
}
});
@@ -45,21 +52,34 @@ export default class ModalImportModels {
}
_open() {
+ const self = this;
+
this._modal = this.$modal({
template: `
<modal-import-models
- on-hide='$ctrl.$state.go("^")'
+ on-hide='$ctrl.onHide()'
cluster-id='$ctrl.$state.params.clusterID'
></modal-import-models>
`,
- controller: ['$state', function($state) {this.$state = $state;}],
+ controller: ['$state', function($state) {
+ this.$state = $state;
+
+ this.onHide = () => {
+ self.deferred.resolve(true);
+
+ this.$state.go('^');
+ };
+ }],
controllerAs: '$ctrl',
+ backdrop: 'static',
show: false
});
return this.AgentManager.startAgentWatch('Back', this.$uiRouter.globals.current.name)
.then(() => this._modal.$promise)
- .then(() => this._modal.show());
+ .then(() => this._modal.show())
+ .then(() => this.deferred.promise)
+ .finally(() => this.deferred = null);
}
open() {
[05/50] [abbrv] ignite git commit: IGNITE-6173: SQL: Create schema
for client caches without their start. This closes #4663.
Posted by sb...@apache.org.
IGNITE-6173: SQL: Create schema for client caches without their start. This closes #4663.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d19123d4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d19123d4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d19123d4
Branch: refs/heads/ignite-10044
Commit: d19123d46f367daa783674172485ffc438b6b96a
Parents: 1502494
Author: Yuriy Gerzhedovich <yg...@gridgain.com>
Authored: Mon Dec 3 13:07:00 2018 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Dec 3 13:07:00 2018 +0300
----------------------------------------------------------------------
.../JdbcThinAbstractDmlStatementSelfTest.java | 5 +
.../thin/JdbcThinBulkLoadAbstractSelfTest.java | 49 ++-
.../apache/ignite/internal/IgniteKernal.java | 10 +-
.../cache/CacheAffinitySharedManager.java | 22 +-
.../processors/cache/ClusterCachesInfo.java | 4 +
.../processors/cache/GridCacheContextInfo.java | 179 +++++++++++
.../processors/cache/GridCacheProcessor.java | 149 ++++-----
.../cache/LocalJoinCachesContext.java | 30 +-
.../processors/cache/StartCacheInfo.java | 25 ++
.../processors/query/GridQueryIndexing.java | 33 +-
.../processors/query/GridQueryProcessor.java | 89 ++++--
.../internal/processors/query/QueryUtils.java | 30 +-
.../schema/SchemaIndexCacheVisitorImpl.java | 3 +-
...IgniteClientCacheInitializationFailTest.java | 25 +-
.../query/h2/DmlStatementsProcessor.java | 12 +-
.../processors/query/h2/H2RowCache.java | 19 +-
.../processors/query/h2/H2RowCacheRegistry.java | 46 +--
.../internal/processors/query/h2/H2Schema.java | 6 +-
.../processors/query/h2/H2TableDescriptor.java | 35 ++-
.../processors/query/h2/H2TableEngine.java | 2 +-
.../internal/processors/query/h2/H2Utils.java | 27 ++
.../processors/query/h2/IgniteH2Indexing.java | 102 ++++---
.../query/h2/database/H2TreeClientIndex.java | 114 +++++++
.../query/h2/database/H2TreeIndex.java | 131 +++-----
.../query/h2/database/H2TreeIndexBase.java | 53 ++++
.../query/h2/ddl/DdlStatementsProcessor.java | 71 +----
.../processors/query/h2/dml/UpdatePlan.java | 2 +-
.../query/h2/dml/UpdatePlanBuilder.java | 89 ++++--
.../query/h2/opt/GridH2RowDescriptor.java | 14 +-
.../query/h2/opt/GridH2SystemIndexFactory.java | 10 +-
.../processors/query/h2/opt/GridH2Table.java | 41 ++-
.../query/h2/sql/GridSqlQueryParser.java | 10 +-
.../visor/verify/ValidateIndexesClosure.java | 6 +-
...dCacheDynamicLoadOnClientPersistentTest.java | 44 +++
.../cache/GridCacheDynamicLoadOnClientTest.java | 304 +++++++++++++++++++
.../cache/index/H2DynamicTableSelfTest.java | 22 ++
.../cache/index/SchemaExchangeSelfTest.java | 149 ++++++---
.../IgniteBinaryCacheQueryTestSuite.java | 5 +
38 files changed, 1478 insertions(+), 489 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAbstractDmlStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAbstractDmlStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAbstractDmlStatementSelfTest.java
index 405f21a..862e841 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAbstractDmlStatementSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAbstractDmlStatementSelfTest.java
@@ -57,6 +57,11 @@ public abstract class JdbcThinAbstractDmlStatementSelfTest extends JdbcThinAbstr
}
/** {@inheritDoc} */
+ @Override protected void afterTestsStopped() {
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
ignite(0).getOrCreateCache(cacheConfig());
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBulkLoadAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBulkLoadAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBulkLoadAbstractSelfTest.java
index 2a4c799..8eeac18 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBulkLoadAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBulkLoadAbstractSelfTest.java
@@ -17,22 +17,12 @@
package org.apache.ignite.jdbc.thin;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.QueryEntity;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.bulkload.BulkLoadCsvFormat;
-import org.apache.ignite.internal.processors.bulkload.BulkLoadCsvParser;
-import org.apache.ignite.internal.processors.query.QueryUtils;
-import org.apache.ignite.lang.IgniteClosure;
-import org.apache.ignite.testframework.GridTestUtils;
-
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.UnsupportedCharsetException;
import java.sql.BatchUpdateException;
+import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -41,6 +31,17 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
import java.util.concurrent.Callable;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.bulkload.BulkLoadCsvFormat;
+import org.apache.ignite.internal.processors.bulkload.BulkLoadCsvParser;
+import org.apache.ignite.internal.processors.query.QueryUtils;
+import org.apache.ignite.lang.IgniteClosure;
+import org.apache.ignite.testframework.GridTestUtils;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -410,6 +411,32 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest extends JdbcThinAbstractD
}
/**
+ * Test imports CSV file into a table on not affinity node and checks the created entries using SELECT statement.
+ *
+ * @throws SQLException If failed.
+ */
+ public void testBulkLoadToNonAffinityNode() throws Exception {
+ IgniteEx client = startGrid(getConfiguration("client").setClientMode(true));
+
+ try (Connection con = connect(client, null)) {
+ con.setSchema('"' + DEFAULT_CACHE_NAME + '"');
+
+ try (Statement stmt = con.createStatement()) {
+ int updatesCnt = stmt.executeUpdate(
+ "copy from '" + BULKLOAD_UTF8_CSV_FILE + "' into " + TBL_NAME +
+ " (_key, age, firstName, lastName)" +
+ " format csv");
+
+ assertEquals(2, updatesCnt);
+
+ checkNationalCacheContents(TBL_NAME);
+ }
+ }
+
+ stopGrid(client.name());
+ }
+
+ /**
* Imports two-entry CSV file with UTF-8 characters into a table using packet size of one byte
* (thus splitting each two-byte UTF-8 character into two packets)
* and checks the created entries using SELECT statement.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/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 4d8a555..f777980 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
@@ -3010,7 +3010,9 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
@Override public <K, V> IgniteBiTuple<IgniteCache<K, V>, Boolean> getOrCreateCache0(
CacheConfiguration<K, V> cacheCfg, boolean sql) {
A.notNull(cacheCfg, "cacheCfg");
- CU.validateNewCacheName(cacheCfg.getName());
+ String cacheName = cacheCfg.getName();
+
+ CU.validateNewCacheName(cacheName);
guard();
@@ -3019,18 +3021,18 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
Boolean res = false;
- if (ctx.cache().cache(cacheCfg.getName()) == null) {
+ if (ctx.cache().cache(cacheName) == null) {
res =
sql ? ctx.cache().dynamicStartSqlCache(cacheCfg).get() :
ctx.cache().dynamicStartCache(cacheCfg,
- cacheCfg.getName(),
+ cacheName,
null,
false,
true,
true).get();
}
- return new IgniteBiTuple<>((IgniteCache<K, V>)ctx.cache().publicJCache(cacheCfg.getName()), res);
+ return new IgniteBiTuple<>(ctx.cache().publicJCache(cacheName), res);
}
catch (IgniteCheckedException e) {
throw CU.convertToCacheException(e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index ce87fa9..07fbef1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -361,7 +361,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
void onCacheGroupCreated(CacheGroupContext grp) {
if (!grpHolders.containsKey(grp.groupId())) {
cctx.io().addCacheGroupHandler(grp.groupId(), GridDhtAffinityAssignmentResponse.class,
- (IgniteBiInClosure<UUID, GridDhtAffinityAssignmentResponse>) this::processAffinityAssignmentResponse);
+ (IgniteBiInClosure<UUID, GridDhtAffinityAssignmentResponse>)this::processAffinityAssignmentResponse);
}
}
@@ -430,10 +430,12 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
DynamicCacheChangeRequest changeReq = startReqs.get(desc.cacheName());
return new StartCacheInfo(
+ desc.cacheConfiguration(),
desc,
changeReq.nearCacheConfiguration(),
topVer,
- changeReq.disabledAfterStart()
+ changeReq.disabledAfterStart(),
+ true
);
})
.collect(Collectors.toList());
@@ -869,7 +871,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
final ExchangeDiscoveryEvents evts = fut.context().events();
- long time = System.currentTimeMillis();
+ long time = U.currentTimeMillis();
Map<StartCacheInfo, DynamicCacheChangeRequest> startCacheInfos = new LinkedHashMap<>();
@@ -920,6 +922,8 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
req
);
}
+ else
+ cctx.kernalContext().cache().initQueryStructuresForNotStartedCache(cacheDesc);
}
Map<StartCacheInfo, IgniteCheckedException> failedCaches = cctx.cache().prepareStartCachesIfPossible(startCacheInfos.keySet());
@@ -951,14 +955,14 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
}
if (log.isInfoEnabled())
- log.info("Caches starting performed in " + (System.currentTimeMillis() - time) + " ms.");
+ log.info("Caches starting performed in " + (U.currentTimeMillis() - time) + " ms.");
- time = System.currentTimeMillis();
+ time = U.currentTimeMillis();
initAffinityOnCacheGroupsStart(fut, exchActions, crd);
if (log.isInfoEnabled())
- log.info("Affinity initialization for started caches performed in " + (System.currentTimeMillis() - time) + " ms.");
+ log.info("Affinity initialization for started caches performed in " + (U.currentTimeMillis() - time) + " ms.");
}
/**
@@ -1522,9 +1526,9 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
assert F.isEmpty(affReq) || (!F.isEmpty(receivedAff) && receivedAff.size() >= affReq.size())
: ("Requested and received affinity are different " +
- "[requestedCnt=" + (affReq != null ? affReq.size() : "none") +
- ", receivedCnt=" + (receivedAff != null ? receivedAff.size() : "none") +
- ", msg=" + msg + "]");
+ "[requestedCnt=" + (affReq != null ? affReq.size() : "none") +
+ ", receivedCnt=" + (receivedAff != null ? receivedAff.size() : "none") +
+ ", msg=" + msg + "]");
final Map<Long, ClusterNode> nodesByOrder = new ConcurrentHashMap<>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index 6718cf3..8ca14a6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@ -1281,6 +1281,7 @@ class ClusterCachesInfo {
if (joinDiscoData != null) {
List<T2<DynamicCacheDescriptor, NearCacheConfiguration>> locJoinStartCaches = new ArrayList<>();
+ List<DynamicCacheDescriptor> locJoinInitCaches = new ArrayList<>();
locCfgsForActivation = new HashMap<>();
boolean active = ctx.state().clusterState().active();
@@ -1329,10 +1330,13 @@ class ClusterCachesInfo {
else
locCfgsForActivation.put(desc.cacheName(), new T2<>(desc.cacheConfiguration(), nearCfg));
}
+ else
+ locJoinInitCaches.add(desc);
}
locJoinCachesCtx = new LocalJoinCachesContext(
locJoinStartCaches,
+ locJoinInitCaches,
new HashMap<>(registeredCacheGrps),
new HashMap<>(registeredCaches));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContextInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContextInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContextInfo.java
new file mode 100644
index 0000000..e72d183
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContextInfo.java
@@ -0,0 +1,179 @@
+/*
+ * 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 org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.lang.IgniteUuid;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Cache context information. Required to support query infrastructure for not started caches on non affinity nodes.
+ */
+@GridToStringExclude
+public class GridCacheContextInfo<K, V> {
+ /** Full cache context. Can be {@code null} in case a cache is not started. */
+ @Nullable private volatile GridCacheContext gridCacheContext;
+
+ /** Cache is client or not. */
+ private final boolean clientCache;
+
+ /** Kernal context. */
+ private final GridKernalContext ctx;
+
+ /** Dynamic cache deployment ID. */
+ private final IgniteUuid dynamicDeploymentId;
+
+ /** Cache configuration. */
+ private final CacheConfiguration config;
+
+ /** Cache group ID. */
+ private final int groupId;
+
+ /** Cache ID. */
+ private final int cacheId;
+
+ /**
+ * Constructor of full cache context.
+ *
+ * @param gridCacheContext Cache context.
+ * @param clientCache Client cache or not.
+ */
+ public GridCacheContextInfo(GridCacheContext<K, V> gridCacheContext, boolean clientCache) {
+ this.gridCacheContext = gridCacheContext;
+ this.ctx = gridCacheContext.kernalContext();
+ this.config = gridCacheContext.config();
+ this.dynamicDeploymentId = gridCacheContext.dynamicDeploymentId();
+ this.groupId = gridCacheContext.groupId();
+ this.cacheId = gridCacheContext.cacheId();
+ this.clientCache = clientCache;
+ }
+
+ /**
+ * Constructor of not started cache context.
+ *
+ * @param cacheDesc Cache descriptor.
+ * @param ctx Kernal context.
+ */
+ public GridCacheContextInfo(DynamicCacheDescriptor cacheDesc, GridKernalContext ctx) {
+ this.config = cacheDesc.cacheConfiguration();
+ this.dynamicDeploymentId = cacheDesc.deploymentId();
+ this.groupId = cacheDesc.groupId();
+ this.ctx = ctx;
+ this.clientCache = true;
+
+ this.cacheId = CU.cacheId(config.getName());
+
+ }
+
+ /**
+ * @return Cache configuration.
+ */
+ public CacheConfiguration config() {
+ return isCacheContextInited() ? gridCacheContext.config() : config;
+ }
+
+ /**
+ * @return Cache name.
+ */
+ public String name() {
+ return isCacheContextInited() ? gridCacheContext.name() : config.getName();
+ }
+
+ /**
+ * @return {@code true} in case cache use custom affinity mapper.
+ */
+ public boolean customAffinityMapper() {
+ return isCacheContextInited() && gridCacheContext.customAffinityMapper();
+ }
+
+ /**
+ * @return Cache group id.
+ */
+ public int groupId() {
+ return isCacheContextInited() ? gridCacheContext.groupId() : groupId;
+ }
+
+ /**
+ * @return Cache id.
+ */
+ public int cacheId() {
+ return isCacheContextInited() ? gridCacheContext.cacheId() : cacheId;
+ }
+
+ /**
+ * @return {@code true} in case affinity node.
+ */
+ public boolean affinityNode() {
+ return isCacheContextInited() && gridCacheContext.affinityNode();
+ }
+
+ /**
+ * @return Cache context. {@code null} for not started cache.
+ */
+ @Nullable public GridCacheContext gridCacheContext() {
+ return gridCacheContext;
+ }
+
+ /**
+ * @return Dynamic deployment ID.
+ */
+ public IgniteUuid dynamicDeploymentId() {
+ return dynamicDeploymentId;
+ }
+
+ /**
+ * Set real cache context in case cache has been fully initted and start.
+ *
+ * @param gridCacheCtx Initted cache context.
+ */
+ public void initCacheContext(GridCacheContext<?, ?> gridCacheCtx) {
+ assert this.gridCacheContext == null : this.gridCacheContext;
+ assert gridCacheCtx != null;
+
+ this.gridCacheContext = gridCacheCtx;
+ }
+
+ /**
+ * @return {@code true} For client cache.
+ */
+ public boolean isClientCache() {
+ return clientCache;
+ }
+
+ /**
+ * @return Kernal context.
+ */
+ public GridKernalContext context() {
+ return ctx;
+ }
+
+ /**
+ * @return {@code true} If Cache context is initted.
+ */
+ public boolean isCacheContextInited() {
+ return gridCacheContext != null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "GridCacheContextInfo: " + name() + " " + (isCacheContextInited() ? "started" : "not started");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/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 8a54852..0870d1b 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
@@ -756,10 +756,10 @@ public class GridCacheProcessor extends GridProcessorAdapter {
addCacheOnJoinFromConfig(caches, templates);
CacheJoinNodeDiscoveryData discoData = new CacheJoinNodeDiscoveryData(
- IgniteUuid.randomUuid(),
- caches,
- templates,
- startAllCachesOnClientStart()
+ IgniteUuid.randomUuid(),
+ caches,
+ templates,
+ startAllCachesOnClientStart()
);
cachesInfo.onStart(discoData);
@@ -1250,16 +1250,16 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (cache.context().userCache()) {
// Re-create cache structures inside indexing in order to apply recent schema changes.
- GridCacheContext cctx = cache.context();
+ GridCacheContextInfo cacheInfo = new GridCacheContextInfo(cache.context(), false);
- DynamicCacheDescriptor desc = cacheDescriptor(cctx.name());
+ DynamicCacheDescriptor desc = cacheDescriptor(cacheInfo.name());
- assert desc != null : cctx.name();
+ assert desc != null : cacheInfo.name();
boolean rmvIdx = !cache.context().group().persistenceEnabled();
- ctx.query().onCacheStop0(cctx, rmvIdx);
- ctx.query().onCacheStart0(cctx, desc.schema(), desc.sql());
+ ctx.query().onCacheStop0(cacheInfo, rmvIdx);
+ ctx.query().onCacheStart0(cacheInfo, desc.schema(), desc.sql());
}
}
}
@@ -1285,6 +1285,20 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
+ * Initialize query infrastructure for not started cache.
+ *
+ * @param cacheDesc Cache descriptor.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void initQueryStructuresForNotStartedCache(DynamicCacheDescriptor cacheDesc) throws IgniteCheckedException {
+ QuerySchema schema = cacheDesc.schema() != null ? cacheDesc.schema() : new QuerySchema();
+
+ GridCacheContextInfo cacheInfo = new GridCacheContextInfo(cacheDesc, ctx);
+
+ ctx.query().onCacheStart(cacheInfo, schema, cacheDesc.sql());
+ }
+
+ /**
* @param cache Cache to stop.
* @param cancel Cancel flag.
* @param destroy Destroy data flag. Setting to <code>true</code> will remove all cache data.
@@ -1308,7 +1322,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
cache.stop();
- ctx.kernalContext().query().onCacheStop(ctx, !cache.context().group().persistenceEnabled() || destroy);
+ GridCacheContextInfo cacheInfo = new GridCacheContextInfo(ctx, false);
+
+ ctx.kernalContext().query().onCacheStop(cacheInfo, !cache.context().group().persistenceEnabled() || destroy);
if (isNearEnabled(ctx)) {
GridDhtCacheAdapter dht = ctx.near().dht();
@@ -1770,7 +1786,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
- *
* @param reqs Cache requests to start.
* @param fut Completable future.
*/
@@ -1785,7 +1800,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
- *
* @param reqs Cache requests to start.
* @param initVer Init exchange version.
* @param doneVer Finish excahnge vertison.
@@ -1956,7 +1970,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
AffinityTopologyVersion exchTopVer,
LocalJoinCachesContext locJoinCtx
) throws IgniteCheckedException {
- long time = System.currentTimeMillis();
+ long time = U.currentTimeMillis();
if (locJoinCtx == null)
return new GridFinishedFuture<>();
@@ -1968,12 +1982,22 @@ public class GridCacheProcessor extends GridProcessorAdapter {
.map(cacheInfo -> new StartCacheInfo(cacheInfo.get1(), cacheInfo.get2(), exchTopVer, false))
.collect(Collectors.toList());
+ locJoinCtx.initCaches()
+ .forEach(cacheDesc -> {
+ try {
+ initQueryStructuresForNotStartedCache(cacheDesc);
+ }
+ catch (Exception e) {
+ log.error("Can't initialize query structures for not started cache [cacheName=" + cacheDesc.cacheName() + "]");
+ }
+ });
+
prepareStartCaches(startCacheInfos);
context().exchange().exchangerUpdateHeartbeat();
if (log.isInfoEnabled())
- log.info("Starting caches on local join performed in " + (System.currentTimeMillis() - time) + " ms.");
+ log.info("Starting caches on local join performed in " + (U.currentTimeMillis() - time) + " ms.");
return res;
}
@@ -2034,7 +2058,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @return Caches which was failed.
* @throws IgniteCheckedException if failed.
*/
- Map<StartCacheInfo, IgniteCheckedException> prepareStartCachesIfPossible(Collection<StartCacheInfo> startCacheInfos) throws IgniteCheckedException {
+ Map<StartCacheInfo, IgniteCheckedException> prepareStartCachesIfPossible(
+ Collection<StartCacheInfo> startCacheInfos) throws IgniteCheckedException {
HashMap<StartCacheInfo, IgniteCheckedException> failedCaches = new HashMap<>();
prepareStartCaches(startCacheInfos, (data, operation) -> {
@@ -2074,7 +2099,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
cacheInfo.getCacheDescriptor(),
cacheInfo.getReqNearCfg(),
cacheInfo.getExchangeTopVer(),
- cacheInfo.isDisabledAfterStart()
+ cacheInfo.isDisabledAfterStart(),
+ cacheInfo.isClientCache()
);
return null;
@@ -2136,11 +2162,11 @@ public class GridCacheProcessor extends GridProcessorAdapter {
cacheStartFailHandler.handle(
startCacheInfo,
cacheInfo -> {
- GridCacheContext<?, ?> cctx = cacheContexts.get(cacheInfo);
+ GridCacheContext cctx = cacheContexts.get(cacheInfo);
if (!cctx.isRecoveryMode()) {
ctx.query().onCacheStart(
- cctx,
+ new GridCacheContextInfo(cctx, cacheInfo.isClientCache()),
cacheInfo.getCacheDescriptor().schema() != null
? cacheInfo.getCacheDescriptor().schema()
: new QuerySchema(),
@@ -2196,14 +2222,15 @@ public class GridCacheProcessor extends GridProcessorAdapter {
DynamicCacheDescriptor desc,
@Nullable NearCacheConfiguration reqNearCfg,
AffinityTopologyVersion exchTopVer,
- boolean disabledAfterStart
+ boolean disabledAfterStart,
+ boolean clientCache
) throws IgniteCheckedException {
GridCacheContext cacheCtx = prepareCacheContext(startCfg, desc, reqNearCfg, exchTopVer, disabledAfterStart);
if (cacheCtx.isRecoveryMode())
finishRecovery(exchTopVer, cacheCtx);
else {
- ctx.query().onCacheStart(cacheCtx, desc.schema() != null ? desc.schema() : new QuerySchema(), desc.sql());
+ ctx.query().onCacheStart(new GridCacheContextInfo(cacheCtx, clientCache), desc.schema() != null ? desc.schema() : new QuerySchema(), desc.sql());
onCacheStarted(cacheCtx);
}
@@ -2275,6 +2302,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/**
* Stops cache under checkpoint lock.
+ *
* @param cctx Cache context.
*/
private void stopCacheSafely(GridCacheContext<?, ?> cctx) {
@@ -2299,7 +2327,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @param cacheContext Cache context.
* @throws IgniteCheckedException If failed.
*/
- private void finishRecovery(AffinityTopologyVersion cacheStartVer, GridCacheContext<?, ?> cacheContext) throws IgniteCheckedException {
+ private void finishRecovery(AffinityTopologyVersion cacheStartVer,
+ GridCacheContext<?, ?> cacheContext) throws IgniteCheckedException {
+
CacheGroupContext groupContext = cacheContext.group();
// Take cluster-wide cache descriptor and try to update local cache and cache group parameters.
@@ -2324,9 +2354,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
- * Stops all caches and groups, that was recovered, but not activated on node join.
- * Such caches can remain only if it was filtered by node filter on current node.
- * It's impossible to check whether current node is affinity node for given cache before join to topology.
+ * Stops all caches and groups, that was recovered, but not activated on node join. Such caches can remain only if
+ * it was filtered by node filter on current node. It's impossible to check whether current node is affinity node
+ * for given cache before join to topology.
*/
public void shutdownNotFinishedRecoveryCaches() {
for (GridCacheAdapter cacheAdapter : caches.values()) {
@@ -2562,17 +2592,18 @@ public class GridCacheProcessor extends GridProcessorAdapter {
grp.onCacheStarted(cacheCtx);
- ctx.query().onCacheStart(cacheCtx, desc.schema() != null ? desc.schema() : new QuerySchema(), desc.sql());
+ ctx.query().onCacheStart(new GridCacheContextInfo(cacheCtx, false),
+ desc.schema() != null ? desc.schema() : new QuerySchema(), desc.sql());
if (log.isInfoEnabled()) {
log.info("Started cache in recovery mode [name=" + cfg.getName() +
- ", id=" + cacheCtx.cacheId() +
- (cfg.getGroupName() != null ? ", group=" + cfg.getGroupName() : "") +
- ", dataRegionName=" + dataRegion +
- ", mode=" + cfg.getCacheMode() +
- ", atomicity=" + cfg.getAtomicityMode() +
- ", backups=" + cfg.getBackups() +
- ", mvcc=" + cacheCtx.mvccEnabled() + ']');
+ ", id=" + cacheCtx.cacheId() +
+ (cfg.getGroupName() != null ? ", group=" + cfg.getGroupName() : "") +
+ ", dataRegionName=" + dataRegion +
+ ", mode=" + cfg.getCacheMode() +
+ ", atomicity=" + cfg.getAtomicityMode() +
+ ", backups=" + cfg.getBackups() +
+ ", mvcc=" + cacheCtx.mvccEnabled() + ']');
}
return cacheCtx;
@@ -2764,6 +2795,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
return ctx;
}
+ else
+ //Try to unregister query structures for not started caches.
+ ctx.query().onCacheStop(cacheName);
return null;
}
@@ -3728,7 +3762,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @param disabledAfterStart If true, cache proxies will be only activated after {@link #restartProxies()}.
* @return Future that will be completed when all caches are deployed.
*/
- public IgniteInternalFuture<Boolean> dynamicStartCaches(Collection<CacheConfiguration> ccfgList, boolean failIfExists,
+ public IgniteInternalFuture<Boolean> dynamicStartCaches(Collection<CacheConfiguration> ccfgList,
+ boolean failIfExists,
boolean checkThreadTx, boolean disabledAfterStart) {
return dynamicStartCachesByStoredConf(
ccfgList.stream().map(StoredCacheData::new).collect(Collectors.toList()),
@@ -4737,9 +4772,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
*/
public Collection<DynamicCacheDescriptor> persistentCaches() {
return cachesInfo.registeredCaches().values()
- .stream()
- .filter(desc -> isPersistentCache(desc.cacheConfiguration(), ctx.config().getDataStorageConfiguration()))
- .collect(Collectors.toList());
+ .stream()
+ .filter(desc -> isPersistentCache(desc.cacheConfiguration(), ctx.config().getDataStorageConfiguration()))
+ .collect(Collectors.toList());
}
/**
@@ -4747,9 +4782,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
*/
public Collection<CacheGroupDescriptor> persistentGroups() {
return cachesInfo.registeredCacheGroups().values()
- .stream()
- .filter(CacheGroupDescriptor::persistenceEnabled)
- .collect(Collectors.toList());
+ .stream()
+ .filter(CacheGroupDescriptor::persistenceEnabled)
+ .collect(Collectors.toList());
}
/**
@@ -4990,32 +5025,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
- * Starts client caches that do not exist yet.
- *
- * @throws IgniteCheckedException In case of error.
- */
- public void createMissingQueryCaches() throws IgniteCheckedException {
- for (Map.Entry<String, DynamicCacheDescriptor> e : cachesInfo.registeredCaches().entrySet()) {
- DynamicCacheDescriptor desc = e.getValue();
-
- if (isMissingQueryCache(desc))
- dynamicStartCache(null, desc.cacheConfiguration().getName(), null, false, true, true).get();
- }
- }
-
- /**
- * Whether cache defined by provided descriptor is not yet started and has queries enabled.
- *
- * @param desc Descriptor.
- * @return {@code True} if this is missing query cache.
- */
- private boolean isMissingQueryCache(DynamicCacheDescriptor desc) {
- CacheConfiguration ccfg = desc.cacheConfiguration();
-
- return !caches.containsKey(ccfg.getName()) && QueryUtils.isEnabled(ccfg);
- }
-
- /**
* Registers MBean for cache components.
*
* @param obj Cache component.
@@ -5439,7 +5448,10 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* Recovery lifecycle for caches.
*/
private class CacheRecoveryLifecycle implements MetastorageLifecycleListener, DatabaseLifecycleListener {
- /** Set of QuerySchema's saved on recovery. It's needed if cache query schema has changed after node joined to topology.*/
+ /**
+ * Set of QuerySchema's saved on recovery. It's needed if cache query schema has changed after node joined to
+ * topology.
+ */
private final Map<Integer, QuerySchema> querySchemas = new ConcurrentHashMap<>();
/** {@inheritDoc} */
@@ -5457,7 +5469,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/** {@inheritDoc} */
- @Override public void beforeBinaryMemoryRestore(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException {
+ @Override public void beforeBinaryMemoryRestore(
+ IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException {
for (DynamicCacheDescriptor cacheDescriptor : persistentCaches())
preparePageStore(cacheDescriptor, true);
}
@@ -5508,7 +5521,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
*
* @param <T> Type of started data.
*/
- private static interface StartCacheFailHandler<T, R> {
+ private interface StartCacheFailHandler<T, R> {
/**
* Handle of fail.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/LocalJoinCachesContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/LocalJoinCachesContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/LocalJoinCachesContext.java
index f41df60..650d398 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/LocalJoinCachesContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/LocalJoinCachesContext.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.processors.cache;
-import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -36,7 +35,13 @@ import org.apache.ignite.internal.util.typedef.internal.S;
public class LocalJoinCachesContext {
/** */
@GridToStringInclude
- private List<T2<DynamicCacheDescriptor, NearCacheConfiguration>> locJoinStartCaches = Collections.emptyList();
+ private List<T2<DynamicCacheDescriptor, NearCacheConfiguration>> locJoinStartCaches;
+
+ /**
+ *
+ */
+ @GridToStringInclude
+ private List<DynamicCacheDescriptor> locJoinInitCaches;
/** */
@GridToStringInclude
@@ -48,15 +53,18 @@ public class LocalJoinCachesContext {
/**
* @param locJoinStartCaches Local caches to start on join.
+ * @param locJoinInitCaches Local caches to initialize query infrastructure without start of caches.
* @param cacheGrpDescs Cache group descriptors captured during join.
* @param cacheDescs Cache descriptors captured during join.
*/
public LocalJoinCachesContext(
List<T2<DynamicCacheDescriptor, NearCacheConfiguration>> locJoinStartCaches,
+ List<DynamicCacheDescriptor> locJoinInitCaches,
Map<Integer, CacheGroupDescriptor> cacheGrpDescs,
Map<String, DynamicCacheDescriptor> cacheDescs
) {
this.locJoinStartCaches = locJoinStartCaches;
+ this.locJoinInitCaches = locJoinInitCaches;
this.cacheGrpDescs = cacheGrpDescs;
this.cacheDescs = cacheDescs;
}
@@ -69,6 +77,13 @@ public class LocalJoinCachesContext {
}
/**
+ * @return Cache descriptors to initialize query infrastructure without start of caches.
+ */
+ public List<DynamicCacheDescriptor> initCaches() {
+ return locJoinInitCaches;
+ }
+
+ /**
* @return Group descriptors.
*/
public Map<Integer, CacheGroupDescriptor> cacheGroupDescriptors() {
@@ -96,13 +111,22 @@ public class LocalJoinCachesContext {
if (cacheNames.contains(desc.cacheName()))
it.remove();
}
+
+ Iterator<DynamicCacheDescriptor> iter = locJoinInitCaches.iterator();
+
+ for (; iter.hasNext(); ) {
+ DynamicCacheDescriptor desc = iter.next();
+
+ if (cacheNames.contains(desc.cacheName()))
+ iter.remove();
+ }
}
/**
* @return {@code True} if the context is empty.
*/
public boolean isEmpty() {
- return F.isEmpty(locJoinStartCaches) && F.isEmpty(cacheGrpDescs) && F.isEmpty(cacheDescs);
+ return F.isEmpty(locJoinStartCaches) && F.isEmpty(locJoinInitCaches) && F.isEmpty(cacheGrpDescs) && F.isEmpty(cacheDescs);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StartCacheInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StartCacheInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StartCacheInfo.java
index a5aea26..7a73b3e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StartCacheInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StartCacheInfo.java
@@ -42,6 +42,9 @@ public class StartCacheInfo {
/** Disable started cache after start or not. */
private final boolean disabledAfterStart;
+ /** Cache is client or not. */
+ private final boolean clientCache;
+
/**
* @param desc Cache configuration for start.
* @param reqNearCfg Near cache configuration for start.
@@ -64,11 +67,26 @@ public class StartCacheInfo {
public StartCacheInfo(CacheConfiguration conf, DynamicCacheDescriptor desc,
NearCacheConfiguration reqNearCfg,
AffinityTopologyVersion exchTopVer, boolean disabledAfterStart) {
+ this(conf, desc, reqNearCfg, exchTopVer, disabledAfterStart, false);
+ }
+
+ /**
+ * @param conf Cache configuration for start.
+ * @param desc Cache descriptor for start.
+ * @param reqNearCfg Near cache configuration for start.
+ * @param exchTopVer Exchange topology version in which starting happened.
+ * @param disabledAfterStart Disable started cache after start or not.
+ * @param clientCache {@code true} in case starting cache on client node.
+ */
+ public StartCacheInfo(CacheConfiguration conf, DynamicCacheDescriptor desc,
+ NearCacheConfiguration reqNearCfg,
+ AffinityTopologyVersion exchTopVer, boolean disabledAfterStart, boolean clientCache) {
startedConf = conf;
this.desc = desc;
this.reqNearCfg = reqNearCfg;
this.exchTopVer = exchTopVer;
this.disabledAfterStart = disabledAfterStart;
+ this.clientCache = clientCache;
}
/**
@@ -106,6 +124,13 @@ public class StartCacheInfo {
return disabledAfterStart;
}
+ /**
+ * @return Start cache on client or not.
+ */
+ public boolean isClientCache() {
+ return clientCache;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(StartCacheInfo.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
index dab2516..c8c9502 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
@@ -29,6 +29,7 @@ import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheContextInfo;
import org.apache.ignite.internal.processors.cache.mvcc.MvccQueryTracker;
import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
@@ -197,20 +198,20 @@ public interface GridQueryIndexing {
*
* @param cacheName Cache name.
* @param schemaName Schema name.
- * @param cctx Cache context.
+ * @param cacheInfo Cache context info.
* @throws IgniteCheckedException If failed.
*/
- public void registerCache(String cacheName, String schemaName, GridCacheContext<?,?> cctx)
+ public void registerCache(String cacheName, String schemaName, GridCacheContextInfo<?, ?> cacheInfo)
throws IgniteCheckedException;
/**
* Unregisters cache.
*
- * @param cctx Cache context.
+ * @param cacheInfo Cache context info.
* @param rmvIdx If {@code true}, will remove index.
* @throws IgniteCheckedException If failed to drop cache schema.
*/
- public void unregisterCache(GridCacheContext cctx, boolean rmvIdx) throws IgniteCheckedException;
+ public void unregisterCache(GridCacheContextInfo cacheInfo, boolean rmvIdx) throws IgniteCheckedException;
/**
*
@@ -237,12 +238,14 @@ public interface GridQueryIndexing {
/**
* Registers type if it was not known before or updates it otherwise.
*
- * @param cctx Cache context.
+ * @param cacheInfo Cache context info.
* @param desc Type descriptor.
+ * @param isSql {@code true} in case table has been created from SQL.
* @throws IgniteCheckedException If failed.
* @return {@code True} if type was registered, {@code false} if for some reason it was rejected.
*/
- public boolean registerType(GridCacheContext cctx, GridQueryTypeDescriptor desc, boolean isSql) throws IgniteCheckedException;
+ public boolean registerType(GridCacheContextInfo cacheInfo, GridQueryTypeDescriptor desc,
+ boolean isSql) throws IgniteCheckedException;
/**
* Updates index. Note that key is unique for cache, so if cache contains multiple indexes
@@ -354,4 +357,22 @@ public interface GridQueryIndexing {
* @return Row cache cleaner.
*/
public GridQueryRowCacheCleaner rowCacheCleaner(int cacheGroupId);
+
+ /**
+ * Return context for registered cache info.
+ *
+ * @param cacheName Cache name.
+ * @return Cache context for registered cache or {@code null} in case the cache has not been registered.
+ */
+ @Nullable public GridCacheContextInfo registeredCacheInfo(String cacheName);
+
+ /**
+ * Initialize table's cache context created for not started cache.
+ *
+ * @param ctx Cache context.
+ * @throws IgniteCheckedException If failed.
+ *
+ * @return {@code true} If context has been initialized.
+ */
+ public boolean initCacheContext(GridCacheContext ctx) throws IgniteCheckedException;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index d3f2930..db52f40 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -63,8 +63,8 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
-import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheContextInfo;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot;
@@ -673,23 +673,26 @@ public class GridQueryProcessor extends GridProcessorAdapter {
/**
* Create type descriptors from schema and initialize indexing for given cache.<p>
* Use with {@link #busyLock} where appropriate.
- * @param cctx Cache context.
+ * @param cacheInfo Cache context info.
* @param schema Initial schema.
* @param isSql {@code true} in case create cache initialized from SQL.
* @throws IgniteCheckedException If failed.
*/
- public void onCacheStart0(GridCacheContext<?, ?> cctx, QuerySchema schema, boolean isSql)
+ public void onCacheStart0(GridCacheContextInfo<?, ?> cacheInfo, QuerySchema schema, boolean isSql)
throws IgniteCheckedException {
- cctx.shared().database().checkpointReadLock();
+ ctx.cache().context().database().checkpointReadLock();
try {
+ if (cacheInfo.isClientCache() && cacheInfo.isCacheContextInited() && idx.initCacheContext(cacheInfo.gridCacheContext()))
+ return;
+
synchronized (stateMux) {
- boolean escape = cctx.config().isSqlEscapeAll();
+ boolean escape = cacheInfo.config().isSqlEscapeAll();
- String cacheName = cctx.name();
+ String cacheName = cacheInfo.name();
- String schemaName = QueryUtils.normalizeSchemaName(cacheName, cctx.config().getSqlSchema());
+ String schemaName = QueryUtils.normalizeSchemaName(cacheName, cacheInfo.config().getSqlSchema());
// Prepare candidates.
List<Class<?>> mustDeserializeClss = new ArrayList<>();
@@ -700,7 +703,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (!F.isEmpty(qryEntities)) {
for (QueryEntity qryEntity : qryEntities) {
- QueryTypeCandidate cand = QueryUtils.typeForQueryEntity(cacheName, schemaName, cctx, qryEntity,
+ QueryTypeCandidate cand = QueryUtils.typeForQueryEntity(cacheName, schemaName, cacheInfo, qryEntity,
mustDeserializeClss, escape);
cands.add(cand);
@@ -735,7 +738,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
// Apply pending operation which could have been completed as no-op at this point.
// There could be only one in-flight operation for a cache.
for (SchemaOperation op : schemaOps.values()) {
- if (F.eq(op.proposeMessage().deploymentId(), cctx.dynamicDeploymentId())) {
+ if (F.eq(op.proposeMessage().deploymentId(), cacheInfo.dynamicDeploymentId())) {
if (op.started()) {
SchemaOperationWorker worker = op.manager().worker();
@@ -799,7 +802,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
// Ready to register at this point.
- registerCache0(cacheName, schemaName, cctx, cands, isSql);
+ registerCache0(cacheName, schemaName, cacheInfo, cands, isSql);
// Warn about possible implicit deserialization.
if (!mustDeserializeClss.isEmpty()) {
@@ -813,7 +816,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
}
finally {
- cctx.shared().database().checkpointReadUnlock();
+ ctx.cache().context().database().checkpointReadUnlock();
}
}
@@ -848,12 +851,13 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* When called for the first time, we initialize topology thus understanding whether current node is coordinator
* or not.
*
- * @param cctx Cache context.
+ * @param cacheInfo Cache context info.
* @param schema Index states.
* @param isSql {@code true} in case create cache initialized from SQL.
* @throws IgniteCheckedException If failed.
*/
- public void onCacheStart(GridCacheContext cctx, QuerySchema schema, boolean isSql) throws IgniteCheckedException {
+ public void onCacheStart(GridCacheContextInfo cacheInfo, QuerySchema schema,
+ boolean isSql) throws IgniteCheckedException {
if (idx == null)
return;
@@ -861,7 +865,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
return;
try {
- onCacheStart0(cctx, schema, isSql);
+ onCacheStart0(cacheInfo, schema, isSql);
}
finally {
busyLock.leaveBusy();
@@ -869,10 +873,26 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
- * @param cctx Cache context.
+ * Destroy H2 structures for not started caches.
+ *
+ * @param cacheName Cache name.
+ */
+ public void onCacheStop(String cacheName) {
+ if (idx == null)
+ return;
+
+ GridCacheContextInfo cacheInfo = idx.registeredCacheInfo(cacheName);
+
+ if (cacheInfo != null)
+ onCacheStop(cacheInfo, true);
+ }
+
+
+ /**
+ * @param cacheInfo Cache context info.
* @param removeIdx If {@code true}, will remove index.
*/
- public void onCacheStop(GridCacheContext cctx, boolean removeIdx) {
+ public void onCacheStop(GridCacheContextInfo cacheInfo, boolean removeIdx) {
if (idx == null)
return;
@@ -880,7 +900,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
return;
try {
- onCacheStop0(cctx, removeIdx);
+ onCacheStop0(cacheInfo, removeIdx);
}
finally {
busyLock.leaveBusy();
@@ -1416,9 +1436,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
String cacheName = op.cacheName();
- GridCacheAdapter cache = ctx.cache().internalCache(cacheName);
+ GridCacheContextInfo cacheInfo = idx.registeredCacheInfo(cacheName);
- if (cache == null || !F.eq(depId, cache.context().dynamicDeploymentId()))
+ if (cacheInfo == null || !F.eq(depId, cacheInfo.dynamicDeploymentId()))
throw new SchemaOperationException(SchemaOperationException.CODE_CACHE_NOT_FOUND, cacheName);
try {
@@ -1427,11 +1447,18 @@ public class GridQueryProcessor extends GridProcessorAdapter {
QueryIndexDescriptorImpl idxDesc = QueryUtils.createIndexDescriptor(type, op0.index());
- GridCacheContext cctx = cache.context();
+ SchemaIndexCacheVisitor visitor;
- SchemaIndexCacheFilter filter = new TableCacheFilter(cctx, op0.tableName());
+ if (cacheInfo.isCacheContextInited()) {
+ GridCacheContext cctx = cacheInfo.gridCacheContext();
- SchemaIndexCacheVisitor visitor = new SchemaIndexCacheVisitorImpl(cctx, filter, cancelTok, op0.parallel());
+ SchemaIndexCacheFilter filter = new TableCacheFilter(cctx, op0.tableName());
+
+ visitor = new SchemaIndexCacheVisitorImpl(cctx, filter, cancelTok, op0.parallel());
+ }
+ else
+ //For not started caches we shouldn't add any data to index.
+ visitor = clo -> {};
idx.dynamicIndexCreate(op0.schemaName(), op0.tableName(), idxDesc, op0.ifNotExists(), visitor);
}
@@ -1582,7 +1609,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
*
* @param cacheName Cache name.
* @param schemaName Schema name.
- * @param cctx Cache context.
+ * @param cacheInfo Cache context info.
* @param cands Candidates.
* @param isSql {@code true} in case create cache initialized from SQL.
* @throws IgniteCheckedException If failed.
@@ -1590,13 +1617,13 @@ public class GridQueryProcessor extends GridProcessorAdapter {
private void registerCache0(
String cacheName,
String schemaName,
- GridCacheContext<?, ?> cctx,
+ GridCacheContextInfo<?, ?> cacheInfo,
Collection<QueryTypeCandidate> cands,
boolean isSql
) throws IgniteCheckedException {
synchronized (stateMux) {
if (idx != null)
- idx.registerCache(cacheName, schemaName, cctx);
+ idx.registerCache(cacheName, schemaName, cacheInfo);
try {
for (QueryTypeCandidate cand : cands) {
@@ -1627,13 +1654,13 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
if (idx != null)
- idx.registerType(cctx, desc, isSql);
+ idx.registerType(cacheInfo, desc, isSql);
}
cacheNames.add(CU.mask(cacheName));
}
catch (IgniteCheckedException | RuntimeException e) {
- onCacheStop0(cctx, true);
+ onCacheStop0(cacheInfo, true);
throw e;
}
@@ -1644,14 +1671,14 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* Unregister cache.<p>
* Use with {@link #busyLock} where appropriate.
*
- * @param cctx Cache context.
+ * @param cacheInfo Cache context info.
* @param destroy Destroy flag.
*/
- public void onCacheStop0(GridCacheContext cctx, boolean destroy) {
+ public void onCacheStop0(GridCacheContextInfo cacheInfo, boolean destroy) {
if (idx == null)
return;
- String cacheName = cctx.name();
+ String cacheName = cacheInfo.name();
synchronized (stateMux) {
// Clear types.
@@ -1687,7 +1714,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
// Notify indexing.
try {
- idx.unregisterCache(cctx, destroy);
+ idx.unregisterCache(cacheInfo, destroy);
}
catch (Exception e) {
U.error(log, "Failed to clear indexing on cache unregister (will ignore): " + cacheName, e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
index 6a2c22a..08d44bd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
@@ -47,7 +47,7 @@ import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.processors.cache.CacheDefaultBinaryAffinityKeyMapper;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheContextInfo;
import org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper;
import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
@@ -397,17 +397,19 @@ public class QueryUtils {
*
* @param cacheName Cache name.
* @param schemaName Schema name.
- * @param cctx Cache context.
+ * @param cacheInfo Cache context info.
* @param qryEntity Query entity.
* @param mustDeserializeClss Classes which must be deserialized.
* @param escape Escape flag.
* @return Type candidate.
* @throws IgniteCheckedException If failed.
*/
- public static QueryTypeCandidate typeForQueryEntity(String cacheName, String schemaName, GridCacheContext cctx,
- QueryEntity qryEntity, List<Class<?>> mustDeserializeClss, boolean escape) throws IgniteCheckedException {
- GridKernalContext ctx = cctx.kernalContext();
- CacheConfiguration<?,?> ccfg = cctx.config();
+ public static QueryTypeCandidate typeForQueryEntity(String cacheName, String schemaName,
+ GridCacheContextInfo cacheInfo,
+ QueryEntity qryEntity, List<Class<?>> mustDeserializeClss, boolean escape)
+ throws IgniteCheckedException {
+ GridKernalContext ctx = cacheInfo.context();
+ CacheConfiguration<?, ?> ccfg = cacheInfo.config();
boolean binaryEnabled = ctx.cacheObjects().isBinaryEnabled(ccfg);
@@ -494,7 +496,7 @@ public class QueryUtils {
// Need to setup affinity key for distributed joins.
String keyType = qryEntity.getKeyType();
- if (!cctx.customAffinityMapper() && keyType != null) {
+ if (!cacheInfo.customAffinityMapper() && keyType != null) {
if (coCtx != null) {
CacheDefaultBinaryAffinityKeyMapper mapper =
(CacheDefaultBinaryAffinityKeyMapper)coCtx.defaultAffMapper();
@@ -516,7 +518,7 @@ public class QueryUtils {
else {
processClassMeta(qryEntity, desc, coCtx);
- AffinityKeyMapper keyMapper = cctx.config().getAffinityMapper();
+ AffinityKeyMapper keyMapper = cacheInfo.config().getAffinityMapper();
if (keyMapper instanceof GridCacheDefaultAffinityKeyMapper) {
String affField =
@@ -619,14 +621,14 @@ public class QueryUtils {
/**
* Add validate property to QueryTypeDescriptor.
- *
+ *
* @param ctx Kernel context.
* @param qryEntity Query entity.
* @param d Descriptor.
* @param name Field name.
* @throws IgniteCheckedException
*/
- private static void addKeyValueValidationProperty(GridKernalContext ctx, QueryEntity qryEntity, QueryTypeDescriptorImpl d,
+ private static void addKeyValueValidationProperty(GridKernalContext ctx, QueryEntity qryEntity, QueryTypeDescriptorImpl d,
String name, boolean isKey) throws IgniteCheckedException {
Map<String, Object> dfltVals = qryEntity.getDefaultFieldValues();
@@ -638,12 +640,12 @@ public class QueryUtils {
Object dfltVal = dfltVals.get(name);
QueryBinaryProperty prop = buildBinaryProperty(
- ctx,
+ ctx,
name,
U.classForName(typeName, Object.class, true),
- d.aliases(),
- isKey,
- true,
+ d.aliases(),
+ isKey,
+ true,
dfltVal,
precision == null ? -1 : precision.getOrDefault(name, -1),
scale == null ? -1 : scale.getOrDefault(name, -1));
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
index c037895..cb78ff6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.processors.query.schema;
+import java.util.List;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
@@ -37,8 +38,6 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.util.worker.GridWorker;
import org.apache.ignite.thread.IgniteThread;
-import java.util.List;
-
import static org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState.EVICTED;
import static org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState.OWNING;
import static org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState.RENTING;
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
index 5432257..ce7f4d7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
@@ -300,13 +300,14 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT
/** {@inheritDoc} */
@Override public void registerCache(String cacheName, String schemaName,
- GridCacheContext<?, ?> cctx) throws IgniteCheckedException {
- if (FAILED_CACHES.contains(cctx.name()) && cctx.kernalContext().clientNode())
- throw new IgniteCheckedException("Test query exception " + cctx.name() + " " + new Random().nextInt());
+ GridCacheContextInfo<?, ?> cacheInfo) throws IgniteCheckedException {
+ if (FAILED_CACHES.contains(cacheInfo.name()) && cacheInfo.gridCacheContext().kernalContext().clientNode())
+ throw new IgniteCheckedException("Test query exception " + cacheInfo.name() + " " + new Random().nextInt());
}
/** {@inheritDoc} */
- @Override public void unregisterCache(GridCacheContext cctx, boolean rmvIdx) throws IgniteCheckedException {
+ @Override public void unregisterCache(GridCacheContextInfo cacheInfo,
+ boolean rmvIdx) throws IgniteCheckedException {
// No-op
}
@@ -318,8 +319,7 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT
return null;
}
- /** {@inheritDoc} */
- @Override public boolean registerType(GridCacheContext cctx,
+ @Override public boolean registerType(GridCacheContextInfo cacheInfo,
GridQueryTypeDescriptor desc, boolean isSql) throws IgniteCheckedException {
return false;
}
@@ -389,5 +389,18 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT
@Override public GridQueryRowCacheCleaner rowCacheCleaner(int cacheGroupId) {
return null;
}
+
+ /** {@inheritDoc} */
+ @Override public GridCacheContextInfo registeredCacheInfo(String cacheName) {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean initCacheContext(GridCacheContext ctx) throws IgniteCheckedException {
+ if (FAILED_CACHES.contains(ctx.name()) && ctx.kernalContext().clientNode())
+ throw new IgniteCheckedException("Test query exception " + ctx.name() + " " + new Random().nextInt());
+
+ return true;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
index 9b31b02..1e32f57 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
@@ -1219,23 +1219,17 @@ public class DmlStatementsProcessor {
GridH2Table tbl = idx.dataTable(cmd.schemaName(), cmd.tableName());
if (tbl == null) {
- idx.kernalContext().cache().createMissingQueryCaches();
-
- tbl = idx.dataTable(cmd.schemaName(), cmd.tableName());
- }
-
- if (tbl == null) {
throw new IgniteSQLException("Table does not exist: " + cmd.tableName(),
IgniteQueryErrorCode.TABLE_NOT_FOUND);
}
+ H2Utils.checkAndStartNotStartedCache(tbl);
+
UpdatePlan plan = UpdatePlanBuilder.planForBulkLoad(cmd, tbl);
IgniteClosureX<List<?>, IgniteBiTuple<?, ?>> dataConverter = new BulkLoadDataConverter(plan);
- GridCacheContext cache = tbl.cache();
-
- IgniteDataStreamer<Object, Object> streamer = cache.grid().dataStreamer(cache.name());
+ IgniteDataStreamer<Object, Object> streamer = idx.kernalContext().grid().dataStreamer(tbl.cacheName());
BulkLoadCacheWriter outputWriter = new BulkLoadStreamerWriter(streamer);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2RowCache.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2RowCache.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2RowCache.java
index 06a3251..15f5501 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2RowCache.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2RowCache.java
@@ -17,19 +17,18 @@
package org.apache.ignite.internal.processors.query.h2;
+import java.util.Iterator;
+import java.util.Map;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.processors.cache.CacheGroupContext;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheContextInfo;
import org.apache.ignite.internal.processors.query.GridQueryRowCacheCleaner;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2KeyValueRowOnheap;
import org.apache.ignite.internal.util.typedef.F;
import org.jsr166.ConcurrentLinkedHashMap;
-import java.util.Iterator;
-import java.util.Map;
-
import static org.jsr166.ConcurrentLinkedHashMap.DFLT_INIT_CAP;
import static org.jsr166.ConcurrentLinkedHashMap.DFLT_LOAD_FACTOR;
@@ -100,13 +99,13 @@ public class H2RowCache implements GridQueryRowCacheCleaner {
/**
* Cache un-registration callback.
*
- * @param cctx Cache context.
+ * @param cacheInfo Cache context info.
* @return {@code True} if there are no more usages for the given cache group.
*/
- public boolean onCacheUnregistered(GridCacheContext cctx) {
+ public boolean onCacheUnregistered(GridCacheContextInfo cacheInfo) {
boolean res = --usageCnt == 0;
- clearForCache(cctx);
+ clearForCache(cacheInfo);
return res;
}
@@ -121,10 +120,10 @@ public class H2RowCache implements GridQueryRowCacheCleaner {
/**
* Clear entries belonging to the given cache.
*
- * @param cctx Cache context.
+ * @param cacheInfo Cache context info.
*/
- private void clearForCache(GridCacheContext cctx) {
- int cacheId = cctx.cacheId();
+ private void clearForCache(GridCacheContextInfo cacheInfo) {
+ int cacheId = cacheInfo.cacheId();
Iterator<Map.Entry<Long, GridH2KeyValueRowOnheap>> iter = rows.entrySet().iterator();
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2RowCacheRegistry.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2RowCacheRegistry.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2RowCacheRegistry.java
index 39f3329..ca135f1 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2RowCacheRegistry.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2RowCacheRegistry.java
@@ -17,13 +17,13 @@
package org.apache.ignite.internal.processors.query.h2;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheContextInfo;
import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManager;
import org.jetbrains.annotations.Nullable;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* H2 row cache registry.
*/
@@ -47,14 +47,14 @@ public class H2RowCacheRegistry {
/**
* Callback invoked on cache registration within indexing.
*
- * @param cctx Cache context.
+ * @param cacheInfo Cache info context.
*/
- public void onCacheRegistered(GridCacheContext cctx) {
- if (!cctx.config().isSqlOnheapCacheEnabled())
+ public void onCacheRegistered(GridCacheContextInfo cacheInfo) {
+ if (!cacheInfo.config().isSqlOnheapCacheEnabled())
return;
synchronized (mux) {
- int grpId = cctx.groupId();
+ int grpId = cacheInfo.groupId();
if (caches != null) {
H2RowCache cache = caches.get(grpId);
@@ -68,31 +68,37 @@ public class H2RowCacheRegistry {
HashMap<Integer, H2RowCache> caches0 = copy();
- H2RowCache rowCache = new H2RowCache(cctx.group(), cctx.config().getSqlOnheapCacheMaxSize());
+ if (cacheInfo.affinityNode()) {
+ GridCacheContext cacheCtx = cacheInfo.gridCacheContext();
- caches0.put(grpId, rowCache);
+ assert cacheCtx != null;
- caches = caches0;
+ H2RowCache rowCache = new H2RowCache(cacheCtx.group(), cacheInfo.config().getSqlOnheapCacheMaxSize());
- // Inject row cache cleaner into store on cache creation.
- // Used in case the cache with enabled SqlOnheapCache is created in exists cache group
- // and SqlOnheapCache is disbaled for the caches have been created before.
- for (IgniteCacheOffheapManager.CacheDataStore ds : cctx.offheap().cacheDataStores())
- ds.setRowCacheCleaner(rowCache);
+ caches0.put(grpId, rowCache);
+
+ caches = caches0;
+
+ // Inject row cache cleaner into store on cache creation.
+ // Used in case the cache with enabled SqlOnheapCache is created in exists cache group
+ // and SqlOnheapCache is disbaled for the caches have been created before.
+ for (IgniteCacheOffheapManager.CacheDataStore ds : cacheCtx.offheap().cacheDataStores())
+ ds.setRowCacheCleaner(rowCache);
+ }
}
}
/**
* Callback invoked when cache gets unregistered.
*
- * @param cctx Cache context.
+ * @param cacheInfo Cache context info.
*/
- public void onCacheUnregistered(GridCacheContext cctx) {
- if (!cctx.config().isSqlOnheapCacheEnabled())
+ public void onCacheUnregistered(GridCacheContextInfo cacheInfo) {
+ if (!cacheInfo.config().isSqlOnheapCacheEnabled())
return;
synchronized (mux) {
- int grpId = cctx.groupId();
+ int grpId = cacheInfo.groupId();
assert caches != null;
@@ -100,7 +106,7 @@ public class H2RowCacheRegistry {
assert cache != null;
- if (cache.onCacheUnregistered(cctx)) {
+ if (cache.onCacheUnregistered(cacheInfo)) {
HashMap<Integer, H2RowCache> caches0 = copy();
caches0.remove(grpId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Schema.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Schema.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Schema.java
index ab7cb4b..ed3a9c5 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Schema.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Schema.java
@@ -105,7 +105,7 @@ public class H2Schema {
if (tbls.putIfAbsent(tbl.tableName(), tbl) != null)
throw new IllegalStateException("Table already registered: " + tbl.fullTableName());
- if (typeToTbl.putIfAbsent(new H2TypeKey(tbl.cache().name(), tbl.typeName()), tbl) != null)
+ if (typeToTbl.putIfAbsent(new H2TypeKey(tbl.cacheName(), tbl.typeName()), tbl) != null)
throw new IllegalStateException("Table already registered: " + tbl.fullTableName());
}
@@ -115,7 +115,7 @@ public class H2Schema {
public void remove(H2TableDescriptor tbl) {
tbls.remove(tbl.tableName());
- typeToTbl.remove(new H2TypeKey(tbl.cache().name(), tbl.typeName()));
+ typeToTbl.remove(new H2TypeKey(tbl.cacheName(), tbl.typeName()));
}
/**
@@ -128,7 +128,7 @@ public class H2Schema {
tbls.remove(tbl.tableName());
- typeToTbl.remove(new H2TypeKey(tbl.cache().name(), tbl.typeName()));
+ typeToTbl.remove(new H2TypeKey(tbl.cacheName(), tbl.typeName()));
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableDescriptor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableDescriptor.java
index 6c20727..920f03d 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableDescriptor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableDescriptor.java
@@ -25,6 +25,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.QueryIndexType;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheContextInfo;
import org.apache.ignite.internal.processors.query.GridQueryIndexDescriptor;
import org.apache.ignite.internal.processors.query.GridQueryProperty;
import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
@@ -71,8 +72,8 @@ public class H2TableDescriptor implements GridH2SystemIndexFactory {
/** */
private final H2Schema schema;
- /** Cache context. */
- private final GridCacheContext cctx;
+ /** Cache context info. */
+ private final GridCacheContextInfo cacheInfo;
/** */
private GridH2Table tbl;
@@ -92,15 +93,15 @@ public class H2TableDescriptor implements GridH2SystemIndexFactory {
* @param idx Indexing.
* @param schema Schema.
* @param type Type descriptor.
- * @param cctx Cache context.
+ * @param cacheInfo Cache context info.
* @param isSql {@code true} in case table has been created from SQL.
*/
public H2TableDescriptor(IgniteH2Indexing idx, H2Schema schema, GridQueryTypeDescriptor type,
- GridCacheContext cctx, boolean isSql) {
+ GridCacheContextInfo cacheInfo, boolean isSql) {
this.idx = idx;
this.type = type;
this.schema = schema;
- this.cctx = cctx;
+ this.cacheInfo = cacheInfo;
this.isSql = isSql;
fullTblName = H2Utils.withQuotes(schema.schemaName()) + "." + H2Utils.withQuotes(type.tableName());
@@ -156,10 +157,24 @@ public class H2TableDescriptor implements GridH2SystemIndexFactory {
}
/**
+ * @return Cache name.
+ */
+ public String cacheName(){
+ return cacheInfo.name();
+ }
+
+ /**
+ * @return Cache context info.
+ */
+ public GridCacheContextInfo cacheInfo() {
+ return cacheInfo;
+ }
+
+ /**
* @return Cache context.
*/
public GridCacheContext cache() {
- return cctx;
+ return cacheInfo.gridCacheContext();
}
/**
@@ -188,8 +203,8 @@ public class H2TableDescriptor implements GridH2SystemIndexFactory {
* @return H2 row factory.
*/
H2RowFactory rowFactory(GridH2RowDescriptor rowDesc) {
- if (cctx.affinityNode())
- return new H2RowFactory(rowDesc, cctx);
+ if (cacheInfo.affinityNode())
+ return new H2RowFactory(rowDesc, cacheInfo.gridCacheContext());
return null;
}
@@ -421,10 +436,10 @@ public class H2TableDescriptor implements GridH2SystemIndexFactory {
* @return Index.
*/
private Index createHashIndex(GridH2Table tbl, String idxName, List<IndexColumn> cols) {
- if (cctx.affinityNode()) {
+ if (cacheInfo.affinityNode()) {
assert pkHashIdx == null : pkHashIdx;
- pkHashIdx = new H2PkHashIndex(cctx, tbl, idxName, cols);
+ pkHashIdx = new H2PkHashIndex(cacheInfo.gridCacheContext(), tbl, idxName, cols);
return pkHashIdx;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableEngine.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableEngine.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableEngine.java
index c05aaf6..9e79fba 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableEngine.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2TableEngine.java
@@ -80,7 +80,7 @@ public class H2TableEngine implements TableEngine {
/** {@inheritDoc} */
@Override public TableBase createTable(CreateTableData createTblData) {
- resTbl0 = new GridH2Table(createTblData, rowDesc0, rowFactory0, tblDesc0, tblDesc0.cache());
+ resTbl0 = new GridH2Table(createTblData, rowDesc0, rowFactory0, tblDesc0, tblDesc0.cacheInfo());
return resTbl0;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d19123d4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
index 865754f..d45a60f 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
@@ -26,6 +26,7 @@ import java.util.Collections;
import java.util.List;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2IndexBase;
@@ -34,6 +35,7 @@ import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
import org.apache.ignite.internal.util.GridStringBuilder;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.SB;
+import org.apache.ignite.internal.util.typedef.internal.U;
import org.h2.engine.Session;
import org.h2.jdbc.JdbcConnection;
import org.h2.result.SortOrder;
@@ -298,4 +300,29 @@ public class H2Utils {
dest.add(col);
}
}
+
+ /**
+ * Check that given table has not started cache and start it for such case.
+ *
+ * @param tbl Table to check on not started cache.
+ * @return {@code true} in case not started and has been started.
+ */
+ public static boolean checkAndStartNotStartedCache(GridH2Table tbl) {
+ if (tbl != null && tbl.isCacheLazy()) {
+ String cacheName = tbl.cacheInfo().config().getName();
+
+ GridKernalContext ctx = tbl.cacheInfo().context();
+
+ try {
+ Boolean res = ctx.cache().dynamicStartCache(null, cacheName, null, false, true, true).get();
+
+ return U.firstNotNull(res, Boolean.FALSE);
+ }
+ catch (IgniteCheckedException ex) {
+ throw U.convertException(ex);
+ }
+ }
+
+ return false;
+ }
}
[40/50] [abbrv] ignite git commit: IGNITE-10442 Fixed flaky
testFailNodesOnCanceledTask - Fixes #5547.
Posted by sb...@apache.org.
IGNITE-10442 Fixed flaky testFailNodesOnCanceledTask - Fixes #5547.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4c56adcf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4c56adcf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4c56adcf
Branch: refs/heads/ignite-10044
Commit: 4c56adcf0997f4a97542cbabd3e5185dc9ed9af1
Parents: 5990bcd
Author: Fedotov <va...@gmail.com>
Authored: Wed Dec 5 19:48:11 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Dec 5 19:48:11 2018 +0300
----------------------------------------------------------------------
.../processors/cache/persistence/IgnitePdsTaskCancelingTest.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4c56adcf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsTaskCancelingTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsTaskCancelingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsTaskCancelingTest.java
index 6b53339..9409f9d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsTaskCancelingTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsTaskCancelingTest.java
@@ -87,6 +87,9 @@ public class IgnitePdsTaskCancelingTest extends GridCommonAbstractTest {
cfg.setDataStorageConfiguration(getDataStorageConfiguration());
+ // Set the thread pool size according to the NUM_TASKS.
+ cfg.setPublicThreadPoolSize(16);
+
return cfg;
}
[07/50] [abbrv] ignite git commit: IGNITE-5759 unmuted
testPartitionRent test - Fixes #5531.
Posted by sb...@apache.org.
IGNITE-5759 unmuted testPartitionRent test - Fixes #5531.
Signed-off-by: Dmitriy Pavlov <dp...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/66d8ac64
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/66d8ac64
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/66d8ac64
Branch: refs/heads/ignite-10044
Commit: 66d8ac64dc0cd6f83bbfc45560cd08f38d8a92ff
Parents: 9b0ce92
Author: Anton Kalashnikov <ka...@yandex.ru>
Authored: Mon Dec 3 18:21:05 2018 +0300
Committer: Dmitriy Pavlov <dp...@apache.org>
Committed: Mon Dec 3 18:21:05 2018 +0300
----------------------------------------------------------------------
.../GridCachePartitionEvictionDuringReadThroughSelfTest.java | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/66d8ac64/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionEvictionDuringReadThroughSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionEvictionDuringReadThroughSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionEvictionDuringReadThroughSelfTest.java
index 01316f6..5a9e86a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionEvictionDuringReadThroughSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionEvictionDuringReadThroughSelfTest.java
@@ -84,8 +84,6 @@ public class GridCachePartitionEvictionDuringReadThroughSelfTest extends GridCom
* @throws Exception if failed.
*/
public void testPartitionRent() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-5759");
-
startGrid(DATA_READ_GRID_IDX);
final AtomicBoolean done = new AtomicBoolean();
[19/50] [abbrv] ignite git commit: IGNITE-8227 implement JUnit test
failure handler for TeamCity. - Fixes #4974.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java
index a0796a3..e7b5ed2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java
@@ -31,6 +31,8 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
@@ -118,6 +120,11 @@ public class IgniteCacheClientReconnectTest extends GridCommonAbstractTest {
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* If setting IGNITE_EXCHANGE_HISTORY_SIZE is set to small value
* it is possible that bunch of clients simultaneous start (amount > IGNITE_EXCHANGE_HISTORY_SIZE)
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java
index ebcff7c..3eca6b3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java
@@ -37,6 +37,8 @@ import org.apache.ignite.cache.CacheEntryProcessor;
import org.apache.ignite.cache.CachePartialUpdateException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -100,6 +102,11 @@ public class IgniteCacheFailedUpdateResponseTest extends GridCommonAbstractTest
txCache = grid("client").cache(TX_CACHE);
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGetRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGetRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGetRestartTest.java
index ba22048..43f016f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGetRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGetRestartTest.java
@@ -31,6 +31,8 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -116,6 +118,11 @@ public class IgniteCacheGetRestartTest extends GridCommonAbstractTest {
return TEST_TIME + 3 * 60_000;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java
index cd85950..7a8b6ba 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java
@@ -24,6 +24,8 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -70,6 +72,11 @@ public class IgniteCacheSizeFailoverTest extends GridCommonAbstractTest {
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
index bed8a41..bd552c2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
@@ -39,6 +39,8 @@ import org.apache.ignite.cache.store.CacheStoreAdapter;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -125,6 +127,11 @@ public class IgniteTxCacheWriteSynchronizationModesMultithreadedTest extends Gri
System.clearProperty(IgniteSystemProperties.IGNITE_ENABLE_FORCIBLE_NODE_KILL);
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java
index 2051616..3ea2916 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java
@@ -36,6 +36,8 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -77,6 +79,11 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra
}
/** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
+ /** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
index 2c6d187..696e5cf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
@@ -37,6 +37,8 @@ import org.apache.ignite.IgniteSet;
import org.apache.ignite.configuration.AtomicConfiguration;
import org.apache.ignite.configuration.CollectionConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteInClosure;
@@ -105,6 +107,11 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
queue.clear();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/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 40f9dc4..f5115c1 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
@@ -33,6 +33,8 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
@@ -132,6 +134,11 @@ public class IgniteCacheCrossCacheTxFailoverTest extends GridCommonAbstractTest
return TEST_TIME + 60_000;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java
index f813ef8..ab94618 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java
@@ -22,6 +22,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
@@ -82,6 +84,11 @@ public class IgniteCacheLockFailoverSelfTest extends GridCacheAbstractSelfTest {
return 2 * 60_000;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/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 fbb7c3a..85eb8d1 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
@@ -44,6 +44,8 @@ import org.apache.ignite.cache.store.CacheStoreAdapter;
import org.apache.ignite.configuration.AtomicConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
@@ -161,6 +163,11 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
}
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @return Cache atomicity mode.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTopologySplitAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTopologySplitAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTopologySplitAbstractTest.java
index 4422d1e..25859dc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTopologySplitAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTopologySplitAbstractTest.java
@@ -27,6 +27,8 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.TestRecordingCommunicationSpi;
@@ -62,6 +64,11 @@ public abstract class IgniteCacheTopologySplitAbstractTest extends GridCommonAbs
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @param seg Cluster segment.
* @param topVer Topology version to wait for.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTxRecoveryRollbackTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTxRecoveryRollbackTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTxRecoveryRollbackTest.java
index 11c4c67..ee7e876 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTxRecoveryRollbackTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTxRecoveryRollbackTest.java
@@ -36,6 +36,8 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.TestRecordingCommunicationSpi;
@@ -112,6 +114,11 @@ public class IgniteCacheTxRecoveryRollbackTest extends GridCommonAbstractTest {
}
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index ba17da0..5c9f50c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -35,6 +35,8 @@ import org.apache.ignite.cache.affinity.Affinity;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.TestDelayingCommunicationSpi;
@@ -96,6 +98,11 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
}
/** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
+ /** {@inheritDoc} */
protected CacheConfiguration cacheConfiguration() {
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyTopologySelfTest.java
index 4344bb1..5df4153 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyTopologySelfTest.java
@@ -25,6 +25,8 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -89,6 +91,11 @@ public class GridCacheNearOnlyTopologySelfTest extends GridCommonAbstractTest {
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/** @throws Exception If failed. */
public void testStartupFirstOneNode() throws Exception {
checkStartupNearNode(0, 2);
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
index a95ad43..8008aa8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
@@ -33,6 +33,8 @@ import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
@@ -251,6 +253,11 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
GridTestUtils.runGC(); // Clean heap before rebalancing.
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java
index 4283d1c..a6100d8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java
@@ -61,6 +61,8 @@ import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteFutureCancelledCheckedException;
@@ -249,6 +251,11 @@ public abstract class CacheMvccAbstractTest extends GridCommonAbstractTest {
super.afterTest();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @param cfgC Optional closure applied to cache configuration.
* @throws Exception If failed.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteBaselineAffinityTopologyActivationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteBaselineAffinityTopologyActivationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteBaselineAffinityTopologyActivationTest.java
index 838c732..cc824be 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteBaselineAffinityTopologyActivationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteBaselineAffinityTopologyActivationTest.java
@@ -36,6 +36,8 @@ import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.DetachedClusterNode;
@@ -112,6 +114,11 @@ public class IgniteBaselineAffinityTopologyActivationTest extends GridCommonAbst
cleanPersistenceDir();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Verifies that when old but compatible node
* (it is the node that once wasn't presented in branchingHistory but hasn't participated in any branching point)
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheConfigurationFileConsistencyCheckTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheConfigurationFileConsistencyCheckTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheConfigurationFileConsistencyCheckTest.java
index 74a3950..80f5616 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheConfigurationFileConsistencyCheckTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheConfigurationFileConsistencyCheckTest.java
@@ -32,6 +32,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
@@ -97,6 +99,11 @@ public class IgnitePdsCacheConfigurationFileConsistencyCheckTest extends GridCom
super.afterTest();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Tests that ignite can start when caches' configurations with same name in different groups stored.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
index 389a7fe..b338f60 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheRebalancingAbstractTest.java
@@ -49,6 +49,8 @@ import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition;
@@ -158,6 +160,11 @@ public abstract class IgnitePdsCacheRebalancingAbstractTest extends GridCommonAb
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @param cacheCfgs Cache cfgs.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java
index 25d54ab..1002c98 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java
@@ -37,6 +37,8 @@ import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -119,6 +121,11 @@ public class IgnitePdsContinuousRestartTest extends GridCommonAbstractTest {
cleanPersistenceDir();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception if failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java
index 8b3c875..cc81a3e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java
@@ -32,6 +32,8 @@ import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.testframework.junits.multijvm.IgniteProcessProxy;
@@ -204,4 +206,9 @@ public class IgnitePdsRebalancingOnNotStableTopologyTest extends GridCommonAbstr
@Override protected long getTestTimeout() {
return TimeUnit.MINUTES.toMillis(10);
}
+
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java
index 8b182c9..e930c8b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java
@@ -30,6 +30,8 @@ import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.GridKernalState;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.persistence.file.FileIO;
@@ -95,6 +97,11 @@ public class IgniteWalFlushFailoverTest extends GridCommonAbstractTest {
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Test flushing error recovery when flush is triggered asynchronously by timeout
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java
index 232591c..d520827 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java
@@ -34,6 +34,8 @@ import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.failure.StopNodeFailureHandler;
import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
import org.apache.ignite.internal.processors.cache.persistence.file.FileIO;
@@ -93,6 +95,11 @@ public abstract class IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends Gr
return 120_000;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @return WAL mode used in test.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalCompactionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalCompactionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalCompactionTest.java
index 14525f0..43dc395 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalCompactionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalCompactionTest.java
@@ -31,6 +31,8 @@ import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.pagemem.FullPageId;
import org.apache.ignite.internal.pagemem.wal.record.PageSnapshot;
@@ -111,6 +113,11 @@ public class WalCompactionTest extends GridCommonAbstractTest {
cleanPersistenceDir();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Tests applying updates from compacted WAL archive.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateFailOverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateFailOverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateFailOverTest.java
index 1ef269e..053146a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateFailOverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateFailOverTest.java
@@ -25,6 +25,8 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import static java.lang.Thread.sleep;
@@ -54,6 +56,11 @@ public class IgniteChangeGlobalStateFailOverTest extends IgniteChangeGlobalState
return 4;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteNoParrallelClusterIsAllowedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteNoParrallelClusterIsAllowedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteNoParrallelClusterIsAllowedTest.java
index 7180d7b..f8ad2de 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteNoParrallelClusterIsAllowedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteNoParrallelClusterIsAllowedTest.java
@@ -18,6 +18,8 @@
package org.apache.ignite.internal.processors.cache.persistence.standbycluster;
import junit.framework.AssertionFailedError;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
@@ -29,6 +31,11 @@ public class IgniteNoParrallelClusterIsAllowedTest extends IgniteChangeGlobalSta
/** */
private static final TcpDiscoveryIpFinder vmIpFinder = new TcpDiscoveryVmIpFinder(true);
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception if failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
index 176d34e..434b499 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteAbstractStandByClientReconnectTest.java
@@ -30,6 +30,8 @@ import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.util.typedef.internal.CU;
@@ -153,6 +155,11 @@ public abstract class IgniteAbstractStandByClientReconnectTest extends GridCommo
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @param disconnectedLatch Disconnect latch. Will be fired when client disconnect event is received.
* @param reconnectedLatch Reconnect latch. Will be fired when cilent reconnect event is receoved.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/CacheScanQueryFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/CacheScanQueryFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/CacheScanQueryFailoverTest.java
index 0633138..53f2f62 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/CacheScanQueryFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/CacheScanQueryFailoverTest.java
@@ -27,6 +27,8 @@ import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.failure.StopNodeOrHaltFailureHandler;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteClosure;
@@ -82,6 +84,11 @@ public class CacheScanQueryFailoverTest extends GridCommonAbstractTest {
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQueryTxSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQueryTxSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQueryTxSelfTest.java
index d3f6896..ff39afb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQueryTxSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQueryTxSelfTest.java
@@ -26,6 +26,8 @@ import org.apache.ignite.IgniteTransactions;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
import org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException;
@@ -70,6 +72,11 @@ public class IndexingSpiQueryTxSelfTest extends GridCacheAbstractSelfTest {
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/** */
public void testIndexingSpiWithTxClient() throws Exception {
IgniteEx client = startGrid("client");
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
index e7c2261..e1883fd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
@@ -68,6 +68,8 @@ import org.apache.ignite.cluster.ClusterTopologyException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -202,6 +204,11 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @return Cache mode.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousWithTransformerFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousWithTransformerFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousWithTransformerFailoverTest.java
index 241dc2a..933dccb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousWithTransformerFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousWithTransformerFailoverTest.java
@@ -33,6 +33,8 @@ import org.apache.ignite.cache.query.ContinuousQueryWithTransformer.EventListene
import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.lang.IgniteOutClosure;
import org.apache.ignite.resources.LoggerResource;
@@ -80,6 +82,11 @@ public class CacheContinuousWithTransformerFailoverTest extends GridCommonAbstra
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java
index 9ec25d3..7cea3f5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java
@@ -29,6 +29,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.managers.communication.GridIoManager;
@@ -90,6 +92,11 @@ public class ClientReconnectContinuousQueryTest extends GridCommonAbstractTest {
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @return Transaction snapshot.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryReconnectTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryReconnectTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryReconnectTest.java
index b104a65..edcbe78 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryReconnectTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryReconnectTest.java
@@ -31,6 +31,8 @@ import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
import org.apache.ignite.cache.query.ContinuousQuery;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
@@ -72,6 +74,11 @@ public class IgniteCacheContinuousQueryReconnectTest extends GridCommonAbstractT
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @return Atomic mode.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOptimisticPrepareOnUnstableTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOptimisticPrepareOnUnstableTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOptimisticPrepareOnUnstableTopologyTest.java
index cbdcffe..87550fd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOptimisticPrepareOnUnstableTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOptimisticPrepareOnUnstableTopologyTest.java
@@ -25,6 +25,8 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
@@ -87,6 +89,11 @@ public class TxOptimisticPrepareOnUnstableTopologyTest extends GridCommonAbstrac
return c;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
*
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java
index 612d6ce..d2e9804 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java
@@ -48,6 +48,8 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteFutureCancelledCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -200,6 +202,11 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @return Started client.
* @throws Exception If f nodeailed.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTopologyChangeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTopologyChangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTopologyChangeTest.java
index 3fd6fd3..f24ea63 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTopologyChangeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTopologyChangeTest.java
@@ -28,6 +28,8 @@ import java.util.concurrent.atomic.AtomicIntegerArray;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.TestRecordingCommunicationSpi;
@@ -106,6 +108,11 @@ public class TxRollbackOnTopologyChangeTest extends GridCommonAbstractTest {
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Tests rollbacks on topology change.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
index d2d895e..6a31abb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
@@ -38,6 +38,8 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.JobEvent;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.GridConcurrentHashSet;
@@ -158,6 +160,11 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
}
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @param proc Continuous processor.
* @return Local event routines.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerClientReconnectAfterClusterRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerClientReconnectAfterClusterRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerClientReconnectAfterClusterRestartTest.java
index 239647c..0c33890 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerClientReconnectAfterClusterRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerClientReconnectAfterClusterRestartTest.java
@@ -24,6 +24,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
@@ -52,6 +54,11 @@ public class DataStreamerClientReconnectAfterClusterRestartTest extends GridComm
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/** */
public void testOneClient() throws Exception {
clusterRestart(false, false);
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBackupFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBackupFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBackupFailoverSelfTest.java
index ff9c51a..5abf125 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBackupFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBackupFailoverSelfTest.java
@@ -26,6 +26,8 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper;
import org.apache.ignite.igfs.IgfsMode;
import org.apache.ignite.igfs.IgfsOutputStream;
@@ -120,6 +122,11 @@ public class IgfsBackupFailoverSelfTest extends IgfsCommonAbstractTest {
checkTopology(numIgfsNodes);
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Start grid with IGFS.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/top/CacheTopologyCommandHandlerTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/top/CacheTopologyCommandHandlerTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/top/CacheTopologyCommandHandlerTest.java
index 5d7dfd7..c318ff8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/top/CacheTopologyCommandHandlerTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/top/CacheTopologyCommandHandlerTest.java
@@ -25,6 +25,8 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.ConnectorConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.rest.GridRestCommand;
@@ -67,6 +69,11 @@ public class CacheTopologyCommandHandlerTest extends GridCommonAbstractTest {
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProxyClientReconnectSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProxyClientReconnectSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProxyClientReconnectSelfTest.java
index 5fdcdc4..b9596c4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProxyClientReconnectSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProxyClientReconnectSelfTest.java
@@ -23,6 +23,8 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.services.Service;
import org.apache.ignite.services.ServiceContext;
@@ -54,6 +56,11 @@ public class GridServiceProxyClientReconnectSelfTest extends GridCommonAbstractT
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/session/GridSessionJobFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/session/GridSessionJobFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/session/GridSessionJobFailoverSelfTest.java
index 85b2e93..ef59bc6 100644
--- a/modules/core/src/test/java/org/apache/ignite/session/GridSessionJobFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/session/GridSessionJobFailoverSelfTest.java
@@ -32,6 +32,8 @@ import org.apache.ignite.compute.ComputeTask;
import org.apache.ignite.compute.ComputeTaskSession;
import org.apache.ignite.compute.ComputeTaskSessionFullSupport;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.resources.TaskSessionResource;
import org.apache.ignite.spi.failover.always.AlwaysFailoverSpi;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -58,6 +60,11 @@ public class GridSessionJobFailoverSelfTest extends GridCommonAbstractTest {
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiCustomTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiCustomTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiCustomTopologySelfTest.java
index 2b88dbb..b2f566b 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiCustomTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/collision/jobstealing/GridJobStealingCollisionSpiCustomTopologySelfTest.java
@@ -25,6 +25,8 @@ import java.util.List;
import java.util.UUID;
import org.apache.ignite.GridTestTaskSession;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.ClusterMetricsSnapshot;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
@@ -103,6 +105,11 @@ public class GridJobStealingCollisionSpiCustomTopologySelfTest extends
return ctx;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Adds Failover SPI attribute.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
index 08cf1f7..970d666 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
@@ -29,6 +29,8 @@ import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
@@ -108,6 +110,11 @@ public class TcpCommunicationSpiDropNodesTest extends GridCommonAbstractTest {
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
index 505d7a5..b65f6a0 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
@@ -33,6 +33,8 @@ import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
@@ -119,6 +121,11 @@ public class TcpCommunicationSpiFaultyClientTest extends GridCommonAbstractTest
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiSkipMessageSendTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiSkipMessageSendTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiSkipMessageSendTest.java
index 2c17f95..588e79e 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiSkipMessageSendTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiSkipMessageSendTest.java
@@ -34,6 +34,8 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.util.nio.GridCommunicationClient;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteCallable;
@@ -102,6 +104,11 @@ public class TcpCommunicationSpiSkipMessageSendTest extends GridCommonAbstractTe
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/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 6bd2a45..4289d64 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
@@ -34,6 +34,8 @@ import org.apache.ignite.IgniteTransactions;
import org.apache.ignite.cluster.ClusterTopologyException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -92,6 +94,11 @@ public class IgniteClientReconnectMassiveShutdownTest extends GridCommonAbstract
return 5 * 60 * 1000;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If any error occurs.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
index f14e0b1..9c22bc4 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
@@ -20,6 +20,8 @@ package org.apache.ignite.spi.discovery.tcp;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.marshaller.jdk.JdkMarshaller;
import org.apache.ignite.spi.IgniteSpiException;
@@ -79,6 +81,11 @@ public class TcpClientDiscoveryMarshallerCheckSelfTest extends GridCommonAbstrac
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
index c85e94e..30b68bb 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
@@ -42,6 +42,8 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
@@ -269,6 +271,11 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
assert G.allGrids().isEmpty();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Checks whether to use failure detection timeout instead of setting explicit timeouts.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/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 99dd5aa..5976f34 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
@@ -42,6 +42,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
@@ -165,6 +167,11 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
+ /** {@inheritDoc} */
@Override protected long getTestTimeout() {
return 5 * 60 * 1000;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryNodeAttributesUpdateOnReconnectTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryNodeAttributesUpdateOnReconnectTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryNodeAttributesUpdateOnReconnectTest.java
index 56dc4ec..241bc11 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryNodeAttributesUpdateOnReconnectTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryNodeAttributesUpdateOnReconnectTest.java
@@ -27,6 +27,8 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteClientReconnectAbstractTest;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.resources.LoggerResource;
@@ -82,6 +84,11 @@ public class TcpDiscoveryNodeAttributesUpdateOnReconnectTest extends GridCommonA
TestReconnectPluginProvider.enabled = true;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index 32df795..1ff1a8d 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -50,6 +50,8 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.GridComponent;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -242,6 +244,11 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
super.afterTest();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If any error occurs.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
index a760e2e..02eb857 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
@@ -24,6 +24,8 @@ import java.net.Socket;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.spi.IgniteSpiOperationTimeoutException;
import org.apache.ignite.spi.IgniteSpiOperationTimeoutHelper;
import org.apache.ignite.spi.discovery.AbstractDiscoverySelfTest;
@@ -81,6 +83,11 @@ public class TcpDiscoverySpiFailureTimeoutSelfTest extends AbstractDiscoverySelf
return spi;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception In case of error.
*/
[09/50] [abbrv] ignite git commit: IGNITE-10422 Make
ignite_inspection.xml configuration default on the project level. - Fixes
#5540.
Posted by sb...@apache.org.
IGNITE-10422 Make ignite_inspection.xml configuration default on the project level. - Fixes #5540.
Signed-off-by: Dmitriy Pavlov <dp...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/504393f6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/504393f6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/504393f6
Branch: refs/heads/ignite-10044
Commit: 504393f6669f288b673df096daac4ffac9086e55
Parents: 66d8ac6
Author: Maxim Muzafarov <ma...@gmail.com>
Authored: Mon Dec 3 19:34:41 2018 +0300
Committer: Dmitriy Pavlov <dp...@apache.org>
Committed: Mon Dec 3 19:34:41 2018 +0300
----------------------------------------------------------------------
.gitignore | 5 +-
.idea/inspectionProfiles/Project_Default.xml | 776 ++++++++++++++++++++++
idea/ignite_inspections.xml | 772 ---------------------
3 files changed, 780 insertions(+), 773 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/504393f6/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index c2eea34..f66b732 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
*.log
/out/
/work/
-.idea/
*/build/
xcuserdata/
*.iws
@@ -31,6 +30,10 @@ git-patch-prop-local.sh
*.exe
.mvn/
+#Ignore all Intellij IDEA files (except default inspections config)
+.idea/
+!.idea/inspectionProfiles/Project_Default.xml
+
#Visual Studio files
*.[Oo]bj
*.user
http://git-wip-us.apache.org/repos/asf/ignite/blob/504393f6/.idea/inspectionProfiles/Project_Default.xml
----------------------------------------------------------------------
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..23515ed
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,776 @@
+<profile version="1.0">
+ <option name="myName" value="ignite_inspections"/>
+ <inspection_tool class="AbstractMethodCallInConstructor" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="AccessorLikeMethodIsEmptyParen" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AccessorLikeMethodIsUnit" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintAddJavascriptInterface" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintAllowAllHostnameVerifier" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintAlwaysShowAction" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintAppCompatMethod" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintAuthLeak" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintBadHostnameVerifier" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintBatteryLife" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintCommitPrefEdits" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintCommitTransaction" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintCustomViewStyleable" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintCutPasteId" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintDefaultLocale" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintDrawAllocation" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintExportedContentProvider" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintExportedPreferenceActivity" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintExportedReceiver" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintExportedService" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintFloatMath" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintGetInstance" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintGifUsage" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintGoogleAppIndexingUrlError" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintGoogleAppIndexingWarning" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintGrantAllUris" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintHandlerLeak" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintIconColors" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintIconDensities" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintIconDipSize" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintIconDuplicates" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintIconDuplicatesConfig" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintIconExtension" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintIconLauncherShape" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintIconLocation" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintIconMissingDensityFolder" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintIconMixedNinePatch" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintIconNoDpi" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintIconXmlAndPng" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintInconsistentLayout" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintInflateParams" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintInlinedApi" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintInvalidUsesTagAttribute" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintJavascriptInterface" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintLocalSuppress" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintLogTagMismatch" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintLongLogTag" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintMergeRootFrame" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintMissingIntentFilterForMediaSearch" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintMissingMediaBrowserServiceIntentFilter" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintMissingOnPlayFromSearch" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintMissingSuperCall" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintNewApi" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintOverdraw" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintOverride" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintOverrideAbstract" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintPackageManagerGetSignatures" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintParcelClassLoader" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintParcelCreator" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintPendingBindings" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintPluralsCandidate" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintPrivateResource" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintRecycle" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintRecyclerView" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintRegistered" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintRequiredSize" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintRtlCompat" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintRtlEnabled" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintRtlHardcoded" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintRtlSymmetry" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintSQLiteString" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintSSLCertificateSocketFactoryCreateSocket" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintSSLCertificateSocketFactoryGetInsecure" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintSdCardPath" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintSecureRandom" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintServiceCast" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintSetJavaScriptEnabled" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintSetTextI18n" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintSetWorldReadable" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintSetWorldWritable" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintShiftFlags" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintShortAlarm" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintShowToast" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintSimpleDateFormat" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintStringFormatCount" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintStringFormatInvalid" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintStringFormatMatches" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintSupportAnnotationUsage" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintSuspiciousImport" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintSwitchIntDef" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintTrustAllX509TrustManager" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintUniqueConstants" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintUnlocalizedSms" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintUnprotectedSMSBroadcastReceiver" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintUnsafeDynamicallyLoadedCode" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintUnsafeNativeCodeLocation" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintUnsafeProtectedBroadcastReceiver" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintUnusedAttribute" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintUseSparseArrays" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintUseValueOf" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintValidFragment" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintViewConstructor" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintViewHolder" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintViewTag" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintWorldReadableFiles" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintWorldWriteableFiles" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintWrongCall" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidKLintWrongViewCast" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintAaptCrash" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintAccidentalOctal" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintAdapterViewChildren" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintAddJavascriptInterface" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintAllowAllHostnameVerifier" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintAllowBackup" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintAlwaysShowAction" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintAppCompatMethod" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintAppCompatResource" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintAssert" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintAuthLeak" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintBadHostnameVerifier" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintBatteryLife" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintButtonCase" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintButtonOrder" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintButtonStyle" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintByteOrderMark" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintCommitPrefEdits" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintCommitTransaction" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintContentDescription" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintCustomViewStyleable" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintCutPasteId" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintDefaultLocale" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintDeprecated" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintDeviceAdmin" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintDisableBaselineAlignment" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintDrawAllocation" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintDuplicateActivity" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintDuplicateDefinition" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintDuplicateIds" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintDuplicateIncludedIds" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintDuplicateUsesFeature" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintEnforceUTF8" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintExportedContentProvider" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintExportedPreferenceActivity" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintExportedReceiver" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintExportedService" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintExtraText" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintExtraTranslation" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintFloatMath" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintFullBackupContent" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintGetInstance" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintGifUsage" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintGoogleAppIndexingUrlError" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintGoogleAppIndexingWarning" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintGradleCompatible" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintGradleDependency" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintGradleDeprecated" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintGradleDynamicVersion" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintGradleGetter" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintGradleIdeError" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintGradleOverrides" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintGradlePath" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintGradlePluginVersion" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintGrantAllUris" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintGridLayout" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintHandlerLeak" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintHardcodedDebugMode" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintHardcodedText" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintHardwareIds" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintIconColors" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintIconDensities" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintIconDipSize" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintIconDuplicates" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintIconDuplicatesConfig" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintIconExtension" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintIconLauncherShape" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintIconLocation" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintIconMissingDensityFolder" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintIconMixedNinePatch" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintIconNoDpi" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintIconXmlAndPng" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintIllegalResourceRef" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintImpliedQuantity" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintInOrMmUsage" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintIncludeLayoutParam" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintInconsistentArrays" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintInconsistentLayout" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintInefficientWeight" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintInflateParams" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintInlinedApi" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintInnerclassSeparator" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintInvalidId" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintInvalidResourceFolder" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintInvalidUsesTagAttribute" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintJavascriptInterface" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintLabelFor" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintLibraryCustomView" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintLocalSuppress" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintLocaleFolder" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintLogTagMismatch" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintLongLogTag" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintManifestOrder" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintManifestResource" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMenuTitle" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMergeRootFrame" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMipmapIcons" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMissingApplicationIcon" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMissingConstraints" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMissingId" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMissingIntentFilterForMediaSearch" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMissingLeanbackLauncher" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMissingLeanbackSupport" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMissingMediaBrowserServiceIntentFilter" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMissingOnPlayFromSearch" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMissingPrefix" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMissingQuantity" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMissingSuperCall" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMissingTranslation" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMissingTvBanner" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMissingVersion" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMockLocation" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintMultipleUsesSdk" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintNestedScrolling" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintNestedWeights" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintNewApi" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintNfcTechWhitespace" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintNotInterpolated" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintNotSibling" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintObsoleteLayoutParam" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintOldTargetApi" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintOrientation" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintOverdraw" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintOverride" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintOverrideAbstract" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintPackageManagerGetSignatures" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintPackagedPrivateKey" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintParcelClassLoader" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintParcelCreator" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintPendingBindings" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintPermissionImpliesUnsupportedHardware" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintPluralsCandidate" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintPrivateResource" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintProguard" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintProguardSplit" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintPropertyEscape" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintProtectedPermissions" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintPxUsage" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintRecycle" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintRecyclerView" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintReferenceType" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintRegistered" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintRelativeOverlap" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintRequiredSize" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintResAuto" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintResourceCycle" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintResourceName" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintRtlCompat" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintRtlEnabled" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintRtlHardcoded" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintRtlSymmetry" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSQLiteString" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSSLCertificateSocketFactoryCreateSocket" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSSLCertificateSocketFactoryGetInsecure" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintScrollViewCount" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintScrollViewSize" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSdCardPath" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSecureRandom" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintServiceCast" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSetJavaScriptEnabled" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSetTextI18n" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSetWorldReadable" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSetWorldWritable" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintShiftFlags" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintShortAlarm" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintShowToast" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSignatureOrSystemPermissions" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSimpleDateFormat" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSmallSp" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSpUsage" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintStateListReachable" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintStaticFieldLeak" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintStringFormatCount" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintStringFormatInvalid" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintStringFormatMatches" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintStringShouldBeInt" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSupportAnnotationUsage" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSuspicious0dp" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSuspiciousImport" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintSwitchIntDef" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintTextFields" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintTextViewEdits" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintTooDeepLayout" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintTooManyViews" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintTrustAllX509TrustManager" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintTypographyDashes" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintTypographyEllipsis" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintTypographyFractions" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintTypographyOther" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintTypos" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUniqueConstants" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUniquePermission" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUnknownId" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUnknownIdInLayout" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUnlocalizedSms" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUnprotectedSMSBroadcastReceiver" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUnsafeDynamicallyLoadedCode" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUnsafeNativeCodeLocation" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUnsafeProtectedBroadcastReceiver" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUnsupportedTvHardware" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUnusedAttribute" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUnusedQuantity" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUnusedResources" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUseAlpha2" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUseCompoundDrawables" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUseSparseArrays" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUseValueOf" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUselessLeaf" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUselessParent" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUsesMinSdkAttributes" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintUsingHttp" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintValidFragment" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintValidRestrictions" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintVectorDrawableCompat" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintVectorRaster" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintViewConstructor" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintViewHolder" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintViewTag" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintWearableBindListener" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintWebViewLayout" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintWorldReadableFiles" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintWorldWriteableFiles" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintWrongCall" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintWrongCase" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintWrongFolder" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintWrongRegion" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AndroidLintWrongViewCast" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AntDuplicateTargetsInspection" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AntMissingPropertiesFileInspection" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="AntResolveInspection" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="ApparentRefinementOfResultType" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="AppliedTypeLambdaCanBeSimplified" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ArrayCreationWithoutNewKeyword" enabled="false" level="INFORMATION" enabled_by_default="false"/>
+ <inspection_tool class="AssertAsName" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="AssignmentToCatchBlockParameter" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="AssignmentToDateFieldFromParameter" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="ignorePrivateMethods" value="true"/>
+ </inspection_tool>
+ <inspection_tool class="BadOddness" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="BigDecimalEquals" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="BooleanMethodIsAlwaysInverted" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="BreakStatementWithLabel" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="BusyWait" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="CStyleArrayDeclaration" enabled="false" level="INFORMATION" enabled_by_default="false"/>
+ <inspection_tool class="CallToStringConcatCanBeReplacedByOperator" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="CaseClassParam" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ChainedPackage" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ClassMayBeInterface" enabled="false" level="INFORMATION" enabled_by_default="false"/>
+ <inspection_tool class="ClassNameDiffersFromFileName" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ClassNameSameAsAncestorName" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="CloneCallsConstructors" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="CloneInNonCloneableClass" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="CloneableImplementsClone" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="m_ignoreCloneableDueToInheritance" value="true"/>
+ </inspection_tool>
+ <inspection_tool class="CollectionContainsUrl" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="CollectionsFieldAccessReplaceableByMethodCall" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ComparableImplementedButEqualsNotOverridden" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ComparatorNotSerializable" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ComparingDiffCollectionKinds" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ComparingUnrelatedTypes" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ComparisonOfShortAndChar" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ComparisonToNaN" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ConditionSignal" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ConstantConditions" enabled="false" level="WARNING" enabled_by_default="false">
+ <option name="SUGGEST_NULLABLE_ANNOTATIONS" value="true"/>
+ <option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="true"/>
+ </inspection_tool>
+ <inspection_tool class="ConstantValueVariableUse" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ContinueStatementWithLabel" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ControlFlowStatementWithoutBraces" enabled="false" level="INFORMATION" enabled_by_default="false"/>
+ <inspection_tool class="Convert2Lambda" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ConvertExpressionToSAM" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ConvertNullInitializerToUnderscore" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ConvertibleToMethodValue" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="CorrespondsUnsorted" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="CovariantCompareTo" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="CovariantEquals" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="DangerousCatchAll" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="DanglingJavadoc" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="DefaultNotLastCaseInSwitch" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="DeprecatedIsStillUsed" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="DeprecatedViewBound" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="DialogTitleCapitalization" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="DivideByZero" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="DollarSignInName" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="DottyDeprecatedWith" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="DropTakeToSlice" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="DuplicateBooleanBranch" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="DuplicateCondition" enabled="false" level="WARNING" enabled_by_default="false">
+ <option name="ignoreMethodCalls" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="DuplicateThrows" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="EmptyCheck" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="EmptyInitializer" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="EmptyParenMethodAccessedAsParameterless" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="EmptyParenMethodOverridenAsParameterless" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="EmptySynchronizedStatement" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="EnumAsName" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="EnumSwitchStatementWhichMissesCases" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="ignoreSwitchStatementsWithDefault" value="true"/>
+ </inspection_tool>
+ <inspection_tool class="EqualityToSameElements" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="EqualsCalledOnEnumConstant" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="EqualsHashCodeCalledOnUrl" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="EqualsWhichDoesntCheckParameterClass" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ErrorRethrown" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ExceptionNameDoesntEndWithException" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ExistsEquals" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ExtendsUtilityClass" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ExternalizableWithSerializationMethods" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="FieldAccessedSynchronizedAndUnsynchronized" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="countGettersAndSetters" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="FieldCanBeLocal" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="FieldFromDelayedInit" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="FieldMayBeStatic" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="FilterEmptyCheck" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="FilterHeadOption" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="FilterOtherContains" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="FilterSize" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="FinalizeNotProtected" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="FindAndMapToApply" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="FindEmptyCheck" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="FloatLiteralEndingWithDecimalPoint" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="FloatingPointEquality" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="FoldTrueAnd" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ForCanBeForeach" enabled="false" level="WARNING" enabled_by_default="false">
+ <option name="REPORT_INDEXED_LOOP" value="true"/>
+ <option name="ignoreUntypedCollections" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="ForwardReference" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="FunctionTupleSyntacticSugar" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="GetGetOrElse" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="GetOrElseNull" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="HashCodeUsesVar" enabled="false" level="WEAK WARNING" enabled_by_default="false"/>
+ <inspection_tool class="HeadOrLastOption" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="HoconIncludeResolution" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="HtmlPresentationalElement" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="IfElseToOption" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="IfMayBeConditional" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="IfStatementWithIdenticalBranches" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="IgnoreResultOfCall" enabled="false" level="WARNING" enabled_by_default="false">
+ <option name="m_reportAllNonLibraryCalls" value="false"/>
+ <option name="callCheckString" value="java.io.InputStream,read,java.io.InputStream,skip,java.lang.StringBuffer,toString,java.lang.StringBuilder,toString,java.lang.String,.*,java.math.BigInteger,.*,java.math.BigDecimal,.*,java.net.InetAddress,.*,java.io.File,.*,java.lang.Object,equals|hashCode"/>
+ </inspection_tool>
+ <inspection_tool class="InjectionNotApplicable" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="InnerClassMayBeStatic" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="InstanceofThis" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="IntLiteralMayBeLongLiteral" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="IntegerDivisionInFloatingPointContext" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="IteratorHasNextCallsIteratorNext" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="IteratorNextDoesNotThrowNoSuchElementException" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="JavaAccessorMethodCalledAsEmptyParen" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="JavaAccessorMethodOverridenAsEmptyParen" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="JavaFxColorRgb" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="JavaFxDefaultTag" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="JavaFxEventHandler" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="JavaFxRedundantPropertyValue" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="JavaFxResourcePropertyValue" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="JavaFxUnresolvedFxIdReference" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="JavaFxUnusedImports" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="JavaLangImport" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="JavaMutatorMethodAccessedAsParameterless" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="JavaMutatorMethodOverridenAsParameterless" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="JsonDuplicatePropertyKeys" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="JsonStandardCompliance" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="KindProjectorSimplifyTypeProjection" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="KindProjectorUseCorrectLambdaKeyword" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="LabeledStatement" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="LanguageFeature" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="LanguageMismatch" enabled="false" level="WARNING" enabled_by_default="false">
+ <option name="CHECK_NON_ANNOTATED_REFERENCES" value="true"/>
+ </inspection_tool>
+ <inspection_tool class="LastIndexToLast" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="LengthOneStringInIndexOf" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ListIndexOfReplaceableByContains" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="LiteralAsArgToStringEquals" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="LoopVariableNotUpdated" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="LossyEncoding" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="MapFlatten" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="MapGetGet" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="MapGetOrElseBoolean" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="MapKeys" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="MapReplaceableByEnumMap" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="MapToBooleanContains" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="MapValues" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="MatchToPartialFunction" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="MethodNameSameAsParentName" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="MethodNamesDifferOnlyByCase" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="MethodOverridesPackageLocalMethod" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="MethodOverridesPrivateMethod" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="MethodOverridesStaticMethod" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="MismatchedCollectionQueryUpdate" enabled="false" level="WEAK WARNING" enabled_by_default="false">
+ <option name="queryNames">
+ <value/>
+ </option>
+ <option name="updateNames">
+ <value/>
+ </option>
+ <option name="ignoredClasses">
+ <value/>
+ </option>
+ </inspection_tool>
+ <inspection_tool class="MissingDeprecatedAnnotation" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="MissingOverrideAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
+ <option name="ignoreObjectMethods" value="true"/>
+ <option name="ignoreAnonymousClassMethods" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="MissortedModifiers" enabled="true" level="ERROR" enabled_by_default="true">
+ <option name="m_requireAnnotationsFirst" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="MisspelledCompareTo" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="MisspelledEquals" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="MisspelledHashcode" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="MisspelledToString" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="MultipleArgListsInAnnotation" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="MultipleRepositoryUrls" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="MutatorLikeMethodIsParameterless" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="NakedNotify" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="NameBooleanParameters" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="NoReturnTypeForImplicitDef" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="NonExceptionNameEndsWithException" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="NonFinalStaticVariableUsedInClassInitialization" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="NonProtectedConstructorInAbstractClass" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="m_ignoreNonPublicClasses" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="NonSerializableObjectBoundToHttpSession" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="NonSerializableWithSerialVersionUIDField" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="NonSerializableWithSerializationMethods" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="NonSynchronizedMethodOverridesSynchronizedMethod" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="NonThreadSafeLazyInitialization" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="NotImplementedCode" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="NotifyCalledOnCondition" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="NotifyNotInSynchronizedContext" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="NotifyWithoutCorrespondingWait" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="NullableProblems" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="REPORT_NULLABLE_METHOD_OVERRIDES_NOTNULL" value="true"/>
+ <option name="REPORT_NOT_ANNOTATED_METHOD_OVERRIDES_NOTNULL" value="false"/>
+ <option name="REPORT_NOTNULL_PARAMETER_OVERRIDES_NULLABLE" value="true"/>
+ <option name="REPORT_NOT_ANNOTATED_PARAMETER_OVERRIDES_NOTNULL" value="true"/>
+ <option name="REPORT_NOT_ANNOTATED_GETTER" value="true"/>
+ <option name="REPORT_NOT_ANNOTATED_SETTER_PARAMETER" value="true"/>
+ <option name="REPORT_ANNOTATION_NOT_PROPAGATED_TO_OVERRIDERS" value="false"/>
+ <option name="REPORT_NULLS_PASSED_TO_NON_ANNOTATED_METHOD" value="true"/>
+ </inspection_tool>
+ <inspection_tool class="ObjectNotify" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ObsoleteCollection" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="ignoreRequiredObsoleteCollectionTypes" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="OptionEqualsSome" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="OverlyStrongTypeCast" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="ignoreInMatchingInstanceof" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="OverriddenMethodCallDuringObjectConstruction" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="PackageVisibleInnerClass" enabled="true" level="WARNING" enabled_by_default="false">
+ <scope name="Production" level="WARNING" enabled="true">
+ <option name="ignoreEnums" value="false"/>
+ <option name="ignoreInterfaces" value="false"/>
+ </scope>
+ <option name="ignoreEnums" value="false"/>
+ <option name="ignoreInterfaces" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="ParameterNameDiffersFromOverriddenParameter" enabled="false" level="WARNING" enabled_by_default="false">
+ <option name="m_ignoreSingleCharacterNames" value="false"/>
+ <option name="m_ignoreOverridesOfLibraryMethods" value="true"/>
+ </inspection_tool>
+ <inspection_tool class="ParameterlessMemberOverridenAsEmptyParen" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="PointlessIndexOfComparison" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ProtectedMemberInFinalClass" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="PublicField" enabled="true" level="WARNING" enabled_by_default="false">
+ <scope name="Production" level="WARNING" enabled="true">
+ <option name="ignoreEnums" value="false"/>
+ <option name="ignorableAnnotations">
+ <value/>
+ </option>
+ </scope>
+ <option name="ignoreEnums" value="false"/>
+ <option name="ignorableAnnotations">
+ <value/>
+ </option>
+ </inspection_tool>
+ <inspection_tool class="PublicFieldAccessedInSynchronizedContext" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="PublicInnerClass" enabled="true" level="WARNING" enabled_by_default="false">
+ <scope name="Production" level="WARNING" enabled="true">
+ <option name="ignoreEnums" value="false"/>
+ <option name="ignoreInterfaces" value="false"/>
+ </scope>
+ <option name="ignoreEnums" value="false"/>
+ <option name="ignoreInterfaces" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="RangeToIndices" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ReadObjectAndWriteObjectPrivate" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ReadObjectInitialization" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ReadResolveAndWriteReplaceProtected" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="RedundantBlock" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="RedundantCollectionConversion" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="RedundantDefaultArgument" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="RedundantFieldInitialization" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="RedundantHeadOrLastOption" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="RedundantImplements" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="ignoreSerializable" value="false"/>
+ <option name="ignoreCloneable" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="RedundantImport" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="RedundantMethodOverride" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="RedundantNewCaseClass" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="RedundantSuppression" enabled="true" level="ERROR" enabled_by_default="true"/>
+ <inspection_tool class="RedundantThrowsDeclaration" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ReferenceMustBePrefixed" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="RemoveRedundantReturn" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ReplaceAssignmentWithOperatorAssignment" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="ignoreLazyOperators" value="true"/>
+ <option name="ignoreObscureOperators" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="ReplaceToWithUntil" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ReplaceWithFlatten" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="RequiredAttributes" enabled="false" level="WARNING" enabled_by_default="false">
+ <option name="myAdditionalRequiredHtmlAttributes" value=""/>
+ </inspection_tool>
+ <inspection_tool class="ResultOfObjectAllocationIgnored" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ResultSetIndexZero" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ReturnOfDateField" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ReverseIterator" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ReverseMap" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ReverseTakeReverse" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="SafeLock" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="SafeVarargsDetector" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="SameElementsToEquals" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="SamePackageImport" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="SameParameterValue" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaDefaultFileTemplate" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaDefaultFileTemplateUsage" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaDeprecatedIdentifier" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaDeprecation" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaDocInlinedTag" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaDocMissingParameterDescription" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaDocUnbalancedHeader" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaDocUnclosedTagWithoutParser" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaDocUnknownParameter" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaDocUnknownTag" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaFileName" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaMalformedFormatString" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaPackageName" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaRedundantCast" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaRedundantConversion" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaStyle" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaUnnecessaryParentheses" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaUnnecessarySemicolon" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaUnreachableCode" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaUnusedSymbol" enabled="false" level="WEAK WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaUselessExpression" enabled="false" level="WEAK WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ScalaXmlUnmatchedTag" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="SerialPersistentFieldsWithWrongSignature" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="SerialVersionUIDNotStaticFinal" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="SignalWithoutCorrespondingAwait" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="SimplifiableFoldOrReduce" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="SimplifiableIfStatement" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="SimplifyBoolean" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="SimplifyBooleanMatch" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="SingleImport" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="SizeReplaceableByIsEmpty" enabled="true" level="ERROR" enabled_by_default="true"/>
+ <inspection_tool class="SizeToLength" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="SleepWhileHoldingLock" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="SortFilter" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="SpellCheckingInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false">
+ <option name="processCode" value="true"/>
+ <option name="processLiterals" value="true"/>
+ <option name="processComments" value="true"/>
+ </inspection_tool>
+ <inspection_tool class="StringBufferToStringInConcatenation" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="StringEqualsEmptyString" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="SubtractionInCompareTo" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="SynchronizeOnLock" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="SynchronizedOnLiteralObject" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="SystemRunFinalizersOnExit" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="TextLabelInSwitchStatement" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ThreadDeathRethrown" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ThreadRun" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ThreadStartInConstruction" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ThreadStopSuspendResume" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ThreadYield" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ThrowableInstanceNeverThrown" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ThrowableResultOfMethodCallIgnored" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ToSetAndBack" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="TransientFieldInNonSerializableClass" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="TransientFieldNotInitialized" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="TrivialStringConcatenation" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="TypeAnnotation" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="TypeCheckCanBeMatch" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="TypeParameterExtendsFinalClass" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="TypeParameterShadow" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="UNCHECKED_WARNING" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="IGNORE_UNCHECKED_ASSIGNMENT" value="false"/>
+ <option name="IGNORE_UNCHECKED_GENERICS_ARRAY_CREATION" value="true"/>
+ <option name="IGNORE_UNCHECKED_CALL" value="false"/>
+ <option name="IGNORE_UNCHECKED_CAST" value="true"/>
+ <option name="IGNORE_UNCHECKED_OVERRIDING" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="UNUSED_SYMBOL" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="LOCAL_VARIABLE" value="true"/>
+ <option name="FIELD" value="true"/>
+ <option name="METHOD" value="false"/>
+ <option name="CLASS" value="false"/>
+ <option name="PARAMETER" value="true"/>
+ <option name="REPORT_PARAMETER_FOR_PUBLIC_METHODS" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="UnaryPlus" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="UnconditionalWait" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="UnitInMap" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="UnitMethodIsParameterless" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="UnknownLanguage" enabled="false" level="ERROR" enabled_by_default="false"/>
+ <inspection_tool class="UnnecessarilyQualifiedStaticUsage" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="m_ignoreStaticFieldAccesses" value="false"/>
+ <option name="m_ignoreStaticMethodCalls" value="false"/>
+ <option name="m_ignoreStaticAccessFromStaticContext" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="UnnecessaryAnnotationParentheses" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="UnnecessaryCallToStringValueOf" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="UnnecessaryConstructor" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="UnnecessaryFinalOnLocalVariable" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="UnnecessaryFinalOnParameter" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="onlyWarnOnAbstractMethods" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="UnnecessaryFullyQualifiedName" enabled="false" level="WARNING" enabled_by_default="false">
+ <option name="m_ignoreJavadoc" value="true"/>
+ <option name="ignoreInModuleStatements" value="true"/>
+ </inspection_tool>
+ <inspection_tool class="UnnecessaryInterfaceModifier" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="UnnecessaryJavaDocLink" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="ignoreInlineLinkToSuper" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="UnnecessaryPartialFunction" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="UnnecessaryQualifierForThis" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="UnnecessarySuperConstructor" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="UnnecessarySuperQualifier" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="UnnecessaryThis" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="UnnecessaryUnaryMinus" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="UnusedCatchParameter" enabled="true" level="WARNING" enabled_by_default="true">
+ <option name="m_ignoreCatchBlocksWithComments" value="false"/>
+ <option name="m_ignoreTestCases" value="false"/>
+ </inspection_tool>
+ <!-- Unused imports used by IntelliJ Idea 2017 -->
+ <inspection_tool class="UnusedImport" enabled="true" level="ERROR" enabled_by_default="true"/>
+ <!-- Unused imporst used by IntelliJ Idea 2018 -->
+ <inspection_tool class="UNUSED_IMPORT" enabled="true" level="ERROR" enabled_by_default="true"/>
+ <inspection_tool class="UnusedLibrary" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="UnusedReturnValue" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="UpperCaseFieldNameNotConstant" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="Use of postfix method call" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="VarCouldBeVal" enabled="false" level="WEAK WARNING" enabled_by_default="false"/>
+ <inspection_tool class="VariablePatternShadow" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="WaitCalledOnCondition" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="WaitNotInLoop" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="WaitNotInSynchronizedContext" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="WaitWhileHoldingTwoLocks" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="WaitWithoutCorrespondingNotify" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="WeakerAccess" enabled="false" level="WARNING" enabled_by_default="false">
+ <option name="SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS" value="true"/>
+ <option name="SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES" value="true"/>
+ <option name="SUGGEST_PRIVATE_FOR_INNERS" value="false"/>
+ </inspection_tool>
+ <inspection_tool class="ZeroIndexToHead" enabled="false" level="WARNING" enabled_by_default="false"/>
+ <inspection_tool class="ZeroLengthArrayInitialization" enabled="true" level="WARNING" enabled_by_default="true"/>
+ <inspection_tool class="ZipWithIndex" enabled="false" level="WARNING" enabled_by_default="false"/>
+</profile>
\ No newline at end of file
[45/50] [abbrv] ignite git commit: IGNITE-10549: [ML]
LogisticRegressionSGDTrainerTest fails with BLAS
Posted by sb...@apache.org.
IGNITE-10549: [ML] LogisticRegressionSGDTrainerTest fails with BLAS
This closes #5577
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d267236e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d267236e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d267236e
Branch: refs/heads/ignite-10044
Commit: d267236e0697264edc186db5b53fe191538b519e
Parents: d045b84
Author: Alexey Platonov <ap...@gmail.com>
Authored: Thu Dec 6 13:16:07 2018 +0300
Committer: Yury Babak <yb...@gridgain.com>
Committed: Thu Dec 6 13:16:07 2018 +0300
----------------------------------------------------------------------
.../ml/regressions/logistic/LogisticRegressionSGDTrainerTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d267236e/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionSGDTrainerTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionSGDTrainerTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionSGDTrainerTest.java
index 7236820..c343ab9 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionSGDTrainerTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionSGDTrainerTest.java
@@ -48,7 +48,7 @@ public class LogisticRegressionSGDTrainerTest extends TrainerTest {
SimpleGDParameterUpdate::sumLocal, SimpleGDParameterUpdate::avg))
.withMaxIterations(100000)
.withLocIterations(100)
- .withBatchSize(10)
+ .withBatchSize(14)
.withSeed(123L);
LogisticRegressionModel mdl = trainer.fit(
[50/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-10044
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-10044
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/89ec0339
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/89ec0339
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/89ec0339
Branch: refs/heads/ignite-10044
Commit: 89ec0339ddfe9c8f03993fda3de23c284f97f316
Parents: 216474c 025a036
Author: sboikov <sb...@apache.org>
Authored: Thu Dec 6 19:22:26 2018 +0300
Committer: sboikov <sb...@apache.org>
Committed: Thu Dec 6 19:22:26 2018 +0300
----------------------------------------------------------------------
.gitignore | 5 +-
.idea/inspectionProfiles/Project_Default.xml | 776 +++++++++++++++++++
examples/config/example-ignite-ml.xml | 38 +
.../AlgorithmSpecificDatasetExample.java | 2 +-
.../ml/inference/ModelStorageExample.java | 122 +++
.../GaussianNaiveBayesTrainerExample.java | 25 +-
...ggedLogisticRegressionSGDTrainerExample.java | 5 +-
.../LogisticRegressionSGDTrainerExample.java | 4 +-
...gressionMultiClassClassificationExample.java | 164 ----
.../logistic/multiclass/package-info.java | 22 -
.../ml/svm/SVMBinaryClassificationExample.java | 112 +++
.../binary/SVMBinaryClassificationExample.java | 112 ---
.../examples/ml/svm/binary/package-info.java | 22 -
.../SVMMultiClassClassificationExample.java | 153 ----
.../ml/svm/multiclass/package-info.java | 22 -
.../RandomForestRegressionExample.java | 9 +-
.../ml/tutorial/Step_9_Go_to_LogReg.java | 4 +-
.../ignite/examples/ml/util/SandboxMLCache.java | 19 -
.../ignite/examples/util/IrisDataset.java | 129 ---
idea/ignite_inspections.xml | 772 ------------------
.../client/ClientReconnectionSelfTest.java | 7 +
...skExecutionAfterTopologyRestartSelfTest.java | 7 +
.../ClientAbstractMultiNodeSelfTest.java | 7 +
.../internal/jdbc2/JdbcMetadataSelfTest.java | 72 +-
.../ignite/jdbc/JdbcMetadataSelfTest.java | 69 +-
.../JdbcThinAbstractDmlStatementSelfTest.java | 5 +
.../jdbc/thin/JdbcThinAbstractSelfTest.java | 7 +
.../thin/JdbcThinBulkLoadAbstractSelfTest.java | 49 +-
.../jdbc/thin/JdbcThinMetadataSelfTest.java | 50 +-
.../IgnitePKIndexesMigrationToUnwrapPkTest.java | 4 +-
.../PersistenceBasicCompatibilityTest.java | 27 +
.../junits/IgniteCompatibilityAbstractTest.java | 12 +-
.../junits/IgniteCompatibilityNodeRunner.java | 14 +-
.../apache/ignite/IgniteSystemProperties.java | 17 +
.../apache/ignite/internal/IgniteKernal.java | 33 +-
.../ignite/internal/IgniteNodeAttributes.java | 3 +
.../ignite/internal/commandline/Arguments.java | 100 ++-
.../internal/commandline/CommandHandler.java | 163 +++-
.../commandline/cache/CacheArguments.java | 18 +
.../apache/ignite/internal/jdbc/JdbcUtils.java | 11 +-
.../internal/jdbc/thin/JdbcThinUtils.java | 11 +-
.../apache/ignite/internal/jdbc2/JdbcUtils.java | 7 +-
.../deployment/GridDeploymentCommunication.java | 10 +-
.../discovery/GridDiscoveryManager.java | 12 +-
.../cache/CacheAffinitySharedManager.java | 22 +-
.../processors/cache/ClusterCachesInfo.java | 4 +
.../cache/GridCacheConcurrentMapImpl.java | 4 +-
.../processors/cache/GridCacheContext.java | 31 +-
.../processors/cache/GridCacheContextInfo.java | 179 +++++
.../GridCachePartitionExchangeManager.java | 4 +-
.../processors/cache/GridCachePreloader.java | 10 +
.../cache/GridCachePreloaderAdapter.java | 10 +
.../processors/cache/GridCacheProcessor.java | 265 ++++---
.../processors/cache/GridCacheUtils.java | 2 +-
.../cache/IgniteCacheOffheapManager.java | 5 +-
.../cache/IgniteCacheOffheapManagerImpl.java | 4 +-
.../cache/LocalJoinCachesContext.java | 30 +-
.../processors/cache/StartCacheInfo.java | 25 +
.../processors/cache/WalStateManager.java | 11 +-
.../dht/CacheDistributedGetFutureAdapter.java | 433 ++++++++++-
.../distributed/dht/GridDhtCacheAdapter.java | 22 +-
.../distributed/dht/GridDhtGetSingleFuture.java | 2 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 4 +-
.../cache/distributed/dht/GridDhtTxLocal.java | 7 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 55 +-
.../dht/GridPartitionedGetFuture.java | 571 +++++---------
.../dht/GridPartitionedSingleGetFuture.java | 349 ++++++---
.../dht/atomic/GridDhtAtomicCache.java | 41 +-
.../GridNearAtomicAbstractUpdateRequest.java | 4 +-
.../dht/preloader/GridDhtPartitionDemander.java | 3 +
.../GridDhtPartitionSupplyMessage.java | 3 +
.../GridDhtPartitionsExchangeFuture.java | 11 +-
.../preloader/GridDhtPartitionsFullMessage.java | 5 +-
.../dht/preloader/GridDhtPreloader.java | 86 +-
.../topology/GridClientPartitionTopology.java | 2 +-
.../dht/topology/GridDhtPartitionTopology.java | 4 +-
.../topology/GridDhtPartitionTopologyImpl.java | 17 +-
.../distributed/near/GridNearGetFuture.java | 453 +++--------
...arOptimisticSerializableTxPrepareFuture.java | 14 +-
.../near/GridNearOptimisticTxPrepareFuture.java | 8 +-
.../GridNearPessimisticTxPrepareFuture.java | 8 +-
.../cache/distributed/near/GridNearTxLocal.java | 21 +-
.../near/GridNearTxPrepareRequest.java | 21 +-
.../cache/mvcc/MvccProcessorImpl.java | 6 +
.../cache/persistence/CheckpointFuture.java | 2 +-
.../persistence/DatabaseLifecycleListener.java | 16 +-
.../GridCacheDatabaseSharedManager.java | 24 +-
.../persistence/GridCacheOffheapManager.java | 15 +-
.../cache/persistence/IndexStorage.java | 26 +-
.../cache/persistence/IndexStorageImpl.java | 37 +-
.../UpgradePendingTreeToPerPartitionTask.java | 4 +-
.../cache/transactions/IgniteTxAdapter.java | 31 +-
.../cache/transactions/IgniteTxHandler.java | 24 +-
.../IgniteTxImplicitSingleStateImpl.java | 5 +
.../cache/transactions/IgniteTxLocalState.java | 5 +
.../cache/transactions/IgniteTxStateImpl.java | 7 +-
.../verify/VerifyBackupPartitionsTaskV2.java | 97 ++-
.../cluster/GridClusterStateProcessor.java | 14 +-
.../processors/query/GridQueryIndexing.java | 49 +-
.../processors/query/GridQueryProcessor.java | 181 +++--
.../internal/processors/query/QueryUtils.java | 30 +-
.../schema/SchemaIndexCacheVisitorImpl.java | 3 +-
.../ignite/internal/util/IgniteUtils.java | 66 ++
.../VisorCacheRebalanceCollectorJobResult.java | 91 +++
.../node/VisorCacheRebalanceCollectorTask.java | 194 +++++
.../VisorCacheRebalanceCollectorTaskArg.java | 54 ++
.../VisorCacheRebalanceCollectorTaskResult.java | 92 +++
.../visor/node/VisorNodeBaselineStatus.java | 45 ++
.../visor/node/VisorNodeDataCollectorJob.java | 74 +-
.../node/VisorNodeDataCollectorTaskResult.java | 3 +-
.../internal/visor/util/VisorTaskUtils.java | 43 +
.../internal/visor/verify/CacheFilterEnum.java | 52 ++
.../verify/VisorIdleVerifyDumpTaskArg.java | 30 +-
.../ignite/spi/discovery/DiscoveryDataBag.java | 6 +
.../ignite/spi/discovery/tcp/ServerImpl.java | 41 +-
...RWThroughDisabledTransactionalCacheTest.java | 8 +
...heStoreSessionListenerLifecycleSelfTest.java | 8 +
...reSessionListenerWriteBehindEnabledTest.java | 8 +
.../CacheJdbcStoreSessionListenerSelfTest.java | 8 +
.../igfs/IgfsFragmentizerTopologySelfTest.java | 7 +
...ridFailFastNodeFailureDetectionSelfTest.java | 7 +
.../GridFailoverCustomTopologySelfTest.java | 7 +
.../ignite/internal/GridFailoverSelfTest.java | 7 +
.../GridFailoverTaskWithPredicateSelfTest.java | 7 +
.../internal/GridFailoverTopologySelfTest.java | 7 +
.../internal/GridTaskFailoverSelfTest.java | 7 +
.../IgniteClientReconnectAbstractTest.java | 7 +
.../IgniteClientReconnectApiExceptionTest.java | 1 -
.../IgniteComputeTopologyExceptionTest.java | 7 +
...RoundRobinErrorAfterClientReconnectTest.java | 7 +
.../commandline/CommandHandlerParsingTest.java | 39 +
.../encryption/EncryptedCacheCreateTest.java | 2 -
...mentRequestOfUnknownClassProcessingTest.java | 151 ++++
.../GridDiscoveryManagerAliveCacheSelfTest.java | 7 +
.../GridDiscoveryManagerAttributesSelfTest.java | 7 +
.../IgniteTopologyPrintFormatSelfTest.java | 7 +
.../OptimizedMarshallerNodeFailoverTest.java | 7 +
.../optimized/OptimizedMarshallerTest.java | 6 +-
.../GridCacheTxLoadFromStoreOnLockSelfTest.java | 8 +
.../cache/CacheClientStoreSelfTest.java | 8 +
.../cache/CacheConnectionLeakStoreTxTest.java | 20 +
.../cache/CacheDataRegionConfigurationTest.java | 7 +
.../cache/CacheEventWithTxLabelTest.java | 494 ++++++++++++
.../cache/CacheGetEntryAbstractTest.java | 4 +-
...GetEntryOptimisticReadCommittedSelfTest.java | 36 +
...GetEntryOptimisticReadCommittedSeltTest.java | 36 -
...etEntryOptimisticRepeatableReadSelfTest.java | 36 +
...etEntryOptimisticRepeatableReadSeltTest.java | 36 -
...eGetEntryOptimisticSerializableSelfTest.java | 36 +
...eGetEntryOptimisticSerializableSeltTest.java | 36 -
...etEntryPessimisticReadCommittedSelfTest.java | 36 +
...etEntryPessimisticReadCommittedSeltTest.java | 36 -
...tEntryPessimisticRepeatableReadSelfTest.java | 105 +++
...tEntryPessimisticRepeatableReadSeltTest.java | 40 -
...GetEntryPessimisticSerializableSelfTest.java | 36 +
...GetEntryPessimisticSerializableSeltTest.java | 36 -
.../CacheGetsDistributionAbstractTest.java | 375 +++++++++
.../cache/CacheGroupMetricsMBeanTest.java | 20 +-
...erceptorPartitionCounterLocalSanityTest.java | 23 +
...torPartitionCounterRandomOperationsTest.java | 104 ++-
.../cache/CacheKeepBinaryTransactionTest.java | 8 +-
.../CacheMetricsForClusterGroupSelfTest.java | 101 ++-
.../cache/CacheMetricsManageTest.java | 11 +-
.../cache/CacheNearReaderUpdateTest.java | 6 +
...cheNearUpdateTopologyChangeAbstractTest.java | 7 +
.../cache/CacheNoAffinityExchangeTest.java | 8 +
.../cache/CacheOffheapMapEntrySelfTest.java | 14 +
.../CachePutEventListenerErrorSelfTest.java | 7 +
.../processors/cache/CachePutIfAbsentTest.java | 4 +
.../CacheReadThroughLocalRestartSelfTest.java | 8 +
.../cache/CacheReadThroughRestartSelfTest.java | 11 +
.../cache/CacheRebalancingSelfTest.java | 13 +-
.../cache/CacheRemoveAllSelfTest.java | 9 +
.../CacheSerializableTransactionsTest.java | 7 +
.../cache/CacheStopAndDestroySelfTest.java | 18 +
...heStoreUsageMultinodeDynamicStartTxTest.java | 8 +
...cheStoreUsageMultinodeStaticStartTxTest.java | 8 +
.../CacheTxNotAllowReadFromBackupTest.java | 66 ++
.../cache/CashEventWithTxLabelTest.java | 487 ------------
.../cache/ClusterReadOnlyModeAbstractTest.java | 11 +-
.../processors/cache/CrossCacheLockTest.java | 8 +
.../EntryVersionConsistencyReadThroughTest.java | 22 +
.../GridCacheAbstractFailoverSelfTest.java | 7 +
.../cache/GridCacheAbstractFullApiSelfTest.java | 9 +
.../GridCacheAbstractRemoveFailureTest.java | 7 +
.../cache/GridCacheAbstractSelfTest.java | 4 +-
...eAtomicEntryProcessorDeploymentSelfTest.java | 11 +
.../cache/GridCacheEntryVersionSelfTest.java | 10 +
.../GridCacheInterceptorAbstractSelfTest.java | 9 +
.../GridCacheInterceptorLocalSelfTest.java | 8 +
...dCacheInterceptorLocalWithStoreSelfTest.java | 9 +
...heInterceptorTransactionalRebalanceTest.java | 8 +
.../GridCacheMarshallingNodeJoinSelfTest.java | 8 +
...ridCacheMultinodeUpdateAbstractSelfTest.java | 17 +-
...inodeUpdateNearEnabledNoBackupsSelfTest.java | 6 +-
...CacheMultinodeUpdateNearEnabledSelfTest.java | 13 +-
.../cache/GridCachePartitionedWritesTest.java | 8 +
.../cache/GridCachePutAllFailoverSelfTest.java | 7 +
.../GridCacheReferenceCleanupSelfTest.java | 17 +
.../cache/GridCacheReloadSelfTest.java | 14 +
...ridCacheStoreManagerDeserializationTest.java | 10 +-
...idCacheValueConsistencyAbstractSelfTest.java | 6 +
.../GridCacheVariableTopologySelfTest.java | 7 +
.../cache/GridCacheVersionMultinodeTest.java | 35 +-
.../GridCacheVersionTopologyChangeTest.java | 15 +
...IgniteAbstractDynamicCacheStartFailTest.java | 7 +
.../processors/cache/IgniteCacheGroupsTest.java | 235 +++++-
.../IgniteCacheInterceptorSelfTestSuite.java | 57 +-
...iteCacheInvokeReadThroughSingleNodeTest.java | 46 ++
.../cache/IgniteCacheInvokeReadThroughTest.java | 55 ++
.../IgniteCacheReadThroughEvictionSelfTest.java | 14 +
...acheReadThroughEvictionsVariationsSuite.java | 3 +-
.../IgniteCacheReadThroughStoreCallTest.java | 8 +
.../cache/IgniteCacheStoreCollectionTest.java | 28 +-
.../IgniteCacheTxCopyOnReadDisabledTest.java | 7 +
.../cache/IgniteCacheTxLocalPeekModesTest.java | 8 +
.../cache/IgniteCacheTxLocalStoreValueTest.java | 8 +
.../IgniteCacheTxNearEnabledStoreValueTest.java | 8 +
.../cache/IgniteCacheTxNearPeekModesTest.java | 9 +
.../cache/IgniteCacheTxPeekModesTest.java | 9 +-
.../cache/IgniteCacheTxStoreValueTest.java | 8 +
...IgniteClientCacheInitializationFailTest.java | 72 +-
.../IgniteClientCacheStartFailoverTest.java | 7 +
.../IgniteClusterActivateDeactivateTest.java | 4 +-
.../cache/IgniteDynamicCacheFilterTest.java | 2 +
...ynamicCacheStartCoordinatorFailoverTest.java | 10 +
...ynamicCacheStartFailWithPersistenceTest.java | 4 +
...eDynamicCacheStartNoExchangeTimeoutTest.java | 36 +-
.../cache/IgniteDynamicCacheStartSelfTest.java | 14 +
...niteDynamicCacheWithConfigStartSelfTest.java | 2 +
.../IgniteDynamicClientCacheStartSelfTest.java | 8 +-
...IgniteGetNonPlainKeyReadThroughSelfTest.java | 155 ++++
.../IgniteStartCacheInTransactionSelfTest.java | 3 +
...gniteTopologyValidatorAbstractCacheTest.java | 7 +
.../IgniteTxExceptionAbstractSelfTest.java | 7 +
.../cache/MvccCacheGroupMetricsMBeanTest.java | 29 +
...titionedAtomicCacheGetsDistributionTest.java | 24 +-
...cTxPessimisticCacheGetsDistributionTest.java | 32 +
...onalOptimisticCacheGetsDistributionTest.java | 17 +-
...nalPessimisticCacheGetsDistributionTest.java | 24 +-
...rtitionsExchangeCoordinatorFailoverTest.java | 7 +
...plicatedAtomicCacheGetsDistributionTest.java | 329 +-------
...cTxPessimisticCacheGetsDistributionTest.java | 32 +
...onalOptimisticCacheGetsDistributionTest.java | 9 +-
...nalPessimisticCacheGetsDistributionTest.java | 24 +-
.../SetTxTimeoutOnPartitionMapExchangeTest.java | 7 +
.../cache/WalModeChangeAbstractSelfTest.java | 3 +
.../cache/WalModeChangeAdvancedSelfTest.java | 11 +
...eAbstractDataStructuresFailoverSelfTest.java | 7 +
.../GridCacheSetAbstractSelfTest.java | 2 +-
.../distributed/CacheAffinityEarlyTest.java | 2 +-
...acheAsyncOperationsFailoverAbstractTest.java | 7 +
.../distributed/CacheAsyncOperationsTest.java | 8 +
.../distributed/CacheBaselineTopologyTest.java | 7 +
.../CacheDataLossOnPartitionMoveTest.java | 6 +-
.../distributed/CacheExchangeMergeTest.java | 16 +-
.../CacheGetInsideLockChangingTopologyTest.java | 7 +
.../distributed/CacheGroupsPreloadTest.java | 44 ++
.../CacheLateAffinityAssignmentTest.java | 4 +
...CacheLoadingConcurrentGridStartSelfTest.java | 7 +
.../CachePageWriteLockUnlockTest.java | 6 +-
.../CachePutAllFailoverAbstractTest.java | 7 +
.../cache/distributed/CacheStartOnJoinTest.java | 14 +-
.../CacheTryLockMultithreadedTest.java | 3 +
...tractDistributedByteArrayValuesSelfTest.java | 4 +
.../GridCacheAbstractNodeRestartSelfTest.java | 7 +
...tractPartitionedByteArrayValuesSelfTest.java | 10 +
.../GridCacheClientModesAbstractSelfTest.java | 4 +
.../distributed/GridCacheEventAbstractTest.java | 3 +
.../distributed/GridCacheMixedModeSelfTest.java | 2 +
.../GridCacheMultiNodeAbstractTest.java | 2 +
...titionEvictionDuringReadThroughSelfTest.java | 2 -
...ridCachePartitionNotLoadedEventSelfTest.java | 2 +
.../GridCachePreloadEventsAbstractSelfTest.java | 8 +
...yMetadataUpdateChangingTopologySelfTest.java | 7 +
.../distributed/IgniteCache150ClientsTest.java | 20 +-
...heClientMultiNodeUpdateTopologyLockTest.java | 7 +
...niteCacheClientNodeChangingTopologyTest.java | 7 +
.../IgniteCacheClientReconnectTest.java | 7 +
.../IgniteCacheCreatePutMultiNodeSelfTest.java | 17 +-
.../distributed/IgniteCacheCreatePutTest.java | 11 +
.../IgniteCacheFailedUpdateResponseTest.java | 48 +-
.../distributed/IgniteCacheGetRestartTest.java | 7 +
.../distributed/IgniteCachePrimarySyncTest.java | 53 +-
.../IgniteCacheReadFromBackupTest.java | 89 ++-
.../IgniteCacheSingleGetMessageTest.java | 33 +-
.../IgniteCacheSizeFailoverTest.java | 7 +
.../IgniteCacheThreadLocalTxTest.java | 4 +
.../IgnitePessimisticTxSuspendResumeTest.java | 5 +
.../IgniteTxCachePrimarySyncTest.java | 96 ++-
...teSynchronizationModesMultithreadedTest.java | 85 +-
.../IgniteTxConcurrentRemoveObjectsTest.java | 52 +-
.../IgniteTxPreloadAbstractTest.java | 12 +-
.../IgniteTxRemoveTimeoutObjectsTest.java | 12 +
.../dht/CacheGetReadFromBackupFailoverTest.java | 257 ++++++
...tPartitionedOnlyByteArrayValuesSelfTest.java | 3 -
...heAbstractTransformWriteThroughSelfTest.java | 3 +
...dCachePartitionedTopologyChangeSelfTest.java | 7 +
...gniteAtomicLongChangingTopologySelfTest.java | 7 +
.../IgniteCacheCrossCacheTxFailoverTest.java | 7 +
.../dht/IgniteCacheLockFailoverSelfTest.java | 15 +
.../dht/IgniteCacheMultiTxLockSelfTest.java | 24 +-
.../IgniteCachePutRetryAbstractSelfTest.java | 7 +
.../IgniteCacheTopologySplitAbstractTest.java | 7 +
.../dht/IgniteCacheTxRecoveryRollbackTest.java | 7 +
.../dht/IgniteCrossCacheMvccTxSelfTest.java | 39 +
.../dht/IgniteCrossCacheTxAbstractSelfTest.java | 181 +++++
.../dht/IgniteCrossCacheTxSelfTest.java | 155 +---
.../dht/NotMappedPartitionInTxTest.java | 149 ++--
...eAtomicInvalidPartitionHandlingSelfTest.java | 7 +
.../near/GridCacheNearOnlyTopologySelfTest.java | 15 +
.../near/GridCacheNearTxPreloadSelfTest.java | 8 +
.../near/GridCachePutArrayValueSelfTest.java | 9 +
.../near/IgniteCacheNearOnlyTxTest.java | 8 +
.../near/IgniteCacheNearReadCommittedTest.java | 8 +
.../rebalancing/CacheManualRebalancingTest.java | 7 +-
...cheRebalancingPartitionCountersMvccTest.java | 29 +
...idCacheRebalancingPartitionCountersTest.java | 9 +
.../GridCacheRebalancingSyncSelfTest.java | 7 +
...cheRebalancingWithAsyncClearingMvccTest.java | 36 +
...idCacheRebalancingWithAsyncClearingTest.java | 9 +
...balanceOnCachesStoppingOrDestroyingTest.java | 279 +++++++
...heReplicatedMvccTxMultiThreadedSelfTest.java | 81 ++
...eReplicatedMvccTxSingleThreadedSelfTest.java | 77 ++
...ridCacheReplicatedMvccTxTimeoutSelfTest.java | 44 ++
...dCacheReplicatedTxMultiThreadedSelfTest.java | 25 -
...CacheReplicatedTxSingleThreadedSelfTest.java | 43 +-
.../GridCacheReplicatedPreloadSelfTest.java | 133 +---
.../PageEvictionMultinodeAbstractTest.java | 4 +
.../IgniteCacheLoadAllAbstractTest.java | 10 +-
.../IgniteCacheTxLoaderWriterTest.java | 8 +
.../IgniteCacheTxLocalLoadAllTest.java | 7 +
...niteCacheTxLocalNoLoadPreviousValueTest.java | 8 +
.../IgniteCacheTxLocalNoReadThroughTest.java | 8 +
.../IgniteCacheTxLocalNoWriteThroughTest.java | 8 +
...cheTxNearEnabledNoLoadPreviousValueTest.java | 8 +
...iteCacheTxNearEnabledNoWriteThroughTest.java | 8 +
.../IgniteCacheTxNoLoadPreviousValueTest.java | 8 +
.../IgniteCacheTxNoReadThroughTest.java | 8 +
.../IgniteCacheTxNoWriteThroughTest.java | 8 +
.../IgniteCacheTxStoreSessionTest.java | 8 +
...TxStoreSessionWriteBehindCoalescingTest.java | 8 +
...gniteCacheTxStoreSessionWriteBehindTest.java | 8 +
.../local/GridCacheDaemonNodeLocalSelfTest.java | 8 +
.../GridCacheLocalByteArrayValuesSelfTest.java | 3 +
.../local/GridCacheLocalEventSelfTest.java | 2 +-
.../cache/mvcc/CacheMvccAbstractTest.java | 7 +
...eBaselineAffinityTopologyActivationTest.java | 7 +
...heConfigurationFileConsistencyCheckTest.java | 7 +
.../IgnitePdsCacheRebalancingAbstractTest.java | 7 +
.../IgnitePdsContinuousRestartTest.java | 7 +
.../persistence/IgnitePdsTaskCancelingTest.java | 3 +
...lWalModeChangeDuringRebalancingSelfTest.java | 102 ++-
...itePdsCacheWalDisabledOnRebalancingTest.java | 266 +++++++
...tePdsRebalancingOnNotStableTopologyTest.java | 7 +
.../db/wal/IgniteWalFlushFailoverTest.java | 7 +
...lFlushMultiNodeFailoverAbstractSelfTest.java | 7 +
.../persistence/db/wal/WalCompactionTest.java | 7 +
.../IgniteChangeGlobalStateFailOverTest.java | 7 +
.../IgniteNoParrallelClusterIsAllowedTest.java | 7 +
...gniteAbstractStandByClientReconnectTest.java | 7 +
.../cache/query/CacheScanQueryFailoverTest.java | 7 +
.../cache/query/IndexingSpiQueryTxSelfTest.java | 7 +
...tinuousQueryAsyncFailoverMvccTxSelfTest.java | 5 -
...ContinuousQueryFailoverAbstractSelfTest.java | 7 +
...heContinuousQueryFailoverMvccTxSelfTest.java | 5 -
...heContinuousWithTransformerFailoverTest.java | 7 +
.../ClientReconnectContinuousQueryTest.java | 7 +
...IgniteCacheContinuousQueryReconnectTest.java | 7 +
.../GridCacheWriteBehindStoreAbstractTest.java | 8 +
.../GridCacheWriteBehindStoreLocalTest.java | 8 +
...heWriteBehindStoreMultithreadedSelfTest.java | 35 +-
...BehindStorePartitionedMultiNodeSelfTest.java | 8 +
...CacheClientWriteBehindStoreAbstractTest.java | 8 +
...IntegrityWithPrimaryIndexCorruptionTest.java | 9 +
.../cache/transactions/TxLabelTest.java | 23 +-
...OptimisticPrepareOnUnstableTopologyTest.java | 7 +
.../TxRollbackAsyncNearCacheTest.java | 9 +
.../cache/transactions/TxRollbackAsyncTest.java | 74 +-
.../TxRollbackOnIncorrectParamsTest.java | 17 +-
.../transactions/TxRollbackOnTimeoutTest.java | 9 +
.../TxRollbackOnTopologyChangeTest.java | 7 +
.../transactions/TxStateChangeEventTest.java | 78 +-
...WithSmallTimeoutAndContentionOneKeyTest.java | 10 +
...ersionedEntryLocalTransactionalSelfTest.java | 9 +
.../continuous/GridEventConsumeSelfTest.java | 7 +
.../database/IndexStorageSelfTest.java | 21 +-
...rClientReconnectAfterClusterRestartTest.java | 7 +
.../igfs/IgfsBackupFailoverSelfTest.java | 7 +
.../top/CacheTopologyCommandHandlerTest.java | 7 +
...GridServiceProxyClientReconnectSelfTest.java | 7 +
.../ServiceDeploymentOnActivationTest.java | 2 +-
.../session/GridSessionJobFailoverSelfTest.java | 7 +
...alingCollisionSpiCustomTopologySelfTest.java | 7 +
.../tcp/TcpCommunicationSpiDropNodesTest.java | 7 +
.../TcpCommunicationSpiFaultyClientTest.java | 7 +
.../TcpCommunicationSpiSkipMessageSendTest.java | 7 +
...gniteClientReconnectMassiveShutdownTest.java | 7 +
...pClientDiscoveryMarshallerCheckSelfTest.java | 7 +
.../tcp/TcpClientDiscoverySpiSelfTest.java | 7 +
.../tcp/TcpDiscoveryMultiThreadedTest.java | 19 +-
...veryNodeAttributesUpdateOnReconnectTest.java | 7 +
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 7 +
.../TcpDiscoverySpiFailureTimeoutSelfTest.java | 7 +
.../tcp/TcpDiscoverySpiReconnectDelayTest.java | 7 +
...nLoadBalancingSpiTopologyChangeSelfTest.java | 7 +
.../testframework/MvccFeatureChecker.java | 30 +-
.../testframework/junits/GridAbstractTest.java | 10 +-
.../junits/TestFailingFailureHandler.java | 50 ++
.../IgniteBasicWithPersistenceTestSuite.java | 2 +
.../IgniteBinaryObjectsCacheTestSuite3.java | 18 +-
.../testsuites/IgniteCacheMvccTestSuite2.java | 2 +-
.../testsuites/IgniteCacheMvccTestSuite3.java | 133 ++++
.../testsuites/IgniteCacheMvccTestSuite4.java | 197 +++++
.../testsuites/IgniteCacheMvccTestSuite5.java | 94 +++
.../testsuites/IgniteCacheMvccTestSuite6.java | 92 +++
.../testsuites/IgniteCacheMvccTestSuite7.java | 76 ++
.../testsuites/IgniteCacheMvccTestSuite9.java | 57 ++
.../IgniteCacheNearOnlySelfTestSuite.java | 31 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 3 +
.../testsuites/IgniteCacheTestSuite2.java | 8 +-
.../testsuites/IgniteCacheTestSuite3.java | 161 ++--
.../testsuites/IgniteCacheTestSuite4.java | 354 +++++----
.../testsuites/IgniteCacheTestSuite5.java | 79 +-
.../testsuites/IgniteCacheTestSuite6.java | 83 +-
.../testsuites/IgniteCacheTestSuite7.java | 56 +-
.../testsuites/IgniteCacheTestSuite9.java | 33 +-
.../IgniteCacheWriteBehindTestSuite.java | 33 +-
.../testsuites/IgniteKernalSelfTestSuite.java | 2 +
.../ignite/testsuites/IgnitePdsTestSuite4.java | 9 +
.../ignite/util/GridCommandHandlerSslTest.java | 88 +++
.../ignite/util/GridCommandHandlerTest.java | 184 ++++-
.../util/GridTopologyHeapSizeSelfTest.java | 7 +
.../HadoopMapReduceErrorResilienceTest.java | 7 +
.../IgniteHadoopFileSystemAbstractSelfTest.java | 6 +
.../taskexecutor/HadoopExecutorServiceTest.java | 7 +
.../query/h2/DmlStatementsProcessor.java | 12 +-
.../processors/query/h2/H2RowCache.java | 19 +-
.../processors/query/h2/H2RowCacheRegistry.java | 46 +-
.../internal/processors/query/h2/H2Schema.java | 6 +-
.../processors/query/h2/H2TableDescriptor.java | 35 +-
.../processors/query/h2/H2TableEngine.java | 2 +-
.../internal/processors/query/h2/H2Utils.java | 27 +
.../processors/query/h2/IgniteH2Indexing.java | 211 +++--
.../processors/query/h2/IndexBuildClosure.java | 54 ++
.../query/h2/IndexRebuildFullClosure.java | 49 ++
.../query/h2/IndexRebuildPartialClosure.java | 76 ++
.../query/h2/RebuildIndexFromHashClosure.java | 47 --
.../processors/query/h2/database/H2Tree.java | 14 +
.../query/h2/database/H2TreeClientIndex.java | 114 +++
.../query/h2/database/H2TreeIndex.java | 177 ++---
.../query/h2/database/H2TreeIndexBase.java | 53 ++
.../query/h2/ddl/DdlStatementsProcessor.java | 71 +-
.../processors/query/h2/dml/UpdatePlan.java | 2 +-
.../query/h2/dml/UpdatePlanBuilder.java | 89 ++-
.../query/h2/opt/GridH2RowDescriptor.java | 14 +-
.../query/h2/opt/GridH2SystemIndexFactory.java | 10 +-
.../processors/query/h2/opt/GridH2Table.java | 95 ++-
.../query/h2/sql/GridSqlQueryParser.java | 10 +-
.../h2/twostep/GridReduceQueryExecutor.java | 648 +---------------
.../h2/twostep/ReducePartitionMapResult.java | 73 ++
.../query/h2/twostep/ReducePartitionMapper.java | 638 +++++++++++++++
.../h2/twostep/ReducePartitionsSpecializer.java | 61 ++
.../visor/verify/ValidateIndexesClosure.java | 6 +-
.../ClientReconnectAfterClusterRestartTest.java | 7 +
...dCacheDynamicLoadOnClientPersistentTest.java | 44 ++
.../cache/GridCacheDynamicLoadOnClientTest.java | 304 ++++++++
.../cache/IgniteCrossCachesJoinsQueryTest.java | 7 +
.../cache/IgniteDynamicSqlRestoreTest.java | 180 ++++-
.../cache/QueryEntityCaseMismatchTest.java | 7 +
...ynamicColumnsAbstractConcurrentSelfTest.java | 21 +
.../cache/index/H2DynamicTableSelfTest.java | 22 +
.../cache/index/SchemaExchangeSelfTest.java | 149 +++-
.../db/wal/IgniteWalRecoveryTest.java | 7 +
.../query/IgniteSqlSplitterSelfTest.java | 4 +-
.../query/SqlIllegalSchemaSelfTest.java | 7 +
.../query/h2/GridIndexRebuildSelfTest.java | 11 +-
.../IgniteBinaryCacheQueryTestSuite.java | 5 +
.../ml/clustering/kmeans/KMeansTrainer.java | 9 +-
.../boosting/GDBBinaryClassifierTrainer.java | 12 +-
.../boosting/GDBLearningStrategy.java | 21 +-
.../boosting/GDBRegressionTrainer.java | 6 +
.../ml/composition/boosting/GDBTrainer.java | 20 +-
.../convergence/ConvergenceChecker.java | 8 +-
.../simple/ConvergenceCheckerStub.java | 3 +-
.../org/apache/ignite/ml/dataset/Dataset.java | 61 +-
.../ignite/ml/dataset/DatasetBuilder.java | 17 +-
.../ignite/ml/dataset/DatasetFactory.java | 174 ++++-
.../ml/dataset/PartitionContextBuilder.java | 11 +-
.../ignite/ml/dataset/PartitionDataBuilder.java | 12 +-
.../ignite/ml/dataset/UpstreamTransformer.java | 22 +-
.../ml/dataset/UpstreamTransformerBuilder.java | 72 ++
.../ml/dataset/UpstreamTransformerChain.java | 153 ----
.../BootstrappedDatasetBuilder.java | 15 +-
.../dataset/impl/cache/CacheBasedDataset.java | 49 +-
.../impl/cache/CacheBasedDatasetBuilder.java | 40 +-
.../dataset/impl/cache/util/ComputeUtils.java | 128 +--
.../ml/dataset/impl/local/LocalDataset.java | 18 +-
.../dataset/impl/local/LocalDatasetBuilder.java | 118 +--
.../ml/dataset/primitive/DatasetWrapper.java | 5 +-
...eatureMatrixWithLabelsOnHeapDataBuilder.java | 7 +-
.../builder/context/EmptyContextBuilder.java | 3 +-
.../builder/data/SimpleDatasetDataBuilder.java | 5 +-
.../data/SimpleLabeledDatasetDataBuilder.java | 5 +-
.../DefaultLearningEnvironmentBuilder.java | 178 +++++
.../ml/environment/LearningEnvironment.java | 19 +-
.../environment/LearningEnvironmentBuilder.java | 167 ++--
.../ml/environment/logging/ConsoleLogger.java | 3 +
.../parallelism/ParallelismStrategy.java | 1 -
.../ignite/ml/inference/ModelDescriptor.java | 8 +
.../reader/FileSystemInfModelReader.java | 2 +-
.../reader/ModelStorageInfModelReader.java | 64 ++
.../storage/IgniteModelDescriptorStorage.java | 57 --
.../storage/LocalModelDescriptorStorage.java | 45 --
.../storage/ModelDescriptorStorage.java | 48 --
.../IgniteModelDescriptorStorage.java | 66 ++
.../descriptor/LocalModelDescriptorStorage.java | 52 ++
.../descriptor/ModelDescriptorStorage.java | 58 ++
.../ModelDescriptorStorageFactory.java | 43 +
.../storage/descriptor/package-info.java | 22 +
.../storage/model/DefaultModelStorage.java | 313 ++++++++
.../ml/inference/storage/model/Directory.java | 42 +
.../ignite/ml/inference/storage/model/File.java | 48 ++
.../storage/model/FileOrDirectory.java | 41 +
.../model/IgniteModelStorageProvider.java | 58 ++
.../model/LocalModelStorageProvider.java | 56 ++
.../inference/storage/model/ModelStorage.java | 115 +++
.../storage/model/ModelStorageFactory.java | 42 +
.../storage/model/ModelStorageProvider.java | 56 ++
.../inference/storage/model/package-info.java | 22 +
.../ml/inference/storage/package-info.java | 2 +-
.../java/org/apache/ignite/ml/knn/KNNUtils.java | 9 +-
.../ml/knn/ann/ANNClassificationTrainer.java | 10 +-
.../KNNClassificationTrainer.java | 8 +-
.../ml/knn/regression/KNNRegressionTrainer.java | 9 +-
.../ml/math/functions/IgniteFunction.java | 12 +-
.../ignite/ml/math/isolve/lsqr/LSQROnHeap.java | 6 +-
.../ml/math/primitives/vector/VectorUtils.java | 11 +
.../ignite/ml/multiclass/OneVsRestTrainer.java | 3 +-
.../gaussian/GaussianNaiveBayesTrainer.java | 11 +-
.../org/apache/ignite/ml/nn/MLPTrainer.java | 1 +
.../org/apache/ignite/ml/pipeline/Pipeline.java | 14 +
.../ml/preprocessing/PreprocessingTrainer.java | 66 +-
.../binarization/BinarizationTrainer.java | 5 +-
.../preprocessing/encoding/EncoderTrainer.java | 12 +-
.../preprocessing/imputing/ImputerTrainer.java | 10 +-
.../maxabsscaling/MaxAbsScalerTrainer.java | 10 +-
.../minmaxscaling/MinMaxScalerTrainer.java | 12 +-
.../normalization/NormalizationTrainer.java | 5 +-
.../standardscaling/StandardScalerTrainer.java | 14 +-
.../linear/LinearRegressionLSQRTrainer.java | 1 +
.../logistic/LogisticRegressionModel.java | 205 +++++
.../logistic/LogisticRegressionSGDTrainer.java | 246 ++++++
.../binomial/LogisticRegressionModel.java | 205 -----
.../binomial/LogisticRegressionSGDTrainer.java | 246 ------
.../logistic/binomial/package-info.java | 22 -
.../LogRegressionMultiClassModel.java | 115 ---
.../LogRegressionMultiClassTrainer.java | 268 -------
.../logistic/multiclass/package-info.java | 22 -
.../LabelPartitionDataBuilderOnHeap.java | 8 +-
...abeledDatasetPartitionDataBuilderOnHeap.java | 7 +-
.../svm/SVMLinearBinaryClassificationModel.java | 194 -----
.../SVMLinearBinaryClassificationTrainer.java | 355 ---------
.../ml/svm/SVMLinearClassificationModel.java | 194 +++++
.../ml/svm/SVMLinearClassificationTrainer.java | 356 +++++++++
.../SVMLinearMultiClassClassificationModel.java | 114 ---
...VMLinearMultiClassClassificationTrainer.java | 268 -------
.../ignite/ml/trainers/DatasetTrainer.java | 28 +-
.../ignite/ml/trainers/TrainerTransformers.java | 68 +-
.../BaggingUpstreamTransformer.java | 29 +-
.../org/apache/ignite/ml/tree/DecisionTree.java | 7 +
.../tree/DecisionTreeClassificationTrainer.java | 6 +
.../ml/tree/DecisionTreeRegressionTrainer.java | 6 +
.../GDBBinaryClassifierOnTreesTrainer.java | 6 +
.../boosting/GDBOnTreesLearningStrategy.java | 3 +-
.../boosting/GDBRegressionOnTreesTrainer.java | 6 +
.../ml/tree/data/DecisionTreeDataBuilder.java | 7 +-
.../tree/randomforest/RandomForestTrainer.java | 1 +
.../apache/ignite/ml/util/plugin/MLPlugin.java | 30 +
.../ml/util/plugin/MLPluginConfiguration.java | 77 ++
.../ignite/ml/util/plugin/MLPluginProvider.java | 195 +++++
.../org.apache.ignite.plugin.PluginProvider | 1 +
.../java/org/apache/ignite/ml/TestUtils.java | 79 ++
.../ignite/ml/common/CollectionsTest.java | 19 +-
.../ignite/ml/common/LocalModelsTest.java | 54 +-
.../MeanAbsValueConvergenceCheckerTest.java | 10 +-
.../MedianOfMedianConvergenceCheckerTest.java | 10 +-
.../cache/CacheBasedDatasetBuilderTest.java | 11 +-
.../impl/cache/CacheBasedDatasetTest.java | 11 +-
.../impl/cache/util/ComputeUtilsTest.java | 16 +-
.../impl/local/LocalDatasetBuilderTest.java | 14 +-
.../ml/dataset/primitive/SimpleDatasetTest.java | 2 +
.../primitive/SimpleLabeledDatasetTest.java | 11 +-
.../LearningEnvironmentBuilderTest.java | 36 +-
.../ml/environment/LearningEnvironmentTest.java | 130 +++-
.../ignite/ml/inference/InferenceTestSuite.java | 4 +-
.../storage/model/AbstractModelStorageTest.java | 142 ++++
.../storage/model/DefaultModelStorageTest.java | 143 ++++
.../ml/math/isolve/lsqr/LSQROnHeapTest.java | 4 +
.../ml/multiclass/OneVsRestTrainerTest.java | 4 +-
.../ignite/ml/pipeline/PipelineMdlTest.java | 2 +-
.../apache/ignite/ml/pipeline/PipelineTest.java | 2 +-
.../binarization/BinarizationTrainerTest.java | 3 +
.../encoding/EncoderTrainerTest.java | 5 +
.../imputing/ImputerTrainerTest.java | 2 +
.../maxabsscaling/MaxAbsScalerTrainerTest.java | 2 +
.../minmaxscaling/MinMaxScalerTrainerTest.java | 2 +
.../normalization/NormalizationTrainerTest.java | 2 +
.../StandardScalerTrainerTest.java | 3 +
.../ml/regressions/RegressionsTestSuite.java | 4 +-
.../linear/LinearRegressionModelTest.java | 23 +-
.../logistic/LogRegMultiClassTrainerTest.java | 141 ----
.../logistic/LogisticRegressionModelTest.java | 1 -
.../LogisticRegressionSGDTrainerTest.java | 4 +-
.../scoring/evaluator/EvaluatorTest.java | 11 +-
.../ignite/ml/svm/SVMBinaryTrainerTest.java | 14 +-
.../org/apache/ignite/ml/svm/SVMModelTest.java | 36 +-
.../ignite/ml/svm/SVMMultiClassTrainerTest.java | 100 ---
.../org/apache/ignite/ml/svm/SVMTestSuite.java | 1 -
.../apache/ignite/ml/trainers/BaggingTest.java | 34 +-
.../ApiParity/CacheConfigurationParityTest.cs | 4 +-
.../ApiParity/DataStorageMetricsParityTest.cs | 5 +-
modules/web-console/backend/app/settings.js | 12 +-
.../docker/compose/docker-compose.yml | 3 +-
.../components/modal-import-models/service.js | 32 +-
.../app/components/ui-grid/controller.js | 10 +
.../frontend/app/components/ui-grid/style.scss | 1 +
.../app/modules/agent/AgentManager.service.js | 2 +-
modules/web-console/frontend/app/types/index.ts | 9 +-
modules/web-console/frontend/app/vendor.js | 2 +
modules/web-console/frontend/package.json | 3 +-
.../cache/IgniteGetAllTxBenchmark.java | 50 ++
.../zk/internal/ZookeeperDiscoveryImpl.java | 21 +
.../zk/internal/ZookeeperDiscoverySpiTest.java | 7 +
634 files changed, 18980 insertions(+), 9083 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/89ec0339/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/89ec0339/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/89ec0339/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/89ec0339/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridClientPartitionTopology.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/89ec0339/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
[22/50] [abbrv] ignite git commit: IGNITE-10386 Add mode when WAL
won't be disabled during rebalancing caused by BLT change
Posted by sb...@apache.org.
IGNITE-10386 Add mode when WAL won't be disabled during rebalancing caused by BLT change
Signed-off-by: Ivan Rakov <ir...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7f758bfc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7f758bfc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7f758bfc
Branch: refs/heads/ignite-10044
Commit: 7f758bfcb7038b9ef45786bd0148ed4bd9e8c9cf
Parents: ea872cc
Author: Andrey Kuznetsov <st...@gmail.com>
Authored: Tue Dec 4 19:46:45 2018 +0300
Committer: Ivan Rakov <ir...@apache.org>
Committed: Tue Dec 4 19:46:45 2018 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 7 ++
.../processors/cache/WalStateManager.java | 7 +-
.../GridDhtPartitionsExchangeFuture.java | 2 +-
...lWalModeChangeDuringRebalancingSelfTest.java | 102 ++++++++++++++++++-
4 files changed, 114 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f758bfc/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index d70162a..9979ee1 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -260,6 +260,13 @@ public final class IgniteSystemProperties {
public static final String IGNITE_TX_DEADLOCK_DETECTION_TIMEOUT = "IGNITE_TX_DEADLOCK_DETECTION_TIMEOUT";
/**
+ * System property to enable pending transaction tracker.
+ * Affects impact of {@link IgniteSystemProperties#IGNITE_DISABLE_WAL_DURING_REBALANCING} property:
+ * if this property is set, WAL anyway won't be disabled during rebalancing triggered by baseline topology change.
+ */
+ public static final String IGNITE_PENDING_TX_TRACKER_ENABLED = "IGNITE_PENDING_TX_TRACKER_ENABLED";
+
+ /**
* System property to override multicast group taken from configuration.
* Used for testing purposes.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f758bfc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/WalStateManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/WalStateManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/WalStateManager.java
index ed62cad..0bcd07da 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/WalStateManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/WalStateManager.java
@@ -387,9 +387,12 @@ public class WalStateManager extends GridCacheSharedManagerAdapter {
* in OWNING state if such feature is enabled.
*
* @param topVer Topology version.
+ * @param changedBaseline The exchange is caused by Baseline Topology change.
*/
- public void changeLocalStatesOnExchangeDone(AffinityTopologyVersion topVer) {
- if (!IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_DISABLE_WAL_DURING_REBALANCING, false))
+ public void changeLocalStatesOnExchangeDone(AffinityTopologyVersion topVer, boolean changedBaseline) {
+ if (changedBaseline
+ && IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_PENDING_TX_TRACKER_ENABLED)
+ || !IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_DISABLE_WAL_DURING_REBALANCING, false))
return;
Set<Integer> grpsToEnableWal = new HashSet<>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f758bfc/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 1eba8b4..ffc55a9 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
@@ -2102,7 +2102,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
}
if (changedAffinity())
- cctx.walState().changeLocalStatesOnExchangeDone(res);
+ cctx.walState().changeLocalStatesOnExchangeDone(res, changedBaseline());
}
final Throwable err0 = err;
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f758bfc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java
index 56426f3..04af1cc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java
@@ -23,6 +23,7 @@ import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.file.OpenOption;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
@@ -51,6 +52,7 @@ import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.spi.IgniteSpiException;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Assert;
@@ -64,6 +66,12 @@ public class LocalWalModeChangeDuringRebalancingSelfTest extends GridCommonAbstr
private static boolean disableWalDuringRebalancing = true;
/** */
+ private static boolean enablePendingTxTracker = false;
+
+ /** */
+ private static int dfltCacheBackupCnt = 0;
+
+ /** */
private static final AtomicReference<CountDownLatch> supplyMessageLatch = new AtomicReference<>();
/** */
@@ -92,7 +100,8 @@ public class LocalWalModeChangeDuringRebalancingSelfTest extends GridCommonAbstr
cfg.setCacheConfiguration(
new CacheConfiguration(DEFAULT_CACHE_NAME)
// Test checks internal state before and after rebalance, so it is configured to be triggered manually
- .setRebalanceDelay(-1),
+ .setRebalanceDelay(-1)
+ .setBackups(dfltCacheBackupCnt),
new CacheConfiguration(REPL_CACHE)
.setRebalanceDelay(-1)
@@ -147,6 +156,9 @@ public class LocalWalModeChangeDuringRebalancingSelfTest extends GridCommonAbstr
System.setProperty(IgniteSystemProperties.IGNITE_DISABLE_WAL_DURING_REBALANCING,
Boolean.toString(disableWalDuringRebalancing));
+ System.setProperty(IgniteSystemProperties.IGNITE_PENDING_TX_TRACKER_ENABLED,
+ Boolean.toString(enablePendingTxTracker));
+
return cfg;
}
@@ -184,6 +196,17 @@ public class LocalWalModeChangeDuringRebalancingSelfTest extends GridCommonAbstr
cleanPersistenceDir();
disableWalDuringRebalancing = true;
+ enablePendingTxTracker = false;
+ dfltCacheBackupCnt = 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ super.afterTestsStopped();
+
+ System.clearProperty(IgniteSystemProperties.IGNITE_DISABLE_WAL_DURING_REBALANCING);
+
+ System.clearProperty(IgniteSystemProperties.IGNITE_PENDING_TX_TRACKER_ENABLED);
}
/**
@@ -286,6 +309,60 @@ public class LocalWalModeChangeDuringRebalancingSelfTest extends GridCommonAbstr
/**
* @throws Exception If failed.
*/
+ public void testWalDisabledDuringRebalancingWithPendingTxTracker() throws Exception {
+ enablePendingTxTracker = true;
+ dfltCacheBackupCnt = 2;
+
+ Ignite ignite = startGrids(3);
+
+ ignite.cluster().active(true);
+
+ ignite.cluster().setBaselineTopology(3);
+
+ IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
+
+ stopGrid(2);
+
+ awaitExchange((IgniteEx)ignite);
+
+ doLoad(cache, 4, 10_000);
+
+ IgniteEx newIgnite = startGrid(2);
+
+ awaitExchange(newIgnite);
+
+ CacheGroupContext grpCtx = newIgnite.cachex(DEFAULT_CACHE_NAME).context().group();
+
+ assertFalse(grpCtx.walEnabled());
+
+ long rebalanceStartedTs = System.currentTimeMillis();
+
+ for (Ignite g : G.allGrids())
+ g.cache(DEFAULT_CACHE_NAME).rebalance();
+
+ awaitPartitionMapExchange();
+
+ assertTrue(grpCtx.walEnabled());
+
+ long rebalanceFinishedTs = System.currentTimeMillis();
+
+ CheckpointHistory cpHist =
+ ((GridCacheDatabaseSharedManager)newIgnite.context().cache().context().database()).checkpointHistory();
+
+ assertNotNull(cpHist);
+
+ // Ensure there was a checkpoint on WAL re-activation.
+ assertEquals(
+ 1,
+ cpHist.checkpoints()
+ .stream()
+ .filter(ts -> rebalanceStartedTs <= ts && ts <= rebalanceFinishedTs)
+ .count());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testLocalAndGlobalWalStateInterdependence() throws Exception {
Ignite ignite = startGrids(3);
@@ -532,6 +609,29 @@ public class LocalWalModeChangeDuringRebalancingSelfTest extends GridCommonAbstr
}
/**
+ * Put random values to cache in multiple threads until time interval given expires.
+ *
+ * @param cache Cache to modify.
+ * @param threadCnt Number ot threads to be used.
+ * @param duration Time interval in milliseconds.
+ * @throws Exception When something goes wrong.
+ */
+ private void doLoad(IgniteCache<Integer, Integer> cache, int threadCnt, long duration) throws Exception {
+ GridTestUtils.runMultiThreaded(() -> {
+ long stopTs = U.currentTimeMillis() + duration;
+
+ int keysCnt = getKeysCount();
+
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+ do {
+ cache.put(rnd.nextInt(keysCnt), rnd.nextInt());
+ }
+ while (U.currentTimeMillis() < stopTs);
+ }, threadCnt, "load-cache");
+ }
+
+ /**
*
*/
private static class TestFileIOFactory implements FileIOFactory {
[08/50] [abbrv] ignite git commit: IGNITE-10422 Make
ignite_inspection.xml configuration default on the project level. - Fixes
#5540.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/504393f6/idea/ignite_inspections.xml
----------------------------------------------------------------------
diff --git a/idea/ignite_inspections.xml b/idea/ignite_inspections.xml
deleted file mode 100644
index 9695fca..0000000
--- a/idea/ignite_inspections.xml
+++ /dev/null
@@ -1,772 +0,0 @@
-<profile version="1.0">
- <option name="myName" value="ignite_inspections" />
- <inspection_tool class="AbstractMethodCallInConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="AccessorLikeMethodIsEmptyParen" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AccessorLikeMethodIsUnit" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintAddJavascriptInterface" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintAllowAllHostnameVerifier" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintAlwaysShowAction" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintAppCompatMethod" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintAuthLeak" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintBadHostnameVerifier" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintBatteryLife" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintCommitPrefEdits" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintCommitTransaction" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintCustomViewStyleable" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintCutPasteId" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintDefaultLocale" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintDrawAllocation" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintExportedContentProvider" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintExportedPreferenceActivity" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintExportedReceiver" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintExportedService" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintFloatMath" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintGetInstance" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintGifUsage" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintGoogleAppIndexingUrlError" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintGoogleAppIndexingWarning" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintGrantAllUris" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintHandlerLeak" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintIconColors" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintIconDensities" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintIconDipSize" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintIconDuplicates" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintIconDuplicatesConfig" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintIconExtension" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintIconLauncherShape" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintIconLocation" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintIconMissingDensityFolder" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintIconMixedNinePatch" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintIconNoDpi" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintIconXmlAndPng" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintInconsistentLayout" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintInflateParams" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintInlinedApi" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintInvalidUsesTagAttribute" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintJavascriptInterface" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintLocalSuppress" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintLogTagMismatch" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintLongLogTag" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintMergeRootFrame" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintMissingIntentFilterForMediaSearch" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintMissingMediaBrowserServiceIntentFilter" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintMissingOnPlayFromSearch" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintMissingSuperCall" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintNewApi" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintOverdraw" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintOverride" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintOverrideAbstract" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintPackageManagerGetSignatures" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintParcelClassLoader" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintParcelCreator" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintPendingBindings" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintPluralsCandidate" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintPrivateResource" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintRecycle" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintRecyclerView" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintRegistered" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintRequiredSize" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintRtlCompat" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintRtlEnabled" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintRtlHardcoded" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintRtlSymmetry" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintSQLiteString" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintSSLCertificateSocketFactoryCreateSocket" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintSSLCertificateSocketFactoryGetInsecure" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintSdCardPath" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintSecureRandom" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintServiceCast" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintSetJavaScriptEnabled" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintSetTextI18n" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintSetWorldReadable" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintSetWorldWritable" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintShiftFlags" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintShortAlarm" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintShowToast" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintSimpleDateFormat" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintStringFormatCount" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintStringFormatInvalid" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintStringFormatMatches" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintSupportAnnotationUsage" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintSuspiciousImport" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintSwitchIntDef" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintTrustAllX509TrustManager" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintUniqueConstants" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintUnlocalizedSms" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintUnprotectedSMSBroadcastReceiver" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintUnsafeDynamicallyLoadedCode" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintUnsafeNativeCodeLocation" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintUnsafeProtectedBroadcastReceiver" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintUnusedAttribute" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintUseSparseArrays" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintUseValueOf" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintValidFragment" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintViewConstructor" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintViewHolder" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintViewTag" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintWorldReadableFiles" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintWorldWriteableFiles" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintWrongCall" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidKLintWrongViewCast" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintAaptCrash" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintAccidentalOctal" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintAdapterViewChildren" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintAddJavascriptInterface" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintAllowAllHostnameVerifier" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintAllowBackup" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintAlwaysShowAction" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintAppCompatMethod" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintAppCompatResource" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintAssert" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintAuthLeak" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintBadHostnameVerifier" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintBatteryLife" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintButtonCase" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintButtonOrder" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintButtonStyle" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintByteOrderMark" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintCommitPrefEdits" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintCommitTransaction" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintContentDescription" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintCustomViewStyleable" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintCutPasteId" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintDefaultLocale" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintDeprecated" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintDeviceAdmin" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintDisableBaselineAlignment" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintDrawAllocation" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintDuplicateActivity" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintDuplicateDefinition" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintDuplicateIds" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintDuplicateIncludedIds" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintDuplicateUsesFeature" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintEnforceUTF8" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintExportedContentProvider" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintExportedPreferenceActivity" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintExportedReceiver" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintExportedService" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintExtraText" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintExtraTranslation" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintFloatMath" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintFullBackupContent" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintGetInstance" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintGifUsage" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintGoogleAppIndexingUrlError" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintGoogleAppIndexingWarning" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintGradleCompatible" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintGradleDependency" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintGradleDeprecated" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintGradleDynamicVersion" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintGradleGetter" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintGradleIdeError" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintGradleOverrides" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintGradlePath" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintGradlePluginVersion" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintGrantAllUris" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintGridLayout" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintHandlerLeak" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintHardcodedDebugMode" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintHardcodedText" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintHardwareIds" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintIconColors" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintIconDensities" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintIconDipSize" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintIconDuplicates" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintIconDuplicatesConfig" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintIconExtension" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintIconLauncherShape" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintIconLocation" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintIconMissingDensityFolder" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintIconMixedNinePatch" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintIconNoDpi" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintIconXmlAndPng" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintIllegalResourceRef" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintImpliedQuantity" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintInOrMmUsage" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintIncludeLayoutParam" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintInconsistentArrays" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintInconsistentLayout" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintInefficientWeight" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintInflateParams" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintInlinedApi" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintInnerclassSeparator" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintInvalidId" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintInvalidResourceFolder" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintInvalidUsesTagAttribute" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintJavascriptInterface" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintLabelFor" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintLibraryCustomView" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintLocalSuppress" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintLocaleFolder" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintLogTagMismatch" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintLongLogTag" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintManifestOrder" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintManifestResource" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMenuTitle" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMergeRootFrame" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMipmapIcons" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMissingApplicationIcon" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMissingConstraints" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMissingId" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMissingIntentFilterForMediaSearch" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMissingLeanbackLauncher" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMissingLeanbackSupport" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMissingMediaBrowserServiceIntentFilter" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMissingOnPlayFromSearch" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMissingPrefix" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMissingQuantity" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMissingSuperCall" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMissingTranslation" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMissingTvBanner" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMissingVersion" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMockLocation" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintMultipleUsesSdk" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintNestedScrolling" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintNestedWeights" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintNewApi" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintNfcTechWhitespace" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintNotInterpolated" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintNotSibling" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintObsoleteLayoutParam" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintOldTargetApi" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintOrientation" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintOverdraw" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintOverride" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintOverrideAbstract" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintPackageManagerGetSignatures" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintPackagedPrivateKey" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintParcelClassLoader" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintParcelCreator" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintPendingBindings" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintPermissionImpliesUnsupportedHardware" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintPluralsCandidate" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintPrivateResource" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintProguard" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintProguardSplit" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintPropertyEscape" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintProtectedPermissions" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintPxUsage" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintRecycle" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintRecyclerView" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintReferenceType" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintRegistered" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintRelativeOverlap" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintRequiredSize" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintResAuto" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintResourceCycle" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintResourceName" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintRtlCompat" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintRtlEnabled" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintRtlHardcoded" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintRtlSymmetry" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSQLiteString" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSSLCertificateSocketFactoryCreateSocket" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSSLCertificateSocketFactoryGetInsecure" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintScrollViewCount" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintScrollViewSize" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSdCardPath" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSecureRandom" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintServiceCast" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSetJavaScriptEnabled" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSetTextI18n" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSetWorldReadable" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSetWorldWritable" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintShiftFlags" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintShortAlarm" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintShowToast" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSignatureOrSystemPermissions" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSimpleDateFormat" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSmallSp" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSpUsage" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintStateListReachable" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintStaticFieldLeak" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintStringFormatCount" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintStringFormatInvalid" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintStringFormatMatches" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintStringShouldBeInt" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSupportAnnotationUsage" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSuspicious0dp" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSuspiciousImport" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintSwitchIntDef" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintTextFields" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintTextViewEdits" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintTooDeepLayout" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintTooManyViews" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintTrustAllX509TrustManager" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintTypographyDashes" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintTypographyEllipsis" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintTypographyFractions" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintTypographyOther" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintTypos" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUniqueConstants" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUniquePermission" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUnknownId" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUnknownIdInLayout" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUnlocalizedSms" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUnprotectedSMSBroadcastReceiver" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUnsafeDynamicallyLoadedCode" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUnsafeNativeCodeLocation" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUnsafeProtectedBroadcastReceiver" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUnsupportedTvHardware" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUnusedAttribute" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUnusedQuantity" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUnusedResources" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUseAlpha2" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUseCompoundDrawables" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUseSparseArrays" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUseValueOf" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUselessLeaf" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUselessParent" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUsesMinSdkAttributes" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintUsingHttp" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintValidFragment" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintValidRestrictions" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintVectorDrawableCompat" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintVectorRaster" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintViewConstructor" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintViewHolder" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintViewTag" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintWearableBindListener" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintWebViewLayout" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintWorldReadableFiles" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintWorldWriteableFiles" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintWrongCall" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintWrongCase" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintWrongFolder" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AndroidLintWrongRegion" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AndroidLintWrongViewCast" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AntDuplicateTargetsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AntMissingPropertiesFileInspection" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="AntResolveInspection" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="ApparentRefinementOfResultType" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="AppliedTypeLambdaCanBeSimplified" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ArrayCreationWithoutNewKeyword" enabled="false" level="INFORMATION" enabled_by_default="false" />
- <inspection_tool class="AssertAsName" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="AssignmentToCatchBlockParameter" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="AssignmentToDateFieldFromParameter" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="ignorePrivateMethods" value="true" />
- </inspection_tool>
- <inspection_tool class="BadOddness" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="BigDecimalEquals" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="BooleanMethodIsAlwaysInverted" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="BreakStatementWithLabel" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="BusyWait" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="CStyleArrayDeclaration" enabled="false" level="INFORMATION" enabled_by_default="false" />
- <inspection_tool class="CallToStringConcatCanBeReplacedByOperator" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="CaseClassParam" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ChainedPackage" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ClassMayBeInterface" enabled="false" level="INFORMATION" enabled_by_default="false" />
- <inspection_tool class="ClassNameDiffersFromFileName" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ClassNameSameAsAncestorName" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="CloneCallsConstructors" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="CloneInNonCloneableClass" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="CloneableImplementsClone" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="m_ignoreCloneableDueToInheritance" value="true" />
- </inspection_tool>
- <inspection_tool class="CollectionContainsUrl" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="CollectionsFieldAccessReplaceableByMethodCall" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ComparableImplementedButEqualsNotOverridden" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ComparatorNotSerializable" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ComparingDiffCollectionKinds" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ComparingUnrelatedTypes" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ComparisonOfShortAndChar" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ComparisonToNaN" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ConditionSignal" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ConstantConditions" enabled="false" level="WARNING" enabled_by_default="false">
- <option name="SUGGEST_NULLABLE_ANNOTATIONS" value="true" />
- <option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="true" />
- </inspection_tool>
- <inspection_tool class="ConstantValueVariableUse" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ContinueStatementWithLabel" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ControlFlowStatementWithoutBraces" enabled="false" level="INFORMATION" enabled_by_default="false" />
- <inspection_tool class="Convert2Lambda" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ConvertExpressionToSAM" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ConvertNullInitializerToUnderscore" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ConvertibleToMethodValue" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="CorrespondsUnsorted" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="CovariantCompareTo" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="CovariantEquals" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="DangerousCatchAll" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="DanglingJavadoc" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="DefaultNotLastCaseInSwitch" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="DeprecatedIsStillUsed" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="DeprecatedViewBound" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="DialogTitleCapitalization" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="DivideByZero" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="DollarSignInName" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="DottyDeprecatedWith" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="DropTakeToSlice" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="DuplicateBooleanBranch" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="DuplicateCondition" enabled="false" level="WARNING" enabled_by_default="false">
- <option name="ignoreMethodCalls" value="false" />
- </inspection_tool>
- <inspection_tool class="DuplicateThrows" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="EmptyCheck" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="EmptyInitializer" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="EmptyParenMethodAccessedAsParameterless" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="EmptyParenMethodOverridenAsParameterless" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="EmptySynchronizedStatement" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="EnumAsName" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="EnumSwitchStatementWhichMissesCases" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="ignoreSwitchStatementsWithDefault" value="true" />
- </inspection_tool>
- <inspection_tool class="EqualityToSameElements" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="EqualsCalledOnEnumConstant" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="EqualsHashCodeCalledOnUrl" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="EqualsWhichDoesntCheckParameterClass" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ErrorRethrown" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ExceptionNameDoesntEndWithException" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ExistsEquals" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ExtendsUtilityClass" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ExternalizableWithSerializationMethods" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="FieldAccessedSynchronizedAndUnsynchronized" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="countGettersAndSetters" value="false" />
- </inspection_tool>
- <inspection_tool class="FieldCanBeLocal" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="FieldFromDelayedInit" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="FieldMayBeStatic" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="FilterEmptyCheck" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="FilterHeadOption" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="FilterOtherContains" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="FilterSize" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="FinalizeNotProtected" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="FindAndMapToApply" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="FindEmptyCheck" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="FloatLiteralEndingWithDecimalPoint" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="FloatingPointEquality" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="FoldTrueAnd" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ForCanBeForeach" enabled="false" level="WARNING" enabled_by_default="false">
- <option name="REPORT_INDEXED_LOOP" value="true" />
- <option name="ignoreUntypedCollections" value="false" />
- </inspection_tool>
- <inspection_tool class="ForwardReference" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="FunctionTupleSyntacticSugar" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="GetGetOrElse" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="GetOrElseNull" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="HashCodeUsesVar" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
- <inspection_tool class="HeadOrLastOption" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="HoconIncludeResolution" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="HtmlPresentationalElement" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="IfElseToOption" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="IfMayBeConditional" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="IfStatementWithIdenticalBranches" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="IgnoreResultOfCall" enabled="false" level="WARNING" enabled_by_default="false">
- <option name="m_reportAllNonLibraryCalls" value="false" />
- <option name="callCheckString" value="java.io.InputStream,read,java.io.InputStream,skip,java.lang.StringBuffer,toString,java.lang.StringBuilder,toString,java.lang.String,.*,java.math.BigInteger,.*,java.math.BigDecimal,.*,java.net.InetAddress,.*,java.io.File,.*,java.lang.Object,equals|hashCode" />
- </inspection_tool>
- <inspection_tool class="InjectionNotApplicable" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="InnerClassMayBeStatic" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="InstanceofThis" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="IntLiteralMayBeLongLiteral" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="IntegerDivisionInFloatingPointContext" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="IteratorHasNextCallsIteratorNext" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="IteratorNextDoesNotThrowNoSuchElementException" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="JavaAccessorMethodCalledAsEmptyParen" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="JavaAccessorMethodOverridenAsEmptyParen" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="JavaFxColorRgb" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="JavaFxDefaultTag" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="JavaFxEventHandler" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="JavaFxRedundantPropertyValue" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="JavaFxResourcePropertyValue" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="JavaFxUnresolvedFxIdReference" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="JavaFxUnusedImports" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="JavaLangImport" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="JavaMutatorMethodAccessedAsParameterless" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="JavaMutatorMethodOverridenAsParameterless" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="JsonDuplicatePropertyKeys" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="JsonStandardCompliance" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="KindProjectorSimplifyTypeProjection" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="KindProjectorUseCorrectLambdaKeyword" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="LabeledStatement" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="LanguageFeature" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="LanguageMismatch" enabled="false" level="WARNING" enabled_by_default="false">
- <option name="CHECK_NON_ANNOTATED_REFERENCES" value="true" />
- </inspection_tool>
- <inspection_tool class="LastIndexToLast" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="LengthOneStringInIndexOf" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ListIndexOfReplaceableByContains" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="LiteralAsArgToStringEquals" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="LoopVariableNotUpdated" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="LossyEncoding" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="MapFlatten" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="MapGetGet" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="MapGetOrElseBoolean" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="MapKeys" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="MapReplaceableByEnumMap" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="MapToBooleanContains" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="MapValues" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="MatchToPartialFunction" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="MethodNameSameAsParentName" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="MethodNamesDifferOnlyByCase" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="MethodOverridesPackageLocalMethod" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="MethodOverridesPrivateMethod" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="MethodOverridesStaticMethod" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="MismatchedCollectionQueryUpdate" enabled="false" level="WEAK WARNING" enabled_by_default="false">
- <option name="queryNames">
- <value />
- </option>
- <option name="updateNames">
- <value />
- </option>
- <option name="ignoredClasses">
- <value />
- </option>
- </inspection_tool>
- <inspection_tool class="MissingDeprecatedAnnotation" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="MissingOverrideAnnotation" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="ignoreObjectMethods" value="true" />
- <option name="ignoreAnonymousClassMethods" value="false" />
- </inspection_tool>
- <inspection_tool class="MissortedModifiers" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="m_requireAnnotationsFirst" value="false" />
- </inspection_tool>
- <inspection_tool class="MisspelledCompareTo" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="MisspelledEquals" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="MisspelledHashcode" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="MisspelledToString" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="MultipleArgListsInAnnotation" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="MultipleRepositoryUrls" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="MutatorLikeMethodIsParameterless" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="NakedNotify" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="NameBooleanParameters" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="NoReturnTypeForImplicitDef" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="NonExceptionNameEndsWithException" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="NonFinalStaticVariableUsedInClassInitialization" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="NonProtectedConstructorInAbstractClass" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="m_ignoreNonPublicClasses" value="false" />
- </inspection_tool>
- <inspection_tool class="NonSerializableObjectBoundToHttpSession" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="NonSerializableWithSerialVersionUIDField" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="NonSerializableWithSerializationMethods" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="NonSynchronizedMethodOverridesSynchronizedMethod" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="NonThreadSafeLazyInitialization" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="NotImplementedCode" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="NotifyCalledOnCondition" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="NotifyNotInSynchronizedContext" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="NotifyWithoutCorrespondingWait" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="NullableProblems" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="REPORT_NULLABLE_METHOD_OVERRIDES_NOTNULL" value="true" />
- <option name="REPORT_NOT_ANNOTATED_METHOD_OVERRIDES_NOTNULL" value="false" />
- <option name="REPORT_NOTNULL_PARAMETER_OVERRIDES_NULLABLE" value="true" />
- <option name="REPORT_NOT_ANNOTATED_PARAMETER_OVERRIDES_NOTNULL" value="true" />
- <option name="REPORT_NOT_ANNOTATED_GETTER" value="true" />
- <option name="REPORT_NOT_ANNOTATED_SETTER_PARAMETER" value="true" />
- <option name="REPORT_ANNOTATION_NOT_PROPAGATED_TO_OVERRIDERS" value="false" />
- <option name="REPORT_NULLS_PASSED_TO_NON_ANNOTATED_METHOD" value="true" />
- </inspection_tool>
- <inspection_tool class="ObjectNotify" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ObsoleteCollection" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="ignoreRequiredObsoleteCollectionTypes" value="false" />
- </inspection_tool>
- <inspection_tool class="OptionEqualsSome" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="OverlyStrongTypeCast" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="ignoreInMatchingInstanceof" value="false" />
- </inspection_tool>
- <inspection_tool class="OverriddenMethodCallDuringObjectConstruction" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="PackageVisibleInnerClass" enabled="true" level="WARNING" enabled_by_default="false">
- <scope name="Production" level="WARNING" enabled="true">
- <option name="ignoreEnums" value="false" />
- <option name="ignoreInterfaces" value="false" />
- </scope>
- <option name="ignoreEnums" value="false" />
- <option name="ignoreInterfaces" value="false" />
- </inspection_tool>
- <inspection_tool class="ParameterNameDiffersFromOverriddenParameter" enabled="false" level="WARNING" enabled_by_default="false">
- <option name="m_ignoreSingleCharacterNames" value="false" />
- <option name="m_ignoreOverridesOfLibraryMethods" value="true" />
- </inspection_tool>
- <inspection_tool class="ParameterlessMemberOverridenAsEmptyParen" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="PointlessIndexOfComparison" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ProtectedMemberInFinalClass" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="PublicField" enabled="true" level="WARNING" enabled_by_default="false">
- <scope name="Production" level="WARNING" enabled="true">
- <option name="ignoreEnums" value="false" />
- <option name="ignorableAnnotations">
- <value />
- </option>
- </scope>
- <option name="ignoreEnums" value="false" />
- <option name="ignorableAnnotations">
- <value />
- </option>
- </inspection_tool>
- <inspection_tool class="PublicFieldAccessedInSynchronizedContext" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="PublicInnerClass" enabled="true" level="WARNING" enabled_by_default="false">
- <scope name="Production" level="WARNING" enabled="true">
- <option name="ignoreEnums" value="false" />
- <option name="ignoreInterfaces" value="false" />
- </scope>
- <option name="ignoreEnums" value="false" />
- <option name="ignoreInterfaces" value="false" />
- </inspection_tool>
- <inspection_tool class="RangeToIndices" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ReadObjectAndWriteObjectPrivate" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ReadObjectInitialization" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ReadResolveAndWriteReplaceProtected" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="RedundantBlock" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="RedundantCollectionConversion" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="RedundantDefaultArgument" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="RedundantFieldInitialization" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="RedundantHeadOrLastOption" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="RedundantImplements" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="ignoreSerializable" value="false" />
- <option name="ignoreCloneable" value="false" />
- </inspection_tool>
- <inspection_tool class="RedundantImport" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="RedundantMethodOverride" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="RedundantNewCaseClass" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="RedundantSuppression" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="RedundantThrowsDeclaration" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ReferenceMustBePrefixed" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="RemoveRedundantReturn" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ReplaceAssignmentWithOperatorAssignment" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="ignoreLazyOperators" value="true" />
- <option name="ignoreObscureOperators" value="false" />
- </inspection_tool>
- <inspection_tool class="ReplaceToWithUntil" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ReplaceWithFlatten" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="RequiredAttributes" enabled="false" level="WARNING" enabled_by_default="false">
- <option name="myAdditionalRequiredHtmlAttributes" value="" />
- </inspection_tool>
- <inspection_tool class="ResultOfObjectAllocationIgnored" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ResultSetIndexZero" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ReturnOfDateField" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ReverseIterator" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ReverseMap" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ReverseTakeReverse" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="SafeLock" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="SafeVarargsDetector" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="SameElementsToEquals" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="SamePackageImport" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="SameParameterValue" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaDefaultFileTemplate" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaDefaultFileTemplateUsage" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaDeprecatedIdentifier" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaDeprecation" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaDocInlinedTag" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaDocMissingParameterDescription" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaDocUnbalancedHeader" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaDocUnclosedTagWithoutParser" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaDocUnknownParameter" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaDocUnknownTag" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaFileName" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaMalformedFormatString" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaPackageName" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaRedundantCast" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaRedundantConversion" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaStyle" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaUnnecessaryParentheses" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaUnnecessarySemicolon" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaUnreachableCode" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaUnusedSymbol" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaUselessExpression" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
- <inspection_tool class="ScalaXmlUnmatchedTag" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="SerialPersistentFieldsWithWrongSignature" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="SerialVersionUIDNotStaticFinal" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="SignalWithoutCorrespondingAwait" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="SimplifiableFoldOrReduce" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="SimplifiableIfStatement" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="SimplifyBoolean" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="SimplifyBooleanMatch" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="SingleImport" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="SizeReplaceableByIsEmpty" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="SizeToLength" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="SleepWhileHoldingLock" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="SortFilter" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="SpellCheckingInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false">
- <option name="processCode" value="true" />
- <option name="processLiterals" value="true" />
- <option name="processComments" value="true" />
- </inspection_tool>
- <inspection_tool class="StringBufferToStringInConcatenation" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="StringEqualsEmptyString" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="SubtractionInCompareTo" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="SynchronizeOnLock" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="SynchronizedOnLiteralObject" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="SystemRunFinalizersOnExit" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="TextLabelInSwitchStatement" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ThreadDeathRethrown" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ThreadRun" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ThreadStartInConstruction" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ThreadStopSuspendResume" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ThreadYield" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ThrowableInstanceNeverThrown" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ThrowableResultOfMethodCallIgnored" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ToSetAndBack" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="TransientFieldInNonSerializableClass" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="TransientFieldNotInitialized" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="TrivialStringConcatenation" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="TypeAnnotation" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="TypeCheckCanBeMatch" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="TypeParameterExtendsFinalClass" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="TypeParameterShadow" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="UNCHECKED_WARNING" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="IGNORE_UNCHECKED_ASSIGNMENT" value="false" />
- <option name="IGNORE_UNCHECKED_GENERICS_ARRAY_CREATION" value="true" />
- <option name="IGNORE_UNCHECKED_CALL" value="false" />
- <option name="IGNORE_UNCHECKED_CAST" value="true" />
- <option name="IGNORE_UNCHECKED_OVERRIDING" value="false" />
- </inspection_tool>
- <inspection_tool class="UNUSED_SYMBOL" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="LOCAL_VARIABLE" value="true" />
- <option name="FIELD" value="true" />
- <option name="METHOD" value="false" />
- <option name="CLASS" value="false" />
- <option name="PARAMETER" value="true" />
- <option name="REPORT_PARAMETER_FOR_PUBLIC_METHODS" value="false" />
- </inspection_tool>
- <inspection_tool class="UnaryPlus" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="UnconditionalWait" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="UnitInMap" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="UnitMethodIsParameterless" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="UnknownLanguage" enabled="false" level="ERROR" enabled_by_default="false" />
- <inspection_tool class="UnnecessarilyQualifiedStaticUsage" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="m_ignoreStaticFieldAccesses" value="false" />
- <option name="m_ignoreStaticMethodCalls" value="false" />
- <option name="m_ignoreStaticAccessFromStaticContext" value="false" />
- </inspection_tool>
- <inspection_tool class="UnnecessaryAnnotationParentheses" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="UnnecessaryCallToStringValueOf" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="UnnecessaryConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="UnnecessaryFinalOnLocalVariable" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="UnnecessaryFinalOnParameter" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="onlyWarnOnAbstractMethods" value="false" />
- </inspection_tool>
- <inspection_tool class="UnnecessaryFullyQualifiedName" enabled="false" level="WARNING" enabled_by_default="false">
- <option name="m_ignoreJavadoc" value="true" />
- <option name="ignoreInModuleStatements" value="true" />
- </inspection_tool>
- <inspection_tool class="UnnecessaryInterfaceModifier" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="UnnecessaryJavaDocLink" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="ignoreInlineLinkToSuper" value="false" />
- </inspection_tool>
- <inspection_tool class="UnnecessaryPartialFunction" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="UnnecessaryQualifierForThis" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="UnnecessarySuperConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="UnnecessarySuperQualifier" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="UnnecessaryThis" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="UnnecessaryUnaryMinus" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="UnusedCatchParameter" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="m_ignoreCatchBlocksWithComments" value="false" />
- <option name="m_ignoreTestCases" value="false" />
- </inspection_tool>
- <inspection_tool class="UnusedLibrary" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="UnusedReturnValue" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="UpperCaseFieldNameNotConstant" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="Use of postfix method call" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="VarCouldBeVal" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
- <inspection_tool class="VariablePatternShadow" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="WaitCalledOnCondition" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="WaitNotInLoop" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="WaitNotInSynchronizedContext" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="WaitWhileHoldingTwoLocks" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="WaitWithoutCorrespondingNotify" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="WeakerAccess" enabled="false" level="WARNING" enabled_by_default="false">
- <option name="SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS" value="true" />
- <option name="SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES" value="true" />
- <option name="SUGGEST_PRIVATE_FOR_INNERS" value="false" />
- </inspection_tool>
- <inspection_tool class="ZeroIndexToHead" enabled="false" level="WARNING" enabled_by_default="false" />
- <inspection_tool class="ZeroLengthArrayInitialization" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="ZipWithIndex" enabled="false" level="WARNING" enabled_by_default="false" />
-</profile>
\ No newline at end of file
[33/50] [abbrv] ignite git commit: IGNITE-10049: MVCC: Create "Cache
4" test suite for MVCC mode. This closes #5499.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheReadFromBackupTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheReadFromBackupTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheReadFromBackupTest.java
index 2bb5fbb..652aba0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheReadFromBackupTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheReadFromBackupTest.java
@@ -50,6 +50,7 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
@@ -87,7 +88,23 @@ public class IgniteCacheReadFromBackupTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testGetFromBackupStoreReadThroughEnabled() throws Exception {
- for (CacheConfiguration<Object, Object> ccfg : cacheConfigurations()) {
+ checkGetFromBackupStoreReadThroughEnabled(cacheConfigurations());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMvccGetFromBackupStoreReadThroughEnabled() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-10274");
+
+ checkGetFromBackupStoreReadThroughEnabled(mvccCacheConfigurations());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ private void checkGetFromBackupStoreReadThroughEnabled(List<CacheConfiguration<Object, Object>> cacheCfgs) throws Exception {
+ for (CacheConfiguration<Object, Object> ccfg : cacheCfgs) {
ccfg.setCacheStoreFactory(new TestStoreFactory());
ccfg.setReadThrough(true);
@@ -131,7 +148,23 @@ public class IgniteCacheReadFromBackupTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testGetFromBackupStoreReadThroughDisabled() throws Exception {
- for (CacheConfiguration<Object, Object> ccfg : cacheConfigurations()) {
+ checkGetFromBackupStoreReadThroughDisabled(cacheConfigurations());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMvccGetFromBackupStoreReadThroughDisabled() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-10274");
+
+ checkGetFromBackupStoreReadThroughDisabled(mvccCacheConfigurations());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ private void checkGetFromBackupStoreReadThroughDisabled(List<CacheConfiguration<Object, Object>> cacheCfgs) throws Exception {
+ for (CacheConfiguration<Object, Object> ccfg : cacheCfgs) {
ccfg.setCacheStoreFactory(new TestStoreFactory());
ccfg.setReadThrough(false);
@@ -159,7 +192,23 @@ public class IgniteCacheReadFromBackupTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testGetFromPrimaryPreloadInProgress() throws Exception {
- for (final CacheConfiguration<Object, Object> ccfg : cacheConfigurations()) {
+ checkGetFromPrimaryPreloadInProgress(cacheConfigurations());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMvccGetFromPrimaryPreloadInProgress() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-10274");
+
+ checkGetFromPrimaryPreloadInProgress(mvccCacheConfigurations());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ private void checkGetFromPrimaryPreloadInProgress(List<CacheConfiguration<Object, Object>> cacheCfgs) throws Exception {
+ for (final CacheConfiguration<Object, Object> ccfg : cacheCfgs) {
boolean near = (ccfg.getNearConfiguration() != null);
log.info("Test cache [mode=" + ccfg.getCacheMode() +
@@ -245,7 +294,24 @@ public class IgniteCacheReadFromBackupTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testNoPrimaryReadPreloadFinished() throws Exception {
- for (CacheConfiguration<Object, Object> ccfg : cacheConfigurations()) {
+ checkNoPrimaryReadPreloadFinished(cacheConfigurations());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMvccNoPrimaryReadPreloadFinished() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-10274");
+
+ checkNoPrimaryReadPreloadFinished(mvccCacheConfigurations());
+
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ private void checkNoPrimaryReadPreloadFinished(List<CacheConfiguration<Object, Object>> cacheCfgs) throws Exception {
+ for (CacheConfiguration<Object, Object> ccfg : cacheCfgs) {
boolean near = (ccfg.getNearConfiguration() != null);
log.info("Test cache [mode=" + ccfg.getCacheMode() +
@@ -370,6 +436,21 @@ public class IgniteCacheReadFromBackupTest extends GridCommonAbstractTest {
}
/**
+ * @return Cache configurations to test.
+ */
+ private List<CacheConfiguration<Object, Object>> mvccCacheConfigurations() {
+ List<CacheConfiguration<Object, Object>> ccfgs = new ArrayList<>();
+
+ ccfgs.add(cacheConfiguration(REPLICATED, TRANSACTIONAL_SNAPSHOT, 0, false));
+
+ ccfgs.add(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, false));
+ ccfgs.add(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, true));
+ ccfgs.add(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 2, false));
+
+ return ccfgs;
+ }
+
+ /**
* @param cacheMode Cache mode.
* @param atomicityMode Cache atomicity mode.
* @param backups Number of backups.
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSingleGetMessageTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSingleGetMessageTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSingleGetMessageTest.java
index 974bcf2..df6100b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSingleGetMessageTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSingleGetMessageTest.java
@@ -37,6 +37,7 @@ import org.apache.ignite.transactions.Transaction;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -88,11 +89,25 @@ public class IgniteCacheSingleGetMessageTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testSingleGetMessage() throws Exception {
+ checkSingleGetMessage(cacheConfigurations());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMvccSingleGetMessage() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-7371");
+
+ checkSingleGetMessage(mvccCacheConfigurations());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void checkSingleGetMessage(List<CacheConfiguration<Integer, Integer>> ccfgs) throws Exception {
assertFalse(ignite(0).configuration().isClientMode());
assertTrue(ignite(SRVS).configuration().isClientMode());
- List<CacheConfiguration<Integer, Integer>> ccfgs = cacheConfigurations();
-
for (int i = 0; i < ccfgs.size(); i++) {
CacheConfiguration<Integer, Integer> ccfg = ccfgs.get(i);
@@ -282,6 +297,19 @@ public class IgniteCacheSingleGetMessageTest extends GridCommonAbstractTest {
}
/**
+ * @return Mvcc cache configurations to test.
+ */
+ private List<CacheConfiguration<Integer, Integer>> mvccCacheConfigurations() {
+ List<CacheConfiguration<Integer, Integer>> ccfgs = new ArrayList<>();
+
+ ccfgs.add(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, FULL_SYNC, 0));
+ ccfgs.add(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, FULL_SYNC, 1));
+ ccfgs.add(cacheConfiguration(REPLICATED, TRANSACTIONAL_SNAPSHOT, FULL_SYNC, 0));
+
+ return ccfgs;
+ }
+
+ /**
* @param cacheMode Cache mode.
* @param atomicityMode Cache atomicity mode.
* @param syncMode Write synchronization mode.
@@ -297,7 +325,6 @@ public class IgniteCacheSingleGetMessageTest extends GridCommonAbstractTest {
ccfg.setCacheMode(cacheMode);
ccfg.setAtomicityMode(atomicityMode);
- ccfg.setAtomicityMode(TRANSACTIONAL);
ccfg.setWriteSynchronizationMode(syncMode);
if (cacheMode == PARTITIONED)
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
index b4af2a8..65e9f37 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
@@ -32,6 +32,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
@@ -78,6 +79,9 @@ public abstract class IgniteTxPreloadAbstractTest extends GridCacheAbstractSelfT
* @throws Exception If failed.
*/
public void testRemoteTxPreloading() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-10391");
+
IgniteCache<String, Integer> cache = jcache(0);
for (int i = 0; i < 10_000; i++)
@@ -147,13 +151,17 @@ public abstract class IgniteTxPreloadAbstractTest extends GridCacheAbstractSelfT
* @throws Exception If failed.
*/
public void testLocalTxPreloadingOptimistic() throws Exception {
- testLocalTxPreloading(OPTIMISTIC);
+ if (!MvccFeatureChecker.forcedMvcc()) // Do not check optimistic tx for mvcc.
+ testLocalTxPreloading(OPTIMISTIC);
}
/**
* @throws Exception If failed.
*/
public void testLocalTxPreloadingPessimistic() throws Exception {
+ if (MvccFeatureChecker.forcedMvcc())
+ fail("https://issues.apache.org/jira/browse/IGNITE-10391");
+
testLocalTxPreloading(PESSIMISTIC);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java
index ab94618..2ab36f2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java
@@ -33,6 +33,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteFutureTimeoutException;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
/**
*
@@ -40,6 +41,13 @@ import org.apache.ignite.testframework.GridTestUtils;
@SuppressWarnings("unchecked")
public class IgniteCacheLockFailoverSelfTest extends GridCacheAbstractSelfTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected int gridCount() {
return 2;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java
index bc3b13d..d7454fd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java
@@ -22,6 +22,7 @@ import java.util.Collection;
import java.util.TreeMap;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
+import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -33,6 +34,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
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.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -55,6 +57,16 @@ public class IgniteCacheMultiTxLockSelfTest extends GridCommonAbstractTest {
/** */
private boolean client;
+ /** Unexpected lock error. */
+ private volatile Throwable err;
+
+ /** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
+ super.setUp();
+ }
+
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
@@ -120,6 +132,8 @@ public class IgniteCacheMultiTxLockSelfTest extends GridCommonAbstractTest {
public void checkExplicitLock(int keys, boolean testClient) throws Exception {
Collection<Thread> threads = new ArrayList<>();
+ err = null;
+
try {
// Start grid 1.
IgniteEx grid1 = startGrid(1);
@@ -171,6 +185,8 @@ public class IgniteCacheMultiTxLockSelfTest extends GridCommonAbstractTest {
assertEquals("txMap is not empty:" + i, 0, tm.idMapSize());
}
+
+ assertNull(err);
}
finally {
stopAllGrids();
@@ -214,7 +230,7 @@ public class IgniteCacheMultiTxLockSelfTest extends GridCommonAbstractTest {
else
cache.removeAll(vals.keySet());
}
- catch (Exception e) {
+ catch (IgniteCheckedException e) {
U.error(log(), "Failed cache operation.", e);
}
finally {
@@ -223,8 +239,12 @@ public class IgniteCacheMultiTxLockSelfTest extends GridCommonAbstractTest {
U.sleep(100);
}
- catch (Exception e){
+ catch (Throwable e){
U.error(log(), "Failed unlock.", e);
+
+ err = e;
+
+ return;
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheMvccTxSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheMvccTxSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheMvccTxSelfTest.java
new file mode 100644
index 0000000..63a255e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheMvccTxSelfTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.distributed.dht;
+
+import org.apache.ignite.cache.CacheAtomicityMode;
+
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
+
+/**
+ *
+ */
+public class IgniteCrossCacheMvccTxSelfTest extends IgniteCrossCacheTxAbstractSelfTest {
+ /** {@inheritDoc} */
+ @Override public CacheAtomicityMode atomicityMode() {
+ return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPessimisticRepeatableRead() throws Exception {
+ checkTxsSingleOp(PESSIMISTIC, REPEATABLE_READ);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheTxAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheTxAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheTxAbstractSelfTest.java
new file mode 100644
index 0000000..5224daf
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheTxAbstractSelfTest.java
@@ -0,0 +1,181 @@
+/*
+ * 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.distributed.dht;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+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.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Tests specific combinations of cross-cache transactions.
+ */
+public abstract class IgniteCrossCacheTxAbstractSelfTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final String FIRST_CACHE = "FirstCache";
+
+ /** */
+ private static final String SECOND_CACHE = "SecondCache";
+
+ /** */
+ private static final int TX_CNT = 500;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
+ return cfg;
+ }
+
+ /**
+ * @return Node count for this test.
+ */
+ private int nodeCount() {
+ return 4;
+ }
+
+ /**
+ * @return {@code True} if near cache should be enabled.
+ */
+ protected boolean nearEnabled() {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override protected void beforeTestsStarted() throws Exception {
+ startGridsMultiThreaded(nodeCount());
+
+ CacheConfiguration firstCfg = new CacheConfiguration(FIRST_CACHE);
+ firstCfg.setBackups(1);
+ firstCfg.setAtomicityMode(atomicityMode());
+ firstCfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ grid(0).createCache(firstCfg);
+
+ CacheConfiguration secondCfg = new CacheConfiguration(SECOND_CACHE);
+ secondCfg.setBackups(1);
+ secondCfg.setAtomicityMode(atomicityMode());
+ secondCfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ if (nearEnabled())
+ secondCfg.setNearConfiguration(new NearCacheConfiguration());
+
+ grid(0).createCache(secondCfg);
+ }
+
+ /**
+ * @return Atomicity mode.
+ */
+ public abstract CacheAtomicityMode atomicityMode();
+
+ /**
+ * @param concurrency Concurrency.
+ * @param isolation Isolation.
+ * @throws Exception If failed.
+ */
+ protected void checkTxsSingleOp(TransactionConcurrency concurrency, TransactionIsolation isolation) throws Exception {
+ Map<Integer, String> firstCheck = new HashMap<>();
+ Map<Integer, String> secondCheck = new HashMap<>();
+
+ for (int i = 0; i < TX_CNT; i++) {
+ int grid = ThreadLocalRandom.current().nextInt(nodeCount());
+
+ IgniteCache<Integer, String> first = grid(grid).cache(FIRST_CACHE);
+ IgniteCache<Integer, String> second = grid(grid).cache(SECOND_CACHE);
+
+ try (Transaction tx = grid(grid).transactions().txStart(concurrency, isolation)) {
+ try {
+ int size = ThreadLocalRandom.current().nextInt(24) + 1;
+
+ for (int k = 0; k < size; k++) {
+ boolean rnd = ThreadLocalRandom.current().nextBoolean();
+
+ IgniteCache<Integer, String> cache = rnd ? first : second;
+ Map<Integer, String> check = rnd ? firstCheck : secondCheck;
+
+ String val = rnd ? "first" + i : "second" + i;
+
+ cache.put(k, val);
+ check.put(k, val);
+ }
+
+ tx.commit();
+ }
+ catch (Throwable e) {
+ e.printStackTrace();
+
+ throw e;
+ }
+ }
+
+ if (i > 0 && i % 100 == 0)
+ info("Finished iteration: " + i);
+ }
+
+ for (int g = 0; g < nodeCount(); g++) {
+ IgniteEx grid = grid(g);
+
+ assertEquals(0, grid.context().cache().context().tm().idMapSize());
+
+ ClusterNode locNode = grid.localNode();
+
+ IgniteCache<Object, Object> firstCache = grid.cache(FIRST_CACHE);
+
+ for (Map.Entry<Integer, String> entry : firstCheck.entrySet()) {
+ boolean primary = grid.affinity(FIRST_CACHE).isPrimary(locNode, entry.getKey());
+
+ boolean backup = grid.affinity(FIRST_CACHE).isBackup(locNode, entry.getKey());
+
+ assertEquals("Invalid value found first cache [primary=" + primary + ", backup=" + backup +
+ ", node=" + locNode.id() + ", key=" + entry.getKey() + ']',
+ entry.getValue(), firstCache.get(entry.getKey()));
+ }
+
+ for (Map.Entry<Integer, String> entry : secondCheck.entrySet()) {
+ boolean primary = grid.affinity(SECOND_CACHE).isPrimary(locNode, entry.getKey());
+
+ boolean backup = grid.affinity(SECOND_CACHE).isBackup(locNode, entry.getKey());
+
+ assertEquals("Invalid value found second cache [primary=" + primary + ", backup=" + backup +
+ ", node=" + locNode.id() + ", key=" + entry.getKey() + ']',
+ entry.getValue(), grid.cache(SECOND_CACHE).get(entry.getKey()));
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheTxSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheTxSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheTxSelfTest.java
index 91c6685..3b0106c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheTxSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheTxSelfTest.java
@@ -14,28 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.ignite.internal.processors.cache.distributed.dht;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ThreadLocalRandom;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.IgniteEx;
-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.testframework.junits.common.GridCommonAbstractTest;
-import org.apache.ignite.transactions.Transaction;
-import org.apache.ignite.transactions.TransactionConcurrency;
-import org.apache.ignite.transactions.TransactionIsolation;
+import org.apache.ignite.cache.CacheAtomicityMode;
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
@@ -43,65 +25,12 @@ import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_REA
import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
/**
- * Tests specific combinations of cross-cache transactions.
+ *
*/
-public class IgniteCrossCacheTxSelfTest extends GridCommonAbstractTest {
- /** */
- private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
- /** */
- private static final String FIRST_CACHE = "FirstCache";
-
- /** */
- private static final String SECOND_CACHE = "SecondCache";
-
- /** */
- private static final int TX_CNT = 500;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
-
- return cfg;
- }
-
- /**
- * @return Node count for this test.
- */
- private int nodeCount() {
- return 4;
- }
-
- /**
- * @return {@code True} if near cache should be enabled.
- */
- protected boolean nearEnabled() {
- return false;
- }
-
+public class IgniteCrossCacheTxSelfTest extends IgniteCrossCacheTxAbstractSelfTest {
/** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override protected void beforeTestsStarted() throws Exception {
- startGridsMultiThreaded(nodeCount());
-
- CacheConfiguration firstCfg = new CacheConfiguration(FIRST_CACHE);
- firstCfg.setBackups(1);
- firstCfg.setAtomicityMode(TRANSACTIONAL);
- firstCfg.setWriteSynchronizationMode(FULL_SYNC);
-
- grid(0).createCache(firstCfg);
-
- CacheConfiguration secondCfg = new CacheConfiguration(SECOND_CACHE);
- secondCfg.setBackups(1);
- secondCfg.setAtomicityMode(TRANSACTIONAL);
- secondCfg.setWriteSynchronizationMode(FULL_SYNC);
-
- if (nearEnabled())
- secondCfg.setNearConfiguration(new NearCacheConfiguration());
-
- grid(0).createCache(secondCfg);
+ @Override public CacheAtomicityMode atomicityMode() {
+ return CacheAtomicityMode.TRANSACTIONAL;
}
/**
@@ -139,78 +68,4 @@ public class IgniteCrossCacheTxSelfTest extends GridCommonAbstractTest {
checkTxsSingleOp(OPTIMISTIC, SERIALIZABLE);
}
- /**
- * @param concurrency Concurrency.
- * @param isolation Isolation.
- * @throws Exception If failed.
- */
- private void checkTxsSingleOp(TransactionConcurrency concurrency, TransactionIsolation isolation) throws Exception {
- Map<Integer, String> firstCheck = new HashMap<>();
- Map<Integer, String> secondCheck = new HashMap<>();
-
- for (int i = 0; i < TX_CNT; i++) {
- int grid = ThreadLocalRandom.current().nextInt(nodeCount());
-
- IgniteCache<Integer, String> first = grid(grid).cache(FIRST_CACHE);
- IgniteCache<Integer, String> second = grid(grid).cache(SECOND_CACHE);
-
- try (Transaction tx = grid(grid).transactions().txStart(concurrency, isolation)) {
- try {
- int size = ThreadLocalRandom.current().nextInt(24) + 1;
-
- for (int k = 0; k < size; k++) {
- boolean rnd = ThreadLocalRandom.current().nextBoolean();
-
- IgniteCache<Integer, String> cache = rnd ? first : second;
- Map<Integer, String> check = rnd ? firstCheck : secondCheck;
-
- String val = rnd ? "first" + i : "second" + i;
-
- cache.put(k, val);
- check.put(k, val);
- }
-
- tx.commit();
- }
- catch (Throwable e) {
- e.printStackTrace();
-
- throw e;
- }
- }
-
- if (i > 0 && i % 100 == 0)
- info("Finished iteration: " + i);
- }
-
- for (int g = 0; g < nodeCount(); g++) {
- IgniteEx grid = grid(g);
-
- assertEquals(0, grid.context().cache().context().tm().idMapSize());
-
- ClusterNode locNode = grid.localNode();
-
- IgniteCache<Object, Object> firstCache = grid.cache(FIRST_CACHE);
-
- for (Map.Entry<Integer, String> entry : firstCheck.entrySet()) {
- boolean primary = grid.affinity(FIRST_CACHE).isPrimary(locNode, entry.getKey());
-
- boolean backup = grid.affinity(FIRST_CACHE).isBackup(locNode, entry.getKey());
-
- assertEquals("Invalid value found first cache [primary=" + primary + ", backup=" + backup +
- ", node=" + locNode.id() + ", key=" + entry.getKey() + ']',
- entry.getValue(), firstCache.get(entry.getKey()));
- }
-
- for (Map.Entry<Integer, String> entry : secondCheck.entrySet()) {
- boolean primary = grid.affinity(SECOND_CACHE).isPrimary(locNode, entry.getKey());
-
- boolean backup = grid.affinity(SECOND_CACHE).isBackup(locNode, entry.getKey());
-
- assertEquals("Invalid value found second cache [primary=" + primary + ", backup=" + backup +
- ", node=" + locNode.id() + ", key=" + entry.getKey() + ']',
- entry.getValue(), grid.cache(SECOND_CACHE).get(entry.getKey()));
- }
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxPreloadSelfTest.java
index caf6cc7..96b932a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxPreloadSelfTest.java
@@ -21,6 +21,7 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.processors.cache.distributed.IgniteTxPreloadAbstractTest;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -29,6 +30,13 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
*/
public class GridCacheNearTxPreloadSelfTest extends IgniteTxPreloadAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected CacheMode cacheMode() {
return PARTITIONED;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEventSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEventSelfTest.java
index 1c79db7..54eb32d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEventSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEventSelfTest.java
@@ -21,6 +21,7 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.processors.cache.distributed.GridCacheEventAbstractTest;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -31,6 +32,13 @@ import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
*/
public class GridCachePartitionedEventSelfTest extends GridCacheEventAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
CacheConfiguration cfg = defaultCacheConfiguration();
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java
index ca12a99..d86fa91 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java
@@ -29,6 +29,7 @@ import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.cache.IgniteCacheAbstractTest;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import org.apache.ignite.transactions.Transaction;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -41,6 +42,13 @@ import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_REA
*/
public class IgniteCacheNearOnlyTxTest extends IgniteCacheAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected int gridCount() {
return 2;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java
index ad9bce0..76f0d17 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java
@@ -22,6 +22,7 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import org.apache.ignite.transactions.Transaction;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -34,6 +35,13 @@ import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED
@SuppressWarnings("RedundantMethodOverride")
public class IgniteCacheNearReadCommittedTest extends GridCacheAbstractSelfTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected int gridCount() {
return 2;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoadAllAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoadAllAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoadAllAbstractTest.java
index 6b4f976..3d9b7bd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoadAllAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoadAllAbstractTest.java
@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import javax.cache.Cache;
import javax.cache.configuration.Factory;
import javax.cache.integration.CacheLoader;
@@ -34,7 +35,7 @@ import org.apache.ignite.cache.affinity.Affinity;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.processors.cache.IgniteCacheAbstractTest;
-import java.util.concurrent.ConcurrentHashMap;
+import org.apache.ignite.testframework.MvccFeatureChecker;
/**
* Test for {@link Cache#loadAll(Set, boolean, CompletionListener)}.
@@ -47,6 +48,13 @@ public abstract class IgniteCacheLoadAllAbstractTest extends IgniteCacheAbstract
private static ConcurrentHashMap<Object, Object> storeMap;
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLoaderWriterTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLoaderWriterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLoaderWriterTest.java
index fc4ec78..75a4cd9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLoaderWriterTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLoaderWriterTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.integration;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -29,6 +30,13 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
*/
public class IgniteCacheTxLoaderWriterTest extends IgniteCacheLoaderWriterAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected int gridCount() {
return 3;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalLoadAllTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalLoadAllTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalLoadAllTest.java
index 97374bf..645a9ff 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalLoadAllTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalLoadAllTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.integration;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -29,6 +30,12 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
*/
public class IgniteCacheTxLocalLoadAllTest extends IgniteCacheLoadAllAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+ super.setUp();
+ }
+ /** {@inheritDoc} */
@Override protected int gridCount() {
return 1;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoLoadPreviousValueTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoLoadPreviousValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoLoadPreviousValueTest.java
index 686b4ca..2e52a63 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoLoadPreviousValueTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoLoadPreviousValueTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.integration;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -29,6 +30,13 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
*/
public class IgniteCacheTxLocalNoLoadPreviousValueTest extends IgniteCacheNoLoadPreviousValueAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected int gridCount() {
return 1;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoReadThroughTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoReadThroughTest.java
index 5235c9d..e25a965 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoReadThroughTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoReadThroughTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.integration;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -29,6 +30,13 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
*/
public class IgniteCacheTxLocalNoReadThroughTest extends IgniteCacheNoReadThroughAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected int gridCount() {
return 1;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoWriteThroughTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoWriteThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoWriteThroughTest.java
index 7985c57..ddc9352 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoWriteThroughTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLocalNoWriteThroughTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.integration;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -29,6 +30,13 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
*/
public class IgniteCacheTxLocalNoWriteThroughTest extends IgniteCacheNoWriteThroughAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected int gridCount() {
return 1;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoLoadPreviousValueTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoLoadPreviousValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoLoadPreviousValueTest.java
index ce42e39..c343402 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoLoadPreviousValueTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoLoadPreviousValueTest.java
@@ -18,12 +18,20 @@
package org.apache.ignite.internal.processors.cache.integration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
/**
*
*/
public class IgniteCacheTxNearEnabledNoLoadPreviousValueTest extends IgniteCacheTxNoLoadPreviousValueTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected NearCacheConfiguration nearConfiguration() {
return new NearCacheConfiguration();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoWriteThroughTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoWriteThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoWriteThroughTest.java
index ea12cce..be9bc34 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoWriteThroughTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoWriteThroughTest.java
@@ -18,12 +18,20 @@
package org.apache.ignite.internal.processors.cache.integration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
/**
*
*/
public class IgniteCacheTxNearEnabledNoWriteThroughTest extends IgniteCacheTxNoWriteThroughTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected NearCacheConfiguration nearConfiguration() {
return new NearCacheConfiguration();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoLoadPreviousValueTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoLoadPreviousValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoLoadPreviousValueTest.java
index ce9ef9b..094aa1a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoLoadPreviousValueTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoLoadPreviousValueTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.integration;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -29,6 +30,13 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
*/
public class IgniteCacheTxNoLoadPreviousValueTest extends IgniteCacheNoLoadPreviousValueAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected int gridCount() {
return 3;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoReadThroughTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoReadThroughTest.java
index 90bc768..a94caff 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoReadThroughTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoReadThroughTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.integration;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -29,6 +30,13 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
*/
public class IgniteCacheTxNoReadThroughTest extends IgniteCacheNoReadThroughAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected int gridCount() {
return 3;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoWriteThroughTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoWriteThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoWriteThroughTest.java
index 325d969..e984dfb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoWriteThroughTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoWriteThroughTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.integration;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -29,6 +30,13 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
*/
public class IgniteCacheTxNoWriteThroughTest extends IgniteCacheNoWriteThroughAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected int gridCount() {
return 3;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
index b9e884b..77f54af 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
@@ -25,6 +25,7 @@ import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
@@ -39,6 +40,13 @@ import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_REA
*/
public class IgniteCacheTxStoreSessionTest extends IgniteCacheStoreSessionAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected int gridCount() {
return 3;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindCoalescingTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindCoalescingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindCoalescingTest.java
index a90b4f1..ea2b8a3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindCoalescingTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindCoalescingTest.java
@@ -22,6 +22,7 @@ import javax.cache.Cache;
import javax.cache.integration.CacheWriterException;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -31,6 +32,13 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
*/
public class IgniteCacheTxStoreSessionWriteBehindCoalescingTest extends IgniteCacheStoreSessionWriteBehindAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected CacheAtomicityMode atomicityMode() {
return TRANSACTIONAL;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindTest.java
index b72aba3..ae6bcae 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindTest.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache.integration;
import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.testframework.MvccFeatureChecker;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -26,6 +27,13 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
*/
public class IgniteCacheTxStoreSessionWriteBehindTest extends IgniteCacheStoreSessionWriteBehindAbstractTest {
/** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+ super.setUp();
+ }
+
+ /** {@inheritDoc} */
@Override protected CacheAtomicityMode atomicityMode() {
return TRANSACTIONAL;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalTransactionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalTransactionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalTransactionalSelfTest.java
index d7fc938..b217703 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalTransactionalSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalTransactionalSelfTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache.version;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.testframework.MvccFeatureChecker;
/**
*
@@ -38,4 +39,12 @@ public class CacheVersionedEntryLocalTransactionalSelfTest extends CacheVersione
@Override protected CacheAtomicityMode atomicityMode() {
return CacheAtomicityMode.TRANSACTIONAL;
}
+
+ /** {@inheritDoc} */
+ @Override public void setUp() throws Exception {
+ MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+ super.setUp();
+ }
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/testframework/MvccFeatureChecker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/MvccFeatureChecker.java b/modules/core/src/test/java/org/apache/ignite/testframework/MvccFeatureChecker.java
index 183c2eb..c70d447 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/MvccFeatureChecker.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/MvccFeatureChecker.java
@@ -19,10 +19,15 @@ package org.apache.ignite.testframework;
import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.internal.processors.query.IgniteSQLException;
+import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS;
+import static org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode.TRANSACTION_SERIALIZATION_ERROR;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
/**
@@ -107,11 +112,26 @@ public class MvccFeatureChecker {
}
/**
+ * TODO proper exception handling after https://issues.apache.org/jira/browse/IGNITE-9470
+ * Checks if given exception was caused by MVCC write conflict.
+ *
+ * @param e Exception.
+ */
+ public static void assertMvccWriteConflict(Exception e) {
+ IgniteSQLException sqlEx = X.cause(e, IgniteSQLException.class);
+
+ assertNotNull(sqlEx);
+
+ assertEquals(TRANSACTION_SERIALIZATION_ERROR, sqlEx.statusCode());
+ }
+
+ /**
* Fails if feature is not supported in Mvcc mode.
*
* @param feature Mvcc feature.
* @throws AssertionError If failed.
*/
+ @SuppressWarnings("fallthrough")
private static void validateFeature(Feature feature) {
switch (feature) {
case NEAR_CACHE:
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite2.java
index 5818653..3c070bc 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite2.java
@@ -115,6 +115,7 @@ public class IgniteCacheMvccTestSuite2 extends TestSuite {
ignoredTests.add(CacheOptimisticTransactionsWithFilterSingleServerTest.class);
ignoredTests.add(CacheOptimisticTransactionsWithFilterTest.class);
+ // Irrelevant Tx tests.
ignoredTests.add(IgniteOnePhaseCommitInvokeTest.class);
ignoredTests.add(IgniteOnePhaseCommitNearReadersTest.class);
ignoredTests.add(GridCacheDhtPreloadOnheapSelfTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite4.java
new file mode 100644
index 0000000..9933633
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite4.java
@@ -0,0 +1,197 @@
+/*
+ * 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.testsuites;
+
+import java.util.HashSet;
+import junit.framework.TestSuite;
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.cache.store.CacheStoreListenerRWThroughDisabledAtomicCacheTest;
+import org.apache.ignite.internal.processors.cache.CacheConnectionLeakStoreTxTest;
+import org.apache.ignite.internal.processors.cache.CacheGetEntryOptimisticReadCommittedSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheGetEntryOptimisticRepeatableReadSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheGetEntryOptimisticSerializableSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheGetEntryPessimisticReadCommittedSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheGetEntryPessimisticRepeatableReadSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheGetEntryPessimisticSerializableSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheOffheapMapEntrySelfTest;
+import org.apache.ignite.internal.processors.cache.CacheReadThroughAtomicRestartSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheReadThroughLocalAtomicRestartSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheReadThroughReplicatedAtomicRestartSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheStoreUsageMultinodeDynamicStartAtomicTest;
+import org.apache.ignite.internal.processors.cache.CacheStoreUsageMultinodeStaticStartAtomicTest;
+import org.apache.ignite.internal.processors.cache.CacheTxNotAllowReadFromBackupTest;
+import org.apache.ignite.internal.processors.cache.GridCacheMultinodeUpdateAtomicNearEnabledSelfTest;
+import org.apache.ignite.internal.processors.cache.GridCacheMultinodeUpdateAtomicSelfTest;
+import org.apache.ignite.internal.processors.cache.GridCacheVersionMultinodeTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicCopyOnReadDisabledTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicLocalPeekModesTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicLocalStoreValueTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicNearEnabledStoreValueTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicNearPeekModesTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicPeekModesTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicReplicatedPeekModesTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicStoreValueTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheConfigurationDefaultTemplateTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheContainsKeyAtomicTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheInvokeReadThroughSingleNodeTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheInvokeReadThroughTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheStartTest;
+import org.apache.ignite.internal.processors.cache.IgniteClientCacheInitializationFailTest;
+import org.apache.ignite.internal.processors.cache.IgniteDynamicCacheStartNoExchangeTimeoutTest;
+import org.apache.ignite.internal.processors.cache.IgniteDynamicCacheStartSelfTest;
+import org.apache.ignite.internal.processors.cache.IgniteDynamicCacheStartStopConcurrentTest;
+import org.apache.ignite.internal.processors.cache.IgniteDynamicClientCacheStartSelfTest;
+import org.apache.ignite.internal.processors.cache.IgniteExchangeFutureHistoryTest;
+import org.apache.ignite.internal.processors.cache.IgniteInternalCacheTypesTest;
+import org.apache.ignite.internal.processors.cache.IgniteStartCacheInTransactionAtomicSelfTest;
+import org.apache.ignite.internal.processors.cache.IgniteSystemCacheOnClientTest;
+import org.apache.ignite.internal.processors.cache.MarshallerCacheJobRunNodeRestartTest;
+import org.apache.ignite.internal.processors.cache.distributed.CacheDiscoveryDataConcurrentJoinTest;
+import org.apache.ignite.internal.processors.cache.distributed.CacheGetFutureHangsSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.CacheGroupsPreloadTest;
+import org.apache.ignite.internal.processors.cache.distributed.CacheNoValueClassOnServerNodeTest;
+import org.apache.ignite.internal.processors.cache.distributed.CacheResultIsNotNullOnPartitionLossTest;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheCreatePutTest;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheFailedUpdateResponseTest;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheReadFromBackupTest;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheSingleGetMessageTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCrossCacheMvccTxSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCrossCacheTxSelfTest;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicLoadAllTest;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicLoaderWriterTest;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicLocalLoadAllTest;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicLocalNoLoadPreviousValueTest;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicLocalNoReadThroughTest;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicLocalNoWriteThroughTest;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicNearEnabledNoLoadPreviousValueTest;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicNearEnabledNoReadThroughTest;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicNearEnabledNoWriteThroughTest;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicNoLoadPreviousValueTest;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicNoReadThroughTest;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicNoWriteThroughTest;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicStoreSessionTest;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicStoreSessionWriteBehindTest;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheJdbcBlobStoreNodeRestartTest;
+import org.apache.ignite.internal.processors.cache.version.CacheVersionedEntryLocalAtomicSwapDisabledSelfTest;
+import org.apache.ignite.internal.processors.cache.version.CacheVersionedEntryPartitionedAtomicSelfTest;
+import org.apache.ignite.internal.processors.cache.version.CacheVersionedEntryReplicatedAtomicSelfTest;
+
+/**
+ *
+ */
+public class IgniteCacheMvccTestSuite4 extends TestSuite {
+ /**
+ * @return IgniteCache test suite.
+ */
+ public static TestSuite suite() {
+ System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true");
+
+ HashSet<Class> ignoredTests = new HashSet<>(128);
+
+ // Skip classes that already contains Mvcc tests
+ ignoredTests.add(GridCacheVersionMultinodeTest.class);
+ ignoredTests.add(IgniteCacheCreatePutTest.class);
+ ignoredTests.add(IgniteClientCacheInitializationFailTest.class);
+ ignoredTests.add(IgniteCacheFailedUpdateResponseTest.class);
+ ignoredTests.add(CacheGetEntryPessimisticRepeatableReadSelfTest.class);
+ ignoredTests.add(CacheTxNotAllowReadFromBackupTest.class);
+ ignoredTests.add(CacheOffheapMapEntrySelfTest.class);
+ ignoredTests.add(CacheGroupsPreloadTest.class);
+ ignoredTests.add(CacheConnectionLeakStoreTxTest.class);
+ ignoredTests.add(IgniteCacheInvokeReadThroughTest.class);
+ ignoredTests.add(IgniteCacheInvokeReadThroughSingleNodeTest.class);
+ ignoredTests.add(IgniteDynamicCacheStartSelfTest.class);
+ ignoredTests.add(IgniteDynamicClientCacheStartSelfTest.class);
+ ignoredTests.add(IgniteDynamicCacheStartNoExchangeTimeoutTest.class);
+ ignoredTests.add(IgniteCacheSingleGetMessageTest.class);
+ ignoredTests.add(IgniteCacheReadFromBackupTest.class);
+
+ // Optimistic tx tests.
+ ignoredTests.add(CacheGetEntryOptimisticReadCommittedSelfTest.class);
+ ignoredTests.add(CacheGetEntryOptimisticRepeatableReadSelfTest.class);
+ ignoredTests.add(CacheGetEntryOptimisticSerializableSelfTest.class);
+
+ // Irrelevant Tx tests.
+ ignoredTests.add(CacheGetEntryPessimisticReadCommittedSelfTest.class);
+ ignoredTests.add(CacheGetEntryPessimisticSerializableSelfTest.class);
+
+ // Atomic cache tests.
+ ignoredTests.add(GridCacheMultinodeUpdateAtomicSelfTest.class);
+ ignoredTests.add(GridCacheMultinodeUpdateAtomicNearEnabledSelfTest.class);
+ ignoredTests.add(IgniteCacheAtomicLoadAllTest.class);
+ ignoredTests.add(IgniteCacheAtomicLocalLoadAllTest.class);
+ ignoredTests.add(IgniteCacheAtomicLoaderWriterTest.class);
+ ignoredTests.add(IgniteCacheAtomicStoreSessionTest.class);
+ ignoredTests.add(IgniteCacheAtomicStoreSessionWriteBehindTest.class);
+ ignoredTests.add(IgniteCacheAtomicNoReadThroughTest.class);
+ ignoredTests.add(IgniteCacheAtomicNearEnabledNoReadThroughTest.class);
+ ignoredTests.add(IgniteCacheAtomicLocalNoReadThroughTest.class);
+ ignoredTests.add(IgniteCacheAtomicNoLoadPreviousValueTest.class);
+ ignoredTests.add(IgniteCacheAtomicNearEnabledNoLoadPreviousValueTest.class);
+ ignoredTests.add(IgniteCacheAtomicLocalNoLoadPreviousValueTest.class);
+ ignoredTests.add(IgniteCacheAtomicNoWriteThroughTest.class);
+ ignoredTests.add(IgniteCacheAtomicNearEnabledNoWriteThroughTest.class);
+ ignoredTests.add(IgniteCacheAtomicLocalNoWriteThroughTest.class);
+ ignoredTests.add(IgniteCacheAtomicPeekModesTest.class);
+ ignoredTests.add(IgniteCacheAtomicNearPeekModesTest.class);
+ ignoredTests.add(IgniteCacheAtomicReplicatedPeekModesTest.class);
+ ignoredTests.add(IgniteCacheAtomicLocalPeekModesTest.class);
+ ignoredTests.add(IgniteCacheAtomicCopyOnReadDisabledTest.class);
+ ignoredTests.add(IgniteCacheAtomicLocalStoreValueTest.class);
+ ignoredTests.add(IgniteCacheAtomicStoreValueTest.class);
+ ignoredTests.add(IgniteCacheAtomicNearEnabledStoreValueTest.class);
+ ignoredTests.add(CacheStoreListenerRWThroughDisabledAtomicCacheTest.class);
+ ignoredTests.add(CacheStoreUsageMultinodeStaticStartAtomicTest.class);
+ ignoredTests.add(CacheStoreUsageMultinodeDynamicStartAtomicTest.class);
+ ignoredTests.add(IgniteStartCacheInTransactionAtomicSelfTest.class);
+ ignoredTests.add(CacheReadThroughReplicatedAtomicRestartSelfTest.class);
+ ignoredTests.add(CacheReadThroughLocalAtomicRestartSelfTest.class);
+ ignoredTests.add(CacheReadThroughAtomicRestartSelfTest.class);
+ ignoredTests.add(CacheVersionedEntryLocalAtomicSwapDisabledSelfTest.class);
+ ignoredTests.add(CacheVersionedEntryPartitionedAtomicSelfTest.class);
+ ignoredTests.add(CacheGetFutureHangsSelfTest.class);
+ ignoredTests.add(IgniteCacheContainsKeyAtomicTest.class);
+ ignoredTests.add(CacheVersionedEntryReplicatedAtomicSelfTest.class);
+ ignoredTests.add(CacheResultIsNotNullOnPartitionLossTest.class);
+
+ // Other non-tx tests.
+ ignoredTests.add(IgniteDynamicCacheStartStopConcurrentTest.class);
+ ignoredTests.add(IgniteCacheConfigurationDefaultTemplateTest.class);
+ ignoredTests.add(IgniteCacheStartTest.class);
+ ignoredTests.add(CacheDiscoveryDataConcurrentJoinTest.class);
+ ignoredTests.add(IgniteCacheJdbcBlobStoreNodeRestartTest.class);
+ ignoredTests.add(IgniteInternalCacheTypesTest.class);
+ ignoredTests.add(IgniteExchangeFutureHistoryTest.class);
+ ignoredTests.add(CacheNoValueClassOnServerNodeTest.class);
+ ignoredTests.add(IgniteSystemCacheOnClientTest.class);
+ ignoredTests.add(MarshallerCacheJobRunNodeRestartTest.class);
+
+ // Skip classes which Mvcc implementations are added in this method below.
+ // TODO IGNITE-10175: refactor these tests (use assume) to support both mvcc and non-mvcc modes after moving to JUnit4/5.
+ ignoredTests.add(IgniteCrossCacheTxSelfTest.class);
+
+ TestSuite suite = new TestSuite("IgniteCache Mvcc Test Suite part 4");
+
+ suite.addTest(IgniteCacheTestSuite4.suite(ignoredTests));
+
+ // Add Mvcc clones.
+ suite.addTestSuite(IgniteCrossCacheMvccTxSelfTest.class);
+
+ return suite;
+ }
+}
[26/50] [abbrv] ignite git commit: IGNITE-5968 mute tests
Posted by sb...@apache.org.
IGNITE-5968 mute tests
Signed-off-by: Dmitriy Govorukhin <dm...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/46ff2683
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/46ff2683
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/46ff2683
Branch: refs/heads/ignite-10044
Commit: 46ff2683a56f0f5c828cd57fc8f991b4becab3ef
Parents: 40f47b4
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Wed Dec 5 12:34:39 2018 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Wed Dec 5 12:34:39 2018 +0300
----------------------------------------------------------------------
.../distributed/GridCachePartitionNotLoadedEventSelfTest.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/46ff2683/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java
index f5695ca..4091b73 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java
@@ -107,6 +107,8 @@ public class GridCachePartitionNotLoadedEventSelfTest extends GridCommonAbstract
* @throws Exception If failed.
*/
public void testPrimaryAndBackupDead() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-5968");
+
backupCnt = 1;
startGridsMultiThreaded(4);
[13/50] [abbrv] ignite git commit: IGNITE-10272: [ML] Inject learning
environment into scope of dataset compute task
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/PreprocessingTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/PreprocessingTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/PreprocessingTrainer.java
index b977864..89751eb 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/PreprocessingTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/PreprocessingTrainer.java
@@ -23,6 +23,7 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.impl.cache.CacheBasedDatasetBuilder;
import org.apache.ignite.ml.dataset.impl.local.LocalDatasetBuilder;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
/**
@@ -37,24 +38,61 @@ public interface PreprocessingTrainer<K, V, T, R> {
/**
* Fits preprocessor.
*
+ * @param envBuilder Learning environment builder.
* @param datasetBuilder Dataset builder.
* @param basePreprocessor Base preprocessor.
* @return Preprocessor.
*/
- public IgniteBiFunction<K, V, R> fit(DatasetBuilder<K, V> datasetBuilder,
+ public IgniteBiFunction<K, V, R> fit(
+ LearningEnvironmentBuilder envBuilder,
+ DatasetBuilder<K, V> datasetBuilder,
IgniteBiFunction<K, V, T> basePreprocessor);
/**
* Fits preprocessor.
*
+ * @param datasetBuilder Dataset builder.
+ * @param basePreprocessor Base preprocessor.
+ * @return Preprocessor.
+ */
+ public default IgniteBiFunction<K, V, R> fit(
+ DatasetBuilder<K, V> datasetBuilder,
+ IgniteBiFunction<K, V, T> basePreprocessor) {
+ return fit(LearningEnvironmentBuilder.defaultBuilder(), datasetBuilder, basePreprocessor);
+ }
+
+ /**
+ * Fits preprocessor.
+ *
+ * @param ignite Ignite instance.
+ * @param cache Ignite cache.
+ * @param basePreprocessor Base preprocessor.
+ * @return Preprocessor.
+ */
+ public default IgniteBiFunction<K, V, R> fit(
+ Ignite ignite, IgniteCache<K, V> cache,
+ IgniteBiFunction<K, V, T> basePreprocessor) {
+ return fit(
+ new CacheBasedDatasetBuilder<>(ignite, cache),
+ basePreprocessor
+ );
+ }
+
+ /**
+ * Fits preprocessor.
+ *
+ * @param envBuilder Learning environment builder.
* @param ignite Ignite instance.
* @param cache Ignite cache.
* @param basePreprocessor Base preprocessor.
* @return Preprocessor.
*/
- public default IgniteBiFunction<K, V, R> fit(Ignite ignite, IgniteCache<K, V> cache,
+ public default IgniteBiFunction<K, V, R> fit(
+ LearningEnvironmentBuilder envBuilder,
+ Ignite ignite, IgniteCache<K, V> cache,
IgniteBiFunction<K, V, T> basePreprocessor) {
return fit(
+ envBuilder,
new CacheBasedDatasetBuilder<>(ignite, cache),
basePreprocessor
);
@@ -68,7 +106,29 @@ public interface PreprocessingTrainer<K, V, T, R> {
* @param basePreprocessor Base preprocessor.
* @return Preprocessor.
*/
- public default IgniteBiFunction<K, V, R> fit(Map<K, V> data, int parts,
+ public default IgniteBiFunction<K, V, R> fit(
+ LearningEnvironmentBuilder envBuilder,
+ Map<K, V> data,
+ int parts,
+ IgniteBiFunction<K, V, T> basePreprocessor) {
+ return fit(
+ envBuilder,
+ new LocalDatasetBuilder<>(data, parts),
+ basePreprocessor
+ );
+ }
+
+ /**
+ * Fits preprocessor.
+ *
+ * @param data Data.
+ * @param parts Number of partitions.
+ * @param basePreprocessor Base preprocessor.
+ * @return Preprocessor.
+ */
+ public default IgniteBiFunction<K, V, R> fit(
+ Map<K, V> data,
+ int parts,
IgniteBiFunction<K, V, T> basePreprocessor) {
return fit(
new LocalDatasetBuilder<>(data, parts),
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/binarization/BinarizationTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/binarization/BinarizationTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/binarization/BinarizationTrainer.java
index ad8c90e..039794c 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/binarization/BinarizationTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/binarization/BinarizationTrainer.java
@@ -18,6 +18,7 @@
package org.apache.ignite.ml.preprocessing.binarization;
import org.apache.ignite.ml.dataset.DatasetBuilder;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.preprocessing.PreprocessingTrainer;
@@ -33,7 +34,9 @@ public class BinarizationTrainer<K, V> implements PreprocessingTrainer<K, V, Vec
private double threshold;
/** {@inheritDoc} */
- @Override public BinarizationPreprocessor<K, V> fit(DatasetBuilder<K, V> datasetBuilder,
+ @Override public BinarizationPreprocessor<K, V> fit(
+ LearningEnvironmentBuilder envBuilder,
+ DatasetBuilder<K, V> datasetBuilder,
IgniteBiFunction<K, V, Vector> basePreprocessor) {
return new BinarizationPreprocessor<>(threshold, basePreprocessor);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/encoding/EncoderTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/encoding/EncoderTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/encoding/EncoderTrainer.java
index d5668e4..14a509e 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/encoding/EncoderTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/encoding/EncoderTrainer.java
@@ -29,6 +29,7 @@ import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.UpstreamEntry;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.preprocessing.PreprocessingTrainer;
@@ -53,14 +54,17 @@ public class EncoderTrainer<K, V> implements PreprocessingTrainer<K, V, Object[]
private EncoderSortingStrategy encoderSortingStgy = EncoderSortingStrategy.FREQUENCY_DESC;
/** {@inheritDoc} */
- @Override public EncoderPreprocessor<K, V> fit(DatasetBuilder<K, V> datasetBuilder,
- IgniteBiFunction<K, V, Object[]> basePreprocessor) {
+ @Override public EncoderPreprocessor<K, V> fit(
+ LearningEnvironmentBuilder envBuilder,
+ DatasetBuilder<K, V> datasetBuilder,
+ IgniteBiFunction<K, V, Object[]> basePreprocessor) {
if (handledIndices.isEmpty())
throw new RuntimeException("Add indices of handled features");
try (Dataset<EmptyContext, EncoderPartitionData> dataset = datasetBuilder.build(
- (upstream, upstreamSize) -> new EmptyContext(),
- (upstream, upstreamSize, ctx) -> {
+ envBuilder,
+ (env, upstream, upstreamSize) -> new EmptyContext(),
+ (env, upstream, upstreamSize, ctx) -> {
// This array will contain not null values for handled indices
Map<String, Integer>[] categoryFrequencies = null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/imputing/ImputerTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/imputing/ImputerTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/imputing/ImputerTrainer.java
index 090b0a4..e8920f3 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/imputing/ImputerTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/imputing/ImputerTrainer.java
@@ -23,8 +23,10 @@ import java.util.Map;
import java.util.Optional;
import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.DatasetBuilder;
+import org.apache.ignite.ml.dataset.PartitionContextBuilder;
import org.apache.ignite.ml.dataset.UpstreamEntry;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
@@ -43,11 +45,13 @@ public class ImputerTrainer<K, V> implements PreprocessingTrainer<K, V, Vector,
private ImputingStrategy imputingStgy = ImputingStrategy.MEAN;
/** {@inheritDoc} */
- @Override public ImputerPreprocessor<K, V> fit(DatasetBuilder<K, V> datasetBuilder,
+ @Override public ImputerPreprocessor<K, V> fit(LearningEnvironmentBuilder envBuilder, DatasetBuilder<K, V> datasetBuilder,
IgniteBiFunction<K, V, Vector> basePreprocessor) {
+ PartitionContextBuilder<K, V, EmptyContext> builder = (env, upstream, upstreamSize) -> new EmptyContext();
try (Dataset<EmptyContext, ImputerPartitionData> dataset = datasetBuilder.build(
- (upstream, upstreamSize) -> new EmptyContext(),
- (upstream, upstreamSize, ctx) -> {
+ envBuilder,
+ builder,
+ (env, upstream, upstreamSize, ctx) -> {
double[] sums = null;
int[] counts = null;
Map<Double, Integer>[] valuesByFreq = null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/maxabsscaling/MaxAbsScalerTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/maxabsscaling/MaxAbsScalerTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/maxabsscaling/MaxAbsScalerTrainer.java
index c8b1dca..52acea3 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/maxabsscaling/MaxAbsScalerTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/maxabsscaling/MaxAbsScalerTrainer.java
@@ -21,6 +21,7 @@ import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.UpstreamEntry;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.preprocessing.PreprocessingTrainer;
@@ -33,11 +34,14 @@ import org.apache.ignite.ml.preprocessing.PreprocessingTrainer;
*/
public class MaxAbsScalerTrainer<K, V> implements PreprocessingTrainer<K, V, Vector, Vector> {
/** {@inheritDoc} */
- @Override public MaxAbsScalerPreprocessor<K, V> fit(DatasetBuilder<K, V> datasetBuilder,
+ @Override public MaxAbsScalerPreprocessor<K, V> fit(
+ LearningEnvironmentBuilder envBuilder,
+ DatasetBuilder<K, V> datasetBuilder,
IgniteBiFunction<K, V, Vector> basePreprocessor) {
try (Dataset<EmptyContext, MaxAbsScalerPartitionData> dataset = datasetBuilder.build(
- (upstream, upstreamSize) -> new EmptyContext(),
- (upstream, upstreamSize, ctx) -> {
+ envBuilder,
+ (env, upstream, upstreamSize) -> new EmptyContext(),
+ (env, upstream, upstreamSize, ctx) -> {
double[] maxAbs = null;
while (upstream.hasNext()) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/minmaxscaling/MinMaxScalerTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/minmaxscaling/MinMaxScalerTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/minmaxscaling/MinMaxScalerTrainer.java
index 6a39236..71f2afc 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/minmaxscaling/MinMaxScalerTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/minmaxscaling/MinMaxScalerTrainer.java
@@ -19,8 +19,10 @@ package org.apache.ignite.ml.preprocessing.minmaxscaling;
import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.DatasetBuilder;
+import org.apache.ignite.ml.dataset.PartitionContextBuilder;
import org.apache.ignite.ml.dataset.UpstreamEntry;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.preprocessing.PreprocessingTrainer;
@@ -33,11 +35,15 @@ import org.apache.ignite.ml.preprocessing.PreprocessingTrainer;
*/
public class MinMaxScalerTrainer<K, V> implements PreprocessingTrainer<K, V, Vector, Vector> {
/** {@inheritDoc} */
- @Override public MinMaxScalerPreprocessor<K, V> fit(DatasetBuilder<K, V> datasetBuilder,
+ @Override public MinMaxScalerPreprocessor<K, V> fit(
+ LearningEnvironmentBuilder envBuilder,
+ DatasetBuilder<K, V> datasetBuilder,
IgniteBiFunction<K, V, Vector> basePreprocessor) {
+ PartitionContextBuilder<K, V, EmptyContext> ctxBuilder = (env, upstream, upstreamSize) -> new EmptyContext();
try (Dataset<EmptyContext, MinMaxScalerPartitionData> dataset = datasetBuilder.build(
- (upstream, upstreamSize) -> new EmptyContext(),
- (upstream, upstreamSize, ctx) -> {
+ envBuilder,
+ ctxBuilder,
+ (env, upstream, upstreamSize, ctx) -> {
double[] min = null;
double[] max = null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/normalization/NormalizationTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/normalization/NormalizationTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/normalization/NormalizationTrainer.java
index b2dc6ed..08c4a68 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/normalization/NormalizationTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/normalization/NormalizationTrainer.java
@@ -18,6 +18,7 @@
package org.apache.ignite.ml.preprocessing.normalization;
import org.apache.ignite.ml.dataset.DatasetBuilder;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.preprocessing.PreprocessingTrainer;
@@ -33,7 +34,9 @@ public class NormalizationTrainer<K, V> implements PreprocessingTrainer<K, V, Ve
private int p = 2;
/** {@inheritDoc} */
- @Override public NormalizationPreprocessor<K, V> fit(DatasetBuilder<K, V> datasetBuilder,
+ @Override public NormalizationPreprocessor<K, V> fit(
+ LearningEnvironmentBuilder envBuilder,
+ DatasetBuilder<K, V> datasetBuilder,
IgniteBiFunction<K, V, Vector> basePreprocessor) {
return new NormalizationPreprocessor<>(p, basePreprocessor);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerTrainer.java
index 5147b05..604f0b0 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerTrainer.java
@@ -21,6 +21,7 @@ import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.UpstreamEntry;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.preprocessing.PreprocessingTrainer;
@@ -33,9 +34,10 @@ import org.apache.ignite.ml.preprocessing.PreprocessingTrainer;
*/
public class StandardScalerTrainer<K, V> implements PreprocessingTrainer<K, V, Vector, Vector> {
/** {@inheritDoc} */
- @Override public StandardScalerPreprocessor<K, V> fit(DatasetBuilder<K, V> datasetBuilder,
+ @Override public StandardScalerPreprocessor<K, V> fit(LearningEnvironmentBuilder envBuilder,
+ DatasetBuilder<K, V> datasetBuilder,
IgniteBiFunction<K, V, Vector> basePreprocessor) {
- StandardScalerData standardScalerData = computeSum(datasetBuilder, basePreprocessor);
+ StandardScalerData standardScalerData = computeSum(envBuilder, datasetBuilder, basePreprocessor);
int n = standardScalerData.sum.length;
long cnt = standardScalerData.cnt;
@@ -51,11 +53,13 @@ public class StandardScalerTrainer<K, V> implements PreprocessingTrainer<K, V, V
}
/** Computes sum, squared sum and row count. */
- private StandardScalerData computeSum(DatasetBuilder<K, V> datasetBuilder,
+ private StandardScalerData computeSum(LearningEnvironmentBuilder envBuilder,
+ DatasetBuilder<K, V> datasetBuilder,
IgniteBiFunction<K, V, Vector> basePreprocessor) {
try (Dataset<EmptyContext, StandardScalerData> dataset = datasetBuilder.build(
- (upstream, upstreamSize) -> new EmptyContext(),
- (upstream, upstreamSize, ctx) -> {
+ envBuilder,
+ (env, upstream, upstreamSize) -> new EmptyContext(),
+ (env, upstream, upstreamSize, ctx) -> {
double[] sum = null;
double[] squaredSum = null;
long cnt = 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/regressions/linear/LinearRegressionLSQRTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/linear/LinearRegressionLSQRTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/linear/LinearRegressionLSQRTrainer.java
index 5497177..dc245d2 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/linear/LinearRegressionLSQRTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/linear/LinearRegressionLSQRTrainer.java
@@ -50,6 +50,7 @@ public class LinearRegressionLSQRTrainer extends SingleLabelDatasetTrainer<Linea
try (LSQROnHeap<K, V> lsqr = new LSQROnHeap<>(
datasetBuilder,
+ envBuilder,
new SimpleLabeledDatasetDataBuilder<>(
new FeatureExtractorWrapper<>(featureExtractor),
lbExtractor.andThen(e -> new double[] {e})
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/LogRegressionMultiClassTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/LogRegressionMultiClassTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/LogRegressionMultiClassTrainer.java
index 71d54fa..fd5a624 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/LogRegressionMultiClassTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/LogRegressionMultiClassTrainer.java
@@ -136,7 +136,8 @@ public class LogRegressionMultiClassTrainer<P extends Serializable>
List<Double> res = new ArrayList<>();
try (Dataset<EmptyContext, LabelPartitionDataOnHeap> dataset = datasetBuilder.build(
- (upstream, upstreamSize) -> new EmptyContext(),
+ envBuilder,
+ (env, upstream, upstreamSize) -> new EmptyContext(),
partDataBuilder
)) {
final Set<Double> clsLabels = dataset.compute(data -> {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/structures/partition/LabelPartitionDataBuilderOnHeap.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/structures/partition/LabelPartitionDataBuilderOnHeap.java b/modules/ml/src/main/java/org/apache/ignite/ml/structures/partition/LabelPartitionDataBuilderOnHeap.java
index 4fba028..5549b08 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/structures/partition/LabelPartitionDataBuilderOnHeap.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/structures/partition/LabelPartitionDataBuilderOnHeap.java
@@ -21,6 +21,7 @@ import java.io.Serializable;
import java.util.Iterator;
import org.apache.ignite.ml.dataset.PartitionDataBuilder;
import org.apache.ignite.ml.dataset.UpstreamEntry;
+import org.apache.ignite.ml.environment.LearningEnvironment;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
/**
@@ -48,8 +49,11 @@ public class LabelPartitionDataBuilderOnHeap<K, V, C extends Serializable>
}
/** {@inheritDoc} */
- @Override public LabelPartitionDataOnHeap build(Iterator<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize,
- C ctx) {
+ @Override public LabelPartitionDataOnHeap build(
+ LearningEnvironment env,
+ Iterator<UpstreamEntry<K, V>> upstreamData,
+ long upstreamDataSize,
+ C ctx) {
double[] y = new double[Math.toIntExact(upstreamDataSize)];
int ptr = 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/structures/partition/LabeledDatasetPartitionDataBuilderOnHeap.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/structures/partition/LabeledDatasetPartitionDataBuilderOnHeap.java b/modules/ml/src/main/java/org/apache/ignite/ml/structures/partition/LabeledDatasetPartitionDataBuilderOnHeap.java
index 0351037..0d054f6 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/structures/partition/LabeledDatasetPartitionDataBuilderOnHeap.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/structures/partition/LabeledDatasetPartitionDataBuilderOnHeap.java
@@ -21,6 +21,7 @@ import java.io.Serializable;
import java.util.Iterator;
import org.apache.ignite.ml.dataset.PartitionDataBuilder;
import org.apache.ignite.ml.dataset.UpstreamEntry;
+import org.apache.ignite.ml.environment.LearningEnvironment;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.structures.LabeledVector;
@@ -57,8 +58,10 @@ public class LabeledDatasetPartitionDataBuilderOnHeap<K, V, C extends Serializab
}
/** {@inheritDoc} */
- @Override public LabeledVectorSet<Double, LabeledVector> build(Iterator<UpstreamEntry<K, V>> upstreamData,
- long upstreamDataSize, C ctx) {
+ @Override public LabeledVectorSet<Double, LabeledVector> build(
+ LearningEnvironment env,
+ Iterator<UpstreamEntry<K, V>> upstreamData,
+ long upstreamDataSize, C ctx) {
int xCols = -1;
double[][] x = null;
double[] y = new double[Math.toIntExact(upstreamDataSize)];
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearBinaryClassificationTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearBinaryClassificationTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearBinaryClassificationTrainer.java
index 47666f4..7ceb53b 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearBinaryClassificationTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearBinaryClassificationTrainer.java
@@ -89,7 +89,8 @@ public class SVMLinearBinaryClassificationTrainer extends SingleLabelDatasetTrai
Vector weights;
try (Dataset<EmptyContext, LabeledVectorSet<Double, LabeledVector>> dataset = datasetBuilder.build(
- (upstream, upstreamSize) -> new EmptyContext(),
+ envBuilder,
+ (env, upstream, upstreamSize) -> new EmptyContext(),
partDataBuilder
)) {
if (mdl == null) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearMultiClassClassificationTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearMultiClassClassificationTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearMultiClassClassificationTrainer.java
index b161914..94f2a99 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearMultiClassClassificationTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearMultiClassClassificationTrainer.java
@@ -157,7 +157,8 @@ public class SVMLinearMultiClassClassificationTrainer
List<Double> res = new ArrayList<>();
try (Dataset<EmptyContext, LabelPartitionDataOnHeap> dataset = datasetBuilder.build(
- (upstream, upstreamSize) -> new EmptyContext(),
+ envBuilder,
+ (env, upstream, upstreamSize) -> new EmptyContext(),
partDataBuilder
)) {
final Set<Double> clsLabels = dataset.compute(data -> {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/trainers/DatasetTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/trainers/DatasetTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/trainers/DatasetTrainer.java
index f321744..dabf66a 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/trainers/DatasetTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/trainers/DatasetTrainer.java
@@ -26,6 +26,7 @@ import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.impl.cache.CacheBasedDatasetBuilder;
import org.apache.ignite.ml.dataset.impl.local.LocalDatasetBuilder;
import org.apache.ignite.ml.environment.LearningEnvironment;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.environment.logging.MLLogger;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
@@ -38,8 +39,11 @@ import org.jetbrains.annotations.NotNull;
* @param <L> Type of a label.
*/
public abstract class DatasetTrainer<M extends Model, L> {
+ /** Learning environment builder. */
+ protected LearningEnvironmentBuilder envBuilder = LearningEnvironmentBuilder.defaultBuilder();
+
/** Learning Environment. */
- protected LearningEnvironment environment = LearningEnvironment.DEFAULT;
+ protected LearningEnvironment environment = envBuilder.buildForTrainer();
/**
* Trains model based on the specified data.
@@ -289,11 +293,25 @@ public abstract class DatasetTrainer<M extends Model, L> {
}
/**
- * Sets learning Environment
- * @param environment Environment.
+ * Changes learning Environment.
+ *
+ * @param envBuilder Learning environment builder.
+ */
+ // TODO: IGNITE-10441 Think about more elegant ways to perform fluent API.
+ public DatasetTrainer<M, L> withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) {
+ this.envBuilder = envBuilder;
+ this.environment = envBuilder.buildForTrainer();
+
+ return this;
+ }
+
+ /**
+ * Get learning environment.
+ *
+ * @return Learning environment.
*/
- public void setEnvironment(LearningEnvironment environment) {
- this.environment = environment;
+ public LearningEnvironment learningEnvironment() {
+ return environment;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/trainers/TrainerTransformers.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/trainers/TrainerTransformers.java b/modules/ml/src/main/java/org/apache/ignite/ml/trainers/TrainerTransformers.java
index 05504c3..1019a39 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/trainers/TrainerTransformers.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/trainers/TrainerTransformers.java
@@ -17,21 +17,15 @@
package org.apache.ignite.ml.trainers;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
-import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.ml.Model;
import org.apache.ignite.ml.composition.ModelsComposition;
import org.apache.ignite.ml.composition.predictionsaggregator.PredictionsAggregator;
-import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.DatasetBuilder;
-import org.apache.ignite.ml.dataset.PartitionContextBuilder;
-import org.apache.ignite.ml.dataset.PartitionDataBuilder;
-import org.apache.ignite.ml.dataset.UpstreamTransformerChain;
import org.apache.ignite.ml.environment.LearningEnvironment;
import org.apache.ignite.ml.environment.logging.MLLogger;
import org.apache.ignite.ml.environment.parallelism.Promise;
@@ -49,7 +43,7 @@ import org.apache.ignite.ml.util.Utils;
*/
public class TrainerTransformers {
/**
- * Add bagging logic to a given trainer.
+ * Add bagging logic to a given trainer. No features bootstrapping is done.
*
* @param ensembleSize Size of ensemble.
* @param subsampleRatio Subsample ratio to whole dataset.
@@ -63,9 +57,8 @@ public class TrainerTransformers {
int ensembleSize,
double subsampleRatio,
PredictionsAggregator aggregator) {
- return makeBagged(trainer, ensembleSize, subsampleRatio, -1, -1, aggregator, new Random().nextLong());
+ return makeBagged(trainer, ensembleSize, subsampleRatio, -1, -1, aggregator);
}
-
/**
* Add bagging logic to a given trainer.
*
@@ -74,31 +67,23 @@ public class TrainerTransformers {
* @param aggregator Aggregator.
* @param featureVectorSize Feature vector dimensionality.
* @param featuresSubspaceDim Feature subspace dimensionality.
- * @param transformationSeed Transformations seed.
* @param <M> Type of one model in ensemble.
* @param <L> Type of labels.
* @return Bagged trainer.
*/
- // TODO: IGNITE-10296: Inject capabilities of seeding through learning environment (remove).
public static <M extends Model<Vector, Double>, L> DatasetTrainer<ModelsComposition, L> makeBagged(
DatasetTrainer<M, L> trainer,
int ensembleSize,
double subsampleRatio,
int featureVectorSize,
int featuresSubspaceDim,
- PredictionsAggregator aggregator,
- Long transformationSeed) {
+ PredictionsAggregator aggregator) {
return new DatasetTrainer<ModelsComposition, L>() {
/** {@inheritDoc} */
@Override public <K, V> ModelsComposition fit(
DatasetBuilder<K, V> datasetBuilder,
IgniteBiFunction<K, V, Vector> featureExtractor,
IgniteBiFunction<K, V, L> lbExtractor) {
- datasetBuilder.upstreamTransformersChain().setSeed(
- transformationSeed == null
- ? new Random().nextLong()
- : transformationSeed);
-
return runOnEnsemble(
(db, i, fe) -> (() -> trainer.fit(db, fe, lbExtractor)),
datasetBuilder,
@@ -172,21 +157,17 @@ public class TrainerTransformers {
log.log(MLLogger.VerboseLevel.LOW, "Start learning.");
List<int[]> mappings = null;
- if (featuresVectorSize > 0) {
+ if (featuresVectorSize > 0 && featureSubspaceDim != featuresVectorSize) {
mappings = IntStream.range(0, ensembleSize).mapToObj(
modelIdx -> getMapping(
featuresVectorSize,
featureSubspaceDim,
- datasetBuilder.upstreamTransformersChain().seed() + modelIdx))
+ environment.randomNumbersGenerator().nextLong() + modelIdx))
.collect(Collectors.toList());
}
Long startTs = System.currentTimeMillis();
- datasetBuilder
- .upstreamTransformersChain()
- .addUpstreamTransformer(new BaggingUpstreamTransformer<>(subsampleRatio));
-
List<IgniteSupplier<M>> tasks = new ArrayList<>();
List<IgniteBiFunction<K, V, Vector>> extractors = new ArrayList<>();
if (mappings != null) {
@@ -195,10 +176,8 @@ public class TrainerTransformers {
}
for (int i = 0; i < ensembleSize; i++) {
- UpstreamTransformerChain<K, V> newChain = Utils.copy(datasetBuilder.upstreamTransformersChain());
- DatasetBuilder<K, V> newBuilder = withNewChain(datasetBuilder, newChain);
- int j = i;
- newChain.modifySeed(s -> s * s + j);
+ DatasetBuilder<K, V> newBuilder =
+ datasetBuilder.withUpstreamTransformer(BaggingUpstreamTransformer.builder(subsampleRatio, i));
tasks.add(
trainingTaskGenerator.apply(newBuilder, i, mappings != null ? extractors.get(i) : extractor));
}
@@ -338,37 +317,4 @@ public class TrainerTransformers {
return mapping;
}
}
-
- /**
- * Creates new dataset builder which is delegate of a given dataset builder in everything except
- * new transformations chain.
- *
- * @param builder Initial builder.
- * @param chain New chain.
- * @param <K> Type of keys.
- * @param <V> Type of values.
- * @return new dataset builder which is delegate of a given dataset builder in everything except
- * new transformations chain.
- */
- private static <K, V> DatasetBuilder<K, V> withNewChain(
- DatasetBuilder<K, V> builder,
- UpstreamTransformerChain<K, V> chain) {
- return new DatasetBuilder<K, V>() {
- /** {@inheritDoc} */
- @Override public <C extends Serializable, D extends AutoCloseable> Dataset<C, D> build(
- PartitionContextBuilder<K, V, C> partCtxBuilder, PartitionDataBuilder<K, V, C, D> partDataBuilder) {
- return builder.build(partCtxBuilder, partDataBuilder);
- }
-
- /** {@inheritDoc} */
- @Override public UpstreamTransformerChain<K, V> upstreamTransformersChain() {
- return chain;
- }
-
- /** {@inheritDoc} */
- @Override public DatasetBuilder<K, V> withFilter(IgniteBiPredicate<K, V> filterToAdd) {
- return builder.withFilter(filterToAdd);
- }
- };
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/trainers/transformers/BaggingUpstreamTransformer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/trainers/transformers/BaggingUpstreamTransformer.java b/modules/ml/src/main/java/org/apache/ignite/ml/trainers/transformers/BaggingUpstreamTransformer.java
index f935ebd..7f45fdd 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/trainers/transformers/BaggingUpstreamTransformer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/trainers/transformers/BaggingUpstreamTransformer.java
@@ -17,12 +17,12 @@
package org.apache.ignite.ml.trainers.transformers;
-import java.util.Random;
import java.util.stream.Stream;
import org.apache.commons.math3.distribution.PoissonDistribution;
import org.apache.commons.math3.random.Well19937c;
import org.apache.ignite.ml.dataset.UpstreamEntry;
import org.apache.ignite.ml.dataset.UpstreamTransformer;
+import org.apache.ignite.ml.dataset.UpstreamTransformerBuilder;
/**
* This class encapsulates the logic needed to do bagging (bootstrap aggregating) by features.
@@ -33,22 +33,43 @@ import org.apache.ignite.ml.dataset.UpstreamTransformer;
* @param <V> Type of upstream values.
*/
public class BaggingUpstreamTransformer<K, V> implements UpstreamTransformer<K, V> {
+ /** Serial version uid. */
+ private static final long serialVersionUID = -913152523469994149L;
+
/** Ratio of subsample to entire upstream size */
private double subsampleRatio;
+ /** Seed used for generating poisson distribution. */
+ private long seed;
+
+ /**
+ * Get builder of {@link BaggingUpstreamTransformer} for a model with a specified index in ensemble.
+ *
+ * @param subsampleRatio Subsample ratio.
+ * @param mdlIdx Index of model in ensemble.
+ * @param <K> Type of upstream keys.
+ * @param <V> Type of upstream values.
+ * @return Builder of {@link BaggingUpstreamTransformer}.
+ */
+ public static <K, V> UpstreamTransformerBuilder<K, V> builder(double subsampleRatio, int mdlIdx) {
+ return env -> new BaggingUpstreamTransformer<>(env.randomNumbersGenerator().nextLong() + mdlIdx, subsampleRatio);
+ }
+
/**
* Construct instance of this transformer with a given subsample ratio.
*
+ * @param seed Seed used for generating poisson distribution which in turn used to make subsamples.
* @param subsampleRatio Subsample ratio.
*/
- public BaggingUpstreamTransformer(double subsampleRatio) {
+ public BaggingUpstreamTransformer(long seed, double subsampleRatio) {
this.subsampleRatio = subsampleRatio;
+ this.seed = seed;
}
/** {@inheritDoc} */
- @Override public Stream<UpstreamEntry<K, V>> transform(Random rnd, Stream<UpstreamEntry<K, V>> upstream) {
+ @Override public Stream<UpstreamEntry<K, V>> transform(Stream<UpstreamEntry<K, V>> upstream) {
PoissonDistribution poisson = new PoissonDistribution(
- new Well19937c(rnd.nextLong()),
+ new Well19937c(seed),
subsampleRatio,
PoissonDistribution.DEFAULT_EPSILON,
PoissonDistribution.DEFAULT_MAX_ITERATIONS);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTree.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTree.java b/modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTree.java
index 482c938..510d26e 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTree.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTree.java
@@ -24,6 +24,7 @@ import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.DatasetBuilder;
import org.apache.ignite.ml.dataset.primitive.builder.context.EmptyContextBuilder;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.trainers.DatasetTrainer;
@@ -76,6 +77,7 @@ public abstract class DecisionTree<T extends ImpurityMeasure<T>> extends Dataset
@Override public <K, V> DecisionTreeNode fit(DatasetBuilder<K, V> datasetBuilder,
IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, Double> lbExtractor) {
try (Dataset<EmptyContext, DecisionTreeData> dataset = datasetBuilder.build(
+ envBuilder,
new EmptyContextBuilder<>(),
new DecisionTreeDataBuilder<>(featureExtractor, lbExtractor, usingIdx)
)) {
@@ -108,6 +110,11 @@ public abstract class DecisionTree<T extends ImpurityMeasure<T>> extends Dataset
return true;
}
+ /** {@inheritDoc} */
+ @Override public DecisionTree<T> withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) {
+ return (DecisionTree<T>)super.withEnvironmentBuilder(envBuilder);
+ }
+
/** */
public <K,V> DecisionTreeNode fit(Dataset<EmptyContext, DecisionTreeData> dataset) {
return split(dataset, e -> true, 0, getImpurityMeasureCalculator(dataset));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTreeClassificationTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTreeClassificationTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTreeClassificationTrainer.java
index 58552f4..321e65f 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTreeClassificationTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTreeClassificationTrainer.java
@@ -23,6 +23,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.tree.data.DecisionTreeData;
import org.apache.ignite.ml.tree.impurity.ImpurityMeasureCalculator;
import org.apache.ignite.ml.tree.impurity.gini.GiniImpurityMeasure;
@@ -129,4 +130,9 @@ public class DecisionTreeClassificationTrainer extends DecisionTree<GiniImpurity
return new GiniImpurityMeasureCalculator(encoder, usingIdx);
}
+
+ /** {@inheritDoc} */
+ @Override public DecisionTreeClassificationTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) {
+ return (DecisionTreeClassificationTrainer)super.withEnvironmentBuilder(envBuilder);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTreeRegressionTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTreeRegressionTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTreeRegressionTrainer.java
index ea57bcc..2b259f2 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTreeRegressionTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/tree/DecisionTreeRegressionTrainer.java
@@ -19,6 +19,7 @@ package org.apache.ignite.ml.tree;
import org.apache.ignite.ml.dataset.Dataset;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.tree.data.DecisionTreeData;
import org.apache.ignite.ml.tree.impurity.ImpurityMeasureCalculator;
import org.apache.ignite.ml.tree.impurity.mse.MSEImpurityMeasure;
@@ -69,4 +70,9 @@ public class DecisionTreeRegressionTrainer extends DecisionTree<MSEImpurityMeasu
return new MSEImpurityMeasureCalculator(usingIdx);
}
+
+ /** {@inheritDoc} */
+ @Override public DecisionTreeRegressionTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) {
+ return (DecisionTreeRegressionTrainer)super.withEnvironmentBuilder(envBuilder);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBBinaryClassifierOnTreesTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBBinaryClassifierOnTreesTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBBinaryClassifierOnTreesTrainer.java
index b99dc2f..b19652d 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBBinaryClassifierOnTreesTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBBinaryClassifierOnTreesTrainer.java
@@ -19,6 +19,7 @@ package org.apache.ignite.ml.tree.boosting;
import org.apache.ignite.ml.composition.boosting.GDBBinaryClassifierTrainer;
import org.apache.ignite.ml.composition.boosting.GDBLearningStrategy;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.tree.DecisionTreeRegressionTrainer;
import org.jetbrains.annotations.NotNull;
@@ -61,6 +62,11 @@ public class GDBBinaryClassifierOnTreesTrainer extends GDBBinaryClassifierTraine
return new GDBOnTreesLearningStrategy(usingIdx);
}
+ /** {@inheritDoc} */
+ @Override public GDBBinaryClassifierOnTreesTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) {
+ return (GDBBinaryClassifierOnTreesTrainer)super.withEnvironmentBuilder(envBuilder);
+ }
+
/**
* Set useIndex parameter and returns trainer instance.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBOnTreesLearningStrategy.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBOnTreesLearningStrategy.java b/modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBOnTreesLearningStrategy.java
index caac168..71e840c 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBOnTreesLearningStrategy.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBOnTreesLearningStrategy.java
@@ -70,6 +70,7 @@ public class GDBOnTreesLearningStrategy extends GDBLearningStrategy {
externalLbToInternalMapping, loss, datasetBuilder, featureExtractor, lbExtractor);
try (Dataset<EmptyContext, DecisionTreeData> dataset = datasetBuilder.build(
+ envBuilder,
new EmptyContextBuilder<>(),
new DecisionTreeDataBuilder<>(featureExtractor, lbExtractor, useIdx)
)) {
@@ -95,7 +96,7 @@ public class GDBOnTreesLearningStrategy extends GDBLearningStrategy {
long startTs = System.currentTimeMillis();
models.add(decisionTreeTrainer.fit(dataset));
double learningTime = (double)(System.currentTimeMillis() - startTs) / 1000.0;
- environment.logger(getClass()).log(MLLogger.VerboseLevel.LOW, "One model training time was %.2fs", learningTime);
+ trainerEnvironment.logger(getClass()).log(MLLogger.VerboseLevel.LOW, "One model training time was %.2fs", learningTime);
}
}
catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBRegressionOnTreesTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBRegressionOnTreesTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBRegressionOnTreesTrainer.java
index b6c0b48..9c588ce 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBRegressionOnTreesTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/tree/boosting/GDBRegressionOnTreesTrainer.java
@@ -19,6 +19,7 @@ package org.apache.ignite.ml.tree.boosting;
import org.apache.ignite.ml.composition.boosting.GDBLearningStrategy;
import org.apache.ignite.ml.composition.boosting.GDBRegressionTrainer;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.tree.DecisionTreeRegressionTrainer;
import org.jetbrains.annotations.NotNull;
@@ -120,4 +121,9 @@ public class GDBRegressionOnTreesTrainer extends GDBRegressionTrainer {
@Override protected GDBLearningStrategy getLearningStrategy() {
return new GDBOnTreesLearningStrategy(usingIdx);
}
+
+ /** {@inheritDoc} */
+ @Override public GDBRegressionOnTreesTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) {
+ return (GDBRegressionOnTreesTrainer)super.withEnvironmentBuilder(envBuilder);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/tree/data/DecisionTreeDataBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/tree/data/DecisionTreeDataBuilder.java b/modules/ml/src/main/java/org/apache/ignite/ml/tree/data/DecisionTreeDataBuilder.java
index 4436b07..1378120 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/tree/data/DecisionTreeDataBuilder.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/tree/data/DecisionTreeDataBuilder.java
@@ -21,6 +21,7 @@ import java.io.Serializable;
import java.util.Iterator;
import org.apache.ignite.ml.dataset.PartitionDataBuilder;
import org.apache.ignite.ml.dataset.UpstreamEntry;
+import org.apache.ignite.ml.environment.LearningEnvironment;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.primitives.vector.Vector;
@@ -60,7 +61,11 @@ public class DecisionTreeDataBuilder<K, V, C extends Serializable>
}
/** {@inheritDoc} */
- @Override public DecisionTreeData build(Iterator<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize, C ctx) {
+ @Override public DecisionTreeData build(
+ LearningEnvironment envBuilder,
+ Iterator<UpstreamEntry<K, V>> upstreamData,
+ long upstreamDataSize,
+ C ctx) {
double[][] features = new double[Math.toIntExact(upstreamDataSize)][];
double[] labels = new double[Math.toIntExact(upstreamDataSize)];
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/main/java/org/apache/ignite/ml/tree/randomforest/RandomForestTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/tree/randomforest/RandomForestTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/tree/randomforest/RandomForestTrainer.java
index 72a97c4..3ee90cb 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/tree/randomforest/RandomForestTrainer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/tree/randomforest/RandomForestTrainer.java
@@ -114,6 +114,7 @@ public abstract class RandomForestTrainer<L, S extends ImpurityComputer<Bootstra
IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, Double> lbExtractor) {
List<TreeRoot> models = null;
try (Dataset<EmptyContext, BootstrappedDatasetPartition> dataset = datasetBuilder.build(
+ envBuilder,
new EmptyContextBuilder<>(),
new BootstrappedDatasetBuilder<>(featureExtractor, lbExtractor, amountOfTrees, subSampleSize))) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/TestUtils.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/TestUtils.java b/modules/ml/src/test/java/org/apache/ignite/ml/TestUtils.java
index 4b472cc..1103ef0 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/TestUtils.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/TestUtils.java
@@ -18,6 +18,7 @@
package org.apache.ignite.ml;
import java.util.stream.IntStream;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.primitives.matrix.Matrix;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.junit.Assert;
@@ -325,4 +326,82 @@ public class TestUtils {
}
}
+
+ /**
+ * Gets test learning environment builder.
+ *
+ * @return test learning environment builder.
+ */
+ public static LearningEnvironmentBuilder testEnvBuilder() {
+ return testEnvBuilder(123L);
+ }
+
+ /**
+ * Gets test learning environment builder with a given seed.
+ *
+ * @param seed Seed.
+ * @return test learning environment builder.
+ */
+ public static LearningEnvironmentBuilder testEnvBuilder(long seed) {
+ return LearningEnvironmentBuilder.defaultBuilder().withRNGSeed(seed);
+ }
+
+ /**
+ * Simple wrapper class which adds {@link AutoCloseable} to given type.
+ *
+ * @param <T> Type to wrap.
+ */
+ public static class DataWrapper<T> implements AutoCloseable {
+ /**
+ * Value to wrap.
+ */
+ T val;
+
+ /**
+ * Wrap given value in {@link AutoCloseable}.
+ *
+ * @param val Value to wrap.
+ * @param <T> Type of value to wrap.
+ * @return Value wrapped as {@link AutoCloseable}.
+ */
+ public static <T> DataWrapper<T> of(T val) {
+ return new DataWrapper<>(val);
+ }
+
+ /**
+ * Construct instance of this class from given value.
+ *
+ * @param val Value to wrap.
+ */
+ public DataWrapper(T val) {
+ this.val = val;
+ }
+
+ /**
+ * Get wrapped value.
+ *
+ * @return Wrapped value.
+ */
+ public T val() {
+ return val;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void close() throws Exception {
+ if (val instanceof AutoCloseable)
+ ((AutoCloseable)val).close();
+ }
+ }
+
+ /**
+ * Return model which returns given constant.
+ *
+ * @param v Constant value.
+ * @param <T> Type of input.
+ * @param <V> Type of output.
+ * @return Model which returns given constant.
+ */
+ public static <T, V> Model<T, V> constantModel(V v) {
+ return t -> v;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/composition/boosting/convergence/mean/MeanAbsValueConvergenceCheckerTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/composition/boosting/convergence/mean/MeanAbsValueConvergenceCheckerTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/composition/boosting/convergence/mean/MeanAbsValueConvergenceCheckerTest.java
index 0b42db8..c218a74 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/composition/boosting/convergence/mean/MeanAbsValueConvergenceCheckerTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/composition/boosting/convergence/mean/MeanAbsValueConvergenceCheckerTest.java
@@ -17,6 +17,7 @@
package org.apache.ignite.ml.composition.boosting.convergence.mean;
+import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.composition.boosting.convergence.ConvergenceChecker;
import org.apache.ignite.ml.composition.boosting.convergence.ConvergenceCheckerTest;
import org.apache.ignite.ml.dataset.impl.local.LocalDataset;
@@ -25,6 +26,7 @@ import org.apache.ignite.ml.dataset.primitive.FeatureMatrixWithLabelsOnHeapData;
import org.apache.ignite.ml.dataset.primitive.FeatureMatrixWithLabelsOnHeapDataBuilder;
import org.apache.ignite.ml.dataset.primitive.builder.context.EmptyContextBuilder;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
import org.junit.Assert;
import org.junit.Test;
@@ -39,11 +41,14 @@ public class MeanAbsValueConvergenceCheckerTest extends ConvergenceCheckerTest {
new MeanAbsValueConvergenceCheckerFactory(0.1), datasetBuilder);
double error = checker.computeError(VectorUtils.of(1, 2), 4.0, notConvergedMdl);
+ LearningEnvironmentBuilder envBuilder = TestUtils.testEnvBuilder();
+
Assert.assertEquals(1.9, error, 0.01);
- Assert.assertFalse(checker.isConverged(datasetBuilder, notConvergedMdl));
- Assert.assertTrue(checker.isConverged(datasetBuilder, convergedMdl));
+ Assert.assertFalse(checker.isConverged(envBuilder, datasetBuilder, notConvergedMdl));
+ Assert.assertTrue(checker.isConverged(envBuilder, datasetBuilder, convergedMdl));
try(LocalDataset<EmptyContext, FeatureMatrixWithLabelsOnHeapData> dataset = datasetBuilder.build(
+ envBuilder,
new EmptyContextBuilder<>(), new FeatureMatrixWithLabelsOnHeapDataBuilder<>(fExtr, lbExtr))) {
double onDSError = checker.computeMeanErrorOnDataset(dataset, notConvergedMdl);
@@ -62,6 +67,7 @@ public class MeanAbsValueConvergenceCheckerTest extends ConvergenceCheckerTest {
new MeanAbsValueConvergenceCheckerFactory(0.1), datasetBuilder);
try(LocalDataset<EmptyContext, FeatureMatrixWithLabelsOnHeapData> dataset = datasetBuilder.build(
+ TestUtils.testEnvBuilder(),
new EmptyContextBuilder<>(), new FeatureMatrixWithLabelsOnHeapDataBuilder<>(fExtr, lbExtr))) {
double onDSError = checker.computeMeanErrorOnDataset(dataset, notConvergedMdl);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/composition/boosting/convergence/median/MedianOfMedianConvergenceCheckerTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/composition/boosting/convergence/median/MedianOfMedianConvergenceCheckerTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/composition/boosting/convergence/median/MedianOfMedianConvergenceCheckerTest.java
index d6880b4..0476a37 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/composition/boosting/convergence/median/MedianOfMedianConvergenceCheckerTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/composition/boosting/convergence/median/MedianOfMedianConvergenceCheckerTest.java
@@ -17,6 +17,7 @@
package org.apache.ignite.ml.composition.boosting.convergence.median;
+import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.composition.boosting.convergence.ConvergenceChecker;
import org.apache.ignite.ml.composition.boosting.convergence.ConvergenceCheckerTest;
import org.apache.ignite.ml.dataset.impl.local.LocalDataset;
@@ -25,6 +26,7 @@ import org.apache.ignite.ml.dataset.primitive.FeatureMatrixWithLabelsOnHeapData;
import org.apache.ignite.ml.dataset.primitive.FeatureMatrixWithLabelsOnHeapDataBuilder;
import org.apache.ignite.ml.dataset.primitive.builder.context.EmptyContextBuilder;
import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.environment.LearningEnvironmentBuilder;
import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
import org.junit.Assert;
import org.junit.Test;
@@ -42,10 +44,14 @@ public class MedianOfMedianConvergenceCheckerTest extends ConvergenceCheckerTest
double error = checker.computeError(VectorUtils.of(1, 2), 4.0, notConvergedMdl);
Assert.assertEquals(1.9, error, 0.01);
- Assert.assertFalse(checker.isConverged(datasetBuilder, notConvergedMdl));
- Assert.assertTrue(checker.isConverged(datasetBuilder, convergedMdl));
+
+ LearningEnvironmentBuilder envBuilder = TestUtils.testEnvBuilder();
+
+ Assert.assertFalse(checker.isConverged(envBuilder, datasetBuilder, notConvergedMdl));
+ Assert.assertTrue(checker.isConverged(envBuilder, datasetBuilder, convergedMdl));
try(LocalDataset<EmptyContext, FeatureMatrixWithLabelsOnHeapData> dataset = datasetBuilder.build(
+ envBuilder,
new EmptyContextBuilder<>(), new FeatureMatrixWithLabelsOnHeapDataBuilder<>(fExtr, lbExtr))) {
double onDSError = checker.computeMeanErrorOnDataset(dataset, notConvergedMdl);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetBuilderTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetBuilderTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetBuilderTest.java
index 1cf6dbf..815bd86 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetBuilderTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetBuilderTest.java
@@ -26,6 +26,7 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.dataset.UpstreamEntry;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -66,8 +67,9 @@ public class CacheBasedDatasetBuilderTest extends GridCommonAbstractTest {
CacheBasedDatasetBuilder<Integer, String> builder = new CacheBasedDatasetBuilder<>(ignite, upstreamCache);
CacheBasedDataset<Integer, String, Long, AutoCloseable> dataset = builder.build(
- (upstream, upstreamSize) -> upstreamSize,
- (upstream, upstreamSize, ctx) -> null
+ TestUtils.testEnvBuilder(),
+ (env, upstream, upstreamSize) -> upstreamSize,
+ (env, upstream, upstreamSize, ctx) -> null
);
Affinity<Integer> upstreamAffinity = ignite.affinity(upstreamCache.getName());
@@ -105,14 +107,15 @@ public class CacheBasedDatasetBuilderTest extends GridCommonAbstractTest {
);
CacheBasedDataset<Integer, Integer, Long, AutoCloseable> dataset = builder.build(
- (upstream, upstreamSize) -> {
+ TestUtils.testEnvBuilder(),
+ (env, upstream, upstreamSize) -> {
UpstreamEntry<Integer, Integer> entry = upstream.next();
assertEquals(Integer.valueOf(2), entry.getKey());
assertEquals(Integer.valueOf(2), entry.getValue());
assertFalse(upstream.hasNext());
return 0L;
},
- (upstream, upstreamSize, ctx) -> {
+ (env, upstream, upstreamSize, ctx) -> {
UpstreamEntry<Integer, Integer> entry = upstream.next();
assertEquals(Integer.valueOf(2), entry.getKey());
assertEquals(Integer.valueOf(2), entry.getValue());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetTest.java
index a892530..7e31b07 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/cache/CacheBasedDatasetTest.java
@@ -38,6 +38,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.topology.Grid
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.dataset.primitive.data.SimpleDatasetData;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -83,8 +84,9 @@ public class CacheBasedDatasetTest extends GridCommonAbstractTest {
CacheBasedDatasetBuilder<Integer, String> builder = new CacheBasedDatasetBuilder<>(ignite, upstreamCache);
CacheBasedDataset<Integer, String, Long, SimpleDatasetData> dataset = builder.build(
- (upstream, upstreamSize) -> upstreamSize,
- (upstream, upstreamSize, ctx) -> new SimpleDatasetData(new double[0], 0)
+ TestUtils.testEnvBuilder(),
+ (env, upstream, upstreamSize) -> upstreamSize,
+ (env, upstream, upstreamSize, ctx) -> new SimpleDatasetData(new double[0], 0)
);
assertEquals("Upstream cache name from dataset",
@@ -138,8 +140,9 @@ public class CacheBasedDatasetTest extends GridCommonAbstractTest {
CacheBasedDatasetBuilder<Integer, String> builder = new CacheBasedDatasetBuilder<>(ignite, upstreamCache);
CacheBasedDataset<Integer, String, Long, SimpleDatasetData> dataset = builder.build(
- (upstream, upstreamSize) -> upstreamSize,
- (upstream, upstreamSize, ctx) -> new SimpleDatasetData(new double[0], 0)
+ TestUtils.testEnvBuilder(),
+ (env, upstream, upstreamSize) -> upstreamSize,
+ (env, upstream, upstreamSize, ctx) -> new SimpleDatasetData(new double[0], 0)
);
assertTrue("Before computation all partitions should not be reserved",
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/cache/util/ComputeUtilsTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/cache/util/ComputeUtilsTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/cache/util/ComputeUtilsTest.java
index cee8f4f..202b6bc 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/cache/util/ComputeUtilsTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/cache/util/ComputeUtilsTest.java
@@ -32,8 +32,9 @@ import org.apache.ignite.cache.affinity.AffinityFunctionContext;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.dataset.UpstreamEntry;
-import org.apache.ignite.ml.dataset.UpstreamTransformerChain;
+import org.apache.ignite.ml.dataset.UpstreamTransformerBuilder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
/**
@@ -179,18 +180,18 @@ public class ComputeUtilsTest extends GridCommonAbstractTest {
ignite,
upstreamCacheName,
(k, v) -> true,
- UpstreamTransformerChain.empty(),
+ UpstreamTransformerBuilder.identity(),
datasetCacheName,
datasetId,
- 0,
- (upstream, upstreamSize, ctx) -> {
+ (env, upstream, upstreamSize, ctx) -> {
cnt.incrementAndGet();
assertEquals(1, upstreamSize);
UpstreamEntry<Integer, Integer> e = upstream.next();
return new TestPartitionData(e.getKey() + e.getValue());
- }
+ },
+ TestUtils.testEnvBuilder().buildForWorker(part)
),
0
);
@@ -229,15 +230,16 @@ public class ComputeUtilsTest extends GridCommonAbstractTest {
ignite,
upstreamCacheName,
(k, v) -> true,
- UpstreamTransformerChain.empty(),
+ UpstreamTransformerBuilder.identity(),
datasetCacheName,
- (upstream, upstreamSize) -> {
+ (env, upstream, upstreamSize) -> {
assertEquals(1, upstreamSize);
UpstreamEntry<Integer, Integer> e = upstream.next();
return e.getKey() + e.getValue();
},
+ TestUtils.testEnvBuilder(),
0
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/local/LocalDatasetBuilderTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/local/LocalDatasetBuilderTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/local/LocalDatasetBuilderTest.java
index 8dc9354..6088140 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/local/LocalDatasetBuilderTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/dataset/impl/local/LocalDatasetBuilderTest.java
@@ -21,6 +21,7 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
+import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.dataset.PartitionContextBuilder;
import org.apache.ignite.ml.dataset.PartitionDataBuilder;
import org.junit.Test;
@@ -47,7 +48,7 @@ public class LocalDatasetBuilderTest {
AtomicLong cnt = new AtomicLong();
- dataset.compute((partData, partIdx) -> {
+ dataset.compute((partData, env) -> {
cnt.incrementAndGet();
int[] arr = partData.data;
@@ -55,7 +56,7 @@ public class LocalDatasetBuilderTest {
assertEquals(10, arr.length);
for (int i = 0; i < 10; i++)
- assertEquals(partIdx * 10 + i, arr[i]);
+ assertEquals(env.partition() * 10 + i, arr[i]);
});
assertEquals(10, cnt.intValue());
@@ -74,7 +75,7 @@ public class LocalDatasetBuilderTest {
AtomicLong cnt = new AtomicLong();
- dataset.compute((partData, partIdx) -> {
+ dataset.compute((partData, env) -> {
cnt.incrementAndGet();
int[] arr = partData.data;
@@ -82,7 +83,7 @@ public class LocalDatasetBuilderTest {
assertEquals(5, arr.length);
for (int i = 0; i < 5; i++)
- assertEquals((partIdx * 5 + i) * 2, arr[i]);
+ assertEquals((env.partition() * 5 + i) * 2, arr[i]);
});
assertEquals(10, cnt.intValue());
@@ -91,10 +92,10 @@ public class LocalDatasetBuilderTest {
/** */
private LocalDataset<Serializable, TestPartitionData> buildDataset(
LocalDatasetBuilder<Integer, Integer> builder) {
- PartitionContextBuilder<Integer, Integer, Serializable> partCtxBuilder = (upstream, upstreamSize) -> null;
+ PartitionContextBuilder<Integer, Integer, Serializable> partCtxBuilder = (env, upstream, upstreamSize) -> null;
PartitionDataBuilder<Integer, Integer, Serializable, TestPartitionData> partDataBuilder
- = (upstream, upstreamSize, ctx) -> {
+ = (env, upstream, upstreamSize, ctx) -> {
int[] arr = new int[Math.toIntExact(upstreamSize)];
int ptr = 0;
@@ -105,6 +106,7 @@ public class LocalDatasetBuilderTest {
};
return builder.build(
+ TestUtils.testEnvBuilder(),
partCtxBuilder.andThen(x -> null),
partDataBuilder.andThen((x, y) -> x)
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/dataset/primitive/SimpleDatasetTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/dataset/primitive/SimpleDatasetTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/dataset/primitive/SimpleDatasetTest.java
index eaa03d2..33c0677 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/dataset/primitive/SimpleDatasetTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/dataset/primitive/SimpleDatasetTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.ml.dataset.primitive;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.dataset.DatasetFactory;
import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
import org.junit.Test;
@@ -43,6 +44,7 @@ public class SimpleDatasetTest {
try (SimpleDataset<?> dataset = DatasetFactory.createSimpleDataset(
dataPoints,
2,
+ TestUtils.testEnvBuilder(),
(k, v) -> VectorUtils.of(v.getAge(), v.getSalary())
)) {
assertArrayEquals("Mean values.", new double[] {37.75, 66000.0}, dataset.mean(), 0);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/dataset/primitive/SimpleLabeledDatasetTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/dataset/primitive/SimpleLabeledDatasetTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/dataset/primitive/SimpleLabeledDatasetTest.java
index f7b0f13..36e540b 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/dataset/primitive/SimpleLabeledDatasetTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/dataset/primitive/SimpleLabeledDatasetTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.ml.dataset.primitive;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.dataset.DatasetFactory;
import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
import org.junit.Test;
@@ -47,14 +48,16 @@ public class SimpleLabeledDatasetTest {
// Creates a local simple dataset containing features and providing standard dataset API.
try (SimpleLabeledDataset<?> dataset = DatasetFactory.createSimpleLabeledDataset(
dataPoints,
+ TestUtils.testEnvBuilder(),
2,
(k, v) -> VectorUtils.of(v.getAge(), v.getSalary()),
(k, v) -> new double[] {k, v.getAge(), v.getSalary()}
)) {
- assertNull(dataset.compute((data, partIdx) -> {
- actualFeatures[partIdx] = data.getFeatures();
- actualLabels[partIdx] = data.getLabels();
- actualRows[partIdx] = data.getRows();
+ assertNull(dataset.compute((data, env) -> {
+ int part = env.partition();
+ actualFeatures[part] = data.getFeatures();
+ actualLabels[part] = data.getLabels();
+ actualRows[part] = data.getRows();
return null;
}, (k, v) -> null));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/environment/LearningEnvironmentBuilderTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/environment/LearningEnvironmentBuilderTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/environment/LearningEnvironmentBuilderTest.java
index 56f262b..7769092 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/environment/LearningEnvironmentBuilderTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/environment/LearningEnvironmentBuilderTest.java
@@ -39,7 +39,7 @@ public class LearningEnvironmentBuilderTest {
/** */
@Test
public void basic() {
- LearningEnvironment env = LearningEnvironment.DEFAULT;
+ LearningEnvironment env = LearningEnvironment.DEFAULT_TRAINER_ENV;
assertNotNull("Strategy", env.parallelismStrategy());
assertNotNull("Logger", env.logger());
@@ -49,42 +49,44 @@ public class LearningEnvironmentBuilderTest {
/** */
@Test
public void withParallelismStrategy() {
- assertTrue(LearningEnvironment.builder().withParallelismStrategy(NoParallelismStrategy.INSTANCE).build()
+ assertTrue(LearningEnvironmentBuilder.defaultBuilder().withParallelismStrategyDependency(part -> NoParallelismStrategy.INSTANCE)
+ .buildForTrainer()
.parallelismStrategy() instanceof NoParallelismStrategy);
- assertTrue(LearningEnvironment.builder().withParallelismStrategy(new DefaultParallelismStrategy()).build()
+ assertTrue(LearningEnvironmentBuilder.defaultBuilder().withParallelismStrategyDependency(part -> new DefaultParallelismStrategy())
+ .buildForTrainer()
.parallelismStrategy() instanceof DefaultParallelismStrategy);
}
/** */
@Test
public void withParallelismStrategyType() {
- assertTrue(LearningEnvironment.builder().withParallelismStrategy(NO_PARALLELISM).build()
+ assertTrue(LearningEnvironmentBuilder.defaultBuilder().withParallelismStrategyType(NO_PARALLELISM).buildForTrainer()
.parallelismStrategy() instanceof NoParallelismStrategy);
- assertTrue(LearningEnvironment.builder().withParallelismStrategy(ON_DEFAULT_POOL).build()
+ assertTrue(LearningEnvironmentBuilder.defaultBuilder().withParallelismStrategyType(ON_DEFAULT_POOL).buildForTrainer()
.parallelismStrategy() instanceof DefaultParallelismStrategy);
}
/** */
@Test
public void withLoggingFactory() {
- assertTrue(LearningEnvironment.builder().withLoggingFactory(ConsoleLogger.factory(MLLogger.VerboseLevel.HIGH))
- .build().logger() instanceof ConsoleLogger);
+ assertTrue(LearningEnvironmentBuilder.defaultBuilder().withLoggingFactoryDependency(part -> ConsoleLogger.factory(MLLogger.VerboseLevel.HIGH))
+ .buildForTrainer().logger() instanceof ConsoleLogger);
- assertTrue(LearningEnvironment.builder().withLoggingFactory(ConsoleLogger.factory(MLLogger.VerboseLevel.HIGH))
- .build().logger(this.getClass()) instanceof ConsoleLogger);
+ assertTrue(LearningEnvironmentBuilder.defaultBuilder().withLoggingFactoryDependency(part -> ConsoleLogger.factory(MLLogger.VerboseLevel.HIGH))
+ .buildForTrainer().logger(this.getClass()) instanceof ConsoleLogger);
- assertTrue(LearningEnvironment.builder().withLoggingFactory(NoOpLogger.factory())
- .build().logger() instanceof NoOpLogger);
+ assertTrue(LearningEnvironmentBuilder.defaultBuilder().withLoggingFactoryDependency(part -> NoOpLogger.factory())
+ .buildForTrainer().logger() instanceof NoOpLogger);
- assertTrue(LearningEnvironment.builder().withLoggingFactory(NoOpLogger.factory())
- .build().logger(this.getClass()) instanceof NoOpLogger);
+ assertTrue(LearningEnvironmentBuilder.defaultBuilder().withLoggingFactoryDependency(part -> NoOpLogger.factory())
+ .buildForTrainer().logger(this.getClass()) instanceof NoOpLogger);
- assertTrue(LearningEnvironment.builder().withLoggingFactory(CustomMLLogger.factory(new NullLogger()))
- .build().logger() instanceof CustomMLLogger);
+ assertTrue(LearningEnvironmentBuilder.defaultBuilder().withLoggingFactoryDependency(part -> CustomMLLogger.factory(new NullLogger()))
+ .buildForTrainer().logger() instanceof CustomMLLogger);
- assertTrue(LearningEnvironment.builder().withLoggingFactory(CustomMLLogger.factory(new NullLogger()))
- .build().logger(this.getClass()) instanceof CustomMLLogger);
+ assertTrue(LearningEnvironmentBuilder.defaultBuilder().withLoggingFactoryDependency(part -> CustomMLLogger.factory(new NullLogger()))
+ .buildForTrainer().logger(this.getClass()) instanceof CustomMLLogger);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ff6b8eed/modules/ml/src/test/java/org/apache/ignite/ml/environment/LearningEnvironmentTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/environment/LearningEnvironmentTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/environment/LearningEnvironmentTest.java
index 73192f0..4b44196 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/environment/LearningEnvironmentTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/environment/LearningEnvironmentTest.java
@@ -17,17 +17,31 @@
package org.apache.ignite.ml.environment;
+import java.util.Map;
+import java.util.Random;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
+import org.apache.ignite.ml.Model;
+import org.apache.ignite.ml.TestUtils;
+import org.apache.ignite.ml.dataset.Dataset;
+import org.apache.ignite.ml.dataset.DatasetBuilder;
+import org.apache.ignite.ml.dataset.PartitionDataBuilder;
import org.apache.ignite.ml.dataset.feature.FeatureMeta;
+import org.apache.ignite.ml.dataset.primitive.builder.context.EmptyContextBuilder;
+import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
import org.apache.ignite.ml.environment.logging.ConsoleLogger;
import org.apache.ignite.ml.environment.logging.MLLogger;
import org.apache.ignite.ml.environment.parallelism.DefaultParallelismStrategy;
import org.apache.ignite.ml.environment.parallelism.ParallelismStrategy;
+import org.apache.ignite.ml.math.functions.IgniteBiFunction;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
+import org.apache.ignite.ml.trainers.DatasetTrainer;
import org.apache.ignite.ml.tree.randomforest.RandomForestRegressionTrainer;
import org.apache.ignite.ml.tree.randomforest.data.FeaturesCountSelectionStrategies;
import org.junit.Test;
+import static org.apache.ignite.ml.TestUtils.constantModel;
import static org.junit.Assert.assertEquals;
/**
@@ -48,13 +62,115 @@ public class LearningEnvironmentTest {
.withSubSampleSize(0.3)
.withSeed(0);
- LearningEnvironment environment = LearningEnvironment.builder()
- .withParallelismStrategy(ParallelismStrategy.Type.ON_DEFAULT_POOL)
- .withLoggingFactory(ConsoleLogger.factory(MLLogger.VerboseLevel.LOW))
- .build();
- trainer.setEnvironment(environment);
- assertEquals(DefaultParallelismStrategy.class, environment.parallelismStrategy().getClass());
- assertEquals(ConsoleLogger.class, environment.logger().getClass());
+ LearningEnvironmentBuilder envBuilder = LearningEnvironmentBuilder.defaultBuilder()
+ .withParallelismStrategyType(ParallelismStrategy.Type.ON_DEFAULT_POOL)
+ .withLoggingFactoryDependency(part -> ConsoleLogger.factory(MLLogger.VerboseLevel.LOW));
+
+ trainer.withEnvironmentBuilder(envBuilder);
+
+ assertEquals(DefaultParallelismStrategy.class, trainer.learningEnvironment().parallelismStrategy().getClass());
+ assertEquals(ConsoleLogger.class, trainer.learningEnvironment().logger().getClass());
+ }
+
+ /**
+ * Test random number generator provided by {@link LearningEnvironment}.
+ * We test that:
+ * 1. Correct random generator is returned for each partition.
+ * 2. Its state is saved between compute calls (for this we do several iterations of compute).
+ */
+ @Test
+ public void testRandomNumbersGenerator() {
+ // We make such builders that provide as functions returning partition index * iteration as random number generator nextInt
+ LearningEnvironmentBuilder envBuilder = TestUtils.testEnvBuilder().withRandomDependency(MockRandom::new);
+ int partitions = 10;
+ int iterations = 2;
+
+ DatasetTrainer<Model<Object, Vector>, Void> trainer = new DatasetTrainer<Model<Object, Vector>, Void>() {
+ /** {@inheritDoc} */
+ @Override public <K, V> Model<Object, Vector> fit(DatasetBuilder<K, V> datasetBuilder,
+ IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, Void> lbExtractor) {
+ Dataset<EmptyContext, TestUtils.DataWrapper<Integer>> ds = datasetBuilder.build(envBuilder,
+ new EmptyContextBuilder<>(),
+ (PartitionDataBuilder<K, V, EmptyContext, TestUtils.DataWrapper<Integer>>)(env, upstreamData, upstreamDataSize, ctx) ->
+ TestUtils.DataWrapper.of(env.partition()));
+
+ Vector v = null;
+ for (int iter = 0; iter < iterations; iter++) {
+ v = ds.compute((dw, env) -> VectorUtils.fill(-1, partitions).set(env.partition(), env.randomNumbersGenerator().nextInt()),
+ (v1, v2) -> zipOverridingEmpty(v1, v2, -1));
+ }
+ return constantModel(v);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean checkState(Model<Object, Vector> mdl) {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected <K, V> Model<Object, Vector> updateModel(Model<Object, Vector> mdl,
+ DatasetBuilder<K, V> datasetBuilder,
+ IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, Void> lbExtractor) {
+ return null;
+ }
+ };
+ trainer.withEnvironmentBuilder(envBuilder);
+ Model<Object, Vector> mdl = trainer.fit(getCacheMock(partitions), partitions, null, null);
+
+ Vector exp = VectorUtils.zeroes(partitions);
+ for (int i = 0; i < partitions; i++)
+ exp.set(i, i * iterations);
+
+
+ Vector res = mdl.apply(null);
+ assertEquals(exp, res);
+ }
+
+ /**
+ * For given two vectors {@code v2, v2} produce vector {@code v} where each component of {@code v}
+ * is produced from corresponding components {@code c1, c2} of {@code v1, v2} respectfully in following way
+ * {@code c = c1 != empty ? c1 : c2}. For example, zipping [2, -1, -1], [-1, 3, -1] will result in [2, 3, -1].
+ *
+ * @param v1 First vector.
+ * @param v2 Second vector.
+ * @param empty Value treated as empty.
+ * @return Result of zipping as described above.
+ */
+ private static Vector zipOverridingEmpty(Vector v1, Vector v2, double empty) {
+ return v1 != null ? (v2 != null ? VectorUtils.zipWith(v1, v2, (d1, d2) -> d1 != empty ? d1 : d2) : v1) : v2;
+ }
+
+ /** Get cache mock */
+ private Map<Integer, Integer> getCacheMock(int partsCnt) {
+ return IntStream.range(0, partsCnt).boxed().collect(Collectors.toMap(x -> x, x -> x));
+ }
+
+ /** Mock random numners generator. */
+ private static class MockRandom extends Random {
+ /** Serial version uuid. */
+ private static final long serialVersionUID = -7738558243461112988L;
+
+ /** Start value. */
+ private int startVal;
+
+ /** Iteration. */
+ private int iter;
+
+ /**
+ * Constructs instance of this class with a specified start value.
+ *
+ * @param startVal Start value.
+ */
+ MockRandom(int startVal) {
+ this.startVal = startVal;
+ iter = 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int nextInt() {
+ iter++;
+ return startVal * iter;
+ }
}
}
[18/50] [abbrv] ignite git commit: IGNITE-8227 implement JUnit test
failure handler for TeamCity. - Fixes #4974.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiReconnectDelayTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiReconnectDelayTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiReconnectDelayTest.java
index 89df32c..68aa431 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiReconnectDelayTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiReconnectDelayTest.java
@@ -29,6 +29,8 @@ import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgnitePredicate;
@@ -58,6 +60,11 @@ public class TcpDiscoverySpiReconnectDelayTest extends GridCommonAbstractTest {
System.setProperty(IgniteSystemProperties.IGNITE_QUIET, "false");
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
//region Client joins after failNode()
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/spi/loadbalancing/roundrobin/GridRoundRobinLoadBalancingSpiTopologyChangeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/loadbalancing/roundrobin/GridRoundRobinLoadBalancingSpiTopologyChangeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/loadbalancing/roundrobin/GridRoundRobinLoadBalancingSpiTopologyChangeSelfTest.java
index 3159e04..edaa0cf 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/loadbalancing/roundrobin/GridRoundRobinLoadBalancingSpiTopologyChangeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/loadbalancing/roundrobin/GridRoundRobinLoadBalancingSpiTopologyChangeSelfTest.java
@@ -23,6 +23,8 @@ import org.apache.ignite.GridTestJob;
import org.apache.ignite.GridTestTaskSession;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.compute.ComputeTaskSession;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.testframework.GridSpiTestContext;
import org.apache.ignite.testframework.GridTestNode;
@@ -54,6 +56,11 @@ public class GridRoundRobinLoadBalancingSpiTopologyChangeSelfTest
return spiCtx;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index b2d12fd..c7205a5 100755
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -172,6 +172,9 @@ public abstract class GridAbstractTest extends TestCase {
/** */
protected static final String DEFAULT_CACHE_NAME = "default";
+ /** Show that test is currently running. */
+ public static volatile boolean testIsRunning = false;
+
/** Supports obtaining test name for JUnit4 cases. */
@Rule public transient TestName nameRule = new TestName();
@@ -1736,7 +1739,7 @@ public abstract class GridAbstractTest extends TestCase {
* @return Failure handler implementation.
*/
protected FailureHandler getFailureHandler(String igniteInstanceName) {
- return new NoOpFailureHandler();
+ return new TestFailingFailureHandler();
}
/**
@@ -2112,6 +2115,8 @@ public abstract class GridAbstractTest extends TestCase {
Thread runner = new IgniteThread(getTestIgniteInstanceName(), "test-runner", new Runnable() {
@Override public void run() {
+ testIsRunning = true;
+
try {
if (forceFailure)
fail("Forced failure: " + forceFailureMsg);
@@ -2122,6 +2127,8 @@ public abstract class GridAbstractTest extends TestCase {
IgniteClosure<Throwable, Throwable> hnd = errorHandler();
ex.set(hnd != null ? hnd.apply(e) : e);
+ } finally {
+ testIsRunning = false;
}
}
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/testframework/junits/TestFailingFailureHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/TestFailingFailureHandler.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/TestFailingFailureHandler.java
new file mode 100644
index 0000000..5034225
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/TestFailingFailureHandler.java
@@ -0,0 +1,50 @@
+/*
+ * 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.testframework.junits;
+
+import junit.framework.TestCase;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.failure.FailureContext;
+import org.apache.ignite.failure.StopNodeFailureHandler;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+
+/**
+ * Stops node and fails test.
+ */
+public class TestFailingFailureHandler extends StopNodeFailureHandler {
+ /** {@inheritDoc} */
+ @Override public boolean handle(Ignite ignite, FailureContext failureCtx) {
+ if (!GridAbstractTest.testIsRunning) {
+ ignite.log().info("Critical issue detected after test finished. Test failure handler ignore it.");
+
+ return true;
+ }
+
+ boolean nodeStopped = super.handle(ignite, failureCtx);
+
+ TestCase.fail(failureCtx.toString());
+
+ return nodeStopped;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(TestFailingFailureHandler.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java b/modules/core/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
index 6edde59..67fee0a 100644
--- a/modules/core/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
@@ -54,6 +54,8 @@ import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.TestRecordingCommunicationSpi;
@@ -204,6 +206,11 @@ public class GridCommandHandlerTest extends GridCommonAbstractTest {
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Test activation works via control.sh
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/core/src/test/java/org/apache/ignite/util/GridTopologyHeapSizeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/util/GridTopologyHeapSizeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/util/GridTopologyHeapSizeSelfTest.java
index c8e4619..9efd6af 100644
--- a/modules/core/src/test/java/org/apache/ignite/util/GridTopologyHeapSizeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/util/GridTopologyHeapSizeSelfTest.java
@@ -20,6 +20,8 @@ package org.apache.ignite.util;
import java.util.UUID;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.ClusterMetricsSnapshot;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -52,6 +54,11 @@ public class GridTopologyHeapSizeSelfTest extends GridCommonAbstractTest {
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopMapReduceErrorResilienceTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopMapReduceErrorResilienceTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopMapReduceErrorResilienceTest.java
index afd6f26..c114351 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopMapReduceErrorResilienceTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopMapReduceErrorResilienceTest.java
@@ -17,6 +17,8 @@
package org.apache.ignite.internal.processors.hadoop.impl;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.igfs.IgfsPath;
import org.apache.ignite.internal.processors.hadoop.impl.examples.HadoopWordCount2;
@@ -28,6 +30,11 @@ import org.apache.ignite.internal.processors.hadoop.impl.examples.HadoopWordCoun
* x { phase where the error happens }.
*/
public class HadoopMapReduceErrorResilienceTest extends HadoopAbstractMapReduceTest {
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Tests recovery.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgniteHadoopFileSystemAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgniteHadoopFileSystemAbstractSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgniteHadoopFileSystemAbstractSelfTest.java
index a73367a..6eef598 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgniteHadoopFileSystemAbstractSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgniteHadoopFileSystemAbstractSelfTest.java
@@ -61,6 +61,7 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.hadoop.fs.CachingHadoopFileSystemFactory;
import org.apache.ignite.hadoop.fs.IgniteHadoopIgfsSecondaryFileSystem;
@@ -338,6 +339,11 @@ public abstract class IgniteHadoopFileSystemAbstractSelfTest extends IgfsCommonA
U.closeQuiet(fs);
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* Get primary IPC endpoint configuration.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/taskexecutor/HadoopExecutorServiceTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/taskexecutor/HadoopExecutorServiceTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/taskexecutor/HadoopExecutorServiceTest.java
index cc6cbb3..171da85 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/taskexecutor/HadoopExecutorServiceTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/taskexecutor/HadoopExecutorServiceTest.java
@@ -17,6 +17,8 @@
package org.apache.ignite.internal.processors.hadoop.impl.taskexecutor;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.processors.hadoop.taskexecutor.HadoopExecutorService;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -28,6 +30,11 @@ import java.util.concurrent.atomic.LongAdder;
*
*/
public class HadoopExecutorServiceTest extends GridCommonAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ClientReconnectAfterClusterRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ClientReconnectAfterClusterRestartTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ClientReconnectAfterClusterRestartTest.java
index 9012161..02e6238 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ClientReconnectAfterClusterRestartTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ClientReconnectAfterClusterRestartTest.java
@@ -35,6 +35,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -112,6 +114,11 @@ public class ClientReconnectAfterClusterRestartTest extends GridCommonAbstractTe
return ccfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/** */
public void testReconnectClient() throws Exception {
try {
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCrossCachesJoinsQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCrossCachesJoinsQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCrossCachesJoinsQueryTest.java
index 17a8ed3..805924e 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCrossCachesJoinsQueryTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCrossCachesJoinsQueryTest.java
@@ -43,6 +43,8 @@ import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.processors.query.h2.sql.AbstractH2CompareQueryTest;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
@@ -132,6 +134,11 @@ public class IgniteCrossCachesJoinsQueryTest extends AbstractH2CompareQueryTest
}
/** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
+ /** {@inheritDoc} */
@Override protected void initCacheAndDbData() throws SQLException {
Statement st = conn.createStatement();
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityCaseMismatchTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityCaseMismatchTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityCaseMismatchTest.java
index 93ffa18..77f41f9 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityCaseMismatchTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityCaseMismatchTest.java
@@ -21,6 +21,8 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -89,6 +91,11 @@ public class QueryEntityCaseMismatchTest extends GridCommonAbstractTest {
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* The cache must not initialize if QueryEntity.keyFields isn't subset of QueryEntity.fields
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicColumnsAbstractConcurrentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicColumnsAbstractConcurrentSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicColumnsAbstractConcurrentSelfTest.java
index e6fd321..fb1da72 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicColumnsAbstractConcurrentSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicColumnsAbstractConcurrentSelfTest.java
@@ -43,6 +43,8 @@ import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteClientReconnectAbstractTest;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -98,6 +100,9 @@ public abstract class DynamicColumnsAbstractConcurrentSelfTest extends DynamicCo
/** Atomicity mode. */
private final CacheAtomicityMode atomicityMode;
+ /** No-Op failure handler. */
+ private boolean noOpFailureHnd;
+
/**
* Constructor.
*
@@ -119,6 +124,8 @@ public abstract class DynamicColumnsAbstractConcurrentSelfTest extends DynamicCo
super.beforeTest();
GridQueryProcessor.idxCls = BlockingIndexing.class;
+
+ noOpFailureHnd = false;
}
/** {@inheritDoc} */
@@ -137,6 +144,14 @@ public abstract class DynamicColumnsAbstractConcurrentSelfTest extends DynamicCo
}
/** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ if (noOpFailureHnd)
+ return new NoOpFailureHandler();
+
+ return super.getFailureHandler(igniteInstanceName);
+ }
+
+ /** {@inheritDoc} */
@Override protected long getTestTimeout() {
return 5 * 60 * 1000L;
}
@@ -175,6 +190,8 @@ public abstract class DynamicColumnsAbstractConcurrentSelfTest extends DynamicCo
* @throws Exception If failed.
*/
public void checkCoordinatorChange(boolean addOrRemove) throws Exception {
+ noOpFailureHnd = true;
+
CountDownLatch finishLatch = new CountDownLatch(2);
// Start servers.
@@ -757,6 +774,8 @@ public abstract class DynamicColumnsAbstractConcurrentSelfTest extends DynamicCo
* @throws Exception If failed.
*/
private void checkClientReconnect(final boolean restartCache, boolean dynamicCache) throws Exception {
+ noOpFailureHnd = true;
+
// Start complex topology.
final IgniteEx srv = ignitionStart(serverConfiguration(1));
ignitionStart(serverConfiguration(2));
@@ -843,6 +862,8 @@ public abstract class DynamicColumnsAbstractConcurrentSelfTest extends DynamicCo
*/
@SuppressWarnings("StringConcatenationInLoop")
public void testConcurrentOperationsAndNodeStartStopMultithreaded() throws Exception {
+ noOpFailureHnd = true;
+
// Start several stable nodes.
ignitionStart(serverConfiguration(1));
ignitionStart(serverConfiguration(2));
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
index e0703a5..04e90d5 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
@@ -59,6 +59,8 @@ import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.DiscoverySpiTestListener;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -235,6 +237,11 @@ public class IgniteWalRecoveryTest extends GridCommonAbstractTest {
cleanPersistenceDir();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception if failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlIllegalSchemaSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlIllegalSchemaSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlIllegalSchemaSelfTest.java
index a91311a..a75a365 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlIllegalSchemaSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlIllegalSchemaSelfTest.java
@@ -26,6 +26,8 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.Ignition;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -41,6 +43,11 @@ public class SqlIllegalSchemaSelfTest extends GridCommonAbstractTest {
stopAllGrids();
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/b94a3c2f/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiTest.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiTest.java b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiTest.java
index b932531..60f5fd7 100644
--- a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiTest.java
+++ b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiTest.java
@@ -52,6 +52,8 @@ import javax.management.ObjectName;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.RetryNTimes;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.spi.discovery.tcp.ipfinder.zk.curator.TestingCluster;
import org.apache.ignite.spi.discovery.tcp.ipfinder.zk.curator.TestingZooKeeperServer;
import org.apache.ignite.Ignite;
@@ -445,6 +447,11 @@ public class ZookeeperDiscoverySpiTest extends GridCommonAbstractTest {
System.clearProperty(ZookeeperDiscoveryImpl.IGNITE_ZOOKEEPER_DISCOVERY_SPI_ACK_TIMEOUT);
}
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new NoOpFailureHandler();
+ }
+
/**
*
*/
[44/50] [abbrv] ignite git commit: IGNITE-10356: JDBC: fixed metadata
returned for Date and Decimal types. This closes #5454.
Posted by sb...@apache.org.
IGNITE-10356: JDBC: fixed metadata returned for Date and Decimal types. This closes #5454.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d045b842
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d045b842
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d045b842
Branch: refs/heads/ignite-10044
Commit: d045b842931f0adc2bd409936c1ba0251bf1ea88
Parents: 24a50e1
Author: Ray <ra...@cisco.com>
Authored: Thu Dec 6 12:08:22 2018 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Dec 6 12:08:22 2018 +0300
----------------------------------------------------------------------
.../internal/jdbc2/JdbcMetadataSelfTest.java | 72 +++++++++++++++++++-
.../ignite/jdbc/JdbcMetadataSelfTest.java | 69 ++++++++++++++++++-
.../jdbc/thin/JdbcThinMetadataSelfTest.java | 50 ++++++++++++--
.../apache/ignite/internal/jdbc/JdbcUtils.java | 11 ++-
.../internal/jdbc/thin/JdbcThinUtils.java | 11 ++-
.../apache/ignite/internal/jdbc2/JdbcUtils.java | 7 +-
6 files changed, 207 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d045b842/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
index 4c127b6..b18e4d5 100755
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.jdbc2;
import java.io.Serializable;
+import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
@@ -28,6 +29,7 @@ import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
+import java.sql.Date;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -53,6 +55,8 @@ import org.jetbrains.annotations.NotNull;
import static java.sql.Types.INTEGER;
import static java.sql.Types.VARCHAR;
+import static java.sql.Types.DECIMAL;
+import static java.sql.Types.DATE;
import static org.apache.ignite.IgniteJdbcDriver.CFG_URL_PREFIX;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -90,7 +94,10 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
.setNotNullFields(new HashSet<>(Arrays.asList("age", "name")))
)),
cacheConfiguration("org").setQueryEntities(Arrays.asList(
- new QueryEntity(AffinityKey.class, Organization.class))));
+ new QueryEntity(AffinityKey.class, Organization.class))),
+
+ cacheConfiguration("metaTest").setQueryEntities(Arrays.asList(
+ new QueryEntity(AffinityKey.class, MetaTest.class))));
TcpDiscoverySpi disco = new TcpDiscoverySpi();
@@ -172,6 +179,40 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
+ public void testDecimalAndDateTypeMetaData() throws Exception {
+ try (Connection conn = DriverManager.getConnection(BASE_URL)) {
+ Statement stmt = conn.createStatement();
+
+ ResultSet rs = stmt.executeQuery(
+ "select t.decimal, t.date from \"metaTest\".MetaTest as t");
+
+ assert rs != null;
+
+ ResultSetMetaData meta = rs.getMetaData();
+
+ assert meta != null;
+
+ assert meta.getColumnCount() == 2;
+
+ assert "METATEST".equalsIgnoreCase(meta.getTableName(1));
+ assert "DECIMAL".equalsIgnoreCase(meta.getColumnName(1));
+ assert "DECIMAL".equalsIgnoreCase(meta.getColumnLabel(1));
+ assert meta.getColumnType(1) == DECIMAL;
+ assert "DECIMAL".equals(meta.getColumnTypeName(1));
+ assert "java.math.BigDecimal".equals(meta.getColumnClassName(1));
+
+ assert "METATEST".equalsIgnoreCase(meta.getTableName(2));
+ assert "DATE".equalsIgnoreCase(meta.getColumnName(2));
+ assert "DATE".equalsIgnoreCase(meta.getColumnLabel(2));
+ assert meta.getColumnType(2) == DATE;
+ assert "DATE".equals(meta.getColumnTypeName(2));
+ assert "java.sql.Date".equals(meta.getColumnClassName(2));
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testGetTables() throws Exception {
try (Connection conn = DriverManager.getConnection(BASE_URL)) {
DatabaseMetaData meta = conn.getMetaData();
@@ -455,7 +496,7 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
try (Connection conn = DriverManager.getConnection(BASE_URL)) {
ResultSet rs = conn.getMetaData().getSchemas();
- Set<String> expectedSchemas = new HashSet<>(Arrays.asList("pers", "org"));
+ Set<String> expectedSchemas = new HashSet<>(Arrays.asList("pers", "org", "metaTest"));
Set<String> schemas = new HashSet<>();
@@ -541,4 +582,31 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
this.name = name;
}
}
+
+ /**
+ * Meta Test.
+ */
+ private static class MetaTest implements Serializable {
+ /** ID. */
+ @QuerySqlField
+ private final int id;
+
+ /** Date. */
+ @QuerySqlField
+ private final Date date;
+
+ /** decimal. */
+ @QuerySqlField
+ private final BigDecimal decimal;
+
+ /**
+ * @param id ID.
+ * @param date Date.
+ */
+ private MetaTest(int id, Date date, BigDecimal decimal) {
+ this.id = id;
+ this.date = date;
+ this.decimal = decimal;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d045b842/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java
index 87c1202..0613de7 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java
@@ -18,12 +18,14 @@
package org.apache.ignite.jdbc;
import java.io.Serializable;
+import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
+import java.sql.Date;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.ignite.IgniteCache;
@@ -40,8 +42,10 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static java.sql.Types.INTEGER;
-import static java.sql.Types.OTHER;
import static java.sql.Types.VARCHAR;
+import static java.sql.Types.DECIMAL;
+import static java.sql.Types.OTHER;
+import static java.sql.Types.DATE;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -103,6 +107,8 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
personCache.put(new AffinityKey<>("p1", "o1"), new Person("John White", 25, 1));
personCache.put(new AffinityKey<>("p2", "o1"), new Person("Joe Black", 35, 1));
personCache.put(new AffinityKey<>("p3", "o2"), new Person("Mike Green", 40, 2));
+
+ jcache(grid(0), cacheConfiguration(), "metaTest", AffinityKey.class, MetaTest.class);
}
/**
@@ -140,6 +146,40 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
+ public void testDecimalAndDateTypeMetaData() throws Exception {
+ try (Connection conn = DriverManager.getConnection(URL)) {
+ Statement stmt = conn.createStatement();
+
+ ResultSet rs = stmt.executeQuery(
+ "select t.decimal, t.date from \"metaTest\".MetaTest as t");
+
+ assert rs != null;
+
+ ResultSetMetaData meta = rs.getMetaData();
+
+ assert meta != null;
+
+ assert meta.getColumnCount() == 2;
+
+ assert "METATEST".equalsIgnoreCase(meta.getTableName(1));
+ assert "DECIMAL".equalsIgnoreCase(meta.getColumnName(1));
+ assert "DECIMAL".equalsIgnoreCase(meta.getColumnLabel(1));
+ assert meta.getColumnType(1) == DECIMAL;
+ assert "DECIMAL".equals(meta.getColumnTypeName(1));
+ assert "java.math.BigDecimal".equals(meta.getColumnClassName(1));
+
+ assert "METATEST".equalsIgnoreCase(meta.getTableName(2));
+ assert "DATE".equalsIgnoreCase(meta.getColumnName(2));
+ assert "DATE".equalsIgnoreCase(meta.getColumnLabel(2));
+ assert meta.getColumnType(2) == DATE;
+ assert "DATE".equals(meta.getColumnTypeName(2));
+ assert "java.sql.Date".equals(meta.getColumnClassName(2));
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testGetTables() throws Exception {
try (Connection conn = DriverManager.getConnection(URL)) {
DatabaseMetaData meta = conn.getMetaData();
@@ -337,4 +377,31 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
this.name = name;
}
}
+
+ /**
+ * Meta Test.
+ */
+ private static class MetaTest implements Serializable {
+ /** ID. */
+ @QuerySqlField
+ private final int id;
+
+ /** Date. */
+ @QuerySqlField
+ private final Date date;
+
+ /** decimal. */
+ @QuerySqlField
+ private final BigDecimal decimal;
+
+ /**
+ * @param id ID.
+ * @param date Date.
+ */
+ private MetaTest(int id, Date date, BigDecimal decimal) {
+ this.id = id;
+ this.date = date;
+ this.decimal = decimal;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d045b842/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
index 9759965..df67666 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
@@ -53,8 +53,10 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import static java.sql.Types.INTEGER;
-import static java.sql.Types.OTHER;
import static java.sql.Types.VARCHAR;
+import static java.sql.Types.DECIMAL;
+import static java.sql.Types.DATE;
+import static java.sql.Types.OTHER;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -158,6 +160,7 @@ public class JdbcThinMetadataSelfTest extends JdbcThinAbstractSelfTest {
stmt.execute("CREATE INDEX IDX ON TEST (ID ASC)");
stmt.execute("CREATE TABLE TEST_DECIMAL_COLUMN (ID INT primary key, DEC_COL DECIMAL(8, 3))");
stmt.execute("CREATE TABLE TEST_DECIMAL_COLUMN_PRECISION (ID INT primary key, DEC_COL DECIMAL(8))");
+ stmt.execute("CREATE TABLE TEST_DECIMAL_DATE_COLUMN_META (ID INT primary key, DEC_COL DECIMAL(8), DATE_COL DATE)");
}
}
@@ -200,6 +203,40 @@ public class JdbcThinMetadataSelfTest extends JdbcThinAbstractSelfTest {
/**
* @throws Exception If failed.
*/
+ public void testDecimalAndDateTypeMetaData() throws Exception {
+ try (Connection conn = DriverManager.getConnection(URL)) {
+ Statement stmt = conn.createStatement();
+
+ ResultSet rs = stmt.executeQuery(
+ "select t.dec_col, t.date_col from TEST_DECIMAL_DATE_COLUMN_META as t");
+
+ assert rs != null;
+
+ ResultSetMetaData meta = rs.getMetaData();
+
+ assert meta != null;
+
+ assert meta.getColumnCount() == 2;
+
+ assert "TEST_DECIMAL_DATE_COLUMN_META".equalsIgnoreCase(meta.getTableName(1));
+ assert "DEC_COL".equalsIgnoreCase(meta.getColumnName(1));
+ assert "DEC_COL".equalsIgnoreCase(meta.getColumnLabel(1));
+ assert meta.getColumnType(1) == DECIMAL;
+ assert "DECIMAL".equals(meta.getColumnTypeName(1));
+ assert "java.math.BigDecimal".equals(meta.getColumnClassName(1));
+
+ assert "TEST_DECIMAL_DATE_COLUMN_META".equalsIgnoreCase(meta.getTableName(2));
+ assert "DATE_COL".equalsIgnoreCase(meta.getColumnName(2));
+ assert "DATE_COL".equalsIgnoreCase(meta.getColumnLabel(2));
+ assert meta.getColumnType(2) == DATE;
+ assert "DATE".equals(meta.getColumnTypeName(2));
+ assert "java.sql.Date".equals(meta.getColumnClassName(2));
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testGetTables() throws Exception {
try (Connection conn = DriverManager.getConnection(URL)) {
DatabaseMetaData meta = conn.getMetaData();
@@ -261,7 +298,8 @@ public class JdbcThinMetadataSelfTest extends JdbcThinAbstractSelfTest {
"PUBLIC.TEST",
"PUBLIC.Quoted",
"PUBLIC.TEST_DECIMAL_COLUMN",
- "PUBLIC.TEST_DECIMAL_COLUMN_PRECISION"));
+ "PUBLIC.TEST_DECIMAL_COLUMN_PRECISION",
+ "PUBLIC.TEST_DECIMAL_DATE_COLUMN_META"));
Set<String> actualTbls = new HashSet<>(expectedTbls.size());
@@ -413,7 +451,10 @@ public class JdbcThinMetadataSelfTest extends JdbcThinAbstractSelfTest {
"PUBLIC.TEST_DECIMAL_COLUMN.ID.null",
"PUBLIC.TEST_DECIMAL_COLUMN.DEC_COL.null.8.3",
"PUBLIC.TEST_DECIMAL_COLUMN_PRECISION.ID.null",
- "PUBLIC.TEST_DECIMAL_COLUMN_PRECISION.DEC_COL.null.8"
+ "PUBLIC.TEST_DECIMAL_COLUMN_PRECISION.DEC_COL.null.8",
+ "PUBLIC.TEST_DECIMAL_DATE_COLUMN_META.ID.null",
+ "PUBLIC.TEST_DECIMAL_DATE_COLUMN_META.DEC_COL.null.8",
+ "PUBLIC.TEST_DECIMAL_DATE_COLUMN_META.DATE_COL.null"
));
Set<String> actualCols = new HashSet<>(expectedCols.size());
@@ -566,7 +607,8 @@ public class JdbcThinMetadataSelfTest extends JdbcThinAbstractSelfTest {
"PUBLIC.TEST.PK_PUBLIC_TEST.NAME",
"PUBLIC.Quoted.PK_PUBLIC_Quoted.Id",
"PUBLIC.TEST_DECIMAL_COLUMN.ID.ID",
- "PUBLIC.TEST_DECIMAL_COLUMN_PRECISION.ID.ID"));
+ "PUBLIC.TEST_DECIMAL_COLUMN_PRECISION.ID.ID",
+ "PUBLIC.TEST_DECIMAL_DATE_COLUMN_META.ID.ID"));
Set<String> actualPks = new HashSet<>(expectedPks.size());
http://git-wip-us.apache.org/repos/asf/ignite/blob/d045b842/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcUtils.java
index 77ef267..7bb1d8b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcUtils.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.jdbc;
+import java.math.BigDecimal;
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
@@ -44,7 +45,7 @@ import static java.sql.Types.TIME;
import static java.sql.Types.TIMESTAMP;
import static java.sql.Types.TINYINT;
import static java.sql.Types.VARCHAR;
-
+import static java.sql.Types.DECIMAL;
/**
* Utility methods for JDBC driver.
*
@@ -189,8 +190,10 @@ class JdbcUtils {
return TIME;
else if (Timestamp.class.getName().equals(cls))
return TIMESTAMP;
- else if (Date.class.getName().equals(cls))
+ else if (Date.class.getName().equals(cls) || java.sql.Date.class.getName().equals(cls))
return DATE;
+ else if (BigDecimal.class.getName().equals(cls))
+ return DECIMAL;
else
return OTHER;
}
@@ -224,8 +227,10 @@ class JdbcUtils {
return "TIME";
else if (Timestamp.class.getName().equals(cls))
return "TIMESTAMP";
- else if (Date.class.getName().equals(cls))
+ else if (Date.class.getName().equals(cls) || java.sql.Date.class.getName().equals(cls))
return "DATE";
+ else if (BigDecimal.class.getName().equals(cls))
+ return "DECIMAL";
else
return "OTHER";
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d045b842/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinUtils.java
index f896e7f..c129370 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinUtils.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.jdbc.thin;
+import java.math.BigDecimal;
import java.sql.Time;
import java.sql.Timestamp;
import java.sql.Types;
@@ -35,6 +36,8 @@ import static java.sql.Types.TIME;
import static java.sql.Types.TIMESTAMP;
import static java.sql.Types.TINYINT;
import static java.sql.Types.VARCHAR;
+import static java.sql.Types.DECIMAL;
+
import static org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl.PROP_PREFIX;
/**
@@ -79,8 +82,10 @@ public class JdbcThinUtils {
return TIME;
else if (Timestamp.class.getName().equals(cls))
return TIMESTAMP;
- else if (Date.class.getName().equals(cls))
+ else if (Date.class.getName().equals(cls) || java.sql.Date.class.getName().equals(cls))
return DATE;
+ else if (BigDecimal.class.getName().equals(cls))
+ return DECIMAL;
else
return OTHER;
}
@@ -114,8 +119,10 @@ public class JdbcThinUtils {
return "TIME";
else if (Timestamp.class.getName().equals(cls))
return "TIMESTAMP";
- else if (Date.class.getName().equals(cls))
+ else if (Date.class.getName().equals(cls) || java.sql.Date.class.getName().equals(cls))
return "DATE";
+ else if (BigDecimal.class.getName().equals(cls))
+ return "DECIMAL";
else
return "OTHER";
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d045b842/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcUtils.java
index cda6ba0..80881d7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcUtils.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.jdbc2;
+import java.math.BigDecimal;
import java.net.URL;
import java.sql.SQLException;
import java.sql.Time;
@@ -41,7 +42,7 @@ import static java.sql.Types.TIME;
import static java.sql.Types.TIMESTAMP;
import static java.sql.Types.TINYINT;
import static java.sql.Types.VARCHAR;
-
+import static java.sql.Types.DECIMAL;
/**
* Utility methods for JDBC driver.
*/
@@ -77,6 +78,8 @@ public class JdbcUtils {
return TIMESTAMP;
else if (Date.class.getName().equals(cls) || java.sql.Date.class.getName().equals(cls))
return DATE;
+ else if (BigDecimal.class.getName().equals(cls))
+ return DECIMAL;
else
return OTHER;
}
@@ -112,6 +115,8 @@ public class JdbcUtils {
return "TIMESTAMP";
else if (Date.class.getName().equals(cls) || java.sql.Date.class.getName().equals(cls))
return "DATE";
+ else if (BigDecimal.class.getName().equals(cls))
+ return "DECIMAL";
else
return "OTHER";
}
[27/50] [abbrv] ignite git commit: IGNITE-10380: Drop Multi-label
Classification for Logistic Regression and SVM
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionSGDTrainerTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionSGDTrainerTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionSGDTrainerTest.java
index d9b6f7a..7236820 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionSGDTrainerTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionSGDTrainerTest.java
@@ -27,8 +27,6 @@ import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
import org.apache.ignite.ml.nn.UpdatesStrategy;
import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDParameterUpdate;
import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDUpdateCalculator;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionModel;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionSGDTrainer;
import org.junit.Test;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMBinaryTrainerTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMBinaryTrainerTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMBinaryTrainerTest.java
index d6f77c0..ccde0d7 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMBinaryTrainerTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMBinaryTrainerTest.java
@@ -27,7 +27,7 @@ import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
import org.junit.Test;
/**
- * Tests for {@link SVMLinearBinaryClassificationTrainer}.
+ * Tests for {@link SVMLinearClassificationTrainer}.
*/
public class SVMBinaryTrainerTest extends TrainerTest {
/**
@@ -40,10 +40,10 @@ public class SVMBinaryTrainerTest extends TrainerTest {
for (int i = 0; i < twoLinearlySeparableClasses.length; i++)
cacheMock.put(i, twoLinearlySeparableClasses[i]);
- SVMLinearBinaryClassificationTrainer trainer = new SVMLinearBinaryClassificationTrainer()
+ SVMLinearClassificationTrainer trainer = new SVMLinearClassificationTrainer()
.withSeed(1234L);
- SVMLinearBinaryClassificationModel mdl = trainer.fit(
+ SVMLinearClassificationModel mdl = trainer.fit(
cacheMock,
parts,
(k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
@@ -62,18 +62,18 @@ public class SVMBinaryTrainerTest extends TrainerTest {
for (int i = 0; i < twoLinearlySeparableClasses.length; i++)
cacheMock.put(i, twoLinearlySeparableClasses[i]);
- SVMLinearBinaryClassificationTrainer trainer = new SVMLinearBinaryClassificationTrainer()
+ SVMLinearClassificationTrainer trainer = new SVMLinearClassificationTrainer()
.withAmountOfIterations(1000)
.withSeed(1234L);
- SVMLinearBinaryClassificationModel originalMdl = trainer.fit(
+ SVMLinearClassificationModel originalMdl = trainer.fit(
cacheMock,
parts,
(k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
(k, v) -> v[0]
);
- SVMLinearBinaryClassificationModel updatedOnSameDS = trainer.update(
+ SVMLinearClassificationModel updatedOnSameDS = trainer.update(
originalMdl,
cacheMock,
parts,
@@ -81,7 +81,7 @@ public class SVMBinaryTrainerTest extends TrainerTest {
(k, v) -> v[0]
);
- SVMLinearBinaryClassificationModel updatedOnEmptyDS = trainer.update(
+ SVMLinearClassificationModel updatedOnEmptyDS = trainer.update(
originalMdl,
new HashMap<Integer, double[]>(),
parts,
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMModelTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMModelTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMModelTest.java
index 9c452f9..3bac790 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMModelTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMModelTest.java
@@ -36,7 +36,7 @@ public class SVMModelTest {
@Test
public void testPredictWithRawLabels() {
Vector weights = new DenseVector(new double[]{2.0, 3.0});
- SVMLinearBinaryClassificationModel mdl = new SVMLinearBinaryClassificationModel(weights, 1.0).withRawLabels(true);
+ SVMLinearClassificationModel mdl = new SVMLinearClassificationModel(weights, 1.0).withRawLabels(true);
Vector observation = new DenseVector(new double[]{1.0, 1.0});
TestUtils.assertEquals(1.0 + 2.0 * 1.0 + 3.0 * 1.0, mdl.apply(observation), PRECISION);
@@ -55,36 +55,16 @@ public class SVMModelTest {
Assert.assertTrue(mdl.isKeepingRawLabels());
- Assert.assertTrue(mdl.toString().length() > 0);
- Assert.assertTrue(mdl.toString(true).length() > 0);
- Assert.assertTrue(mdl.toString(false).length() > 0);
- }
-
-
- /** */
- @Test
- public void testPredictWithMultiClasses() {
- Vector weights1 = new DenseVector(new double[]{10.0, 0.0});
- Vector weights2 = new DenseVector(new double[]{0.0, 10.0});
- Vector weights3 = new DenseVector(new double[]{-1.0, -1.0});
- SVMLinearMultiClassClassificationModel mdl = new SVMLinearMultiClassClassificationModel();
- mdl.add(1, new SVMLinearBinaryClassificationModel(weights1, 0.0).withRawLabels(true));
- mdl.add(2, new SVMLinearBinaryClassificationModel(weights2, 0.0).withRawLabels(true));
- mdl.add(2, new SVMLinearBinaryClassificationModel(weights3, 0.0).withRawLabels(true));
-
- Assert.assertTrue(mdl.toString().length() > 0);
- Assert.assertTrue(mdl.toString(true).length() > 0);
- Assert.assertTrue(mdl.toString(false).length() > 0);
-
- Vector observation = new DenseVector(new double[]{1.0, 1.0});
- TestUtils.assertEquals( 1.0, mdl.apply(observation), PRECISION);
+ Assert.assertTrue(!mdl.toString().isEmpty());
+ Assert.assertTrue(!mdl.toString(true).isEmpty());
+ Assert.assertTrue(!mdl.toString(false).isEmpty());
}
/** */
@Test
public void testPredictWithErasedLabels() {
Vector weights = new DenseVector(new double[]{1.0, 1.0});
- SVMLinearBinaryClassificationModel mdl = new SVMLinearBinaryClassificationModel(weights, 1.0);
+ SVMLinearClassificationModel mdl = new SVMLinearClassificationModel(weights, 1.0);
Vector observation = new DenseVector(new double[]{1.0, 1.0});
TestUtils.assertEquals(1.0, mdl.apply(observation), PRECISION);
@@ -101,7 +81,7 @@ public class SVMModelTest {
observation = new DenseVector(new double[]{-1.0, -2.0});
TestUtils.assertEquals(0.0, mdl.apply(observation), PRECISION);
- final SVMLinearBinaryClassificationModel mdlWithNewData = mdl.withIntercept(-2.0).withWeights(new DenseVector(new double[] {-2.0, -2.0}));
+ final SVMLinearClassificationModel mdlWithNewData = mdl.withIntercept(-2.0).withWeights(new DenseVector(new double[] {-2.0, -2.0}));
System.out.println("The SVM model is " + mdlWithNewData);
observation = new DenseVector(new double[]{-1.0, -2.0});
@@ -113,7 +93,7 @@ public class SVMModelTest {
@Test
public void testPredictWithErasedLabelsAndChangedThreshold() {
Vector weights = new DenseVector(new double[]{1.0, 1.0});
- SVMLinearBinaryClassificationModel mdl = new SVMLinearBinaryClassificationModel(weights, 1.0).withThreshold(5);
+ SVMLinearClassificationModel mdl = new SVMLinearClassificationModel(weights, 1.0).withThreshold(5);
Vector observation = new DenseVector(new double[]{1.0, 1.0});
TestUtils.assertEquals(0.0, mdl.apply(observation), PRECISION);
@@ -129,7 +109,7 @@ public class SVMModelTest {
public void testPredictOnAnObservationWithWrongCardinality() {
Vector weights = new DenseVector(new double[]{2.0, 3.0});
- SVMLinearBinaryClassificationModel mdl = new SVMLinearBinaryClassificationModel(weights, 1.0);
+ SVMLinearClassificationModel mdl = new SVMLinearClassificationModel(weights, 1.0);
Vector observation = new DenseVector(new double[]{1.0});
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMMultiClassTrainerTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMMultiClassTrainerTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMMultiClassTrainerTest.java
deleted file mode 100644
index 7c4809f..0000000
--- a/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMMultiClassTrainerTest.java
+++ /dev/null
@@ -1,100 +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.ml.svm;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.ignite.ml.TestUtils;
-import org.apache.ignite.ml.common.TrainerTest;
-import org.apache.ignite.ml.math.primitives.vector.Vector;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
-import org.junit.Test;
-
-/**
- * Tests for {@link SVMLinearBinaryClassificationTrainer}.
- */
-public class SVMMultiClassTrainerTest extends TrainerTest {
- /**
- * Test trainer on 4 sets grouped around of square vertices.
- */
- @Test
- public void testTrainWithTheLinearlySeparableCase() {
- Map<Integer, double[]> cacheMock = new HashMap<>();
-
- for (int i = 0; i < twoLinearlySeparableClasses.length; i++)
- cacheMock.put(i, twoLinearlySeparableClasses[i]);
-
- SVMLinearMultiClassClassificationTrainer trainer = new SVMLinearMultiClassClassificationTrainer()
- .withLambda(0.3)
- .withAmountOfLocIterations(10)
- .withAmountOfIterations(20)
- .withSeed(1234L);
-
- SVMLinearMultiClassClassificationModel mdl = trainer.fit(
- cacheMock,
- parts,
- (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
- (k, v) -> v[0]
- );
- TestUtils.assertEquals(0, mdl.apply(VectorUtils.of(100, 10)), PRECISION);
- TestUtils.assertEquals(1, mdl.apply(VectorUtils.of(10, 100)), PRECISION);
- }
-
- /** */
- @Test
- public void testUpdate() {
- Map<Integer, double[]> cacheMock = new HashMap<>();
-
- for (int i = 0; i < twoLinearlySeparableClasses.length; i++)
- cacheMock.put(i, twoLinearlySeparableClasses[i]);
-
- SVMLinearMultiClassClassificationTrainer trainer = new SVMLinearMultiClassClassificationTrainer()
- .withLambda(0.3)
- .withAmountOfLocIterations(10)
- .withAmountOfIterations(100)
- .withSeed(1234L);
-
- SVMLinearMultiClassClassificationModel originalMdl = trainer.fit(
- cacheMock,
- parts,
- (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
- (k, v) -> v[0]
- );
-
- SVMLinearMultiClassClassificationModel updatedOnSameDS = trainer.update(
- originalMdl,
- cacheMock,
- parts,
- (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
- (k, v) -> v[0]
- );
-
- SVMLinearMultiClassClassificationModel updatedOnEmptyDS = trainer.update(
- originalMdl,
- new HashMap<Integer, double[]>(),
- parts,
- (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
- (k, v) -> v[0]
- );
-
- Vector v = VectorUtils.of(100, 10);
- TestUtils.assertEquals(originalMdl.apply(v), updatedOnSameDS.apply(v), PRECISION);
- TestUtils.assertEquals(originalMdl.apply(v), updatedOnEmptyDS.apply(v), PRECISION);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMTestSuite.java b/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMTestSuite.java
index df7263f..a2aea6e 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMTestSuite.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/svm/SVMTestSuite.java
@@ -27,7 +27,6 @@ import org.junit.runners.Suite;
@Suite.SuiteClasses({
SVMModelTest.class,
SVMBinaryTrainerTest.class,
- SVMMultiClassTrainerTest.class,
})
public class SVMTestSuite {
// No-op.
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/test/java/org/apache/ignite/ml/trainers/BaggingTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/trainers/BaggingTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/trainers/BaggingTest.java
index 1b96ce2..31fe8b3 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/trainers/BaggingTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/trainers/BaggingTest.java
@@ -37,8 +37,8 @@ import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
import org.apache.ignite.ml.nn.UpdatesStrategy;
import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDParameterUpdate;
import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDUpdateCalculator;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionModel;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionSGDTrainer;
+import org.apache.ignite.ml.regressions.logistic.LogisticRegressionModel;
+import org.apache.ignite.ml.regressions.logistic.LogisticRegressionSGDTrainer;
import org.junit.Test;
/**
[31/50] [abbrv] ignite git commit: IGNITE-9023 LinkageError or
ClassNotFoundException should not be swollen by GridDeploymentCommunication
during processing deployment request - Fixes #5472.
Posted by sb...@apache.org.
IGNITE-9023 LinkageError or ClassNotFoundException should not be swollen by GridDeploymentCommunication during processing deployment request - Fixes #5472.
Signed-off-by: Dmitriy Govorukhin <dm...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ee5a8f32
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ee5a8f32
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ee5a8f32
Branch: refs/heads/ignite-10044
Commit: ee5a8f321ebef44e34fb8074944a84872d932fea
Parents: 929fbb5
Author: Vyacheslav Daradur <da...@gmail.com>
Authored: Wed Dec 5 13:11:17 2018 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Wed Dec 5 13:11:17 2018 +0300
----------------------------------------------------------------------
.../deployment/GridDeploymentCommunication.java | 10 +-
...mentRequestOfUnknownClassProcessingTest.java | 151 +++++++++++++++++++
.../testsuites/IgniteKernalSelfTestSuite.java | 2 +
3 files changed, 159 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee5a8f32/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentCommunication.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentCommunication.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentCommunication.java
index fdbe9b9..d79346d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentCommunication.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentCommunication.java
@@ -204,9 +204,9 @@ class GridDeploymentCommunication {
// since it was already performed before (and was successful).
if (!(ldr instanceof GridDeploymentClassLoader)) {
// First check for @GridNotPeerDeployable annotation.
- try {
- String clsName = req.resourceName().replace('/', '.');
+ String clsName = req.resourceName().replace('/', '.');
+ try {
int idx = clsName.indexOf(".class");
if (idx >= 0)
@@ -228,8 +228,10 @@ class GridDeploymentCommunication {
return;
}
}
- catch (ClassNotFoundException ignore) {
- // Safely ignore it here - resource wasn't a class name.
+ catch (LinkageError | ClassNotFoundException e) {
+ U.warn(log, "Failed to resolve class: " + clsName, e);
+ // Defined errors can be safely ignored here, because of resource which is able to be not a class name.
+ // Unsuccessful response will be sent below if the resource failed to be loaded.
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee5a8f32/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/DeploymentRequestOfUnknownClassProcessingTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/DeploymentRequestOfUnknownClassProcessingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/DeploymentRequestOfUnknownClassProcessingTest.java
new file mode 100644
index 0000000..f1f080b
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/DeploymentRequestOfUnknownClassProcessingTest.java
@@ -0,0 +1,151 @@
+/*
+ * 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.managers.deployment;
+
+import java.net.URL;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.managers.communication.GridIoPolicy;
+import org.apache.ignite.internal.managers.communication.GridMessageListener;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.internal.U;
+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.testframework.GridTestExternalClassLoader;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.LogListener;
+import org.apache.ignite.testframework.config.GridTestProperties;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.internal.GridTopic.TOPIC_CLASSLOAD;
+
+/**
+ * Tests the processing of deployment request with an attempt to load a class with an unknown class name.
+ */
+public class DeploymentRequestOfUnknownClassProcessingTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final String TEST_TOPIC_NAME = "TEST_TOPIC_NAME";
+
+ /** */
+ private static final String UNKNOWN_CLASS_NAME = "unknown.UnknownClassName";
+
+ /** */
+ private final ListeningTestLogger remNodeLog = new ListeningTestLogger(false, log);
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ cfg.setPeerClassLoadingEnabled(true);
+
+ TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+ discoSpi.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(discoSpi);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ startGrid(getConfiguration(getTestIgniteInstanceName(0)));
+
+ IgniteConfiguration cfg = getConfiguration(getTestIgniteInstanceName(1));
+
+ cfg.setGridLogger(remNodeLog);
+
+ startGrid(cfg);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testResponseReceivingOnDeploymentRequestOfUnknownClass() throws Exception {
+ IgniteEx locNode = grid(0);
+ IgniteEx remNode = grid(1);
+
+ // Register deployment on remote node for attemt to load class on request receiving
+ GridTestExternalClassLoader ldr = new GridTestExternalClassLoader(new URL[] {
+ new URL(GridTestProperties.getProperty("p2p.uri.cls"))
+ });
+
+ Class task = ldr.loadClass("org.apache.ignite.tests.p2p.P2PTestTaskExternalPath1");
+
+ GridDeployment locDep = remNode.context().deploy().deploy(task, task.getClassLoader());
+
+ final GridFutureAdapter<Void> testResultFut = new GridFutureAdapter<>();
+
+ final LogListener remNodeLogLsnr = LogListener
+ .matches(s -> s.startsWith("Failed to resolve class: " + UNKNOWN_CLASS_NAME)).build();
+
+ remNodeLog.registerListener(remNodeLogLsnr);
+
+ locNode.context().io().addMessageListener(TEST_TOPIC_NAME, new GridMessageListener() {
+ @Override public void onMessage(UUID nodeId, Object msg, byte plc) {
+ try {
+ assertTrue(msg instanceof GridDeploymentResponse);
+
+ GridDeploymentResponse resp = (GridDeploymentResponse)msg;
+
+ assertFalse("Unexpected response result, success=" + resp.success(), resp.success());
+
+ String errMsg = resp.errorMessage();
+
+ assertNotNull("Response should contain an error message.", errMsg);
+
+ assertTrue("Response contains unexpected error message, errorMessage=" + errMsg,
+ errMsg.startsWith("Requested resource not found (ignoring locally): " + UNKNOWN_CLASS_NAME));
+
+ testResultFut.onDone();
+ }
+ catch (Error e) {
+ testResultFut.onDone(e);
+ }
+ }
+ });
+
+ GridDeploymentRequest req = new GridDeploymentRequest(TEST_TOPIC_NAME, locDep.classLoaderId(),
+ UNKNOWN_CLASS_NAME, false);
+
+ req.responseTopicBytes(U.marshal(locNode.context(), req.responseTopic()));
+
+ locNode.context().io().sendToGridTopic(remNode.localNode(), TOPIC_CLASSLOAD, req, GridIoPolicy.P2P_POOL);
+
+ // Сhecks that the expected response has been received.
+ testResultFut.get(5_000, TimeUnit.MILLISECONDS);
+
+ // Checks that error has been logged on remote node.
+ assertTrue(remNodeLogLsnr.check());
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee5a8f32/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
index ab2306e..7e0148d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
@@ -42,6 +42,7 @@ import org.apache.ignite.internal.IgniteUpdateNotifierPerClusterSettingSelfTest;
import org.apache.ignite.internal.LongJVMPauseDetectorTest;
import org.apache.ignite.internal.managers.GridManagerStopSelfTest;
import org.apache.ignite.internal.managers.communication.GridCommunicationSendMessageSelfTest;
+import org.apache.ignite.internal.managers.deployment.DeploymentRequestOfUnknownClassProcessingTest;
import org.apache.ignite.internal.managers.deployment.GridDeploymentManagerStopSelfTest;
import org.apache.ignite.internal.managers.discovery.GridDiscoveryManagerAliveCacheSelfTest;
import org.apache.ignite.internal.managers.discovery.GridDiscoveryManagerAttributesSelfTest;
@@ -137,6 +138,7 @@ public class IgniteKernalSelfTestSuite extends TestSuite {
suite.addTestSuite(IgniteConnectionConcurrentReserveAndRemoveTest.class);
suite.addTestSuite(LongJVMPauseDetectorTest.class);
suite.addTestSuite(ClusterMetricsSelfTest.class);
+ suite.addTestSuite(DeploymentRequestOfUnknownClassProcessingTest.class);
// Managed Services.
suite.addTestSuite(GridServiceProcessorSingleNodeSelfTest.class);
[42/50] [abbrv] ignite git commit: IGNITE-10373 Web Console: Fixed
docker-compose.yml.
Posted by sb...@apache.org.
IGNITE-10373 Web Console: Fixed docker-compose.yml.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/63b1422e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/63b1422e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/63b1422e
Branch: refs/heads/ignite-10044
Commit: 63b1422e9095bb9c9afa7cfc27e7f24b30ce8f97
Parents: ececcbc
Author: Pavel Konstantinov <pk...@gridgain.com>
Authored: Thu Dec 6 11:34:53 2018 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Dec 6 11:34:53 2018 +0700
----------------------------------------------------------------------
modules/web-console/docker/compose/docker-compose.yml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/63b1422e/modules/web-console/docker/compose/docker-compose.yml
----------------------------------------------------------------------
diff --git a/modules/web-console/docker/compose/docker-compose.yml b/modules/web-console/docker/compose/docker-compose.yml
index 109bfca..15f2ae4 100644
--- a/modules/web-console/docker/compose/docker-compose.yml
+++ b/modules/web-console/docker/compose/docker-compose.yml
@@ -15,7 +15,7 @@
# limitations under the License.
#
-version: 1
+version: '3'
services:
mongodb:
@@ -50,7 +50,6 @@ services:
image: apacheignite/web-console-frontend
depends_on:
- mongodb
- - testenv
ports:
# Proxy HTTP nginx port (HOST_PORT:DOCKER_PORT)
- 80:80
[41/50] [abbrv] ignite git commit: IGNITE-10564 Added tasks to
collect rebalance metrics.
Posted by sb...@apache.org.
IGNITE-10564 Added tasks to collect rebalance metrics.
Co-authored-by: Alexey Kuznetsov <ak...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ececcbcd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ececcbcd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ececcbcd
Branch: refs/heads/ignite-10044
Commit: ececcbcd1883a2cda5a2eb12e0f0deffddf6b829
Parents: 4c56adc
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Thu Dec 6 11:30:08 2018 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Dec 6 11:30:08 2018 +0700
----------------------------------------------------------------------
.../VisorCacheRebalanceCollectorJobResult.java | 91 +++++++++
.../node/VisorCacheRebalanceCollectorTask.java | 194 +++++++++++++++++++
.../VisorCacheRebalanceCollectorTaskArg.java | 54 ++++++
.../VisorCacheRebalanceCollectorTaskResult.java | 92 +++++++++
.../visor/node/VisorNodeBaselineStatus.java | 45 +++++
.../visor/node/VisorNodeDataCollectorJob.java | 74 ++++---
.../node/VisorNodeDataCollectorTaskResult.java | 3 +-
.../internal/visor/util/VisorTaskUtils.java | 43 ++++
8 files changed, 564 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ececcbcd/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorJobResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorJobResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorJobResult.java
new file mode 100644
index 0000000..5bd818d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorJobResult.java
@@ -0,0 +1,91 @@
+/*
+ * 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.visor.node;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.dto.IgniteDataTransferObject;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * Result object for cache rebalance job.
+ */
+public class VisorCacheRebalanceCollectorJobResult extends IgniteDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Rebalance percent. */
+ private double rebalance;
+
+ /** Node baseline state. */
+ private VisorNodeBaselineStatus baseline;
+
+ /**
+ * Default constructor.
+ */
+ public VisorCacheRebalanceCollectorJobResult() {
+ // No-op.
+ }
+
+ /**
+ * @return Rebalance progress.
+ */
+ public double getRebalance() {
+ return rebalance;
+ }
+
+ /**
+ * @param rebalance Rebalance progress.
+ */
+ public void setRebalance(double rebalance) {
+ this.rebalance = rebalance;
+ }
+
+ /**
+ * @return Node baseline status.
+ */
+ public VisorNodeBaselineStatus getBaseline() {
+ return baseline;
+ }
+
+ /**
+ * @param baseline Node baseline status.
+ */
+ public void setBaseline(VisorNodeBaselineStatus baseline) {
+ this.baseline = baseline;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeDouble(rebalance);
+ U.writeEnum(out, baseline);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ rebalance = in.readDouble();
+ baseline = VisorNodeBaselineStatus.fromOrdinal(in.readByte());
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheRebalanceCollectorJobResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ececcbcd/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTask.java
new file mode 100644
index 0000000..eda9f94
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTask.java
@@ -0,0 +1,194 @@
+/*
+ * 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.visor.node;
+
+import java.util.Collection;
+import java.util.List;
+import org.apache.ignite.cache.CacheMetrics;
+import org.apache.ignite.cluster.BaselineNode;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.internal.cluster.IgniteClusterEx;
+import org.apache.ignite.internal.processors.cache.CacheGroupContext;
+import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
+import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
+import org.apache.ignite.internal.processors.cache.GridCacheUtils;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorMultiNodeTask;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.visor.node.VisorNodeBaselineStatus.BASELINE_NOT_AVAILABLE;
+import static org.apache.ignite.internal.visor.node.VisorNodeBaselineStatus.NODE_IN_BASELINE;
+import static org.apache.ignite.internal.visor.node.VisorNodeBaselineStatus.NODE_NOT_IN_BASELINE;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.MINIMAL_REBALANCE;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.NOTHING_TO_REBALANCE;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.REBALANCE_COMPLETE;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.REBALANCE_NOT_AVAILABLE;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.isProxyCache;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.isRestartingCache;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.log;
+
+/**
+ * Collects topology rebalance metrics.
+ */
+@GridInternal
+public class VisorCacheRebalanceCollectorTask extends VisorMultiNodeTask<VisorCacheRebalanceCollectorTaskArg,
+ VisorCacheRebalanceCollectorTaskResult, VisorCacheRebalanceCollectorJobResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorCacheRebalanceCollectorJob job(VisorCacheRebalanceCollectorTaskArg arg) {
+ return new VisorCacheRebalanceCollectorJob(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override protected VisorCacheRebalanceCollectorTaskResult reduce0(List<ComputeJobResult> results) {
+ return reduce(new VisorCacheRebalanceCollectorTaskResult(), results);
+ }
+
+ /**
+ * @param taskRes Task result.
+ * @param results Results.
+ * @return Topology rebalance metrics collector task result.
+ */
+ protected VisorCacheRebalanceCollectorTaskResult reduce(
+ VisorCacheRebalanceCollectorTaskResult taskRes,
+ List<ComputeJobResult> results
+ ) {
+ for (ComputeJobResult res : results) {
+ VisorCacheRebalanceCollectorJobResult jobRes = res.getData();
+
+ if (jobRes != null) {
+ if (res.getException() == null)
+ taskRes.getRebalance().put(res.getNode().id(), jobRes.getRebalance());
+
+ taskRes.getBaseline().put(res.getNode().id(), jobRes.getBaseline());
+ }
+ }
+
+ return taskRes;
+ }
+
+ /**
+ * Job that collects rebalance metrics.
+ */
+ private static class VisorCacheRebalanceCollectorJob extends VisorJob<VisorCacheRebalanceCollectorTaskArg, VisorCacheRebalanceCollectorJobResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Create job with given argument.
+ *
+ * @param arg Job argument.
+ * @param debug Debug flag.
+ */
+ private VisorCacheRebalanceCollectorJob(VisorCacheRebalanceCollectorTaskArg arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected VisorCacheRebalanceCollectorJobResult run(VisorCacheRebalanceCollectorTaskArg arg) {
+ VisorCacheRebalanceCollectorJobResult res = new VisorCacheRebalanceCollectorJobResult();
+
+ long start0 = U.currentTimeMillis();
+
+ try {
+ int partitions = 0;
+ double total = 0;
+ double ready = 0;
+
+ GridCacheProcessor cacheProc = ignite.context().cache();
+
+ boolean rebalanceInProgress = false;
+
+ for (CacheGroupContext grp: cacheProc.cacheGroups()) {
+ String cacheName = grp.config().getName();
+
+ if (isProxyCache(ignite, cacheName) || isRestartingCache(ignite, cacheName))
+ continue;
+
+ try {
+ GridCacheAdapter ca = cacheProc.internalCache(cacheName);
+
+ if (ca == null || !ca.context().started())
+ continue;
+
+ CacheMetrics cm = ca.localMetrics();
+
+ partitions += cm.getTotalPartitionsCount();
+
+ long keysTotal = cm.getEstimatedRebalancingKeys();
+ long keysReady = cm.getRebalancedKeys();
+
+ if (keysReady >= keysTotal)
+ keysReady = Math.max(keysTotal - 1, 0);
+
+ total += keysTotal;
+ ready += keysReady;
+
+ if (cm.getRebalancingPartitionsCount() > 0)
+ rebalanceInProgress = true;
+ }
+ catch(IllegalStateException | IllegalArgumentException e) {
+ if (debug && ignite.log() != null)
+ ignite.log().error("Ignored cache group: " + grp.cacheOrGroupName(), e);
+ }
+ }
+
+ if (partitions == 0)
+ res.setRebalance(NOTHING_TO_REBALANCE);
+ else if (total == 0 && rebalanceInProgress)
+ res.setRebalance(MINIMAL_REBALANCE);
+ else
+ res.setRebalance(total > 0 ? Math.max(ready / total, MINIMAL_REBALANCE) : REBALANCE_COMPLETE);
+ }
+ catch (Exception e) {
+ res.setRebalance(REBALANCE_NOT_AVAILABLE);
+
+ ignite.log().error("Failed to collect rebalance metrics", e);
+ }
+
+ if (GridCacheUtils.isPersistenceEnabled(ignite.configuration())) {
+ IgniteClusterEx cluster = ignite.cluster();
+
+ Object consistentId = ignite.localNode().consistentId();
+
+ Collection<? extends BaselineNode> baseline = cluster.currentBaselineTopology();
+
+ boolean inBaseline = baseline.stream().anyMatch(n -> consistentId.equals(n.consistentId()));
+
+ res.setBaseline(inBaseline ? NODE_IN_BASELINE : NODE_NOT_IN_BASELINE);
+ }
+ else
+ res.setBaseline(BASELINE_NOT_AVAILABLE);
+
+ if (debug)
+ log(ignite.log(), "Collected rebalance metrics", getClass(), start0);
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheRebalanceCollectorJob.class, this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ececcbcd/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTaskArg.java
new file mode 100644
index 0000000..d97fd50
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTaskArg.java
@@ -0,0 +1,54 @@
+/*
+ * 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.visor.node;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Argument for {@link VisorCacheRebalanceCollectorTask} task.
+ */
+public class VisorCacheRebalanceCollectorTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Default constructor.
+ */
+ public VisorCacheRebalanceCollectorTaskArg() {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheRebalanceCollectorTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ececcbcd/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTaskResult.java
new file mode 100644
index 0000000..1305cd2
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorCacheRebalanceCollectorTaskResult.java
@@ -0,0 +1,92 @@
+/*
+ * 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.visor.node;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.internal.dto.IgniteDataTransferObject;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * Result object for {@link VisorCacheRebalanceCollectorTask} task.
+ */
+public class VisorCacheRebalanceCollectorTaskResult extends IgniteDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Rebalance state on nodes. */
+ private Map<UUID, Double> rebalance = new HashMap<>();
+
+ /** Nodes baseline status. */
+ private Map<UUID, VisorNodeBaselineStatus> baseline = new HashMap<>();
+
+ /**
+ * Default constructor.
+ */
+ public VisorCacheRebalanceCollectorTaskResult() {
+ // No-op.
+ }
+
+ /**
+ * @return Rebalance on nodes.
+ */
+ public Map<UUID, Double> getRebalance() {
+ return rebalance;
+ }
+
+ /**
+ * @return Baseline.
+ */
+ public Map<UUID, VisorNodeBaselineStatus> getBaseline() {
+ return baseline;
+ }
+
+ /**
+ * Add specified results.
+ *
+ * @param res Results to add.
+ */
+ public void add(VisorCacheRebalanceCollectorTaskResult res) {
+ assert res != null;
+
+ rebalance.putAll(res.getRebalance());
+ baseline.putAll(res.getBaseline());
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeMap(out, rebalance);
+ U.writeMap(out, baseline);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ rebalance = U.readMap(in);
+ baseline = U.readMap(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheRebalanceCollectorTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ececcbcd/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeBaselineStatus.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeBaselineStatus.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeBaselineStatus.java
new file mode 100644
index 0000000..ea90be3
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeBaselineStatus.java
@@ -0,0 +1,45 @@
+/*
+ * 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.visor.node;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Node baseline status.
+ */
+public enum VisorNodeBaselineStatus {
+ /** */
+ NODE_IN_BASELINE,
+ /** */
+ NODE_NOT_IN_BASELINE,
+ /** */
+ BASELINE_NOT_AVAILABLE;
+
+ /** Enumerated values. */
+ private static final VisorNodeBaselineStatus[] VALS = values();
+
+ /**
+ * Efficiently gets enumerated value from its ordinal.
+ *
+ * @param ord Ordinal value.
+ * @return Enumerated value or {@code null} if ordinal out of range.
+ */
+ @Nullable public static VisorNodeBaselineStatus fromOrdinal(int ord) {
+ return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ececcbcd/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
index 9025ed0..9a7d2b1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
@@ -28,8 +28,9 @@ import org.apache.ignite.cache.CacheMetrics;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
+import org.apache.ignite.internal.processors.cache.CacheGroupContext;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager;
import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
import org.apache.ignite.internal.processors.igfs.IgfsProcessorAdapter;
@@ -50,9 +51,15 @@ import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isIgfsC
import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isSystemCache;
import static org.apache.ignite.internal.visor.compute.VisorComputeMonitoringHolder.COMPUTE_MONITORING_HOLDER_KEY;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.EVT_MAPPER;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.MINIMAL_REBALANCE;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.NOTHING_TO_REBALANCE;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.REBALANCE_COMPLETE;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.REBALANCE_NOT_AVAILABLE;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.VISOR_TASK_EVTS;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.checkExplicitTaskMonitoring;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.collectEvents;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.isProxyCache;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.isRestartingCache;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.log;
/**
@@ -141,18 +148,6 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
}
/**
- * @param cacheName Cache name to check.
- * @return {@code true} if cache on local node is not a data cache or near cache disabled.
- */
- private boolean proxyCache(String cacheName) {
- GridDiscoveryManager discovery = ignite.context().discovery();
-
- ClusterNode locNode = ignite.localNode();
-
- return !(discovery.cacheAffinityNode(locNode, cacheName) || discovery.cacheNearNode(locNode, cacheName));
- }
-
- /**
* Collect memory metrics.
*
* @param res Job result.
@@ -194,38 +189,51 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
List<VisorCache> resCaches = res.getCaches();
- for (String cacheName : cacheProc.cacheNames()) {
- if (proxyCache(cacheName))
- continue;
+ boolean rebalanceInProgress = false;
- boolean sysCache = isSystemCache(cacheName);
+ for (CacheGroupContext grp : cacheProc.cacheGroups()) {
+ boolean first = true;
- if (arg.getSystemCaches() || !(sysCache || isIgfsCache(cfg, cacheName))) {
+ for (GridCacheContext cache : grp.caches()) {
long start0 = U.currentTimeMillis();
+ String cacheName = cache.name();
+
try {
+ if (isProxyCache(ignite, cacheName) || isRestartingCache(ignite, cacheName))
+ continue;
+
GridCacheAdapter ca = cacheProc.internalCache(cacheName);
if (ca == null || !ca.context().started())
continue;
- CacheMetrics cm = ca.localMetrics();
+ if (first) {
+ CacheMetrics cm = ca.localMetrics();
+
+ partitions += cm.getTotalPartitionsCount();
+
+ long keysTotal = cm.getEstimatedRebalancingKeys();
+ long keysReady = cm.getRebalancedKeys();
+
+ if (keysReady >= keysTotal)
+ keysReady = Math.max(keysTotal - 1, 0);
- partitions += cm.getTotalPartitionsCount();
+ total += keysTotal;
+ ready += keysReady;
- long partTotal = cm.getEstimatedRebalancingKeys();
- long partReady = cm.getRebalancedKeys();
+ if (!rebalanceInProgress && cm.getRebalancingPartitionsCount() > 0)
+ rebalanceInProgress = true;
- if (partReady >= partTotal)
- partReady = Math.max(partTotal - 1, 0);
+ first = false;
+ }
- total += partTotal;
- ready += partReady;
+ boolean addToRes = arg.getSystemCaches() || !(isSystemCache(cacheName) || isIgfsCache(cfg, cacheName));
- if (all || cacheGrps.contains(ca.configuration().getGroupName()))
+ if (addToRes && (all || cacheGrps.contains(ca.configuration().getGroupName())))
resCaches.add(new VisorCache(ignite, ca, arg.isCollectCacheMetrics()));
}
- catch(IllegalStateException | IllegalArgumentException e) {
+ catch (IllegalStateException | IllegalArgumentException e) {
if (debug && ignite.log() != null)
ignite.log().error("Ignored cache: " + cacheName, e);
}
@@ -237,11 +245,14 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
}
if (partitions == 0)
- res.setRebalance(-1);
+ res.setRebalance(NOTHING_TO_REBALANCE);
+ else if (total == 0 && rebalanceInProgress)
+ res.setRebalance(MINIMAL_REBALANCE);
else
- res.setRebalance(total > 0 ? ready / total : 1);
+ res.setRebalance(total > 0 ? Math.max(ready / total, MINIMAL_REBALANCE) : REBALANCE_COMPLETE);
}
catch (Exception e) {
+ res.setRebalance(REBALANCE_NOT_AVAILABLE);
res.setCachesEx(new VisorExceptionWrapper(e));
}
}
@@ -260,7 +271,8 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
FileSystemConfiguration igfsCfg = igfs.configuration();
- if (proxyCache(igfsCfg.getDataCacheConfiguration().getName()) || proxyCache(igfsCfg.getMetaCacheConfiguration().getName()))
+ if (isProxyCache(ignite, igfsCfg.getDataCacheConfiguration().getName()) ||
+ isProxyCache(ignite, igfsCfg.getMetaCacheConfiguration().getName()))
continue;
try {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ececcbcd/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
index eb161f8..f8eb869 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
@@ -131,7 +131,8 @@ public class VisorNodeDataCollectorTaskResult extends VisorDataTransferObject {
readyTopVers.isEmpty() &&
pendingExchanges.isEmpty() &&
persistenceMetrics.isEmpty() &&
- persistenceMetricsEx.isEmpty();
+ persistenceMetricsEx.isEmpty() &&
+ rebalance.isEmpty();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ececcbcd/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
index fda9ba1..7ab1ffc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
@@ -58,6 +58,10 @@ import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.eviction.AbstractEvictionPolicyFactory;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.events.Event;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
+import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
+import org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl;
import org.apache.ignite.internal.processors.igfs.IgfsEx;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
@@ -110,6 +114,19 @@ public class VisorTaskUtils {
public static final int LOG_FILES_COUNT_LIMIT = 5000;
/** */
+ public static final int NOTHING_TO_REBALANCE = -1;
+
+ /** */
+ public static final int REBALANCE_NOT_AVAILABLE = -2;
+
+ /** */
+ public static final double MINIMAL_REBALANCE = 0.01;
+
+ /** */
+ public static final int REBALANCE_COMPLETE = 1;
+
+
+ /** */
private static final int DFLT_BUFFER_SIZE = 4096;
/** Only task event types that Visor should collect. */
@@ -1248,4 +1265,30 @@ public class VisorTaskUtils {
return Arrays.asList(addrs);
}
+
+ /**
+ * @param ignite Ignite.
+ * @param cacheName Cache name to check.
+ * @return {@code true} if cache on local node is not a data cache or near cache disabled.
+ */
+ public static boolean isProxyCache(IgniteEx ignite, String cacheName) {
+ GridDiscoveryManager discovery = ignite.context().discovery();
+
+ ClusterNode locNode = ignite.localNode();
+
+ return !(discovery.cacheAffinityNode(locNode, cacheName) || discovery.cacheNearNode(locNode, cacheName));
+ }
+
+ /**
+ * Check whether cache restarting in progress.
+ *
+ * @param ignite Grid.
+ * @param cacheName Cache name to check.
+ * @return {@code true} when cache restarting in progress.
+ */
+ public static boolean isRestartingCache(IgniteEx ignite, String cacheName) {
+ IgniteCacheProxy<Object, Object> proxy = ignite.context().cache().jcache(cacheName);
+
+ return proxy instanceof IgniteCacheProxyImpl && ((IgniteCacheProxyImpl) proxy).isRestarting();
+ }
}
[32/50] [abbrv] ignite git commit: IGNITE-10049: MVCC: Create "Cache
4" test suite for MVCC mode. This closes #5499.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index 5f7377f..378c9e9 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
@@ -17,6 +17,7 @@
package org.apache.ignite.testsuites;
+import java.util.HashSet;
import junit.framework.TestSuite;
import org.apache.ignite.cache.store.CacheStoreListenerRWThroughDisabledAtomicCacheTest;
import org.apache.ignite.cache.store.CacheStoreListenerRWThroughDisabledTransactionalCacheTest;
@@ -26,12 +27,13 @@ import org.apache.ignite.cache.store.jdbc.CacheJdbcStoreSessionListenerSelfTest;
import org.apache.ignite.internal.processors.GridCacheTxLoadFromStoreOnLockSelfTest;
import org.apache.ignite.internal.processors.cache.CacheClientStoreSelfTest;
import org.apache.ignite.internal.processors.cache.CacheConnectionLeakStoreTxTest;
-import org.apache.ignite.internal.processors.cache.CacheGetEntryOptimisticReadCommittedSeltTest;
-import org.apache.ignite.internal.processors.cache.CacheGetEntryOptimisticRepeatableReadSeltTest;
-import org.apache.ignite.internal.processors.cache.CacheGetEntryOptimisticSerializableSeltTest;
-import org.apache.ignite.internal.processors.cache.CacheGetEntryPessimisticReadCommittedSeltTest;
-import org.apache.ignite.internal.processors.cache.CacheGetEntryPessimisticRepeatableReadSeltTest;
-import org.apache.ignite.internal.processors.cache.CacheGetEntryPessimisticSerializableSeltTest;
+import org.apache.ignite.internal.processors.cache.CacheEventWithTxLabelTest;
+import org.apache.ignite.internal.processors.cache.CacheGetEntryOptimisticReadCommittedSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheGetEntryOptimisticRepeatableReadSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheGetEntryOptimisticSerializableSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheGetEntryPessimisticReadCommittedSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheGetEntryPessimisticRepeatableReadSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheGetEntryPessimisticSerializableSelfTest;
import org.apache.ignite.internal.processors.cache.CacheOffheapMapEntrySelfTest;
import org.apache.ignite.internal.processors.cache.CacheReadThroughAtomicRestartSelfTest;
import org.apache.ignite.internal.processors.cache.CacheReadThroughLocalAtomicRestartSelfTest;
@@ -46,7 +48,6 @@ import org.apache.ignite.internal.processors.cache.CacheStoreUsageMultinodeDynam
import org.apache.ignite.internal.processors.cache.CacheStoreUsageMultinodeStaticStartAtomicTest;
import org.apache.ignite.internal.processors.cache.CacheStoreUsageMultinodeStaticStartTxTest;
import org.apache.ignite.internal.processors.cache.CacheTxNotAllowReadFromBackupTest;
-import org.apache.ignite.internal.processors.cache.CashEventWithTxLabelTest;
import org.apache.ignite.internal.processors.cache.CrossCacheLockTest;
import org.apache.ignite.internal.processors.cache.GridCacheMarshallingNodeJoinSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheMultinodeUpdateAtomicNearEnabledSelfTest;
@@ -155,193 +156,202 @@ import org.apache.ignite.internal.processors.cache.version.CacheVersionedEntryPa
import org.apache.ignite.internal.processors.cache.version.CacheVersionedEntryReplicatedAtomicSelfTest;
import org.apache.ignite.internal.processors.cache.version.CacheVersionedEntryReplicatedTransactionalSelfTest;
+import static org.apache.ignite.testframework.GridTestUtils.addTestIfNeeded;
+
/**
* Test suite.
*/
public class IgniteCacheTestSuite4 extends TestSuite {
/**
* @return IgniteCache test suite.
- * @throws Exception Thrown in case of the failure.
*/
- public static TestSuite suite() throws Exception {
+ public static TestSuite suite() {
+ return suite(null);
+ }
+
+ /**
+ * @param ignoredTests Ignored tests.
+ * @return IgniteCache test suite.
+ */
+ public static TestSuite suite(HashSet<Class> ignoredTests) {
TestSuite suite = new TestSuite("IgniteCache Test Suite part 4");
// Multi node update.
- suite.addTestSuite(GridCacheMultinodeUpdateSelfTest.class);
- suite.addTestSuite(GridCacheMultinodeUpdateNearEnabledSelfTest.class);
- suite.addTestSuite(GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.class);
- suite.addTestSuite(GridCacheMultinodeUpdateAtomicSelfTest.class);
- suite.addTestSuite(GridCacheMultinodeUpdateAtomicNearEnabledSelfTest.class);
-
- suite.addTestSuite(IgniteCacheAtomicLoadAllTest.class);
- suite.addTestSuite(IgniteCacheAtomicLocalLoadAllTest.class);
- suite.addTestSuite(IgniteCacheTxLoadAllTest.class);
- suite.addTestSuite(IgniteCacheTxLocalLoadAllTest.class);
-
- suite.addTestSuite(IgniteCacheAtomicLoaderWriterTest.class);
- suite.addTestSuite(IgniteCacheTxLoaderWriterTest.class);
-
- suite.addTestSuite(IgniteCacheAtomicStoreSessionTest.class);
- suite.addTestSuite(IgniteCacheTxStoreSessionTest.class);
- suite.addTestSuite(IgniteCacheAtomicStoreSessionWriteBehindTest.class);
- suite.addTestSuite(IgniteCacheTxStoreSessionWriteBehindTest.class);
- suite.addTestSuite(IgniteCacheTxStoreSessionWriteBehindCoalescingTest.class);
-
- suite.addTestSuite(IgniteCacheAtomicNoReadThroughTest.class);
- suite.addTestSuite(IgniteCacheAtomicNearEnabledNoReadThroughTest.class);
- suite.addTestSuite(IgniteCacheAtomicLocalNoReadThroughTest.class);
- suite.addTestSuite(IgniteCacheTxNoReadThroughTest.class);
- suite.addTestSuite(IgniteCacheTxNearEnabledNoReadThroughTest.class);
- suite.addTestSuite(IgniteCacheTxLocalNoReadThroughTest.class);
-
- suite.addTestSuite(IgniteCacheAtomicNoLoadPreviousValueTest.class);
- suite.addTestSuite(IgniteCacheAtomicNearEnabledNoLoadPreviousValueTest.class);
- suite.addTestSuite(IgniteCacheAtomicLocalNoLoadPreviousValueTest.class);
- suite.addTestSuite(IgniteCacheTxNoLoadPreviousValueTest.class);
- suite.addTestSuite(IgniteCacheTxNearEnabledNoLoadPreviousValueTest.class);
- suite.addTestSuite(IgniteCacheTxLocalNoLoadPreviousValueTest.class);
-
- suite.addTestSuite(IgniteCacheAtomicNoWriteThroughTest.class);
- suite.addTestSuite(IgniteCacheAtomicNearEnabledNoWriteThroughTest.class);
- suite.addTestSuite(IgniteCacheAtomicLocalNoWriteThroughTest.class);
- suite.addTestSuite(IgniteCacheTxNoWriteThroughTest.class);
- suite.addTestSuite(IgniteCacheTxNearEnabledNoWriteThroughTest.class);
- suite.addTestSuite(IgniteCacheTxLocalNoWriteThroughTest.class);
-
- suite.addTestSuite(IgniteCacheAtomicPeekModesTest.class);
- suite.addTestSuite(IgniteCacheAtomicNearPeekModesTest.class);
- suite.addTestSuite(IgniteCacheAtomicReplicatedPeekModesTest.class);
- suite.addTestSuite(IgniteCacheAtomicLocalPeekModesTest.class);
- suite.addTestSuite(IgniteCacheTxPeekModesTest.class);
- suite.addTestSuite(IgniteCacheTxNearPeekModesTest.class);
- suite.addTestSuite(IgniteCacheTxLocalPeekModesTest.class);
- suite.addTestSuite(IgniteCacheTxReplicatedPeekModesTest.class);
-
- suite.addTestSuite(IgniteCacheInvokeReadThroughSingleNodeTest.class);
- suite.addTestSuite(IgniteCacheInvokeReadThroughTest.class);
- suite.addTestSuite(IgniteCacheReadThroughStoreCallTest.class);
- suite.addTestSuite(GridCacheVersionMultinodeTest.class);
-
- suite.addTestSuite(IgniteCacheNearReadCommittedTest.class);
- suite.addTestSuite(IgniteCacheAtomicCopyOnReadDisabledTest.class);
- suite.addTestSuite(IgniteCacheTxCopyOnReadDisabledTest.class);
-
- suite.addTestSuite(IgniteCacheTxPreloadNoWriteTest.class);
-
- suite.addTestSuite(IgniteDynamicCacheStartSelfTest.class);
- suite.addTestSuite(IgniteDynamicCacheMultinodeTest.class);
- suite.addTestSuite(IgniteDynamicCacheStartFailTest.class);
- suite.addTestSuite(IgniteDynamicCacheStartCoordinatorFailoverTest.class);
- suite.addTestSuite(IgniteDynamicCacheWithConfigStartSelfTest.class);
- suite.addTestSuite(IgniteCacheDynamicStopSelfTest.class);
- suite.addTestSuite(IgniteDynamicCacheStartStopConcurrentTest.class);
- suite.addTestSuite(IgniteCacheConfigurationTemplateTest.class);
- suite.addTestSuite(IgniteCacheConfigurationDefaultTemplateTest.class);
- suite.addTestSuite(IgniteDynamicClientCacheStartSelfTest.class);
- suite.addTestSuite(IgniteDynamicCacheStartNoExchangeTimeoutTest.class);
- suite.addTestSuite(CacheAffinityEarlyTest.class);
- suite.addTestSuite(IgniteCacheCreatePutMultiNodeSelfTest.class);
- suite.addTestSuite(IgniteCacheCreatePutTest.class);
- suite.addTestSuite(CacheStartOnJoinTest.class);
- suite.addTestSuite(IgniteCacheStartTest.class);
- suite.addTestSuite(CacheDiscoveryDataConcurrentJoinTest.class);
- suite.addTestSuite(IgniteClientCacheInitializationFailTest.class);
- suite.addTestSuite(IgniteCacheFailedUpdateResponseTest.class);
-
- suite.addTestSuite(GridCacheTxLoadFromStoreOnLockSelfTest.class);
-
- suite.addTestSuite(GridCacheMarshallingNodeJoinSelfTest.class);
-
- suite.addTestSuite(IgniteCacheJdbcBlobStoreNodeRestartTest.class);
-
- suite.addTestSuite(IgniteCacheAtomicLocalStoreValueTest.class);
- suite.addTestSuite(IgniteCacheAtomicStoreValueTest.class);
- suite.addTestSuite(IgniteCacheAtomicNearEnabledStoreValueTest.class);
- suite.addTestSuite(IgniteCacheTxLocalStoreValueTest.class);
- suite.addTestSuite(IgniteCacheTxStoreValueTest.class);
- suite.addTestSuite(IgniteCacheTxNearEnabledStoreValueTest.class);
-
- suite.addTestSuite(IgniteCacheLockFailoverSelfTest.class);
- suite.addTestSuite(IgniteCacheMultiTxLockSelfTest.class);
-
- suite.addTestSuite(IgniteInternalCacheTypesTest.class);
-
- suite.addTestSuite(IgniteExchangeFutureHistoryTest.class);
-
- suite.addTestSuite(CacheNoValueClassOnServerNodeTest.class);
- suite.addTestSuite(IgniteSystemCacheOnClientTest.class);
-
- suite.addTestSuite(CacheRemoveAllSelfTest.class);
- suite.addTestSuite(CacheGetEntryOptimisticReadCommittedSeltTest.class);
- suite.addTestSuite(CacheGetEntryOptimisticRepeatableReadSeltTest.class);
- suite.addTestSuite(CacheGetEntryOptimisticSerializableSeltTest.class);
- suite.addTestSuite(CacheGetEntryPessimisticReadCommittedSeltTest.class);
- suite.addTestSuite(CacheGetEntryPessimisticRepeatableReadSeltTest.class);
- suite.addTestSuite(CacheGetEntryPessimisticSerializableSeltTest.class);
- suite.addTestSuite(CacheTxNotAllowReadFromBackupTest.class);
-
- suite.addTestSuite(CacheStopAndDestroySelfTest.class);
-
- suite.addTestSuite(CacheOffheapMapEntrySelfTest.class);
-
- suite.addTestSuite(CacheJdbcStoreSessionListenerSelfTest.class);
- suite.addTestSuite(CacheStoreSessionListenerLifecycleSelfTest.class);
- suite.addTestSuite(CacheStoreListenerRWThroughDisabledAtomicCacheTest.class);
- suite.addTestSuite(CacheStoreListenerRWThroughDisabledTransactionalCacheTest.class);
- suite.addTestSuite(CacheStoreSessionListenerWriteBehindEnabledTest.class);
-
- suite.addTestSuite(CacheClientStoreSelfTest.class);
- suite.addTestSuite(CacheStoreUsageMultinodeStaticStartAtomicTest.class);
- suite.addTestSuite(CacheStoreUsageMultinodeStaticStartTxTest.class);
- suite.addTestSuite(CacheStoreUsageMultinodeDynamicStartAtomicTest.class);
- suite.addTestSuite(CacheStoreUsageMultinodeDynamicStartTxTest.class);
- suite.addTestSuite(CacheConnectionLeakStoreTxTest.class);
-
- suite.addTestSuite(GridCacheStoreManagerDeserializationTest.class);
- suite.addTestSuite(GridLocalCacheStoreManagerDeserializationTest.class);
-
- suite.addTestSuite(IgniteStartCacheInTransactionSelfTest.class);
- suite.addTestSuite(IgniteStartCacheInTransactionAtomicSelfTest.class);
-
- suite.addTestSuite(CacheReadThroughRestartSelfTest.class);
- suite.addTestSuite(CacheReadThroughReplicatedRestartSelfTest.class);
- suite.addTestSuite(CacheReadThroughReplicatedAtomicRestartSelfTest.class);
- suite.addTestSuite(CacheReadThroughLocalRestartSelfTest.class);
- suite.addTestSuite(CacheReadThroughLocalAtomicRestartSelfTest.class);
- suite.addTestSuite(CacheReadThroughAtomicRestartSelfTest.class);
+ addTestIfNeeded(suite, GridCacheMultinodeUpdateSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, GridCacheMultinodeUpdateNearEnabledSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, GridCacheMultinodeUpdateAtomicSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, GridCacheMultinodeUpdateAtomicNearEnabledSelfTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteCacheAtomicLoadAllTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheAtomicLocalLoadAllTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxLoadAllTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxLocalLoadAllTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteCacheAtomicLoaderWriterTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxLoaderWriterTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteCacheAtomicStoreSessionTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxStoreSessionTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheAtomicStoreSessionWriteBehindTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxStoreSessionWriteBehindTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxStoreSessionWriteBehindCoalescingTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteCacheAtomicNoReadThroughTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheAtomicNearEnabledNoReadThroughTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheAtomicLocalNoReadThroughTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxNoReadThroughTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxNearEnabledNoReadThroughTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxLocalNoReadThroughTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteCacheAtomicNoLoadPreviousValueTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheAtomicNearEnabledNoLoadPreviousValueTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheAtomicLocalNoLoadPreviousValueTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxNoLoadPreviousValueTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxNearEnabledNoLoadPreviousValueTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxLocalNoLoadPreviousValueTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteCacheAtomicNoWriteThroughTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheAtomicNearEnabledNoWriteThroughTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheAtomicLocalNoWriteThroughTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxNoWriteThroughTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxNearEnabledNoWriteThroughTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxLocalNoWriteThroughTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteCacheAtomicPeekModesTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheAtomicNearPeekModesTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheAtomicReplicatedPeekModesTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheAtomicLocalPeekModesTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxPeekModesTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxNearPeekModesTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxLocalPeekModesTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxReplicatedPeekModesTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteCacheInvokeReadThroughSingleNodeTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheInvokeReadThroughTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheReadThroughStoreCallTest.class, ignoredTests);
+ addTestIfNeeded(suite, GridCacheVersionMultinodeTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteCacheNearReadCommittedTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheAtomicCopyOnReadDisabledTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxCopyOnReadDisabledTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteCacheTxPreloadNoWriteTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteDynamicCacheStartSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteDynamicCacheMultinodeTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteDynamicCacheStartFailTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteDynamicCacheStartCoordinatorFailoverTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteDynamicCacheWithConfigStartSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheDynamicStopSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteDynamicCacheStartStopConcurrentTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheConfigurationTemplateTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheConfigurationDefaultTemplateTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteDynamicClientCacheStartSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteDynamicCacheStartNoExchangeTimeoutTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheAffinityEarlyTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheCreatePutMultiNodeSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheCreatePutTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheStartOnJoinTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheStartTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheDiscoveryDataConcurrentJoinTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteClientCacheInitializationFailTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheFailedUpdateResponseTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, GridCacheTxLoadFromStoreOnLockSelfTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, GridCacheMarshallingNodeJoinSelfTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteCacheJdbcBlobStoreNodeRestartTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteCacheAtomicLocalStoreValueTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheAtomicStoreValueTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheAtomicNearEnabledStoreValueTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxLocalStoreValueTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxStoreValueTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheTxNearEnabledStoreValueTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteCacheLockFailoverSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheMultiTxLockSelfTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteInternalCacheTypesTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteExchangeFutureHistoryTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, CacheNoValueClassOnServerNodeTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteSystemCacheOnClientTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, CacheRemoveAllSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheGetEntryOptimisticReadCommittedSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheGetEntryOptimisticRepeatableReadSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheGetEntryOptimisticSerializableSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheGetEntryPessimisticReadCommittedSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheGetEntryPessimisticRepeatableReadSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheGetEntryPessimisticSerializableSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheTxNotAllowReadFromBackupTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, CacheStopAndDestroySelfTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, CacheOffheapMapEntrySelfTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, CacheJdbcStoreSessionListenerSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheStoreSessionListenerLifecycleSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheStoreListenerRWThroughDisabledAtomicCacheTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheStoreListenerRWThroughDisabledTransactionalCacheTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheStoreSessionListenerWriteBehindEnabledTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, CacheClientStoreSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheStoreUsageMultinodeStaticStartAtomicTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheStoreUsageMultinodeStaticStartTxTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheStoreUsageMultinodeDynamicStartAtomicTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheStoreUsageMultinodeDynamicStartTxTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheConnectionLeakStoreTxTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, GridCacheStoreManagerDeserializationTest.class, ignoredTests);
+ addTestIfNeeded(suite, GridLocalCacheStoreManagerDeserializationTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, IgniteStartCacheInTransactionSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteStartCacheInTransactionAtomicSelfTest.class, ignoredTests);
+
+ addTestIfNeeded(suite, CacheReadThroughRestartSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheReadThroughReplicatedRestartSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheReadThroughReplicatedAtomicRestartSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheReadThroughLocalRestartSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheReadThroughLocalAtomicRestartSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheReadThroughAtomicRestartSelfTest.class, ignoredTests);
// Versioned entry tests
- suite.addTestSuite(CacheVersionedEntryLocalAtomicSwapDisabledSelfTest.class);
- suite.addTestSuite(CacheVersionedEntryLocalTransactionalSelfTest.class);
- suite.addTestSuite(CacheVersionedEntryPartitionedAtomicSelfTest.class);
- suite.addTestSuite(CacheVersionedEntryPartitionedTransactionalSelfTest.class);
- suite.addTestSuite(CacheVersionedEntryReplicatedAtomicSelfTest.class);
- suite.addTestSuite(CacheVersionedEntryReplicatedTransactionalSelfTest.class);
+ addTestIfNeeded(suite, CacheVersionedEntryLocalAtomicSwapDisabledSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheVersionedEntryLocalTransactionalSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheVersionedEntryPartitionedAtomicSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheVersionedEntryPartitionedTransactionalSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheVersionedEntryReplicatedAtomicSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheVersionedEntryReplicatedTransactionalSelfTest.class, ignoredTests);
- suite.addTestSuite(GridCacheDhtTxPreloadSelfTest.class);
- suite.addTestSuite(GridCacheNearTxPreloadSelfTest.class);
- suite.addTestSuite(GridReplicatedTxPreloadTest.class);
- suite.addTestSuite(CacheGroupsPreloadTest.class);
+ addTestIfNeeded(suite, GridCacheDhtTxPreloadSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, GridCacheNearTxPreloadSelfTest.class, ignoredTests);
+ addTestIfNeeded(suite, GridReplicatedTxPreloadTest.class, ignoredTests);
+ addTestIfNeeded(suite, CacheGroupsPreloadTest.class, ignoredTests);
- suite.addTestSuite(IgniteDynamicCacheFilterTest.class);
+ addTestIfNeeded(suite, IgniteDynamicCacheFilterTest.class, ignoredTests);
- suite.addTestSuite(CrossCacheLockTest.class);
- suite.addTestSuite(IgniteCrossCacheTxSelfTest.class);
+ addTestIfNeeded(suite, CrossCacheLockTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCrossCacheTxSelfTest.class, ignoredTests);
- suite.addTestSuite(CacheGetFutureHangsSelfTest.class);
+ addTestIfNeeded(suite, CacheGetFutureHangsSelfTest.class, ignoredTests);
- suite.addTestSuite(IgniteCacheSingleGetMessageTest.class);
- suite.addTestSuite(IgniteCacheReadFromBackupTest.class);
+ addTestIfNeeded(suite, IgniteCacheSingleGetMessageTest.class, ignoredTests);
+ addTestIfNeeded(suite, IgniteCacheReadFromBackupTest.class, ignoredTests);
- suite.addTestSuite(MarshallerCacheJobRunNodeRestartTest.class);
+ addTestIfNeeded(suite, MarshallerCacheJobRunNodeRestartTest.class, ignoredTests);
- suite.addTestSuite(IgniteCacheNearOnlyTxTest.class);
+ addTestIfNeeded(suite, IgniteCacheNearOnlyTxTest.class, ignoredTests);
- suite.addTestSuite(IgniteCacheContainsKeyAtomicTest.class);
+ addTestIfNeeded(suite, IgniteCacheContainsKeyAtomicTest.class, ignoredTests);
- suite.addTestSuite(CacheResultIsNotNullOnPartitionLossTest.class);
+ addTestIfNeeded(suite, CacheResultIsNotNullOnPartitionLossTest.class, ignoredTests);
- suite.addTestSuite(CashEventWithTxLabelTest.class);
+ addTestIfNeeded(suite, CacheEventWithTxLabelTest.class, ignoredTests);
return suite;
}
[28/50] [abbrv] ignite git commit: IGNITE-10380: Drop Multi-label
Classification for Logistic Regression and SVM
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/LogRegressionMultiClassTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/LogRegressionMultiClassTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/LogRegressionMultiClassTrainer.java
deleted file mode 100644
index fd5a624..0000000
--- a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/LogRegressionMultiClassTrainer.java
+++ /dev/null
@@ -1,269 +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.ml.regressions.logistic.multiclass;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import org.apache.ignite.ml.dataset.Dataset;
-import org.apache.ignite.ml.dataset.DatasetBuilder;
-import org.apache.ignite.ml.dataset.PartitionDataBuilder;
-import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
-import org.apache.ignite.ml.math.functions.IgniteBiFunction;
-import org.apache.ignite.ml.math.primitives.vector.Vector;
-import org.apache.ignite.ml.nn.UpdatesStrategy;
-import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDParameterUpdate;
-import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDUpdateCalculator;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionModel;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionSGDTrainer;
-import org.apache.ignite.ml.structures.partition.LabelPartitionDataBuilderOnHeap;
-import org.apache.ignite.ml.structures.partition.LabelPartitionDataOnHeap;
-import org.apache.ignite.ml.trainers.SingleLabelDatasetTrainer;
-
-/**
- * All common parameters are shared with bunch of binary classification trainers.
- */
-public class LogRegressionMultiClassTrainer<P extends Serializable>
- extends SingleLabelDatasetTrainer<LogRegressionMultiClassModel> {
- /** Update strategy. */
- private UpdatesStrategy updatesStgy = new UpdatesStrategy<>(
- new SimpleGDUpdateCalculator(0.2),
- SimpleGDParameterUpdate::sumLocal,
- SimpleGDParameterUpdate::avg
- );
-
- /** Max number of iteration. */
- private int amountOfIterations = 100;
-
- /** Batch size. */
- private int batchSize = 100;
-
- /** Number of local iterations. */
- private int amountOfLocIterations = 100;
-
- /** Seed for random generator. */
- private long seed = 1234L;
-
- /**
- * Trains model based on the specified data.
- *
- * @param datasetBuilder Dataset builder.
- * @param featureExtractor Feature extractor.
- * @param lbExtractor Label extractor.
- * @return Model.
- */
- @Override public <K, V> LogRegressionMultiClassModel fit(DatasetBuilder<K, V> datasetBuilder,
- IgniteBiFunction<K, V, Vector> featureExtractor,
- IgniteBiFunction<K, V, Double> lbExtractor) {
- List<Double> classes = extractClassLabels(datasetBuilder, lbExtractor);
-
- return updateModel(null, datasetBuilder, featureExtractor, lbExtractor);
- }
-
- /** {@inheritDoc} */
- @Override public <K, V> LogRegressionMultiClassModel updateModel(LogRegressionMultiClassModel newMdl,
- DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor,
- IgniteBiFunction<K, V, Double> lbExtractor) {
-
- List<Double> classes = extractClassLabels(datasetBuilder, lbExtractor);
-
- if(classes.isEmpty())
- return getLastTrainedModelOrThrowEmptyDatasetException(newMdl);
-
- LogRegressionMultiClassModel multiClsMdl = new LogRegressionMultiClassModel();
-
- classes.forEach(clsLb -> {
- LogisticRegressionSGDTrainer<?> trainer =
- new LogisticRegressionSGDTrainer<>()
- .withBatchSize(batchSize)
- .withLocIterations(amountOfLocIterations)
- .withMaxIterations(amountOfIterations)
- .withSeed(seed);
-
- IgniteBiFunction<K, V, Double> lbTransformer = (k, v) -> {
- Double lb = lbExtractor.apply(k, v);
-
- if (lb.equals(clsLb))
- return 1.0;
- else
- return 0.0;
- };
-
- LogisticRegressionModel mdl = Optional.ofNullable(newMdl)
- .flatMap(multiClassModel -> multiClassModel.getModel(clsLb))
- .map(learnedModel -> trainer.update(learnedModel, datasetBuilder, featureExtractor, lbTransformer))
- .orElseGet(() -> trainer.fit(datasetBuilder, featureExtractor, lbTransformer));
-
- multiClsMdl.add(clsLb, mdl);
- });
-
- return multiClsMdl;
- }
-
- /** {@inheritDoc} */
- @Override protected boolean checkState(LogRegressionMultiClassModel mdl) {
- return true;
- }
-
- /** Iterates among dataset and collects class labels. */
- private <K, V> List<Double> extractClassLabels(DatasetBuilder<K, V> datasetBuilder,
- IgniteBiFunction<K, V, Double> lbExtractor) {
- assert datasetBuilder != null;
-
- PartitionDataBuilder<K, V, EmptyContext, LabelPartitionDataOnHeap> partDataBuilder = new LabelPartitionDataBuilderOnHeap<>(lbExtractor);
-
- List<Double> res = new ArrayList<>();
-
- try (Dataset<EmptyContext, LabelPartitionDataOnHeap> dataset = datasetBuilder.build(
- envBuilder,
- (env, upstream, upstreamSize) -> new EmptyContext(),
- partDataBuilder
- )) {
- final Set<Double> clsLabels = dataset.compute(data -> {
- final Set<Double> locClsLabels = new HashSet<>();
-
- final double[] lbs = data.getY();
-
- for (double lb : lbs)
- locClsLabels.add(lb);
-
- return locClsLabels;
- }, (a, b) -> {
- if (a == null)
- return b == null ? new HashSet<>() : b;
- if (b == null)
- return a;
- return Stream.of(a, b).flatMap(Collection::stream).collect(Collectors.toSet());
- });
-
- if (clsLabels != null)
- res.addAll(clsLabels);
-
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- return res;
- }
-
- /**
- * Set up the regularization parameter.
- *
- * @param batchSize The size of learning batch.
- * @return Trainer with new batch size parameter value.
- */
- public LogRegressionMultiClassTrainer withBatchSize(int batchSize) {
- this.batchSize = batchSize;
- return this;
- }
-
- /**
- * Get the batch size.
- *
- * @return The parameter value.
- */
- public double getBatchSize() {
- return batchSize;
- }
-
- /**
- * Get the amount of outer iterations of SGD algorithm.
- *
- * @return The parameter value.
- */
- public int getAmountOfIterations() {
- return amountOfIterations;
- }
-
- /**
- * Set up the amount of outer iterations.
- *
- * @param amountOfIterations The parameter value.
- * @return Trainer with new amountOfIterations parameter value.
- */
- public LogRegressionMultiClassTrainer withAmountOfIterations(int amountOfIterations) {
- this.amountOfIterations = amountOfIterations;
- return this;
- }
-
- /**
- * Get the amount of local iterations.
- *
- * @return The parameter value.
- */
- public int getAmountOfLocIterations() {
- return amountOfLocIterations;
- }
-
- /**
- * Set up the amount of local iterations of SGD algorithm.
- *
- * @param amountOfLocIterations The parameter value.
- * @return Trainer with new amountOfLocIterations parameter value.
- */
- public LogRegressionMultiClassTrainer withAmountOfLocIterations(int amountOfLocIterations) {
- this.amountOfLocIterations = amountOfLocIterations;
- return this;
- }
-
- /**
- * Set up the random seed parameter.
- *
- * @param seed Seed for random generator.
- * @return Trainer with new seed parameter value.
- */
- public LogRegressionMultiClassTrainer withSeed(long seed) {
- this.seed = seed;
- return this;
- }
-
- /**
- * Get the seed for random generator.
- *
- * @return The parameter value.
- */
- public long seed() {
- return seed;
- }
-
- /**
- * Set up the updates strategy.
- *
- * @param updatesStgy Update strategy.
- * @return Trainer with new update strategy parameter value.
- */
- public LogRegressionMultiClassTrainer withUpdatesStgy(UpdatesStrategy updatesStgy) {
- this.updatesStgy = updatesStgy;
- return this;
- }
-
- /**
- * Get the update strategy.
- *
- * @return The parameter value.
- */
- public UpdatesStrategy getUpdatesStgy() {
- return updatesStgy;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/package-info.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/package-info.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/package-info.java
deleted file mode 100644
index 2e7b947..0000000
--- a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/multiclass/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * Contains multi-class logistic regression.
- */
-package org.apache.ignite.ml.regressions.logistic.multiclass;
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearBinaryClassificationModel.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearBinaryClassificationModel.java b/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearBinaryClassificationModel.java
deleted file mode 100644
index f5d2b28..0000000
--- a/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearBinaryClassificationModel.java
+++ /dev/null
@@ -1,194 +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.ml.svm;
-
-import java.io.Serializable;
-import java.util.Objects;
-import org.apache.ignite.ml.Exportable;
-import org.apache.ignite.ml.Exporter;
-import org.apache.ignite.ml.Model;
-import org.apache.ignite.ml.math.primitives.vector.Vector;
-
-/**
- * Base class for SVM linear classification model.
- */
-public class SVMLinearBinaryClassificationModel implements Model<Vector, Double>, Exportable<SVMLinearBinaryClassificationModel>, Serializable {
- /** */
- private static final long serialVersionUID = -996984622291440226L;
-
- /** Output label format. '0' and '1' for false value and raw distances from the separating hyperplane otherwise. */
- private boolean isKeepingRawLabels = false;
-
- /** Threshold to assign '1' label to the observation if raw value more than this threshold. */
- private double threshold = 0.5;
-
- /** Multiplier of the objects's vector required to make prediction. */
- private Vector weights;
-
- /** Intercept of the linear regression model. */
- private double intercept;
-
- /** */
- public SVMLinearBinaryClassificationModel(Vector weights, double intercept) {
- this.weights = weights;
- this.intercept = intercept;
- }
-
- /**
- * Set up the output label format.
- *
- * @param isKeepingRawLabels The parameter value.
- * @return Model with new isKeepingRawLabels parameter value.
- */
- public SVMLinearBinaryClassificationModel withRawLabels(boolean isKeepingRawLabels) {
- this.isKeepingRawLabels = isKeepingRawLabels;
- return this;
- }
-
- /**
- * Set up the threshold.
- *
- * @param threshold The parameter value.
- * @return Model with new threshold parameter value.
- */
- public SVMLinearBinaryClassificationModel withThreshold(double threshold) {
- this.threshold = threshold;
- return this;
- }
-
- /**
- * Set up the weights.
- *
- * @param weights The parameter value.
- * @return Model with new weights parameter value.
- */
- public SVMLinearBinaryClassificationModel withWeights(Vector weights) {
- this.weights = weights;
- return this;
- }
-
- /**
- * Set up the intercept.
- *
- * @param intercept The parameter value.
- * @return Model with new intercept parameter value.
- */
- public SVMLinearBinaryClassificationModel withIntercept(double intercept) {
- this.intercept = intercept;
- return this;
- }
-
- /** {@inheritDoc} */
- @Override public Double apply(Vector input) {
- final double res = input.dot(weights) + intercept;
- if (isKeepingRawLabels)
- return res;
- else
- return res - threshold > 0 ? 1.0 : 0;
- }
-
- /**
- * Gets the output label format mode.
- *
- * @return The parameter value.
- */
- public boolean isKeepingRawLabels() {
- return isKeepingRawLabels;
- }
-
- /**
- * Gets the threshold.
- *
- * @return The parameter value.
- */
- public double threshold() {
- return threshold;
- }
-
- /**
- * Gets the weights.
- *
- * @return The parameter value.
- */
- public Vector weights() {
- return weights;
- }
-
- /**
- * Gets the intercept.
- *
- * @return The parameter value.
- */
- public double intercept() {
- return intercept;
- }
-
- /** {@inheritDoc} */
- @Override public <P> void saveModel(Exporter<SVMLinearBinaryClassificationModel, P> exporter, P path) {
- exporter.save(this, path);
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
-
- SVMLinearBinaryClassificationModel mdl = (SVMLinearBinaryClassificationModel)o;
-
- return Double.compare(mdl.intercept, intercept) == 0
- && Double.compare(mdl.threshold, threshold) == 0
- && Boolean.compare(mdl.isKeepingRawLabels, isKeepingRawLabels) == 0
- && Objects.equals(weights, mdl.weights);
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return Objects.hash(weights, intercept, isKeepingRawLabels, threshold);
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- if (weights.size() < 20) {
- StringBuilder builder = new StringBuilder();
-
- for (int i = 0; i < weights.size(); i++) {
- double nextItem = i == weights.size() - 1 ? intercept : weights.get(i + 1);
-
- builder.append(String.format("%.4f", Math.abs(weights.get(i))))
- .append("*x")
- .append(i)
- .append(nextItem > 0 ? " + " : " - ");
- }
-
- builder.append(String.format("%.4f", Math.abs(intercept)));
- return builder.toString();
- }
-
- return "SVMModel [" +
- "weights=" + weights +
- ", intercept=" + intercept +
- ']';
- }
-
- /** {@inheritDoc} */
- @Override public String toString(boolean pretty) {
- return toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearBinaryClassificationTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearBinaryClassificationTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearBinaryClassificationTrainer.java
deleted file mode 100644
index 7ceb53b..0000000
--- a/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearBinaryClassificationTrainer.java
+++ /dev/null
@@ -1,356 +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.ml.svm;
-
-import java.util.Random;
-import org.apache.ignite.ml.dataset.Dataset;
-import org.apache.ignite.ml.dataset.DatasetBuilder;
-import org.apache.ignite.ml.dataset.PartitionDataBuilder;
-import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
-import org.apache.ignite.ml.math.StorageConstants;
-import org.apache.ignite.ml.math.functions.IgniteBiFunction;
-import org.apache.ignite.ml.math.primitives.vector.Vector;
-import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
-import org.apache.ignite.ml.math.primitives.vector.impl.SparseVector;
-import org.apache.ignite.ml.structures.LabeledVector;
-import org.apache.ignite.ml.structures.LabeledVectorSet;
-import org.apache.ignite.ml.structures.partition.LabeledDatasetPartitionDataBuilderOnHeap;
-import org.apache.ignite.ml.trainers.SingleLabelDatasetTrainer;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Base class for a soft-margin SVM linear classification trainer based on the communication-efficient distributed dual
- * coordinate ascent algorithm (CoCoA) with hinge-loss function. <p> This trainer takes input as Labeled Dataset with 0
- * and 1 labels for two classes and makes binary classification. </p> The paper about this algorithm could be found
- * here https://arxiv.org/abs/1409.1458.
- */
-public class SVMLinearBinaryClassificationTrainer extends SingleLabelDatasetTrainer<SVMLinearBinaryClassificationModel> {
- /** Amount of outer SDCA algorithm iterations. */
- private int amountOfIterations = 200;
-
- /** Amount of local SDCA algorithm iterations. */
- private int amountOfLocIterations = 100;
-
- /** Regularization parameter. */
- private double lambda = 0.4;
-
- /** The seed number. */
- private long seed = 1234L;
-
- /**
- * Trains model based on the specified data.
- *
- * @param datasetBuilder Dataset builder.
- * @param featureExtractor Feature extractor.
- * @param lbExtractor Label extractor.
- * @return Model.
- */
- @Override public <K, V> SVMLinearBinaryClassificationModel fit(DatasetBuilder<K, V> datasetBuilder,
- IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, Double> lbExtractor) {
-
- return updateModel(null, datasetBuilder, featureExtractor, lbExtractor);
- }
-
- /** {@inheritDoc} */
- @Override protected <K, V> SVMLinearBinaryClassificationModel updateModel(SVMLinearBinaryClassificationModel mdl,
- DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor,
- IgniteBiFunction<K, V, Double> lbExtractor) {
-
- assert datasetBuilder != null;
-
- IgniteBiFunction<K, V, Double> patchedLbExtractor = (k, v) -> {
- final Double lb = lbExtractor.apply(k, v);
- if (lb == 0.0)
- return -1.0;
- else
- return lb;
- };
-
- PartitionDataBuilder<K, V, EmptyContext, LabeledVectorSet<Double, LabeledVector>> partDataBuilder = new LabeledDatasetPartitionDataBuilderOnHeap<>(
- featureExtractor,
- patchedLbExtractor
- );
-
- Vector weights;
-
- try (Dataset<EmptyContext, LabeledVectorSet<Double, LabeledVector>> dataset = datasetBuilder.build(
- envBuilder,
- (env, upstream, upstreamSize) -> new EmptyContext(),
- partDataBuilder
- )) {
- if (mdl == null) {
- final int cols = dataset.compute(org.apache.ignite.ml.structures.Dataset::colSize, (a, b) -> {
- if (a == null)
- return b == null ? 0 : b;
- if (b == null)
- return a;
- return b;
- });
-
- final int weightVectorSizeWithIntercept = cols + 1;
- weights = initializeWeightsWithZeros(weightVectorSizeWithIntercept);
- } else
- weights = getStateVector(mdl);
-
- for (int i = 0; i < this.getAmountOfIterations(); i++) {
- Vector deltaWeights = calculateUpdates(weights, dataset);
- if (deltaWeights == null)
- return getLastTrainedModelOrThrowEmptyDatasetException(mdl);
-
- weights = weights.plus(deltaWeights); // creates new vector
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- return new SVMLinearBinaryClassificationModel(weights.viewPart(1, weights.size() - 1), weights.get(0));
- }
-
- /** {@inheritDoc} */
- @Override protected boolean checkState(SVMLinearBinaryClassificationModel mdl) {
- return true;
- }
-
- /**
- * @param mdl Model.
- * @return vector of model weights with intercept.
- */
- private Vector getStateVector(SVMLinearBinaryClassificationModel mdl) {
- double intercept = mdl.intercept();
- Vector weights = mdl.weights();
-
- int stateVectorSize = weights.size() + 1;
- Vector res = weights.isDense() ?
- new DenseVector(stateVectorSize) :
- new SparseVector(stateVectorSize, StorageConstants.RANDOM_ACCESS_MODE);
-
- res.set(0, intercept);
- weights.nonZeroes().forEach(ith -> res.set(ith.index(), ith.get()));
- return res;
- }
-
- /** */
- @NotNull private Vector initializeWeightsWithZeros(int vectorSize) {
- return new DenseVector(vectorSize);
- }
-
- /** */
- private Vector calculateUpdates(Vector weights,
- Dataset<EmptyContext, LabeledVectorSet<Double, LabeledVector>> dataset) {
- return dataset.compute(data -> {
- Vector copiedWeights = weights.copy();
- Vector deltaWeights = initializeWeightsWithZeros(weights.size());
- final int amountOfObservation = data.rowSize();
-
- Vector tmpAlphas = initializeWeightsWithZeros(amountOfObservation);
- Vector deltaAlphas = initializeWeightsWithZeros(amountOfObservation);
-
- Random random = new Random(seed);
-
- for (int i = 0; i < this.getAmountOfLocIterations(); i++) {
- int randomIdx = random.nextInt(amountOfObservation);
-
- Deltas deltas = getDeltas(data, copiedWeights, amountOfObservation, tmpAlphas, randomIdx);
-
- copiedWeights = copiedWeights.plus(deltas.deltaWeights); // creates new vector
- deltaWeights = deltaWeights.plus(deltas.deltaWeights); // creates new vector
-
- tmpAlphas.set(randomIdx, tmpAlphas.get(randomIdx) + deltas.deltaAlpha);
- deltaAlphas.set(randomIdx, deltaAlphas.get(randomIdx) + deltas.deltaAlpha);
- }
- return deltaWeights;
- }, (a, b) -> {
- if (a == null)
- return b == null ? new DenseVector() : b;
- if (b == null)
- return a;
- return a.plus(b);
- });
- }
-
- /** */
- private Deltas getDeltas(LabeledVectorSet data, Vector copiedWeights, int amountOfObservation, Vector tmpAlphas,
- int randomIdx) {
- LabeledVector row = (LabeledVector)data.getRow(randomIdx);
- Double lb = (Double)row.label();
- Vector v = makeVectorWithInterceptElement(row);
-
- double alpha = tmpAlphas.get(randomIdx);
-
- return maximize(lb, v, alpha, copiedWeights, amountOfObservation);
- }
-
- /** */
- private Vector makeVectorWithInterceptElement(LabeledVector row) {
- Vector vec = row.features().like(row.features().size() + 1);
-
- vec.set(0, 1); // set intercept element
-
- for (int j = 0; j < row.features().size(); j++)
- vec.set(j + 1, row.features().get(j));
-
- return vec;
- }
-
- /** */
- private Deltas maximize(double lb, Vector v, double alpha, Vector weights, int amountOfObservation) {
- double gradient = calcGradient(lb, v, weights, amountOfObservation);
- double prjGrad = calculateProjectionGradient(alpha, gradient);
-
- return calcDeltas(lb, v, alpha, prjGrad, weights.size(), amountOfObservation);
- }
-
- /** */
- private Deltas calcDeltas(double lb, Vector v, double alpha, double gradient, int vectorSize,
- int amountOfObservation) {
- if (gradient != 0.0) {
-
- double qii = v.dot(v);
- double newAlpha = calcNewAlpha(alpha, gradient, qii);
-
- Vector deltaWeights = v.times(lb * (newAlpha - alpha) / (this.getLambda() * amountOfObservation));
-
- return new Deltas(newAlpha - alpha, deltaWeights);
- }
- else
- return new Deltas(0.0, initializeWeightsWithZeros(vectorSize));
- }
-
- /** */
- private double calcNewAlpha(double alpha, double gradient, double qii) {
- if (qii != 0.0)
- return Math.min(Math.max(alpha - (gradient / qii), 0.0), 1.0);
- else
- return 1.0;
- }
-
- /** */
- private double calcGradient(double lb, Vector v, Vector weights, int amountOfObservation) {
- double dotProduct = v.dot(weights);
- return (lb * dotProduct - 1.0) * (this.getLambda() * amountOfObservation);
- }
-
- /** */
- private double calculateProjectionGradient(double alpha, double gradient) {
- if (alpha <= 0.0)
- return Math.min(gradient, 0.0);
-
- else if (alpha >= 1.0)
- return Math.max(gradient, 0.0);
-
- else
- return gradient;
- }
-
- /**
- * Set up the regularization parameter.
- *
- * @param lambda The regularization parameter. Should be more than 0.0.
- * @return Trainer with new lambda parameter value.
- */
- public SVMLinearBinaryClassificationTrainer withLambda(double lambda) {
- assert lambda > 0.0;
- this.lambda = lambda;
- return this;
- }
-
- /**
- * Get the regularization lambda.
- *
- * @return The property value.
- */
- public double getLambda() {
- return lambda;
- }
-
- /**
- * Get the amount of outer iterations of SCDA algorithm.
- *
- * @return The property value.
- */
- public int getAmountOfIterations() {
- return amountOfIterations;
- }
-
- /**
- * Set up the amount of outer iterations of SCDA algorithm.
- *
- * @param amountOfIterations The parameter value.
- * @return Trainer with new amountOfIterations parameter value.
- */
- public SVMLinearBinaryClassificationTrainer withAmountOfIterations(int amountOfIterations) {
- this.amountOfIterations = amountOfIterations;
- return this;
- }
-
- /**
- * Get the amount of local iterations of SCDA algorithm.
- *
- * @return The property value.
- */
- public int getAmountOfLocIterations() {
- return amountOfLocIterations;
- }
-
- /**
- * Set up the amount of local iterations of SCDA algorithm.
- *
- * @param amountOfLocIterations The parameter value.
- * @return Trainer with new amountOfLocIterations parameter value.
- */
- public SVMLinearBinaryClassificationTrainer withAmountOfLocIterations(int amountOfLocIterations) {
- this.amountOfLocIterations = amountOfLocIterations;
- return this;
- }
-
- /**
- * Get the seed number.
- *
- * @return The property value.
- */
- public long getSeed() {
- return seed;
- }
-
- /**
- * Set up the seed.
- *
- * @param seed The parameter value.
- * @return Model with new seed parameter value.
- */
- public SVMLinearBinaryClassificationTrainer withSeed(long seed) {
- this.seed = seed;
- return this;
- }
-}
-
-/** This is a helper class to handle pair results which are returned from the calculation method. */
-class Deltas {
- /** */
- public double deltaAlpha;
-
- /** */
- public Vector deltaWeights;
-
- /** */
- public Deltas(double deltaAlpha, Vector deltaWeights) {
- this.deltaAlpha = deltaAlpha;
- this.deltaWeights = deltaWeights;
- }
-}
-
-
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearClassificationModel.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearClassificationModel.java b/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearClassificationModel.java
new file mode 100644
index 0000000..579fdb2
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearClassificationModel.java
@@ -0,0 +1,194 @@
+/*
+ * 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.ml.svm;
+
+import java.io.Serializable;
+import java.util.Objects;
+import org.apache.ignite.ml.Exportable;
+import org.apache.ignite.ml.Exporter;
+import org.apache.ignite.ml.Model;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+
+/**
+ * Base class for SVM linear classification model.
+ */
+public class SVMLinearClassificationModel implements Model<Vector, Double>, Exportable<SVMLinearClassificationModel>, Serializable {
+ /** */
+ private static final long serialVersionUID = -996984622291440226L;
+
+ /** Output label format. '0' and '1' for false value and raw distances from the separating hyperplane otherwise. */
+ private boolean isKeepingRawLabels = false;
+
+ /** Threshold to assign '1' label to the observation if raw value more than this threshold. */
+ private double threshold = 0.5;
+
+ /** Multiplier of the objects's vector required to make prediction. */
+ private Vector weights;
+
+ /** Intercept of the linear regression model. */
+ private double intercept;
+
+ /** */
+ public SVMLinearClassificationModel(Vector weights, double intercept) {
+ this.weights = weights;
+ this.intercept = intercept;
+ }
+
+ /**
+ * Set up the output label format.
+ *
+ * @param isKeepingRawLabels The parameter value.
+ * @return Model with new isKeepingRawLabels parameter value.
+ */
+ public SVMLinearClassificationModel withRawLabels(boolean isKeepingRawLabels) {
+ this.isKeepingRawLabels = isKeepingRawLabels;
+ return this;
+ }
+
+ /**
+ * Set up the threshold.
+ *
+ * @param threshold The parameter value.
+ * @return Model with new threshold parameter value.
+ */
+ public SVMLinearClassificationModel withThreshold(double threshold) {
+ this.threshold = threshold;
+ return this;
+ }
+
+ /**
+ * Set up the weights.
+ *
+ * @param weights The parameter value.
+ * @return Model with new weights parameter value.
+ */
+ public SVMLinearClassificationModel withWeights(Vector weights) {
+ this.weights = weights;
+ return this;
+ }
+
+ /**
+ * Set up the intercept.
+ *
+ * @param intercept The parameter value.
+ * @return Model with new intercept parameter value.
+ */
+ public SVMLinearClassificationModel withIntercept(double intercept) {
+ this.intercept = intercept;
+ return this;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Double apply(Vector input) {
+ final double res = input.dot(weights) + intercept;
+ if (isKeepingRawLabels)
+ return res;
+ else
+ return res - threshold > 0 ? 1.0 : 0;
+ }
+
+ /**
+ * Gets the output label format mode.
+ *
+ * @return The parameter value.
+ */
+ public boolean isKeepingRawLabels() {
+ return isKeepingRawLabels;
+ }
+
+ /**
+ * Gets the threshold.
+ *
+ * @return The parameter value.
+ */
+ public double threshold() {
+ return threshold;
+ }
+
+ /**
+ * Gets the weights.
+ *
+ * @return The parameter value.
+ */
+ public Vector weights() {
+ return weights;
+ }
+
+ /**
+ * Gets the intercept.
+ *
+ * @return The parameter value.
+ */
+ public double intercept() {
+ return intercept;
+ }
+
+ /** {@inheritDoc} */
+ @Override public <P> void saveModel(Exporter<SVMLinearClassificationModel, P> exporter, P path) {
+ exporter.save(this, path);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ SVMLinearClassificationModel mdl = (SVMLinearClassificationModel)o;
+
+ return Double.compare(mdl.intercept, intercept) == 0
+ && Double.compare(mdl.threshold, threshold) == 0
+ && Boolean.compare(mdl.isKeepingRawLabels, isKeepingRawLabels) == 0
+ && Objects.equals(weights, mdl.weights);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return Objects.hash(weights, intercept, isKeepingRawLabels, threshold);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ if (weights.size() < 20) {
+ StringBuilder builder = new StringBuilder();
+
+ for (int i = 0; i < weights.size(); i++) {
+ double nextItem = i == weights.size() - 1 ? intercept : weights.get(i + 1);
+
+ builder.append(String.format("%.4f", Math.abs(weights.get(i))))
+ .append("*x")
+ .append(i)
+ .append(nextItem > 0 ? " + " : " - ");
+ }
+
+ builder.append(String.format("%.4f", Math.abs(intercept)));
+ return builder.toString();
+ }
+
+ return "SVMModel [" +
+ "weights=" + weights +
+ ", intercept=" + intercept +
+ ']';
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString(boolean pretty) {
+ return toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearClassificationTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearClassificationTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearClassificationTrainer.java
new file mode 100644
index 0000000..67484ea
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearClassificationTrainer.java
@@ -0,0 +1,356 @@
+/*
+ * 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.ml.svm;
+
+import java.util.Random;
+import org.apache.ignite.ml.dataset.Dataset;
+import org.apache.ignite.ml.dataset.DatasetBuilder;
+import org.apache.ignite.ml.dataset.PartitionDataBuilder;
+import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
+import org.apache.ignite.ml.math.StorageConstants;
+import org.apache.ignite.ml.math.functions.IgniteBiFunction;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
+import org.apache.ignite.ml.math.primitives.vector.impl.SparseVector;
+import org.apache.ignite.ml.structures.LabeledVector;
+import org.apache.ignite.ml.structures.LabeledVectorSet;
+import org.apache.ignite.ml.structures.partition.LabeledDatasetPartitionDataBuilderOnHeap;
+import org.apache.ignite.ml.trainers.SingleLabelDatasetTrainer;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Base class for a soft-margin SVM linear classification trainer based on the communication-efficient distributed dual
+ * coordinate ascent algorithm (CoCoA) with hinge-loss function. <p> This trainer takes input as Labeled Dataset with 0
+ * and 1 labels for two classes and makes binary classification. </p> The paper about this algorithm could be found
+ * here https://arxiv.org/abs/1409.1458.
+ */
+public class SVMLinearClassificationTrainer extends SingleLabelDatasetTrainer<SVMLinearClassificationModel> {
+ /** Amount of outer SDCA algorithm iterations. */
+ private int amountOfIterations = 200;
+
+ /** Amount of local SDCA algorithm iterations. */
+ private int amountOfLocIterations = 100;
+
+ /** Regularization parameter. */
+ private double lambda = 0.4;
+
+ /** The seed number. */
+ private long seed = 1234L;
+
+ /**
+ * Trains model based on the specified data.
+ *
+ * @param datasetBuilder Dataset builder.
+ * @param featureExtractor Feature extractor.
+ * @param lbExtractor Label extractor.
+ * @return Model.
+ */
+ @Override public <K, V> SVMLinearClassificationModel fit(DatasetBuilder<K, V> datasetBuilder,
+ IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, Double> lbExtractor) {
+
+ return updateModel(null, datasetBuilder, featureExtractor, lbExtractor);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected <K, V> SVMLinearClassificationModel updateModel(SVMLinearClassificationModel mdl,
+ DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor,
+ IgniteBiFunction<K, V, Double> lbExtractor) {
+
+ assert datasetBuilder != null;
+
+ IgniteBiFunction<K, V, Double> patchedLbExtractor = (k, v) -> {
+ final Double lb = lbExtractor.apply(k, v);
+ if (lb == 0.0)
+ return -1.0;
+ else
+ return lb;
+ };
+
+ PartitionDataBuilder<K, V, EmptyContext, LabeledVectorSet<Double, LabeledVector>> partDataBuilder = new LabeledDatasetPartitionDataBuilderOnHeap<>(
+ featureExtractor,
+ patchedLbExtractor
+ );
+
+ Vector weights;
+
+ try (Dataset<EmptyContext, LabeledVectorSet<Double, LabeledVector>> dataset = datasetBuilder.build(
+ envBuilder,
+ (env, upstream, upstreamSize) -> new EmptyContext(),
+ partDataBuilder
+ )) {
+ if (mdl == null) {
+ final int cols = dataset.compute(org.apache.ignite.ml.structures.Dataset::colSize, (a, b) -> {
+ if (a == null)
+ return b == null ? 0 : b;
+ if (b == null)
+ return a;
+ return b;
+ });
+
+ final int weightVectorSizeWithIntercept = cols + 1;
+ weights = initializeWeightsWithZeros(weightVectorSizeWithIntercept);
+ } else
+ weights = getStateVector(mdl);
+
+ for (int i = 0; i < this.getAmountOfIterations(); i++) {
+ Vector deltaWeights = calculateUpdates(weights, dataset);
+ if (deltaWeights == null)
+ return getLastTrainedModelOrThrowEmptyDatasetException(mdl);
+
+ weights = weights.plus(deltaWeights); // creates new vector
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ return new SVMLinearClassificationModel(weights.viewPart(1, weights.size() - 1), weights.get(0));
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean checkState(SVMLinearClassificationModel mdl) {
+ return true;
+ }
+
+ /**
+ * @param mdl Model.
+ * @return vector of model weights with intercept.
+ */
+ private Vector getStateVector(SVMLinearClassificationModel mdl) {
+ double intercept = mdl.intercept();
+ Vector weights = mdl.weights();
+
+ int stateVectorSize = weights.size() + 1;
+ Vector res = weights.isDense() ?
+ new DenseVector(stateVectorSize) :
+ new SparseVector(stateVectorSize, StorageConstants.RANDOM_ACCESS_MODE);
+
+ res.set(0, intercept);
+ weights.nonZeroes().forEach(ith -> res.set(ith.index(), ith.get()));
+ return res;
+ }
+
+ /** */
+ @NotNull private Vector initializeWeightsWithZeros(int vectorSize) {
+ return new DenseVector(vectorSize);
+ }
+
+ /** */
+ private Vector calculateUpdates(Vector weights,
+ Dataset<EmptyContext, LabeledVectorSet<Double, LabeledVector>> dataset) {
+ return dataset.compute(data -> {
+ Vector copiedWeights = weights.copy();
+ Vector deltaWeights = initializeWeightsWithZeros(weights.size());
+ final int amountOfObservation = data.rowSize();
+
+ Vector tmpAlphas = initializeWeightsWithZeros(amountOfObservation);
+ Vector deltaAlphas = initializeWeightsWithZeros(amountOfObservation);
+
+ Random random = new Random(seed);
+
+ for (int i = 0; i < this.getAmountOfLocIterations(); i++) {
+ int randomIdx = random.nextInt(amountOfObservation);
+
+ Deltas deltas = getDeltas(data, copiedWeights, amountOfObservation, tmpAlphas, randomIdx);
+
+ copiedWeights = copiedWeights.plus(deltas.deltaWeights); // creates new vector
+ deltaWeights = deltaWeights.plus(deltas.deltaWeights); // creates new vector
+
+ tmpAlphas.set(randomIdx, tmpAlphas.get(randomIdx) + deltas.deltaAlpha);
+ deltaAlphas.set(randomIdx, deltaAlphas.get(randomIdx) + deltas.deltaAlpha);
+ }
+ return deltaWeights;
+ }, (a, b) -> {
+ if (a == null)
+ return b == null ? new DenseVector() : b;
+ if (b == null)
+ return a;
+ return a.plus(b);
+ });
+ }
+
+ /** */
+ private Deltas getDeltas(LabeledVectorSet data, Vector copiedWeights, int amountOfObservation, Vector tmpAlphas,
+ int randomIdx) {
+ LabeledVector row = (LabeledVector)data.getRow(randomIdx);
+ Double lb = (Double)row.label();
+ Vector v = makeVectorWithInterceptElement(row);
+
+ double alpha = tmpAlphas.get(randomIdx);
+
+ return maximize(lb, v, alpha, copiedWeights, amountOfObservation);
+ }
+
+ /** */
+ private Vector makeVectorWithInterceptElement(LabeledVector row) {
+ Vector vec = row.features().like(row.features().size() + 1);
+
+ vec.set(0, 1); // set intercept element
+
+ for (int j = 0; j < row.features().size(); j++)
+ vec.set(j + 1, row.features().get(j));
+
+ return vec;
+ }
+
+ /** */
+ private Deltas maximize(double lb, Vector v, double alpha, Vector weights, int amountOfObservation) {
+ double gradient = calcGradient(lb, v, weights, amountOfObservation);
+ double prjGrad = calculateProjectionGradient(alpha, gradient);
+
+ return calcDeltas(lb, v, alpha, prjGrad, weights.size(), amountOfObservation);
+ }
+
+ /** */
+ private Deltas calcDeltas(double lb, Vector v, double alpha, double gradient, int vectorSize,
+ int amountOfObservation) {
+ if (gradient != 0.0) {
+
+ double qii = v.dot(v);
+ double newAlpha = calcNewAlpha(alpha, gradient, qii);
+
+ Vector deltaWeights = v.times(lb * (newAlpha - alpha) / (this.getLambda() * amountOfObservation));
+
+ return new Deltas(newAlpha - alpha, deltaWeights);
+ }
+ else
+ return new Deltas(0.0, initializeWeightsWithZeros(vectorSize));
+ }
+
+ /** */
+ private double calcNewAlpha(double alpha, double gradient, double qii) {
+ if (qii != 0.0)
+ return Math.min(Math.max(alpha - (gradient / qii), 0.0), 1.0);
+ else
+ return 1.0;
+ }
+
+ /** */
+ private double calcGradient(double lb, Vector v, Vector weights, int amountOfObservation) {
+ double dotProduct = v.dot(weights);
+ return (lb * dotProduct - 1.0) * (this.getLambda() * amountOfObservation);
+ }
+
+ /** */
+ private double calculateProjectionGradient(double alpha, double gradient) {
+ if (alpha <= 0.0)
+ return Math.min(gradient, 0.0);
+
+ else if (alpha >= 1.0)
+ return Math.max(gradient, 0.0);
+
+ else
+ return gradient;
+ }
+
+ /**
+ * Set up the regularization parameter.
+ *
+ * @param lambda The regularization parameter. Should be more than 0.0.
+ * @return Trainer with new lambda parameter value.
+ */
+ public SVMLinearClassificationTrainer withLambda(double lambda) {
+ assert lambda > 0.0;
+ this.lambda = lambda;
+ return this;
+ }
+
+ /**
+ * Get the regularization lambda.
+ *
+ * @return The property value.
+ */
+ public double getLambda() {
+ return lambda;
+ }
+
+ /**
+ * Get the amount of outer iterations of SCDA algorithm.
+ *
+ * @return The property value.
+ */
+ public int getAmountOfIterations() {
+ return amountOfIterations;
+ }
+
+ /**
+ * Set up the amount of outer iterations of SCDA algorithm.
+ *
+ * @param amountOfIterations The parameter value.
+ * @return Trainer with new amountOfIterations parameter value.
+ */
+ public SVMLinearClassificationTrainer withAmountOfIterations(int amountOfIterations) {
+ this.amountOfIterations = amountOfIterations;
+ return this;
+ }
+
+ /**
+ * Get the amount of local iterations of SCDA algorithm.
+ *
+ * @return The property value.
+ */
+ public int getAmountOfLocIterations() {
+ return amountOfLocIterations;
+ }
+
+ /**
+ * Set up the amount of local iterations of SCDA algorithm.
+ *
+ * @param amountOfLocIterations The parameter value.
+ * @return Trainer with new amountOfLocIterations parameter value.
+ */
+ public SVMLinearClassificationTrainer withAmountOfLocIterations(int amountOfLocIterations) {
+ this.amountOfLocIterations = amountOfLocIterations;
+ return this;
+ }
+
+ /**
+ * Get the seed number.
+ *
+ * @return The property value.
+ */
+ public long getSeed() {
+ return seed;
+ }
+
+ /**
+ * Set up the seed.
+ *
+ * @param seed The parameter value.
+ * @return Model with new seed parameter value.
+ */
+ public SVMLinearClassificationTrainer withSeed(long seed) {
+ this.seed = seed;
+ return this;
+ }
+}
+
+/** This is a helper class to handle pair results which are returned from the calculation method. */
+class Deltas {
+ /** */
+ public double deltaAlpha;
+
+ /** */
+ public Vector deltaWeights;
+
+ /** */
+ public Deltas(double deltaAlpha, Vector deltaWeights) {
+ this.deltaAlpha = deltaAlpha;
+ this.deltaWeights = deltaWeights;
+ }
+}
+
+
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearMultiClassClassificationModel.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearMultiClassClassificationModel.java b/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearMultiClassClassificationModel.java
deleted file mode 100644
index 46bf4b2..0000000
--- a/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearMultiClassClassificationModel.java
+++ /dev/null
@@ -1,114 +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.ml.svm;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.TreeMap;
-import org.apache.ignite.ml.Exportable;
-import org.apache.ignite.ml.Exporter;
-import org.apache.ignite.ml.Model;
-import org.apache.ignite.ml.math.primitives.vector.Vector;
-
-/** Base class for multi-classification model for set of SVM classifiers. */
-public class SVMLinearMultiClassClassificationModel implements Model<Vector, Double>, Exportable<SVMLinearMultiClassClassificationModel>, Serializable {
- /** */
- private static final long serialVersionUID = -667986511191350227L;
-
- /** List of models associated with each class. */
- private Map<Double, SVMLinearBinaryClassificationModel> models;
-
- /** */
- public SVMLinearMultiClassClassificationModel() {
- this.models = new HashMap<>();
- }
-
- /** {@inheritDoc} */
- @Override public Double apply(Vector input) {
- TreeMap<Double, Double> maxMargins = new TreeMap<>();
-
- models.forEach((k, v) -> maxMargins.put(input.dot(v.weights()) + v.intercept(), k));
-
- return maxMargins.lastEntry().getValue();
- }
-
- /** {@inheritDoc} */
- @Override public <P> void saveModel(Exporter<SVMLinearMultiClassClassificationModel, P> exporter, P path) {
- exporter.save(this, path);
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (o == null || getClass() != o.getClass())
- return false;
-
- SVMLinearMultiClassClassificationModel mdl = (SVMLinearMultiClassClassificationModel)o;
-
- return Objects.equals(models, mdl.models);
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return Objects.hash(models);
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- StringBuilder wholeStr = new StringBuilder();
-
- models.forEach((clsLb, mdl) ->
- wholeStr
- .append("The class with label ")
- .append(clsLb)
- .append(" has classifier: ")
- .append(mdl.toString())
- .append(System.lineSeparator())
- );
-
- return wholeStr.toString();
- }
-
- /** {@inheritDoc} */
- @Override public String toString(boolean pretty) {
- return toString();
- }
-
- /**
- * Adds a specific SVM binary classifier to the bunch of same classifiers.
- *
- * @param clsLb The class label for the added model.
- * @param mdl The model.
- */
- public void add(double clsLb, SVMLinearBinaryClassificationModel mdl) {
- models.put(clsLb, mdl);
- }
-
- /**
- * @param clsLb Class label.
- * @return model trained for target class if it exists.
- */
- public Optional<SVMLinearBinaryClassificationModel> getModelForClass(double clsLb) {
- return Optional.of(models.get(clsLb));
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearMultiClassClassificationTrainer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearMultiClassClassificationTrainer.java b/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearMultiClassClassificationTrainer.java
deleted file mode 100644
index 94f2a99..0000000
--- a/modules/ml/src/main/java/org/apache/ignite/ml/svm/SVMLinearMultiClassClassificationTrainer.java
+++ /dev/null
@@ -1,269 +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.ml.svm;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import org.apache.ignite.ml.dataset.Dataset;
-import org.apache.ignite.ml.dataset.DatasetBuilder;
-import org.apache.ignite.ml.dataset.PartitionDataBuilder;
-import org.apache.ignite.ml.dataset.primitive.context.EmptyContext;
-import org.apache.ignite.ml.math.functions.IgniteBiFunction;
-import org.apache.ignite.ml.math.primitives.vector.Vector;
-import org.apache.ignite.ml.structures.partition.LabelPartitionDataBuilderOnHeap;
-import org.apache.ignite.ml.structures.partition.LabelPartitionDataOnHeap;
-import org.apache.ignite.ml.trainers.SingleLabelDatasetTrainer;
-
-/**
- * Base class for a soft-margin SVM linear multiclass-classification trainer based on the communication-efficient
- * distributed dual coordinate ascent algorithm (CoCoA) with hinge-loss function.
- *
- * All common parameters are shared with bunch of binary classification trainers.
- */
-public class SVMLinearMultiClassClassificationTrainer
- extends SingleLabelDatasetTrainer<SVMLinearMultiClassClassificationModel> {
- /** Amount of outer SDCA algorithm iterations. */
- private int amountOfIterations = 20;
-
- /** Amount of local SDCA algorithm iterations. */
- private int amountOfLocIterations = 50;
-
- /** Regularization parameter. */
- private double lambda = 0.2;
-
- /** The seed number. */
- private long seed = 1234L;
-
- /**
- * Trains model based on the specified data.
- *
- * @param datasetBuilder Dataset builder.
- * @param featureExtractor Feature extractor.
- * @param lbExtractor Label extractor.
- * @return Model.
- */
- @Override public <K, V> SVMLinearMultiClassClassificationModel fit(DatasetBuilder<K, V> datasetBuilder,
- IgniteBiFunction<K, V, Vector> featureExtractor,
- IgniteBiFunction<K, V, Double> lbExtractor) {
- return updateModel(null, datasetBuilder, featureExtractor, lbExtractor);
- }
-
- /** {@inheritDoc} */
- @Override public <K, V> SVMLinearMultiClassClassificationModel updateModel(
- SVMLinearMultiClassClassificationModel mdl,
- DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor,
- IgniteBiFunction<K, V, Double> lbExtractor) {
-
- List<Double> classes = extractClassLabels(datasetBuilder, lbExtractor);
- if (classes.isEmpty())
- return getLastTrainedModelOrThrowEmptyDatasetException(mdl);
-
- SVMLinearMultiClassClassificationModel multiClsMdl = new SVMLinearMultiClassClassificationModel();
-
- classes.forEach(clsLb -> {
- SVMLinearBinaryClassificationTrainer trainer = new SVMLinearBinaryClassificationTrainer()
- .withAmountOfIterations(this.getAmountOfIterations())
- .withAmountOfLocIterations(this.getAmountOfLocIterations())
- .withLambda(this.getLambda())
- .withSeed(this.seed);
-
- IgniteBiFunction<K, V, Double> lbTransformer = (k, v) -> {
- Double lb = lbExtractor.apply(k, v);
-
- if (lb.equals(clsLb))
- return 1.0;
- else
- return 0.0;
- };
-
- SVMLinearBinaryClassificationModel updatedMdl;
-
- if (mdl == null)
- updatedMdl = learnNewModel(trainer, datasetBuilder, featureExtractor, lbTransformer);
- else
- updatedMdl = updateModel(mdl, clsLb, trainer, datasetBuilder, featureExtractor, lbTransformer);
- multiClsMdl.add(clsLb, updatedMdl);
- });
-
- return multiClsMdl;
- }
-
- /** {@inheritDoc} */
- @Override protected boolean checkState(SVMLinearMultiClassClassificationModel mdl) {
- return true;
- }
-
- /**
- * Trains model based on the specified data.
- *
- * @param svmTrainer Prepared SVM trainer.
- * @param datasetBuilder Dataset builder.
- * @param featureExtractor Feature extractor.
- * @param lbExtractor Label extractor.
- */
- private <K, V> SVMLinearBinaryClassificationModel learnNewModel(SVMLinearBinaryClassificationTrainer svmTrainer,
- DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor,
- IgniteBiFunction<K, V, Double> lbExtractor) {
-
- return svmTrainer.fit(datasetBuilder, featureExtractor, lbExtractor);
- }
-
- /**
- * Updates already learned model or fit new model if there is no model for current class label.
- *
- * @param multiClsMdl Learning multi-class model.
- * @param clsLb Current class label.
- * @param svmTrainer Prepared SVM trainer.
- * @param datasetBuilder Dataset builder.
- * @param featureExtractor Feature extractor.
- * @param lbExtractor Label extractor.
- */
- private <K, V> SVMLinearBinaryClassificationModel updateModel(SVMLinearMultiClassClassificationModel multiClsMdl,
- Double clsLb, SVMLinearBinaryClassificationTrainer svmTrainer, DatasetBuilder<K, V> datasetBuilder,
- IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, Double> lbExtractor) {
-
- return multiClsMdl.getModelForClass(clsLb)
- .map(learnedModel -> svmTrainer.update(learnedModel, datasetBuilder, featureExtractor, lbExtractor))
- .orElseGet(() -> svmTrainer.fit(datasetBuilder, featureExtractor, lbExtractor));
- }
-
- /** Iterates among dataset and collects class labels. */
- private <K, V> List<Double> extractClassLabels(DatasetBuilder<K, V> datasetBuilder,
- IgniteBiFunction<K, V, Double> lbExtractor) {
- assert datasetBuilder != null;
-
- PartitionDataBuilder<K, V, EmptyContext, LabelPartitionDataOnHeap> partDataBuilder = new LabelPartitionDataBuilderOnHeap<>(lbExtractor);
-
- List<Double> res = new ArrayList<>();
-
- try (Dataset<EmptyContext, LabelPartitionDataOnHeap> dataset = datasetBuilder.build(
- envBuilder,
- (env, upstream, upstreamSize) -> new EmptyContext(),
- partDataBuilder
- )) {
- final Set<Double> clsLabels = dataset.compute(data -> {
- final Set<Double> locClsLabels = new HashSet<>();
-
- final double[] lbs = data.getY();
-
- for (double lb : lbs)
- locClsLabels.add(lb);
-
- return locClsLabels;
- }, (a, b) -> {
- if (a == null)
- return b == null ? new HashSet<>() : b;
- if (b == null)
- return a;
- return Stream.of(a, b).flatMap(Collection::stream).collect(Collectors.toSet());
- });
-
- if (clsLabels != null)
- res.addAll(clsLabels);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- return res;
- }
-
- /**
- * Set up the regularization parameter.
- *
- * @param lambda The regularization parameter. Should be more than 0.0.
- * @return Trainer with new lambda parameter value.
- */
- public SVMLinearMultiClassClassificationTrainer withLambda(double lambda) {
- assert lambda > 0.0;
- this.lambda = lambda;
- return this;
- }
-
- /**
- * Get the regularization lambda.
- *
- * @return The property value.
- */
- public double getLambda() {
- return lambda;
- }
-
- /**
- * Gets the amount of outer iterations of SCDA algorithm.
- *
- * @return The property value.
- */
- public int getAmountOfIterations() {
- return amountOfIterations;
- }
-
- /**
- * Set up the amount of outer iterations of SCDA algorithm.
- *
- * @param amountOfIterations The parameter value.
- * @return Trainer with new amountOfIterations parameter value.
- */
- public SVMLinearMultiClassClassificationTrainer withAmountOfIterations(int amountOfIterations) {
- this.amountOfIterations = amountOfIterations;
- return this;
- }
-
- /**
- * Gets the amount of local iterations of SCDA algorithm.
- *
- * @return The property value.
- */
- public int getAmountOfLocIterations() {
- return amountOfLocIterations;
- }
-
- /**
- * Set up the amount of local iterations of SCDA algorithm.
- *
- * @param amountOfLocIterations The parameter value.
- * @return Trainer with new amountOfLocIterations parameter value.
- */
- public SVMLinearMultiClassClassificationTrainer withAmountOfLocIterations(int amountOfLocIterations) {
- this.amountOfLocIterations = amountOfLocIterations;
- return this;
- }
-
- /**
- * Gets the seed number.
- *
- * @return The property value.
- */
- public long getSeed() {
- return seed;
- }
-
- /**
- * Set up the seed.
- *
- * @param seed The parameter value.
- * @return Model with new seed parameter value.
- */
- public SVMLinearMultiClassClassificationTrainer withSeed(long seed) {
- this.seed = seed;
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/test/java/org/apache/ignite/ml/common/CollectionsTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/common/CollectionsTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/common/CollectionsTest.java
index 745eac9..e951145 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/common/CollectionsTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/common/CollectionsTest.java
@@ -34,16 +34,13 @@ import org.apache.ignite.ml.math.primitives.matrix.impl.DenseMatrix;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
import org.apache.ignite.ml.math.primitives.vector.impl.VectorizedViewMatrix;
-import org.apache.ignite.ml.regressions.linear.LinearRegressionModel;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionModel;
-import org.apache.ignite.ml.regressions.logistic.multiclass.LogRegressionMultiClassModel;
+import org.apache.ignite.ml.regressions.logistic.LogisticRegressionModel;
import org.apache.ignite.ml.structures.Dataset;
import org.apache.ignite.ml.structures.DatasetRow;
import org.apache.ignite.ml.structures.FeatureMetadata;
import org.apache.ignite.ml.structures.LabeledVector;
import org.apache.ignite.ml.structures.LabeledVectorSet;
-import org.apache.ignite.ml.svm.SVMLinearBinaryClassificationModel;
-import org.apache.ignite.ml.svm.SVMLinearMultiClassClassificationModel;
+import org.apache.ignite.ml.svm.SVMLinearClassificationModel;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -92,17 +89,7 @@ public class CollectionsTest {
test(new KNNClassificationModel(null).withK(1), new KNNClassificationModel(null).withK(2));
- LogRegressionMultiClassModel mdl = new LogRegressionMultiClassModel();
- mdl.add(1, new LogisticRegressionModel(new DenseVector(), 1.0));
- test(mdl, new LogRegressionMultiClassModel());
-
- test(new LinearRegressionModel(null, 1.0), new LinearRegressionModel(null, 0.5));
-
- SVMLinearMultiClassClassificationModel mdl1 = new SVMLinearMultiClassClassificationModel();
- mdl1.add(1, new SVMLinearBinaryClassificationModel(new DenseVector(), 1.0));
- test(mdl1, new SVMLinearMultiClassClassificationModel());
-
- test(new SVMLinearBinaryClassificationModel(null, 1.0), new SVMLinearBinaryClassificationModel(null, 0.5));
+ test(new SVMLinearClassificationModel(null, 1.0), new SVMLinearClassificationModel(null, 0.5));
test(new ANNClassificationModel(new LabeledVectorSet<>(), new ANNClassificationTrainer.CentroidStat()),
new ANNClassificationModel(new LabeledVectorSet<>(1, 1, true), new ANNClassificationTrainer.CentroidStat()));
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/test/java/org/apache/ignite/ml/common/LocalModelsTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/common/LocalModelsTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/common/LocalModelsTest.java
index ca3f0b5..c5b2ffe 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/common/LocalModelsTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/common/LocalModelsTest.java
@@ -43,12 +43,10 @@ import org.apache.ignite.ml.math.distances.ManhattanDistance;
import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
import org.apache.ignite.ml.regressions.linear.LinearRegressionModel;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionModel;
-import org.apache.ignite.ml.regressions.logistic.multiclass.LogRegressionMultiClassModel;
+import org.apache.ignite.ml.regressions.logistic.LogisticRegressionModel;
import org.apache.ignite.ml.structures.LabeledVector;
import org.apache.ignite.ml.structures.LabeledVectorSet;
-import org.apache.ignite.ml.svm.SVMLinearBinaryClassificationModel;
-import org.apache.ignite.ml.svm.SVMLinearMultiClassClassificationModel;
+import org.apache.ignite.ml.svm.SVMLinearClassificationModel;
import org.junit.Assert;
import org.junit.Test;
@@ -99,36 +97,11 @@ public class LocalModelsTest {
@Test
public void importExportSVMBinaryClassificationModelTest() throws IOException {
executeModelTest(mdlFilePath -> {
- SVMLinearBinaryClassificationModel mdl = new SVMLinearBinaryClassificationModel(new DenseVector(new double[]{1, 2}), 3);
- Exporter<SVMLinearBinaryClassificationModel, String> exporter = new FileExporter<>();
+ SVMLinearClassificationModel mdl = new SVMLinearClassificationModel(new DenseVector(new double[] {1, 2}), 3);
+ Exporter<SVMLinearClassificationModel, String> exporter = new FileExporter<>();
mdl.saveModel(exporter, mdlFilePath);
- SVMLinearBinaryClassificationModel load = exporter.load(mdlFilePath);
-
- Assert.assertNotNull(load);
- Assert.assertEquals("", mdl, load);
-
- return null;
- });
- }
-
- /** */
- @Test
- public void importExportSVMMultiClassClassificationModelTest() throws IOException {
- executeModelTest(mdlFilePath -> {
- SVMLinearBinaryClassificationModel binaryMdl1 = new SVMLinearBinaryClassificationModel(new DenseVector(new double[]{1, 2}), 3);
- SVMLinearBinaryClassificationModel binaryMdl2 = new SVMLinearBinaryClassificationModel(new DenseVector(new double[]{2, 3}), 4);
- SVMLinearBinaryClassificationModel binaryMdl3 = new SVMLinearBinaryClassificationModel(new DenseVector(new double[]{3, 4}), 5);
-
- SVMLinearMultiClassClassificationModel mdl = new SVMLinearMultiClassClassificationModel();
- mdl.add(1, binaryMdl1);
- mdl.add(2, binaryMdl2);
- mdl.add(3, binaryMdl3);
-
- Exporter<SVMLinearMultiClassClassificationModel, String> exporter = new FileExporter<>();
- mdl.saveModel(exporter, mdlFilePath);
-
- SVMLinearMultiClassClassificationModel load = exporter.load(mdlFilePath);
+ SVMLinearClassificationModel load = exporter.load(mdlFilePath);
Assert.assertNotNull(load);
Assert.assertEquals("", mdl, load);
@@ -155,23 +128,6 @@ public class LocalModelsTest {
}
/** */
- @Test
- public void importExportLogRegressionMultiClassModelTest() throws IOException {
- executeModelTest(mdlFilePath -> {
- LogRegressionMultiClassModel mdl = new LogRegressionMultiClassModel();
- Exporter<LogRegressionMultiClassModel, String> exporter = new FileExporter<>();
- mdl.saveModel(exporter, mdlFilePath);
-
- LogRegressionMultiClassModel load = exporter.load(mdlFilePath);
-
- Assert.assertNotNull(load);
- Assert.assertEquals("", mdl, load);
-
- return null;
- });
- }
-
- /** */
private void executeModelTest(Function<String, Void> code) throws IOException {
Path mdlPath = Files.createTempFile(null, null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/test/java/org/apache/ignite/ml/multiclass/OneVsRestTrainerTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/multiclass/OneVsRestTrainerTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/multiclass/OneVsRestTrainerTest.java
index 9842d92..61f9fc4 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/multiclass/OneVsRestTrainerTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/multiclass/OneVsRestTrainerTest.java
@@ -28,8 +28,8 @@ import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
import org.apache.ignite.ml.nn.UpdatesStrategy;
import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDParameterUpdate;
import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDUpdateCalculator;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionModel;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionSGDTrainer;
+import org.apache.ignite.ml.regressions.logistic.LogisticRegressionModel;
+import org.apache.ignite.ml.regressions.logistic.LogisticRegressionSGDTrainer;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/test/java/org/apache/ignite/ml/pipeline/PipelineMdlTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/pipeline/PipelineMdlTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/pipeline/PipelineMdlTest.java
index e59d515..8445900 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/pipeline/PipelineMdlTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/pipeline/PipelineMdlTest.java
@@ -20,7 +20,7 @@ package org.apache.ignite.ml.pipeline;
import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionModel;
+import org.apache.ignite.ml.regressions.logistic.LogisticRegressionModel;
import org.junit.Test;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/test/java/org/apache/ignite/ml/pipeline/PipelineTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/pipeline/PipelineTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/pipeline/PipelineTest.java
index d517ce6..fec6220 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/pipeline/PipelineTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/pipeline/PipelineTest.java
@@ -29,7 +29,7 @@ import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDParameterUpda
import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDUpdateCalculator;
import org.apache.ignite.ml.preprocessing.minmaxscaling.MinMaxScalerTrainer;
import org.apache.ignite.ml.preprocessing.normalization.NormalizationTrainer;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionSGDTrainer;
+import org.apache.ignite.ml.regressions.logistic.LogisticRegressionSGDTrainer;
import org.junit.Test;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/test/java/org/apache/ignite/ml/regressions/RegressionsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/RegressionsTestSuite.java b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/RegressionsTestSuite.java
index 021b567..2fa69ef 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/RegressionsTestSuite.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/RegressionsTestSuite.java
@@ -20,7 +20,6 @@ package org.apache.ignite.ml.regressions;
import org.apache.ignite.ml.regressions.linear.LinearRegressionLSQRTrainerTest;
import org.apache.ignite.ml.regressions.linear.LinearRegressionModelTest;
import org.apache.ignite.ml.regressions.linear.LinearRegressionSGDTrainerTest;
-import org.apache.ignite.ml.regressions.logistic.LogRegMultiClassTrainerTest;
import org.apache.ignite.ml.regressions.logistic.LogisticRegressionModelTest;
import org.apache.ignite.ml.regressions.logistic.LogisticRegressionSGDTrainerTest;
import org.junit.runner.RunWith;
@@ -35,8 +34,7 @@ import org.junit.runners.Suite;
LinearRegressionLSQRTrainerTest.class,
LinearRegressionSGDTrainerTest.class,
LogisticRegressionModelTest.class,
- LogisticRegressionSGDTrainerTest.class,
- LogRegMultiClassTrainerTest.class
+ LogisticRegressionSGDTrainerTest.class
})
public class RegressionsTestSuite {
// No-op.
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/test/java/org/apache/ignite/ml/regressions/linear/LinearRegressionModelTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/linear/LinearRegressionModelTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/linear/LinearRegressionModelTest.java
index 66871b0..36d0fc7 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/linear/LinearRegressionModelTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/linear/LinearRegressionModelTest.java
@@ -21,8 +21,6 @@ import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.math.exceptions.CardinalityException;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionModel;
-import org.apache.ignite.ml.regressions.logistic.multiclass.LogRegressionMultiClassModel;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
@@ -40,9 +38,9 @@ public class LinearRegressionModelTest {
Vector weights = new DenseVector(new double[]{2.0, 3.0});
LinearRegressionModel mdl = new LinearRegressionModel(weights, 1.0);
- assertTrue(mdl.toString().length() > 0);
- assertTrue(mdl.toString(true).length() > 0);
- assertTrue(mdl.toString(false).length() > 0);
+ assertTrue(!mdl.toString().isEmpty());
+ assertTrue(!mdl.toString(true).isEmpty());
+ assertTrue(!mdl.toString(false).isEmpty());
Vector observation = new DenseVector(new double[]{1.0, 1.0});
TestUtils.assertEquals(1.0 + 2.0 * 1.0 + 3.0 * 1.0, mdl.apply(observation), PRECISION);
@@ -61,21 +59,6 @@ public class LinearRegressionModelTest {
}
/** */
- @Test
- public void testPredictWithMultiClasses() {
- Vector weights1 = new DenseVector(new double[]{10.0, 0.0});
- Vector weights2 = new DenseVector(new double[]{0.0, 10.0});
- Vector weights3 = new DenseVector(new double[]{-1.0, -1.0});
- LogRegressionMultiClassModel mdl = new LogRegressionMultiClassModel();
- mdl.add(1, new LogisticRegressionModel(weights1, 0.0).withRawLabels(true));
- mdl.add(2, new LogisticRegressionModel(weights2, 0.0).withRawLabels(true));
- mdl.add(2, new LogisticRegressionModel(weights3, 0.0).withRawLabels(true));
-
- Vector observation = new DenseVector(new double[]{1.0, 1.0});
- TestUtils.assertEquals( 1.0, mdl.apply(observation), PRECISION);
- }
-
- /** */
@Test(expected = CardinalityException.class)
public void testPredictOnAnObservationWithWrongCardinality() {
Vector weights = new DenseVector(new double[]{2.0, 3.0});
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogRegMultiClassTrainerTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogRegMultiClassTrainerTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogRegMultiClassTrainerTest.java
deleted file mode 100644
index c99bf02..0000000
--- a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogRegMultiClassTrainerTest.java
+++ /dev/null
@@ -1,141 +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.ml.regressions.logistic;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.ignite.ml.TestUtils;
-import org.apache.ignite.ml.common.TrainerTest;
-import org.apache.ignite.ml.math.primitives.vector.Vector;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
-import org.apache.ignite.ml.nn.UpdatesStrategy;
-import org.apache.ignite.ml.optimization.SmoothParametrized;
-import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDParameterUpdate;
-import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDUpdateCalculator;
-import org.apache.ignite.ml.regressions.logistic.multiclass.LogRegressionMultiClassModel;
-import org.apache.ignite.ml.regressions.logistic.multiclass.LogRegressionMultiClassTrainer;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Tests for {@link LogRegressionMultiClassTrainer}.
- */
-public class LogRegMultiClassTrainerTest extends TrainerTest {
- /**
- * Test trainer on 4 sets grouped around of square vertices.
- */
- @Test
- public void testTrainWithTheLinearlySeparableCase() {
- Map<Integer, double[]> cacheMock = new HashMap<>();
-
- for (int i = 0; i < fourSetsInSquareVertices.length; i++)
- cacheMock.put(i, fourSetsInSquareVertices[i]);
-
- final UpdatesStrategy<SmoothParametrized, SimpleGDParameterUpdate> stgy = new UpdatesStrategy<>(
- new SimpleGDUpdateCalculator(0.2),
- SimpleGDParameterUpdate::sumLocal,
- SimpleGDParameterUpdate::avg
- );
-
- LogRegressionMultiClassTrainer<?> trainer = new LogRegressionMultiClassTrainer<>()
- .withUpdatesStgy(stgy)
- .withAmountOfIterations(1000)
- .withAmountOfLocIterations(10)
- .withBatchSize(100)
- .withSeed(123L);
-
- Assert.assertEquals(trainer.getAmountOfIterations(), 1000);
- Assert.assertEquals(trainer.getAmountOfLocIterations(), 10);
- Assert.assertEquals(trainer.getBatchSize(), 100, PRECISION);
- Assert.assertEquals(trainer.seed(), 123L);
- Assert.assertEquals(trainer.getUpdatesStgy(), stgy);
-
- LogRegressionMultiClassModel mdl = trainer.fit(
- cacheMock,
- parts,
- (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
- (k, v) -> v[0]
- );
-
- Assert.assertTrue(mdl.toString().length() > 0);
- Assert.assertTrue(mdl.toString(true).length() > 0);
- Assert.assertTrue(mdl.toString(false).length() > 0);
-
- TestUtils.assertEquals(1, mdl.apply(VectorUtils.of(10, 10)), PRECISION);
- TestUtils.assertEquals(1, mdl.apply(VectorUtils.of(-10, 10)), PRECISION);
- TestUtils.assertEquals(2, mdl.apply(VectorUtils.of(-10, -10)), PRECISION);
- TestUtils.assertEquals(3, mdl.apply(VectorUtils.of(10, -10)), PRECISION);
- }
-
- /** */
- @Test
- public void testUpdate() {
- Map<Integer, double[]> cacheMock = new HashMap<>();
-
- for (int i = 0; i < fourSetsInSquareVertices.length; i++)
- cacheMock.put(i, fourSetsInSquareVertices[i]);
-
- LogRegressionMultiClassTrainer<?> trainer = new LogRegressionMultiClassTrainer<>()
- .withUpdatesStgy(new UpdatesStrategy<>(
- new SimpleGDUpdateCalculator(0.2),
- SimpleGDParameterUpdate::sumLocal,
- SimpleGDParameterUpdate::avg
- ))
- .withAmountOfIterations(1000)
- .withAmountOfLocIterations(10)
- .withBatchSize(100)
- .withSeed(123L);
-
- LogRegressionMultiClassModel originalMdl = trainer.fit(
- cacheMock,
- parts,
- (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
- (k, v) -> v[0]
- );
-
- LogRegressionMultiClassModel updatedOnSameDS = trainer.update(
- originalMdl,
- cacheMock,
- parts,
- (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
- (k, v) -> v[0]
- );
-
- LogRegressionMultiClassModel updatedOnEmptyDS = trainer.update(
- originalMdl,
- new HashMap<Integer, double[]>(),
- parts,
- (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
- (k, v) -> v[0]
- );
-
- List<Vector> vectors = Arrays.asList(
- VectorUtils.of(10, 10),
- VectorUtils.of(-10, 10),
- VectorUtils.of(-10, -10),
- VectorUtils.of(10, -10)
- );
-
- for (Vector vec : vectors) {
- TestUtils.assertEquals(originalMdl.apply(vec), updatedOnSameDS.apply(vec), PRECISION);
- TestUtils.assertEquals(originalMdl.apply(vec), updatedOnEmptyDS.apply(vec), PRECISION);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/098caf44/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionModelTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionModelTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionModelTest.java
index e8aaacd..4fae638 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionModelTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/logistic/LogisticRegressionModelTest.java
@@ -21,7 +21,6 @@ import org.apache.ignite.ml.TestUtils;
import org.apache.ignite.ml.math.exceptions.CardinalityException;
import org.apache.ignite.ml.math.primitives.vector.Vector;
import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
-import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionModel;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
[25/50] [abbrv] ignite git commit: IGNITE-10536 Web Console: Correct
handle error in agent manager service.
Posted by sb...@apache.org.
IGNITE-10536 Web Console: Correct handle error in agent manager service.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/40f47b46
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/40f47b46
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/40f47b46
Branch: refs/heads/ignite-10044
Commit: 40f47b466552270ae74d5f8b860e04d0b46e367e
Parents: d8886a0
Author: Alexander Kalinin <ve...@yandex.ru>
Authored: Wed Dec 5 16:29:58 2018 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Dec 5 16:29:58 2018 +0700
----------------------------------------------------------------------
.../web-console/frontend/app/modules/agent/AgentManager.service.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/40f47b46/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/agent/AgentManager.service.js b/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
index dad625d..ef0d423 100644
--- a/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
+++ b/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
@@ -552,7 +552,7 @@ export default class AgentManager {
if (err instanceof CancellationError)
return;
- return err;
+ throw err;
});
}
[30/50] [abbrv] ignite git commit: IGNITE-8227 implement JUnit test
failure handler for TeamCity. Unused import fix.
Posted by sb...@apache.org.
IGNITE-8227 implement JUnit test failure handler for TeamCity. Unused import fix.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/929fbb5e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/929fbb5e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/929fbb5e
Branch: refs/heads/ignite-10044
Commit: 929fbb5e1abd2c5da172500c46d569369bf431cf
Parents: 098caf4
Author: Dmitriy Pavlov <dp...@apache.org>
Authored: Wed Dec 5 13:07:38 2018 +0300
Committer: Dmitriy Pavlov <dp...@apache.org>
Committed: Wed Dec 5 13:07:38 2018 +0300
----------------------------------------------------------------------
.../org/apache/ignite/testframework/junits/GridAbstractTest.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/929fbb5e/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index c7205a5..1db255c 100755
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -62,7 +62,6 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.events.EventType;
import org.apache.ignite.failure.FailureHandler;
-import org.apache.ignite.failure.NoOpFailureHandler;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;