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/11/29 12:15:57 UTC

[01/50] [abbrv] ignite git commit: IGNITE-9828: Muted tests.

Repository: ignite
Updated Branches:
  refs/heads/ignite-10044 0f71f1358 -> e0657d718


IGNITE-9828: Muted tests.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ae5bfadf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ae5bfadf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ae5bfadf

Branch: refs/heads/ignite-10044
Commit: ae5bfadf09254fd62416c887c1404713582a4571
Parents: 1dea0a4
Author: Igor Seliverstov <gv...@gmail.com>
Authored: Fri Nov 23 17:32:00 2018 +0300
Committer: Igor Seliverstov <gv...@gmail.com>
Committed: Fri Nov 23 17:32:22 2018 +0300

----------------------------------------------------------------------
 .../CacheContinuousQueryAsyncFailoverMvccTxSelfTest.java        | 5 +++++
 .../continuous/CacheContinuousQueryFailoverMvccTxSelfTest.java  | 5 +++++
 2 files changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ae5bfadf/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 334d219..7c15f38 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
@@ -50,4 +50,9 @@ public class CacheContinuousQueryAsyncFailoverMvccTxSelfTest  extends CacheConti
     @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/ae5bfadf/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 76d1689..2d578f2 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
@@ -45,4 +45,9 @@ public class CacheContinuousQueryFailoverMvccTxSelfTest extends CacheContinuousQ
     @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");
+    }
 }
\ No newline at end of file


[15/50] [abbrv] ignite git commit: IGNITE-10184 enable of test after IGNITE-5380 uncomment after fix. - Fixes #5390.

Posted by sb...@apache.org.
IGNITE-10184 enable of test after IGNITE-5380 uncomment after fix. - Fixes #5390.

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/c870500a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c870500a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c870500a

Branch: refs/heads/ignite-10044
Commit: c870500a4144168e31a75046f848cba741dba96d
Parents: 7e1d178
Author: Albert Iskhakov <al...@gmail.com>
Authored: Mon Nov 26 17:28:38 2018 +0300
Committer: Dmitriy Pavlov <dp...@apache.org>
Committed: Mon Nov 26 17:28:38 2018 +0300

----------------------------------------------------------------------
 .../processors/query/SqlSchemaSelfTest.java     | 25 +++++++++++++-------
 1 file changed, 17 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c870500a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSchemaSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSchemaSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSchemaSelfTest.java
index b271d80..dcfffd8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSchemaSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSchemaSelfTest.java
@@ -20,14 +20,18 @@ package org.apache.ignite.internal.processors.query;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
+import java.util.concurrent.Callable;
 import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.CacheException;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.QueryEntity;
 import org.apache.ignite.cache.query.SqlFieldsQuery;
 import org.apache.ignite.cache.query.annotations.QuerySqlField;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
@@ -292,19 +296,24 @@ public class SqlSchemaSelfTest extends GridCommonAbstractTest {
      *
      * @throws Exception If failed.
      */
-    public void _testTypeConflictInPublicSchema() throws Exception {
-        // TODO: IGNITE-5380: uncomment work after fix.
-        fail("Hang for now, need to fix");
-
+    public void testTypeConflictInPublicSchema() throws Exception {
         node.createCache(new CacheConfiguration<PersonKey, Person>()
             .setName(CACHE_PERSON)
             .setIndexedTypes(PersonKey.class, Person.class)
             .setSqlSchema(QueryUtils.DFLT_SCHEMA));
 
-        node.createCache(new CacheConfiguration<PersonKey, Person>()
-            .setName(CACHE_PERSON_2)
-            .setIndexedTypes(PersonKey.class, Person.class)
-            .setSqlSchema(QueryUtils.DFLT_SCHEMA));
+        Throwable th = GridTestUtils.assertThrows(log, (Callable<Void>) () -> {
+            node.createCache(new CacheConfiguration<PersonKey, Person>()
+                .setName(CACHE_PERSON_2)
+                .setIndexedTypes(PersonKey.class, Person.class)
+                .setSqlSchema(QueryUtils.DFLT_SCHEMA));
+
+            return null;
+        }, CacheException.class, null);
+
+        SchemaOperationException e = X.cause(th, SchemaOperationException.class);
+
+        assertEquals(SchemaOperationException.CODE_TABLE_EXISTS, e.code());
     }
 
     /**


[40/50] [abbrv] ignite git commit: IGNITE-10433 Web Console: Fixed "Import models" dialog cleanup on exit logic.

Posted by sb...@apache.org.
IGNITE-10433 Web Console: Fixed "Import models" dialog cleanup on exit logic.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3606b21b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3606b21b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3606b21b

Branch: refs/heads/ignite-10044
Commit: 3606b21bfe0d254864b284571a3f2692d4d4870a
Parents: 8e170d6
Author: Alexander Kalinin <ve...@yandex.ru>
Authored: Wed Nov 28 14:52:14 2018 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Nov 28 14:52:14 2018 +0700

----------------------------------------------------------------------
 .../components/modal-import-models/service.js   | 24 +++++++++++++++-----
 1 file changed, 18 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3606b21b/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 3c0ecbb..e17721db 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,12 +16,18 @@
  */
 
 export default class ModalImportModels {
-    static $inject = ['$modal', 'AgentManager', '$uiRouter'];
-    constructor($modal, AgentManager, $uiRouter) {
-        Object.assign(this, {$modal, AgentManager, $uiRouter});
+    static $inject = ['$modal', '$uiRouter', 'AgentManager'];
+
+    constructor($modal, $uiRouter, AgentManager) {
+        this.$modal = $modal;
+        this.$uiRouter = $uiRouter;
+        this.AgentManager = AgentManager;
     }
+
     _goToDynamicState() {
-        if (this._state) this.$uiRouter.stateRegistry.deregister(this._state);
+        if (this._state)
+            this.$uiRouter.stateRegistry.deregister(this._state);
+
         this._state = this.$uiRouter.stateRegistry.register({
             name: 'importModels',
             parent: this.$uiRouter.stateService.current,
@@ -29,11 +35,15 @@ export default class ModalImportModels {
                 this._open();
             },
             onExit: () => {
+                this.AgentManager.stopWatch();
+
                 this._modal && this._modal.hide();
             }
         });
+
         return this.$uiRouter.stateService.go(this._state, this.$uiRouter.stateService.params);
     }
+
     _open() {
         this._modal = this.$modal({
             template: `
@@ -46,10 +56,12 @@ export default class ModalImportModels {
             controllerAs: '$ctrl',
             show: false
         });
+
         return this.AgentManager.startAgentWatch('Back', this.$uiRouter.globals.current.name)
-        .then(() => this._modal.$promise)
-        .then(() => this._modal.show());
+            .then(() => this._modal.$promise)
+            .then(() => this._modal.show());
     }
+
     open() {
         this._goToDynamicState();
     }


[43/50] [abbrv] ignite git commit: IGNITE-10298 Cover possible deadlock in case of caches start and frequent checkpoints. - Fixes #5517.

Posted by sb...@apache.org.
IGNITE-10298 Cover possible deadlock in case of caches start and frequent checkpoints. - Fixes #5517.

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/fe8c8cc5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fe8c8cc5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fe8c8cc5

Branch: refs/heads/ignite-10044
Commit: fe8c8cc5816872ba58bbd2401698b9e847788ea0
Parents: 2418d87
Author: Pavel Kovalenko <jo...@gmail.com>
Authored: Wed Nov 28 13:32:50 2018 +0300
Committer: Pavel Kovalenko <jo...@gmail.com>
Committed: Wed Nov 28 13:32:50 2018 +0300

----------------------------------------------------------------------
 .../GridCacheDatabaseSharedManager.java         |  20 ++-
 ...PdsCacheStartStopWithFreqCheckpointTest.java | 177 +++++++++++++++++++
 .../ignite/testsuites/IgnitePdsTestSuite2.java  |   3 +
 3 files changed, 198 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/fe8c8cc5/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 9a083f8..eb52ee6 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
@@ -250,6 +250,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     /** Checkpoint thread. Needs to be volatile because it is created in exchange worker. */
     private volatile Checkpointer checkpointer;
 
+    /** Checkpointer thread instance. */
+    private volatile IgniteThread checkpointerThread;
+
     /** For testing only. */
     private volatile boolean checkpointsEnabled = true;
 
@@ -427,6 +430,15 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
 
     /**
      * For test use only.
+     *
+     * @return Checkpointer thread instance.
+     */
+    public IgniteThread checkpointerThread() {
+        return checkpointerThread;
+    }
+
+    /**
+     * For test use only.
      */
     public IgniteInternalFuture<Void> enableCheckpoints(boolean enable) {
         GridFutureAdapter<Void> fut = new GridFutureAdapter<>();
@@ -2014,7 +2026,11 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     @Override public void onStateRestored(AffinityTopologyVersion topVer) throws IgniteCheckedException {
         long time = System.currentTimeMillis();
 
-        new IgniteThread(cctx.igniteInstanceName(), "db-checkpoint-thread", checkpointer).start();
+        IgniteThread cpThread = new IgniteThread(cctx.igniteInstanceName(), "db-checkpoint-thread", checkpointer);
+
+        cpThread.start();
+
+        checkpointerThread = cpThread;
 
         CheckpointProgressSnapshot chp = checkpointer.wakeupForCheckpoint(0, "node started");
 
@@ -4648,7 +4664,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
             pageStore.ensure(grp.groupId(), p);
 
             if (pageStore.pages(grp.groupId(), p) <= 1) {
-                log.info("Partition [id=" + p + ", state=N/A (only file header) ]");
+                log.info("Partition [grp=" + grp.cacheOrGroupName() + ", id=" + p + ", state=N/A (only file header) ]");
 
                 continue;
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe8c8cc5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheStartStopWithFreqCheckpointTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheStartStopWithFreqCheckpointTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheStartStopWithFreqCheckpointTest.java
new file mode 100644
index 0000000..8e00d88
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheStartStopWithFreqCheckpointTest.java
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CacheRebalanceMode;
+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.IgniteFutureTimeoutCheckedException;
+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.junits.common.GridCommonAbstractTest;
+import org.junit.Assert;
+
+/**
+ *
+ */
+public class IgnitePdsCacheStartStopWithFreqCheckpointTest extends GridCommonAbstractTest {
+    /** Caches. */
+    private static final int CACHES = 10;
+
+    /** Cache name. */
+    private static final String CACHE_NAME = "test";
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        cfg.setConsistentId(igniteInstanceName);
+
+        DataStorageConfiguration dsCfg = new DataStorageConfiguration()
+            .setWalMode(WALMode.LOG_ONLY)
+            .setCheckpointFrequency(1000)
+            .setDefaultDataRegionConfiguration(
+                new DataRegionConfiguration()
+                    .setMaxSize(512 * 1024 * 1024)
+                    .setPersistenceEnabled(true)
+            );
+
+        cfg.setDataStorageConfiguration(dsCfg);
+
+        CacheConfiguration[] ccfgs = new CacheConfiguration[CACHES];
+
+        for (int i = 0; i < ccfgs.length; i++)
+            ccfgs[i] = cacheConfiguration(i);
+
+        cfg.setCacheConfiguration(ccfgs);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    private CacheConfiguration cacheConfiguration(int cacheIdx) {
+        return new CacheConfiguration(CACHE_NAME + cacheIdx)
+            .setCacheMode(CacheMode.REPLICATED)
+            .setBackups(0)
+            .setRebalanceMode(CacheRebalanceMode.NONE);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        stopAllGrids();
+
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+
+        cleanPersistenceDir();
+    }
+
+    /**
+     * Test checkpoint deadlock during caches start/stop process and frequent checkpoints is set.
+     *
+     * @throws Exception If failed.
+     */
+    public void testCheckpointDeadlock() throws Exception {
+        IgniteEx crd = startGrid(0);
+
+        crd.cluster().active(true);
+
+        for (int cacheId = 0; cacheId < CACHES; cacheId++) {
+            IgniteCache<Object, Object> cache = crd.getOrCreateCache(CACHE_NAME + cacheId);
+
+            for (int key = 0; key < 4096; key++)
+                cache.put(key, key);
+        }
+
+        forceCheckpoint();
+
+        final AtomicBoolean stopFlag = new AtomicBoolean();
+
+        IgniteInternalFuture<?> cacheStartStopFut = GridTestUtils.runAsync(() -> {
+            while (!stopFlag.get()) {
+                List<String> cacheNames = new ArrayList<>();
+                for (int i = 0; i < CACHES / 2; i++)
+                    cacheNames.add(CACHE_NAME + i);
+
+                try {
+                    // Stop cache without destroy.
+                    crd.context().cache().dynamicDestroyCaches(cacheNames, false, false, false).get();
+                }
+                catch (IgniteCheckedException e) {
+                    throw new IgniteException("Failed to destroy cache", e);
+                }
+
+                List<CacheConfiguration> cachesToStart = new ArrayList<>();
+                for (int i = 0; i < CACHES / 2; i++)
+                    cachesToStart.add(cacheConfiguration(i));
+
+                crd.getOrCreateCaches(cachesToStart);
+            }
+        });
+
+        U.sleep(60_000);
+
+        log.info("Stopping caches start/stop process.");
+
+        stopFlag.set(true);
+
+        try {
+            cacheStartStopFut.get(30, TimeUnit.SECONDS);
+        }
+        catch (IgniteFutureTimeoutCheckedException e) {
+            U.dumpThreads(log);
+
+            log.warning("Caches start/stop future hangs. Interrupting checkpointer...");
+
+            interruptCheckpointer(crd);
+
+            // Should succeed.
+            cacheStartStopFut.get();
+
+            Assert.assertTrue("Checkpoint and exchange is probably in deadlock (see thread dump above for details).", false);
+        }
+    }
+
+    /**
+     * Interrupts checkpoint thread for given node.
+     *
+     * @param node Node.
+     */
+    private void interruptCheckpointer(IgniteEx node) {
+        GridCacheDatabaseSharedManager dbMgr = (GridCacheDatabaseSharedManager) node.context().cache().context().database();
+
+        dbMgr.checkpointerThread().interrupt();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe8c8cc5/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
index c12f515..baaf882 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
@@ -19,6 +19,7 @@ package org.apache.ignite.testsuites;
 
 import junit.framework.TestSuite;
 import org.apache.ignite.internal.processors.cache.persistence.IgniteDataStorageMetricsSelfTest;
+import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsCacheStartStopWithFreqCheckpointTest;
 import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsCorruptedStoreTest;
 import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsExchangeDuringCheckpointTest;
 import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsPageSizesTest;
@@ -117,6 +118,8 @@ public class IgnitePdsTestSuite2 extends TestSuite {
         suite.addTestSuite(IgniteWalFlushFsyncWithDedicatedWorkerSelfTest.class);
 
         suite.addTestSuite(IgniteWalFlushFsyncWithMmapBufferSelfTest.class);
+
+        suite.addTestSuite(IgnitePdsCacheStartStopWithFreqCheckpointTest.class);
     }
 
     /**


[45/50] [abbrv] ignite git commit: IGNITE-9501 Exclude newly joined nodes from exchange latch

Posted by sb...@apache.org.
IGNITE-9501 Exclude newly joined nodes from exchange latch


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/371586ae
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/371586ae
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/371586ae

Branch: refs/heads/ignite-10044
Commit: 371586ae7ceb941ba602a6ac2e8c3a313ab882d5
Parents: 0e34042
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Wed Nov 28 18:57:48 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Nov 28 18:57:48 2018 +0300

----------------------------------------------------------------------
 .../distributed/dht/preloader/latch/ExchangeLatchManager.java      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/371586ae/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/latch/ExchangeLatchManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/latch/ExchangeLatchManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/latch/ExchangeLatchManager.java
index 35c04fb..0308ff4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/latch/ExchangeLatchManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/latch/ExchangeLatchManager.java
@@ -64,7 +64,7 @@ public class ExchangeLatchManager {
      * Exchange latch V2 protocol introduces following optimization:
      * Joining nodes are explicitly excluded from possible latch participants.
      */
-    public static final IgniteProductVersion PROTOCOL_V2_VERSION_SINCE = IgniteProductVersion.fromString("2.7.0");
+    public static final IgniteProductVersion PROTOCOL_V2_VERSION_SINCE = IgniteProductVersion.fromString("2.5.3");
 
     /** Logger. */
     private final IgniteLogger log;


[13/50] [abbrv] ignite git commit: IGNITE-10330: Disk page compression. - Fixes #5200.

Posted by sb...@apache.org.
IGNITE-10330: Disk page compression. - Fixes #5200.

Signed-off-by: Sergi Vladykin <se...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e8eeea37
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e8eeea37
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e8eeea37

Branch: refs/heads/ignite-10044
Commit: e8eeea375584bb31a8a9f60e43c8206cd4753d64
Parents: 9137af7
Author: Sergi Vladykin <se...@gmail.com>
Authored: Mon Nov 26 15:37:58 2018 +0300
Committer: Sergi Vladykin <se...@gmail.com>
Committed: Mon Nov 26 15:37:58 2018 +0300

----------------------------------------------------------------------
 modules/compress/licenses/Snappy-LICENSE.txt    |   29 +
 .../compress/licenses/Snappy-java-LICENSE.txt   |  202 ++
 modules/compress/licenses/Zstd-LICENSE.txt      |   30 +
 modules/compress/licenses/Zstd-jni-LICENSE.txt  |   26 +
 modules/compress/licenses/jnr-ffi-LICENSE.txt   |   25 +
 modules/compress/licenses/jnr-posix-LICENSE.txt | 2486 ++++++++++++++++++
 modules/compress/licenses/lz4-LICENSE.txt       |   11 +
 modules/compress/licenses/lz4-java-LICENSE.txt  |  202 ++
 modules/compress/pom.xml                        |  113 +
 .../compress/CompressionProcessorImpl.java      |  403 +++
 .../compress/NativeFileSystemLinux.java         |  142 +
 .../compress/NativeFileSystemPosix.java         |   54 +
 .../compress/CompressionProcessorTest.java      | 1021 +++++++
 ...DiskPageCompressionIntegrationAsyncTest.java |   30 +
 .../DiskPageCompressionIntegrationTest.java     |  468 ++++
 .../compress/FileSystemUtilsTest.java           |  193 ++
 .../IgnitePdsCompressionTestSuite.java          |   56 +
 .../IgnitePdsCompressionTestSuite2.java         |   38 +
 .../org/apache/ignite/DataStorageMetrics.java   |   18 +
 .../apache/ignite/IgniteSystemProperties.java   |   44 +
 .../configuration/CacheConfiguration.java       |   60 +
 .../configuration/DataStorageConfiguration.java |   16 +-
 .../configuration/DiskPageCompression.java      |   38 +
 .../ignite/internal/GridKernalContext.java      |    6 +
 .../ignite/internal/GridKernalContextImpl.java  |   12 +
 .../ignite/internal/IgniteComponentType.java    |    7 +
 .../apache/ignite/internal/IgniteKernal.java    |    2 +
 .../internal/pagemem/store/PageStore.java       |   34 +-
 .../cache/CacheCompressionManager.java          |   95 +
 .../cache/CacheGroupMetricsMXBeanImpl.java      |   23 +-
 .../processors/cache/GridCacheContext.java      |   13 +
 .../processors/cache/GridCacheProcessor.java    |    3 +
 .../persistence/DataStorageMetricsImpl.java     |   22 +-
 .../persistence/DataStorageMetricsSnapshot.java |   18 +
 .../GridCacheDatabaseSharedManager.java         |   89 +-
 .../cache/persistence/file/AbstractFileIO.java  |    2 +-
 .../cache/persistence/file/AsyncFileIO.java     |   38 +-
 .../cache/persistence/file/EncryptedFileIO.java |   16 +-
 .../cache/persistence/file/FileIO.java          |   19 +
 .../cache/persistence/file/FileIODecorator.java |   17 +-
 .../cache/persistence/file/FilePageStore.java   |   72 +-
 .../persistence/file/FilePageStoreManager.java  |   65 +-
 .../cache/persistence/file/FilePageStoreV2.java |   21 +
 .../persistence/file/RandomAccessFileIO.java    |   35 +
 .../cache/persistence/file/UnzipFileIO.java     |   15 +
 .../persistence/pagemem/PageMemoryImpl.java     |   20 +-
 .../persistence/tree/io/AbstractDataPageIO.java |   79 +-
 .../cache/persistence/tree/io/BPlusIO.java      |   32 +-
 .../persistence/tree/io/CompactablePageIO.java  |   43 +
 .../persistence/tree/io/DataPagePayload.java    |   16 +
 .../cache/persistence/tree/io/PageIO.java       |  103 +-
 .../wal/reader/StandaloneGridKernalContext.java |    6 +
 .../compress/CompressionProcessor.java          |  173 ++
 .../processors/compress/FileSystemUtils.java    |  129 +
 .../processors/compress/NativeFileSystem.java   |   50 +
 .../apache/ignite/internal/util/GridUnsafe.java |    1 +
 .../ignite/internal/util/IgniteUtils.java       |   24 +-
 .../ignite/mxbean/CacheGroupMetricsMXBean.java  |   12 +
 .../ignite/mxbean/DataStorageMetricsMXBean.java |    8 +
 .../IgniteClusterActivateDeactivateTest.java    |    2 +-
 .../cache/persistence/DummyPageIO.java          |   21 +-
 .../IgniteDataStorageMetricsSelfTest.java       |   17 +-
 .../persistence/IgnitePdsDynamicCacheTest.java  |    3 +-
 .../IgnitePdsExchangeDuringCheckpointTest.java  |    1 +
 .../persistence/IgnitePdsPageSizesTest.java     |    8 +
 ...lWalModeChangeDuringRebalancingSelfTest.java |   15 +
 .../db/IgnitePdsCacheRestoreTest.java           |    8 +-
 .../db/IgnitePdsDataRegionMetricsTest.java      |   10 +-
 .../db/IgnitePdsReserveWalSegmentsTest.java     |    2 -
 ...gniteCheckpointDirtyPagesForLowLoadTest.java |    1 -
 ...faultPageSizeBackwardsCompatibilityTest.java |   19 +-
 .../persistence/db/wal/WalCompactionTest.java   |   26 +-
 .../db/wal/WalDeletionArchiveAbstractTest.java  |    1 -
 .../database/IgniteDbAbstractTest.java          |    2 -
 .../loadtests/hashmap/GridCacheTestContext.java |    2 +
 modules/direct-io/pom.xml                       |   17 +-
 .../file/AlignedBuffersDirectFileIO.java        |  112 +-
 .../file/AlignedBuffersDirectFileIOFactory.java |   16 +-
 .../persistence/file/IgniteNativeIoLib.java     |    2 +-
 ...kPageCompressionIntegrationDirectIOTest.java |   31 +
 .../persistence/file/IgniteFileIOTest.java      |   15 +
 .../testsuites/IgnitePdsNativeIoTestSuite2.java |    4 +
 parent/pom.xml                                  |    5 +
 pom.xml                                         |    1 +
 84 files changed, 7208 insertions(+), 158 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/licenses/Snappy-LICENSE.txt
----------------------------------------------------------------------
diff --git a/modules/compress/licenses/Snappy-LICENSE.txt b/modules/compress/licenses/Snappy-LICENSE.txt
new file mode 100644
index 0000000..530d2f2
--- /dev/null
+++ b/modules/compress/licenses/Snappy-LICENSE.txt
@@ -0,0 +1,29 @@
+Copyright 2011, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+    * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/licenses/Snappy-java-LICENSE.txt
----------------------------------------------------------------------
diff --git a/modules/compress/licenses/Snappy-java-LICENSE.txt b/modules/compress/licenses/Snappy-java-LICENSE.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/compress/licenses/Snappy-java-LICENSE.txt
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/licenses/Zstd-LICENSE.txt
----------------------------------------------------------------------
diff --git a/modules/compress/licenses/Zstd-LICENSE.txt b/modules/compress/licenses/Zstd-LICENSE.txt
new file mode 100644
index 0000000..a793a80
--- /dev/null
+++ b/modules/compress/licenses/Zstd-LICENSE.txt
@@ -0,0 +1,30 @@
+BSD License
+
+For Zstandard software
+
+Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+ * Neither the name Facebook nor the names of its contributors may be used to
+   endorse or promote products derived from this software without specific
+   prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/licenses/Zstd-jni-LICENSE.txt
----------------------------------------------------------------------
diff --git a/modules/compress/licenses/Zstd-jni-LICENSE.txt b/modules/compress/licenses/Zstd-jni-LICENSE.txt
new file mode 100644
index 0000000..db1103a
--- /dev/null
+++ b/modules/compress/licenses/Zstd-jni-LICENSE.txt
@@ -0,0 +1,26 @@
+Zstd-jni: JNI bindings to Zstd Library
+
+Copyright (c) 2015-2018, Luben Karavelov/ All rights reserved.
+
+BSD License
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/licenses/jnr-ffi-LICENSE.txt
----------------------------------------------------------------------
diff --git a/modules/compress/licenses/jnr-ffi-LICENSE.txt b/modules/compress/licenses/jnr-ffi-LICENSE.txt
new file mode 100644
index 0000000..a3a8343
--- /dev/null
+++ b/modules/compress/licenses/jnr-ffi-LICENSE.txt
@@ -0,0 +1,25 @@
+  Licensed 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.
+
+
+  Alternatively, you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  This code is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+  version 3 for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  version 3 along with this work.  If not, see <http://www.gnu.org/licenses/>.


[31/50] [abbrv] ignite git commit: IGNITE-7072: IgniteCache.replace(k, v, nv) fix for binary mode

Posted by sb...@apache.org.
IGNITE-7072: IgniteCache.replace(k, v, nv) fix for binary mode


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/23de7435
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/23de7435
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/23de7435

Branch: refs/heads/ignite-10044
Commit: 23de74357483aa2979b54ea4e54254ef0d2f3637
Parents: 882b5a4
Author: Igor Sapego <is...@apache.org>
Authored: Tue Nov 27 19:26:26 2018 +0300
Committer: Igor Sapego <is...@apache.org>
Committed: Tue Nov 27 19:28:01 2018 +0300

----------------------------------------------------------------------
 .../cache/CacheEntryPredicateContainsValue.java |  4 ++
 .../GridCacheBinaryObjectsAbstractSelfTest.java | 58 ++++++++++++++++++++
 2 files changed, 62 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/23de7435/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateContainsValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateContainsValue.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateContainsValue.java
index 73a98b7..ad9861c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateContainsValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateContainsValue.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache;
 
 import java.nio.ByteBuffer;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.CU;
@@ -60,6 +61,9 @@ public class CacheEntryPredicateContainsValue extends CacheEntryPredicateAdapter
 
         GridCacheContext cctx = e.context();
 
+        if (this.val instanceof BinaryObject && val instanceof BinaryObject)
+            return F.eq(val, this.val);
+
         Object thisVal = CU.value(this.val, cctx, false);
         Object cacheVal = CU.value(val, cctx, false);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/23de7435/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
index 00a3181..98e906f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
@@ -290,6 +290,64 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
     /**
      * @throws Exception If failed.
      */
+    public void testReplace() throws Exception {
+        IgniteCache<Integer, TestObject> c = jcache(0);
+
+        for (int i = 0; i < ENTRY_CNT; i++)
+            c.put(i, new TestObject(i));
+
+        for (int i = 0; i < ENTRY_CNT; i++) {
+            TestObject obj = c.get(i);
+
+            assertEquals(i, obj.val);
+        }
+
+        IgniteCache<Integer, BinaryObject> kpc = keepBinaryCache();
+
+        BinaryObjectBuilder bldr = grid(0).binary().builder(TestObject.class.getName());
+
+        bldr.setField("val", -42);
+
+        BinaryObject testObj = bldr.build();
+
+        for (int i = 0; i < ENTRY_CNT; i++) {
+            BinaryObject po = kpc.get(i);
+
+            assertEquals(i, (int)po.field("val"));
+
+            assertTrue(kpc.replace(i, po, testObj));
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testRemove() throws Exception {
+        IgniteCache<Integer, TestObject> c = jcache(0);
+
+        for (int i = 0; i < ENTRY_CNT; i++)
+            c.put(i, new TestObject(i));
+
+        for (int i = 0; i < ENTRY_CNT; i++) {
+            TestObject obj = c.get(i);
+
+            assertEquals(i, obj.val);
+        }
+
+        IgniteCache<Integer, BinaryObject> kpc = keepBinaryCache();
+
+        for (int i = 0; i < ENTRY_CNT; i++) {
+            BinaryObject po = kpc.get(i);
+
+            assertEquals(i, (int)po.field("val"));
+
+            assertTrue(kpc.remove(i, po));
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testIterator() throws Exception {
         IgniteCache<Integer, TestObject> c = jcache(0);
 


[17/50] [abbrv] ignite git commit: IGNITE-10358: Added collections data type specification for python thin client

Posted by sb...@apache.org.
IGNITE-10358: Added collections data type specification for python thin client

This closes #5470


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/04fae6d2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/04fae6d2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/04fae6d2

Branch: refs/heads/ignite-10044
Commit: 04fae6d2cbbd83b15a43cf17da9011c0eccec41b
Parents: acc1024
Author: Dmitry Melnichuk <dm...@nobitlost.com>
Authored: Mon Nov 26 17:14:59 2018 +0300
Committer: Igor Sapego <is...@apache.org>
Committed: Mon Nov 26 17:34:19 2018 +0300

----------------------------------------------------------------------
 .../docs/source/pyignite.datatypes.base.rst     |  7 ++
 .../python/docs/source/pyignite.datatypes.rst   |  1 +
 .../platforms/python/pyignite/datatypes/base.py | 24 +++++++
 .../python/pyignite/datatypes/complex.py        | 23 +++---
 .../python/pyignite/datatypes/internal.py       | 19 +++--
 .../python/pyignite/datatypes/null_object.py    |  3 +-
 .../python/pyignite/datatypes/primitive.py      |  3 +-
 .../pyignite/datatypes/primitive_arrays.py      |  3 +-
 .../pyignite/datatypes/primitive_objects.py     |  3 +-
 .../python/pyignite/datatypes/standard.py       |  9 +--
 modules/platforms/python/pyignite/utils.py      |  6 +-
 modules/platforms/python/setup.py               |  2 +-
 .../platforms/python/tests/test_key_value.py    | 75 +++++++++++++++++++-
 13 files changed, 149 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/04fae6d2/modules/platforms/python/docs/source/pyignite.datatypes.base.rst
----------------------------------------------------------------------
diff --git a/modules/platforms/python/docs/source/pyignite.datatypes.base.rst b/modules/platforms/python/docs/source/pyignite.datatypes.base.rst
new file mode 100644
index 0000000..849a028
--- /dev/null
+++ b/modules/platforms/python/docs/source/pyignite.datatypes.base.rst
@@ -0,0 +1,7 @@
+pyignite.datatypes.base module
+==============================
+
+.. automodule:: pyignite.datatypes.base
+    :members:
+    :undoc-members:
+    :show-inheritance:

http://git-wip-us.apache.org/repos/asf/ignite/blob/04fae6d2/modules/platforms/python/docs/source/pyignite.datatypes.rst
----------------------------------------------------------------------
diff --git a/modules/platforms/python/docs/source/pyignite.datatypes.rst b/modules/platforms/python/docs/source/pyignite.datatypes.rst
index 77e7183..d72f844 100644
--- a/modules/platforms/python/docs/source/pyignite.datatypes.rst
+++ b/modules/platforms/python/docs/source/pyignite.datatypes.rst
@@ -11,6 +11,7 @@ Submodules
 
 .. toctree::
 
+   pyignite.datatypes.base
    pyignite.datatypes.binary
    pyignite.datatypes.cache_config
    pyignite.datatypes.cache_properties

http://git-wip-us.apache.org/repos/asf/ignite/blob/04fae6d2/modules/platforms/python/pyignite/datatypes/base.py
----------------------------------------------------------------------
diff --git a/modules/platforms/python/pyignite/datatypes/base.py b/modules/platforms/python/pyignite/datatypes/base.py
new file mode 100644
index 0000000..a0522c0
--- /dev/null
+++ b/modules/platforms/python/pyignite/datatypes/base.py
@@ -0,0 +1,24 @@
+# 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.
+
+from abc import ABC
+
+
+class IgniteDataType(ABC):
+    """
+    This is a base class for all Ignite data types, a.k.a. parser/constructor
+    classes, both object and payload varieties.
+    """
+    pass

http://git-wip-us.apache.org/repos/asf/ignite/blob/04fae6d2/modules/platforms/python/pyignite/datatypes/complex.py
----------------------------------------------------------------------
diff --git a/modules/platforms/python/pyignite/datatypes/complex.py b/modules/platforms/python/pyignite/datatypes/complex.py
index 9a5664c..87e5130 100644
--- a/modules/platforms/python/pyignite/datatypes/complex.py
+++ b/modules/platforms/python/pyignite/datatypes/complex.py
@@ -20,7 +20,8 @@ import inspect
 from pyignite.constants import *
 from pyignite.exceptions import ParseError
 from pyignite.utils import entity_id, hashcode, is_hinted
-from .internal import AnyDataObject
+from .base import IgniteDataType
+from .internal import AnyDataObject, infer_from_python
 from .type_codes import *
 
 
@@ -30,7 +31,7 @@ __all__ = [
 ]
 
 
-class ObjectArrayObject:
+class ObjectArrayObject(IgniteDataType):
     """
     Array of objects of any type. Its Python representation is
     tuple(type_id, iterable of any type).
@@ -106,11 +107,11 @@ class ObjectArrayObject:
         buffer = bytes(header)
 
         for x in value:
-            buffer += AnyDataObject.from_python(x)
+            buffer += infer_from_python(x)
         return buffer
 
 
-class WrappedDataObject:
+class WrappedDataObject(IgniteDataType):
     """
     One or more binary objects can be wrapped in an array. This allows reading,
     storing, passing and writing objects efficiently without understanding
@@ -195,7 +196,7 @@ class CollectionObject(ObjectArrayObject):
         )
 
 
-class Map:
+class Map(IgniteDataType):
     """
     Dictionary type, payload-only.
 
@@ -273,14 +274,8 @@ class Map:
         buffer = bytes(header)
 
         for k, v in value.items():
-            if is_hinted(k):
-                buffer += k[1].from_python(k[0])
-            else:
-                buffer += AnyDataObject.from_python(k)
-            if is_hinted(v):
-                buffer += v[1].from_python(v[0])
-            else:
-                buffer += AnyDataObject.from_python(v)
+            buffer += infer_from_python(k)
+            buffer += infer_from_python(v)
         return buffer
 
 
@@ -323,7 +318,7 @@ class MapObject(Map):
         return super().from_python(value, type_id)
 
 
-class BinaryObject:
+class BinaryObject(IgniteDataType):
     type_code = TC_COMPLEX_OBJECT
 
     USER_TYPE = 0x0001

http://git-wip-us.apache.org/repos/asf/ignite/blob/04fae6d2/modules/platforms/python/pyignite/datatypes/internal.py
----------------------------------------------------------------------
diff --git a/modules/platforms/python/pyignite/datatypes/internal.py b/modules/platforms/python/pyignite/datatypes/internal.py
index a363a5f..844e0ef 100644
--- a/modules/platforms/python/pyignite/datatypes/internal.py
+++ b/modules/platforms/python/pyignite/datatypes/internal.py
@@ -389,6 +389,20 @@ class AnyDataObject:
         return cls.map_python_type(value).from_python(value)
 
 
+def infer_from_python(value: Any):
+    """
+    Convert pythonic value to ctypes buffer, type hint-aware.
+
+    :param value: pythonic value or (value, type_hint) tuple,
+    :return: bytes.
+    """
+    if is_hinted(value):
+        value, data_type = value
+    else:
+        data_type = AnyDataObject
+    return data_type.from_python(value)
+
+
 @attr.s
 class AnyDataArray(AnyDataObject):
     """
@@ -454,8 +468,5 @@ class AnyDataArray(AnyDataObject):
         buffer = bytes(header)
 
         for x in value:
-            if is_hinted(x):
-                buffer += x[1].from_python(x[0])
-            else:
-                buffer += super().from_python(x)
+            buffer += infer_from_python(x)
         return buffer

http://git-wip-us.apache.org/repos/asf/ignite/blob/04fae6d2/modules/platforms/python/pyignite/datatypes/null_object.py
----------------------------------------------------------------------
diff --git a/modules/platforms/python/pyignite/datatypes/null_object.py b/modules/platforms/python/pyignite/datatypes/null_object.py
index 9fa1e8f..a648e30 100644
--- a/modules/platforms/python/pyignite/datatypes/null_object.py
+++ b/modules/platforms/python/pyignite/datatypes/null_object.py
@@ -21,13 +21,14 @@ There can't be null type, because null payload takes exactly 0 bytes.
 
 import ctypes
 
+from .base import IgniteDataType
 from .type_codes import TC_NULL
 
 
 __all__ = ['Null']
 
 
-class Null:
+class Null(IgniteDataType):
     default = None
     pythonic = type(None)
     _object_c_type = None

http://git-wip-us.apache.org/repos/asf/ignite/blob/04fae6d2/modules/platforms/python/pyignite/datatypes/primitive.py
----------------------------------------------------------------------
diff --git a/modules/platforms/python/pyignite/datatypes/primitive.py b/modules/platforms/python/pyignite/datatypes/primitive.py
index 94c8fe3..d1e9f4e 100644
--- a/modules/platforms/python/pyignite/datatypes/primitive.py
+++ b/modules/platforms/python/pyignite/datatypes/primitive.py
@@ -16,6 +16,7 @@
 import ctypes
 
 from pyignite.constants import *
+from .base import IgniteDataType
 
 
 __all__ = [
@@ -24,7 +25,7 @@ __all__ = [
 ]
 
 
-class Primitive:
+class Primitive(IgniteDataType):
     """
     Ignite primitive type. Base type for the following types:
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/04fae6d2/modules/platforms/python/pyignite/datatypes/primitive_arrays.py
----------------------------------------------------------------------
diff --git a/modules/platforms/python/pyignite/datatypes/primitive_arrays.py b/modules/platforms/python/pyignite/datatypes/primitive_arrays.py
index 83a2b4c..6a93191 100644
--- a/modules/platforms/python/pyignite/datatypes/primitive_arrays.py
+++ b/modules/platforms/python/pyignite/datatypes/primitive_arrays.py
@@ -16,6 +16,7 @@
 import ctypes
 
 from pyignite.constants import *
+from .base import IgniteDataType
 from .primitive import *
 from .type_codes import *
 
@@ -28,7 +29,7 @@ __all__ = [
 ]
 
 
-class PrimitiveArray:
+class PrimitiveArray(IgniteDataType):
     """
     Base class for array of primitives. Payload-only.
     """

http://git-wip-us.apache.org/repos/asf/ignite/blob/04fae6d2/modules/platforms/python/pyignite/datatypes/primitive_objects.py
----------------------------------------------------------------------
diff --git a/modules/platforms/python/pyignite/datatypes/primitive_objects.py b/modules/platforms/python/pyignite/datatypes/primitive_objects.py
index 4e37ce1..105acee 100644
--- a/modules/platforms/python/pyignite/datatypes/primitive_objects.py
+++ b/modules/platforms/python/pyignite/datatypes/primitive_objects.py
@@ -16,6 +16,7 @@
 import ctypes
 
 from pyignite.constants import *
+from .base import IgniteDataType
 from .type_codes import *
 
 
@@ -25,7 +26,7 @@ __all__ = [
 ]
 
 
-class DataObject:
+class DataObject(IgniteDataType):
     """
     Base class for primitive data objects.
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/04fae6d2/modules/platforms/python/pyignite/datatypes/standard.py
----------------------------------------------------------------------
diff --git a/modules/platforms/python/pyignite/datatypes/standard.py b/modules/platforms/python/pyignite/datatypes/standard.py
index 5f3af74..cc5b955 100644
--- a/modules/platforms/python/pyignite/datatypes/standard.py
+++ b/modules/platforms/python/pyignite/datatypes/standard.py
@@ -20,6 +20,7 @@ from math import ceil
 import uuid
 
 from pyignite.constants import *
+from .base import IgniteDataType
 from .type_codes import *
 from .null_object import Null
 
@@ -39,7 +40,7 @@ __all__ = [
 ]
 
 
-class StandardObject:
+class StandardObject(IgniteDataType):
     type_code = None
 
     @classmethod
@@ -58,7 +59,7 @@ class StandardObject:
         return c_type, buffer
 
 
-class String:
+class String(IgniteDataType):
     """
     Pascal-style string: `c_int` counter, followed by count*bytes.
     UTF-8-encoded, so that one character may take 1 to 4 bytes.
@@ -125,7 +126,7 @@ class String:
         return bytes(data_object)
 
 
-class DecimalObject:
+class DecimalObject(IgniteDataType):
     type_code = TC_DECIMAL
     pythonic = decimal.Decimal
     default = decimal.Decimal('0.00')
@@ -511,7 +512,7 @@ class BinaryEnumObject(EnumObject):
     type_code = TC_BINARY_ENUM
 
 
-class StandardArray:
+class StandardArray(IgniteDataType):
     """
     Base class for array of primitives. Payload-only.
     """

http://git-wip-us.apache.org/repos/asf/ignite/blob/04fae6d2/modules/platforms/python/pyignite/utils.py
----------------------------------------------------------------------
diff --git a/modules/platforms/python/pyignite/utils.py b/modules/platforms/python/pyignite/utils.py
index a08bc9b..1d4298e 100644
--- a/modules/platforms/python/pyignite/utils.py
+++ b/modules/platforms/python/pyignite/utils.py
@@ -16,6 +16,7 @@
 from functools import wraps
 from typing import Any, Type, Union
 
+from pyignite.datatypes.base import IgniteDataType
 from .constants import *
 
 
@@ -47,11 +48,14 @@ def is_hinted(value):
     return (
         isinstance(value, tuple)
         and len(value) == 2
-        and isinstance(value[1], object)
+        and issubclass(value[1], IgniteDataType)
     )
 
 
 def is_wrapped(value: Any) -> bool:
+    """
+    Check if a value is of WrappedDataObject type.
+    """
     return (
         type(value) is tuple
         and len(value) == 2

http://git-wip-us.apache.org/repos/asf/ignite/blob/04fae6d2/modules/platforms/python/setup.py
----------------------------------------------------------------------
diff --git a/modules/platforms/python/setup.py b/modules/platforms/python/setup.py
index 7419c97..583eaa3 100644
--- a/modules/platforms/python/setup.py
+++ b/modules/platforms/python/setup.py
@@ -70,7 +70,7 @@ with open('README.md', 'r', encoding='utf-8') as readme_file:
 
 setuptools.setup(
     name='pyignite',
-    version='0.3.1',
+    version='0.3.4',
     python_requires='>={}.{}'.format(*PYTHON_REQUIRED),
     author='Dmitry Melnichuk',
     author_email='dmitry.melnichuk@nobitlost.com',

http://git-wip-us.apache.org/repos/asf/ignite/blob/04fae6d2/modules/platforms/python/tests/test_key_value.py
----------------------------------------------------------------------
diff --git a/modules/platforms/python/tests/test_key_value.py b/modules/platforms/python/tests/test_key_value.py
index c569c77..6b4fb0e 100644
--- a/modules/platforms/python/tests/test_key_value.py
+++ b/modules/platforms/python/tests/test_key_value.py
@@ -13,8 +13,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from datetime import datetime
+
 from pyignite.api import *
-from pyignite.datatypes import IntObject
+from pyignite.datatypes import (
+    CollectionObject, IntObject, MapObject, TimestampObject,
+)
 
 
 def test_put_get(client, cache):
@@ -325,3 +329,72 @@ def test_cache_get_size(client, cache):
     result = cache_get_size(client, cache)
     assert result.status == 0
     assert result.value == 1
+
+
+def test_put_get_collection(client):
+
+    test_datetime = datetime(year=1996, month=3, day=1)
+
+    cache = client.get_or_create_cache('test_coll_cache')
+    cache.put(
+        'simple',
+        (
+            1,
+            [
+                (123, IntObject),
+                678,
+                None,
+                55.2,
+                ((test_datetime, 0), TimestampObject),
+            ]
+        ),
+        value_hint=CollectionObject
+    )
+    value = cache.get('simple')
+    assert value == (1, [123, 678, None, 55.2, (test_datetime, 0)])
+
+    cache.put(
+        'nested',
+        (
+            1,
+            [
+                123,
+                ((1, [456, 'inner_test_string', 789]), CollectionObject),
+                'outer_test_string',
+            ]
+        ),
+        value_hint=CollectionObject
+    )
+    value = cache.get('nested')
+    assert value == (
+        1,
+        [
+            123,
+            (1, [456, 'inner_test_string', 789]),
+            'outer_test_string'
+        ]
+    )
+
+
+def test_put_get_map(client):
+
+    cache = client.get_or_create_cache('test_map_cache')
+
+    cache.put(
+        'test_map',
+        (
+            MapObject.HASH_MAP,
+            {
+                (123, IntObject): 'test_data',
+                456: ((1, [456, 'inner_test_string', 789]), CollectionObject),
+                'test_key': 32.4,
+            }
+        ),
+        value_hint=MapObject
+    )
+    value = cache.get('test_map')
+    assert value == (MapObject.HASH_MAP, {
+        123: 'test_data',
+        456: (1, [456, 'inner_test_string', 789]),
+        'test_key': 32.4,
+    })


[21/50] [abbrv] ignite git commit: IGNITE-10393: MVCC: Fixed streamer with persistence on. This closes #5497.

Posted by sb...@apache.org.
IGNITE-10393: MVCC: Fixed streamer with persistence on. This closes #5497.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c63a60a3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c63a60a3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c63a60a3

Branch: refs/heads/ignite-10044
Commit: c63a60a39d4131861c98a84440ecb8c67b10ba25
Parents: 25c41fa
Author: Igor Seliverstov <gv...@gmail.com>
Authored: Tue Nov 27 10:31:01 2018 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Nov 27 10:31:01 2018 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheMapEntry.java     |  2 +-
 .../persistence/pagemem/PageMemoryImpl.java     |  2 +-
 ...aStreamProcessorMvccPersistenceSelfTest.java | 28 +++++++++
 .../DataStreamProcessorPersistenceSelfTest.java | 28 +++++++++
 .../DataStreamProcessorSelfTest.java            | 63 +++++++++++++++++++-
 .../testsuites/IgniteBinaryCacheTestSuite.java  |  2 +
 .../testsuites/IgniteCacheMvccTestSuite.java    |  2 +
 .../ignite/testsuites/IgniteCacheTestSuite.java |  2 +
 8 files changed, 126 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c63a60a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 5f4f974..bbdff35 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -3478,7 +3478,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
                             expireTime,
                             partition(),
                             updateCntr,
-                            mvccVer
+                            mvccVer == null ? MvccUtils.INITIAL_VERSION : mvccVer
                         )));
                     } else {
                         cctx.shared().wal().log(new DataRecord(new DataEntry(

http://git-wip-us.apache.org/repos/asf/ignite/blob/c63a60a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
index f6aa059..c4b0104 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
@@ -53,7 +53,6 @@ import org.apache.ignite.internal.pagemem.PageIdUtils;
 import org.apache.ignite.internal.pagemem.PageUtils;
 import org.apache.ignite.internal.pagemem.store.IgnitePageStoreManager;
 import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
-import org.apache.ignite.internal.processors.cache.persistence.StorageException;
 import org.apache.ignite.internal.pagemem.wal.WALIterator;
 import org.apache.ignite.internal.pagemem.wal.WALPointer;
 import org.apache.ignite.internal.pagemem.wal.record.CheckpointRecord;
@@ -65,6 +64,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.persistence.CheckpointLockStateChecker;
 import org.apache.ignite.internal.processors.cache.persistence.CheckpointWriteProgressSupplier;
 import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.StorageException;
 import org.apache.ignite.internal.processors.cache.persistence.freelist.io.PagesListMetaIO;
 import org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId;
 import org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO;

http://git-wip-us.apache.org/repos/asf/ignite/blob/c63a60a3/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorMvccPersistenceSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorMvccPersistenceSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorMvccPersistenceSelfTest.java
new file mode 100644
index 0000000..9360cab
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorMvccPersistenceSelfTest.java
@@ -0,0 +1,28 @@
+/*
+ * 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.datastreamer;
+
+/**
+ *
+ */
+public class DataStreamProcessorMvccPersistenceSelfTest extends DataStreamProcessorMvccSelfTest {
+    /** {@inheritDoc} */
+    @Override public boolean persistenceEnabled() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c63a60a3/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorPersistenceSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorPersistenceSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorPersistenceSelfTest.java
new file mode 100644
index 0000000..7ce4fdd
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorPersistenceSelfTest.java
@@ -0,0 +1,28 @@
+/*
+ * 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.datastreamer;
+
+/**
+ *
+ */
+public class DataStreamProcessorPersistenceSelfTest extends DataStreamProcessorSelfTest {
+    /** {@inheritDoc} */
+    @Override public boolean persistenceEnabled() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c63a60a3/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
index 877df2e..39f43e3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
@@ -42,9 +42,12 @@ import org.apache.ignite.cache.store.CacheStore;
 import org.apache.ignite.cache.store.CacheStoreAdapter;
 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.IgniteReflectionFactory;
 import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.configuration.WALMode;
 import org.apache.ignite.events.Event;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteKernal;
@@ -52,6 +55,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+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.IgniteClosure;
@@ -97,6 +101,13 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
     /** */
     private TestStore store;
 
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        if (persistenceEnabled())
+            cleanPersistenceDir();
+    }
+
     /** {@inheritDoc} */
     @Override public void afterTest() throws Exception {
         super.afterTest();
@@ -104,6 +115,13 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
         useCache = false;
     }
 
+    /**
+     * @return {@code True} if persistent store is enabled for test.
+     */
+    public boolean persistenceEnabled() {
+        return false;
+    }
+
     /** {@inheritDoc} */
     @SuppressWarnings({"unchecked"})
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
@@ -141,6 +159,12 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
             }
 
             cfg.setCacheConfiguration(cc);
+
+            if (persistenceEnabled())
+                cfg.setDataStorageConfiguration(new DataStorageConfiguration()
+                    .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+                            .setPersistenceEnabled(true))
+                    .setWalMode(WALMode.LOG_ONLY));
         }
         else {
             cfg.setCacheConfiguration();
@@ -225,6 +249,8 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
 
             Ignite igniteWithoutCache = startGrid(1);
 
+            afterGridStarted();
+
             final IgniteDataStreamer<Integer, Integer> ldr = igniteWithoutCache.dataStreamer(DEFAULT_CACHE_NAME);
 
             ldr.receiver(DataStreamerCacheUpdaters.<Integer, Integer>batchedSorted());
@@ -337,7 +363,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
             startGrid(1);
             startGrid(2);
 
-            awaitPartitionMapExchange();
+            afterGridStarted();
 
             IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
@@ -422,6 +448,8 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
             Ignite g1 = startGrid(1);
             startGrid(2); // Reproduced only for several nodes in topology (if marshalling is used).
 
+            afterGridStarted();
+
             List<Object> arrays = Arrays.<Object>asList(
                 new byte[] {1}, new boolean[] {true, false}, new char[] {2, 3}, new short[] {3, 4},
                 new int[] {4, 5}, new long[] {5, 6}, new float[] {6, 7}, new double[] {7, 8});
@@ -485,6 +513,8 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
 
             Ignite g1 = grid(idx - 1);
 
+            afterGridStarted();
+
             // Get and configure loader.
             final IgniteDataStreamer<Integer, Integer> ldr = g1.dataStreamer(DEFAULT_CACHE_NAME);
 
@@ -589,6 +619,8 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
         try {
             Ignite g1 = startGrid(1);
 
+            afterGridStarted();
+
             IgniteDataStreamer<Object, Object> ldr = g1.dataStreamer(DEFAULT_CACHE_NAME);
 
             ldr.close(false);
@@ -746,6 +778,8 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
         try {
             Ignite g = startGrid();
 
+            afterGridStarted();
+
             final IgniteCache<Integer, Integer> c = g.cache(DEFAULT_CACHE_NAME);
 
             final IgniteDataStreamer<Integer, Integer> ldr = g.dataStreamer(DEFAULT_CACHE_NAME);
@@ -799,6 +833,8 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
         try {
             Ignite g = startGrid();
 
+            afterGridStarted();
+
             IgniteCache<Integer, Integer> c = g.cache(DEFAULT_CACHE_NAME);
 
             IgniteDataStreamer<Integer, Integer> ldr = g.dataStreamer(DEFAULT_CACHE_NAME);
@@ -835,6 +871,8 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
         try {
             Ignite g = startGrid();
 
+            afterGridStarted();
+
             final CountDownLatch latch = new CountDownLatch(9);
 
             g.events().localListen(new IgnitePredicate<Event>() {
@@ -891,6 +929,8 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
             startGrid(2);
             startGrid(3);
 
+            afterGridStarted();
+
             for (int i = 0; i < 1000; i++)
                 storeMap.put(i, i);
 
@@ -940,6 +980,8 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
         }
         finally {
             storeMap = null;
+
+            stopAllGrids();
         }
     }
 
@@ -955,6 +997,8 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
             startGrid(2);
             startGrid(3);
 
+            afterGridStarted();
+
             try (IgniteDataStreamer<String, TestObject> ldr = ignite.dataStreamer(DEFAULT_CACHE_NAME)) {
                 ldr.allowOverwrite(true);
                 ldr.keepBinary(customKeepBinary());
@@ -988,6 +1032,8 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
 
             Ignite ignite = startGrid(1);
 
+            afterGridStarted();
+
             final IgniteCache<String, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             try (IgniteDataStreamer<String, String> ldr = ignite.dataStreamer(DEFAULT_CACHE_NAME)) {
@@ -1034,6 +1080,8 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
 
             Ignite client = startGrid(0);
 
+            afterGridStarted();
+
             final IgniteCache<String, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             try (IgniteDataStreamer<String, String> ldr = client.dataStreamer(DEFAULT_CACHE_NAME)) {
@@ -1100,6 +1148,19 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Activates grid if necessary and wait for partition map exchange.
+     */
+    private void afterGridStarted() throws InterruptedException {
+        G.allGrids().stream()
+            .filter(g -> !g.cluster().node().isClient())
+            .findAny()
+            .filter(g -> !g.cluster().active())
+            .ifPresent(g -> g.cluster().active(true));
+
+        awaitPartitionMapExchange();
+    }
+
+    /**
      *
      */
     @SuppressWarnings("PublicInnerClass")

http://git-wip-us.apache.org/repos/asf/ignite/blob/c63a60a3/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheTestSuite.java
index 170bb33..5cfe534 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheTestSuite.java
@@ -34,6 +34,7 @@ import org.apache.ignite.internal.processors.cache.binary.distributed.dht.GridCa
 import org.apache.ignite.internal.processors.cache.binary.distributed.dht.GridCacheAtomicPartitionedOnlyBinaryMultithreadedSelfTest;
 import org.apache.ignite.internal.processors.cache.binary.distributed.dht.GridCacheBinariesNearPartitionedByteArrayValuesSelfTest;
 import org.apache.ignite.internal.processors.cache.binary.distributed.dht.GridCacheBinariesPartitionedOnlyByteArrayValuesSelfTest;
+import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessorPersistenceSelfTest;
 import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessorSelfTest;
 
 /**
@@ -51,6 +52,7 @@ public class IgniteBinaryCacheTestSuite extends TestSuite {
 
         // Tests below have a special version for Binary Marshaller
         ignoredTests.add(DataStreamProcessorSelfTest.class);
+        ignoredTests.add(DataStreamProcessorPersistenceSelfTest.class);
         ignoredTests.add(GridCacheAffinityRoutingSelfTest.class);
         ignoredTests.add(IgniteCacheAtomicLocalExpiryPolicyTest.class);
         ignoredTests.add(GridCacheEntryMemorySizeSelfTest.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/c63a60a3/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite.java
index d4b837c..930706d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite.java
@@ -38,6 +38,7 @@ import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccTxFailoverTest;
 import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccVacuumTest;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccCachePeekTest;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccUnsupportedTxModesTest;
+import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessorMvccPersistenceSelfTest;
 import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessorMvccSelfTest;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
@@ -59,6 +60,7 @@ public class IgniteCacheMvccTestSuite extends TestSuite {
         suite.addTestSuite(CacheMvccConfigurationValidationTest.class);
 
         suite.addTestSuite(DataStreamProcessorMvccSelfTest.class);
+        suite.addTestSuite(DataStreamProcessorMvccPersistenceSelfTest.class);
         suite.addTestSuite(CacheMvccOperationChecksTest.class);
 
         suite.addTestSuite(CacheMvccRemoteTxOnNearNodeStartTest.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/c63a60a3/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index 52e2ba2..dd03ef3 100755
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -144,6 +144,7 @@ import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCa
 import org.apache.ignite.internal.processors.cache.local.GridCacheLocalTxExceptionSelfTest;
 import org.apache.ignite.internal.processors.cache.query.continuous.CacheEntryProcessorExternalizableFailedTest;
 import org.apache.ignite.internal.processors.cache.query.continuous.CacheEntryProcessorNonSerializableTest;
+import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessorPersistenceSelfTest;
 import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessorSelfTest;
 import org.apache.ignite.internal.processors.datastreamer.DataStreamerClientReconnectAfterClusterRestartTest;
 import org.apache.ignite.internal.processors.datastreamer.DataStreamerImplSelfTest;
@@ -250,6 +251,7 @@ public class IgniteCacheTestSuite extends TestSuite {
         suite.addTestSuite(GridCacheBalancingStoreSelfTest.class);
         suite.addTestSuite(GridCacheAffinityApiSelfTest.class);
         suite.addTestSuite(GridCacheStoreValueBytesSelfTest.class);
+        GridTestUtils.addTestIfNeeded(suite, DataStreamProcessorPersistenceSelfTest.class, ignoredTests);
         GridTestUtils.addTestIfNeeded(suite, DataStreamProcessorSelfTest.class, ignoredTests);
         GridTestUtils.addTestIfNeeded(suite, DataStreamerUpdateAfterLoadTest.class, ignoredTests);
         suite.addTestSuite(DataStreamerMultiThreadedSelfTest.class);


[05/50] [abbrv] ignite git commit: IGNITE-9996: Performance drop final fix.

Posted by sb...@apache.org.
IGNITE-9996: Performance drop final fix.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/475a0a71
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/475a0a71
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/475a0a71

Branch: refs/heads/ignite-10044
Commit: 475a0a71500dc4f638100f3ec0c7f8029db42f4a
Parents: 5c01c41
Author: Nikolay Izhikov <ni...@apache.org>
Authored: Fri Nov 23 21:22:12 2018 +0300
Committer: Nikolay Izhikov <ni...@apache.org>
Committed: Fri Nov 23 21:31:02 2018 +0300

----------------------------------------------------------------------
 .../cache/persistence/pagemem/PageMemoryImpl.java  |  6 +++---
 .../wal/serializer/RecordDataV1Serializer.java     | 17 ++++++++++++++---
 2 files changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/475a0a71/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
index 6f7d2c5..b64b294 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
@@ -228,7 +228,7 @@ public class PageMemoryImpl implements PageMemoryEx {
     private final GridEncryptionManager encMgr;
 
     /** */
-    private final EncryptionSpi encSpi;
+    private final boolean encryptionDisabled;
 
     /** */
     private final IgniteLogger log;
@@ -324,7 +324,7 @@ public class PageMemoryImpl implements PageMemoryEx {
         storeMgr = ctx.pageStore();
         walMgr = ctx.wal();
         encMgr = ctx.kernalContext().encryption();
-        encSpi = ctx.gridConfig().getEncryptionSpi();
+        encryptionDisabled = ctx.gridConfig().getEncryptionSpi() instanceof  NoopEncryptionSpi;
 
         assert storeMgr != null;
         assert walMgr != null;
@@ -973,7 +973,7 @@ public class PageMemoryImpl implements PageMemoryEx {
 
     /** {@inheritDoc} */
     @Override public int realPageSize(int grpId) {
-        if ((encSpi instanceof NoopEncryptionSpi) || encMgr.groupKey(grpId) == null)
+        if (encryptionDisabled || encMgr.groupKey(grpId) == null)
             return pageSize();
 
         return encPageSize;

http://git-wip-us.apache.org/repos/asf/ignite/blob/475a0a71/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV1Serializer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV1Serializer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV1Serializer.java
index ab35f46..84c4074 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV1Serializer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV1Serializer.java
@@ -146,6 +146,9 @@ public class RecordDataV1Serializer implements RecordDataSerializer {
     private final GridEncryptionManager encMgr;
 
     /** */
+    private final boolean encryptionDisabled;
+
+    /** */
     private static final byte ENCRYPTED = 1;
 
     /** */
@@ -162,6 +165,8 @@ public class RecordDataV1Serializer implements RecordDataSerializer {
         this.encSpi = cctx.gridConfig().getEncryptionSpi();
         this.encMgr = cctx.kernalContext().encryption();
 
+        encryptionDisabled = encSpi instanceof NoopEncryptionSpi;
+
         //This happen on offline WAL iteration(we don't have encryption keys available).
         if (encSpi != null)
             this.realPageSize = CU.encryptedPageSize(pageSize, encSpi);
@@ -227,7 +232,7 @@ public class RecordDataV1Serializer implements RecordDataSerializer {
      * @return {@code True} if this record should be encrypted.
      */
     private boolean needEncryption(WALRecord rec) {
-        if (encSpi instanceof NoopEncryptionSpi)
+        if (encryptionDisabled)
             return false;
 
         if (!(rec instanceof WalRecordCacheGroupAware))
@@ -241,7 +246,7 @@ public class RecordDataV1Serializer implements RecordDataSerializer {
      * @return {@code True} if this record should be encrypted.
      */
     private boolean needEncryption(int grpId) {
-        if (encSpi instanceof NoopEncryptionSpi)
+        if (encryptionDisabled)
             return false;
 
         GridEncryptionManager encMgr = cctx.kernalContext().encryption();
@@ -1923,6 +1928,9 @@ public class RecordDataV1Serializer implements RecordDataSerializer {
      * @return Real record type.
      */
     RecordType recordType(WALRecord rec) {
+        if (encryptionDisabled)
+            return rec.type();
+
         if (needEncryption(rec))
             return ENCRYPTED_RECORD;
 
@@ -1937,6 +1945,9 @@ public class RecordDataV1Serializer implements RecordDataSerializer {
      * @return {@code True} if this data record should be encrypted.
      */
     boolean isDataRecordEncrypted(DataRecord rec) {
+        if (encryptionDisabled)
+            return false;
+
         for (DataEntry e : rec.writeEntries()) {
             if (cctx.cacheContext(e.cacheId()) != null && needEncryption(cctx.cacheContext(e.cacheId()).groupId()))
                 return true;
@@ -2014,7 +2025,7 @@ public class RecordDataV1Serializer implements RecordDataSerializer {
         for (DataEntry entry : dataRec.writeEntries()) {
             int clSz = entrySize(entry);
 
-            if (needEncryption(cctx.cacheContext(entry.cacheId()).groupId()))
+            if (!encryptionDisabled && needEncryption(cctx.cacheContext(entry.cacheId()).groupId()))
                 sz += encSpi.encryptedSize(clSz) + 1 /* encrypted flag */ + 4 /* groupId */ + 4 /* data size */;
             else {
                 sz += clSz;


[26/50] [abbrv] ignite git commit: IGNITE-9284: [ML] Add a Standard Scaler

Posted by sb...@apache.org.
IGNITE-9284: [ML] Add a Standard Scaler

this closes #4964


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/41f4225c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/41f4225c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/41f4225c

Branch: refs/heads/ignite-10044
Commit: 41f4225c4b2f2735bce4ce861b9a51afc80d5815
Parents: 46a84fd
Author: Ravil Galeyev <de...@yandex.ru>
Authored: Tue Nov 27 14:05:17 2018 +0300
Committer: Yury Babak <yb...@gridgain.com>
Committed: Tue Nov 27 14:05:17 2018 +0300

----------------------------------------------------------------------
 .../ml/preprocessing/StandardScalerExample.java |  84 +++++++++++++++
 .../standardscaling/StandardScalerData.java     |  56 ++++++++++
 .../StandardScalerPreprocessor.java             |  91 +++++++++++++++++
 .../standardscaling/StandardScalerTrainer.java  | 101 +++++++++++++++++++
 .../standardscaling/package-info.java           |  22 ++++
 .../StandardScalerPreprocessorTest.java         |  59 +++++++++++
 .../StandardScalerTrainerTest.java              |  85 ++++++++++++++++
 7 files changed, 498 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/41f4225c/examples/src/main/java/org/apache/ignite/examples/ml/preprocessing/StandardScalerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/preprocessing/StandardScalerExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/preprocessing/StandardScalerExample.java
new file mode 100644
index 0000000..13d8635
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/preprocessing/StandardScalerExample.java
@@ -0,0 +1,84 @@
+/*
+ * 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.preprocessing;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.examples.ml.dataset.model.Person;
+import org.apache.ignite.examples.ml.util.DatasetHelper;
+import org.apache.ignite.ml.dataset.DatasetFactory;
+import org.apache.ignite.ml.dataset.primitive.SimpleDataset;
+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.preprocessing.standardscaling.StandardScalerTrainer;
+
+/**
+ * Example that shows how to use StandardScaler preprocessor to scale the given data.
+ *
+ * Machine learning preprocessors are built as a chain. Most often the first preprocessor is a feature extractor as
+ * shown in this example. The second preprocessor here is a {@code StandardScaler} preprocessor which is built on top of
+ * the feature extractor and represents a chain of itself and the underlying feature extractor.
+ */
+public class StandardScalerExample {
+    /** Run example. */
+    public static void main(String[] args) throws Exception {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println(">>> Standard scaler example started.");
+
+            IgniteCache<Integer, Person> persons = createCache(ignite);
+
+            // Defines first preprocessor that extracts features from an upstream data.
+            IgniteBiFunction<Integer, Person, Vector> featureExtractor = (k, v) -> VectorUtils.of(
+                v.getAge(),
+                v.getSalary()
+            );
+
+            // Defines second preprocessor that processes features.
+            IgniteBiFunction<Integer, Person, Vector> preprocessor = new StandardScalerTrainer<Integer, Person>()
+                .fit(ignite, persons, featureExtractor);
+
+            // Creates a cache based simple dataset containing features and providing standard dataset API.
+            try (SimpleDataset<?> dataset = DatasetFactory.createSimpleDataset(ignite, persons, preprocessor)) {
+                new DatasetHelper(dataset).describe();
+            }
+
+            System.out.println(">>> Standard scaler example completed.");
+        }
+    }
+
+    /** */
+    private static IgniteCache<Integer, Person> createCache(Ignite ignite) {
+        CacheConfiguration<Integer, Person> cacheConfiguration = new CacheConfiguration<>();
+
+        cacheConfiguration.setName("PERSONS");
+        cacheConfiguration.setAffinity(new RendezvousAffinityFunction(false, 2));
+
+        IgniteCache<Integer, Person> persons = ignite.createCache(cacheConfiguration);
+
+        persons.put(1, new Person("Mike", 42, 10000));
+        persons.put(2, new Person("John", 32, 64000));
+        persons.put(3, new Person("George", 53, 120000));
+        persons.put(4, new Person("Karl", 24, 70000));
+
+        return persons;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/41f4225c/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerData.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerData.java b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerData.java
new file mode 100644
index 0000000..f96dcc5
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerData.java
@@ -0,0 +1,56 @@
+/*
+ * 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.preprocessing.standardscaling;
+
+/** A Service class for {@link StandardScalerTrainer} which used for sums holing. */
+public class StandardScalerData implements AutoCloseable {
+    /** Sum values of every feature. */
+    double[] sum;
+    /** Sum of squared values of every feature. */
+    double[] squaredSum;
+    /** Rows count */
+    long cnt;
+
+    /**
+     * Creates {@code StandardScalerData}.
+     *
+     * @param sum Sum values of every feature.
+     * @param squaredSum Sum of squared values of every feature.
+     * @param cnt Rows count.
+     */
+    public StandardScalerData(double[] sum, double[] squaredSum, long cnt) {
+        this.sum = sum;
+        this.squaredSum = squaredSum;
+        this.cnt = cnt;
+    }
+
+    /** Merges to current. */
+    StandardScalerData merge(StandardScalerData that) {
+        for (int i = 0; i < sum.length; i++) {
+            sum[i] += that.sum[i];
+            squaredSum[i] += that.squaredSum[i];
+        }
+
+        cnt += that.cnt;
+        return this;
+    }
+
+    /** */
+    @Override public void close() {
+        // Do nothing, GC will clean up.
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/41f4225c/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerPreprocessor.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerPreprocessor.java b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerPreprocessor.java
new file mode 100644
index 0000000..293e86a
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerPreprocessor.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.ml.preprocessing.standardscaling;
+
+import org.apache.ignite.ml.math.functions.IgniteBiFunction;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+
+/**
+ * The preprocessing function that makes standard scaling, transforms features to make {@code mean} equal to {@code 0}
+ * and {@code variance} equal to {@code 1}. From mathematical point of view it's the following function which is applied
+ * to every element in a dataset:
+ *
+ * {@code a_i = (a_i - mean_i) / sigma_i for all i},
+ *
+ * where {@code i} is a number of column, {@code mean_i} is the mean value this column and {@code sigma_i} is the
+ * standard deviation in this column.
+ *
+ * @param <K> Type of a key in {@code upstream} data.
+ * @param <V> Type of a value in {@code upstream} data.
+ */
+public class StandardScalerPreprocessor<K, V> implements IgniteBiFunction<K, V, Vector> {
+    /** */
+    private static final long serialVersionUID = -5977957318991608203L;
+
+    /** Means for each column. */
+    private final double[] means;
+    /** Standard deviation for each column. */
+    private final double[] sigmas;
+
+    /** Base preprocessor. */
+    private final IgniteBiFunction<K, V, Vector> basePreprocessor;
+
+    /**
+     * Constructs a new instance of standardscaling preprocessor.
+     *
+     * @param means Means of each column.
+     * @param sigmas Standard deviations in each column.
+     * @param basePreprocessor Base preprocessor.
+     */
+    public StandardScalerPreprocessor(double[] means, double[] sigmas,
+        IgniteBiFunction<K, V, Vector> basePreprocessor) {
+        assert means.length == sigmas.length;
+
+        this.means = means;
+        this.sigmas = sigmas;
+        this.basePreprocessor = basePreprocessor;
+    }
+
+    /**
+     * Applies this preprocessor.
+     *
+     * @param k Key.
+     * @param v Value.
+     * @return Preprocessed row.
+     */
+    @Override public Vector apply(K k, V v) {
+        Vector res = basePreprocessor.apply(k, v);
+
+        assert res.size() == means.length;
+
+        for (int i = 0; i < res.size(); i++)
+            res.set(i, (res.get(i) - means[i]) / sigmas[i]);
+
+        return res;
+    }
+
+    /** */
+    public double[] getMeans() {
+        return means;
+    }
+
+    /** */
+    public double[] getSigmas() {
+        return sigmas;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/41f4225c/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
new file mode 100644
index 0000000..3661772
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerTrainer.java
@@ -0,0 +1,101 @@
+/*
+ * 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.preprocessing.standardscaling;
+
+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.math.functions.IgniteBiFunction;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.preprocessing.PreprocessingTrainer;
+
+/**
+ * Trainer of the standard scaler preprocessor.
+ *
+ * @param <K> Type of a key in {@code upstream} data.
+ * @param <V> Type of a value in {@code upstream} data.
+ */
+public class StandardScalerTrainer<K, V> implements PreprocessingTrainer<K, V, Vector, Vector> {
+    /** {@inheritDoc} */
+    @Override public StandardScalerPreprocessor<K, V> fit(DatasetBuilder<K, V> datasetBuilder,
+        IgniteBiFunction<K, V, Vector> basePreprocessor) {
+        StandardScalerData standardScalerData = computeSum(datasetBuilder, basePreprocessor);
+
+        int n = standardScalerData.sum.length;
+        long cnt = standardScalerData.cnt;
+        double[] mean = new double[n];
+        double[] sigma = new double[n];
+
+        for (int i = 0; i < n; i++) {
+            mean[i] = standardScalerData.sum[i] / cnt;
+            double variace = (standardScalerData.squaredSum[i] - Math.pow(standardScalerData.sum[i], 2) / cnt) / cnt;
+            sigma[i] = Math.sqrt(variace);
+        }
+        return new StandardScalerPreprocessor<>(mean, sigma, basePreprocessor);
+    }
+
+    /** Computes sum, squared sum and row count. */
+    private StandardScalerData computeSum(DatasetBuilder<K, V> datasetBuilder,
+        IgniteBiFunction<K, V, Vector> basePreprocessor) {
+        try (Dataset<EmptyContext, StandardScalerData> dataset = datasetBuilder.build(
+            (upstream, upstreamSize) -> new EmptyContext(),
+            (upstream, upstreamSize, ctx) -> {
+                double[] sum = null;
+                double[] squaredSum = null;
+                long cnt = 0;
+
+                while (upstream.hasNext()) {
+                    UpstreamEntry<K, V> entity = upstream.next();
+                    Vector row = basePreprocessor.apply(entity.getKey(), entity.getValue());
+
+                    if (sum == null) {
+                        sum = new double[row.size()];
+                        squaredSum = new double[row.size()];
+                    }
+                    else {
+                        assert sum.length == row.size() : "Base preprocessor must return exactly " + sum.length
+                            + " features";
+                    }
+
+                    ++cnt;
+                    for (int i = 0; i < row.size(); i++) {
+                        double x = row.get(i);
+                        sum[i] += x;
+                        squaredSum[i] += x * x;
+                    }
+                }
+                return new StandardScalerData(sum, squaredSum, cnt);
+            }
+        )) {
+
+            return dataset.compute(data -> data,
+                (a, b) -> {
+                    if (a == null)
+                        return b;
+                    if (b == null)
+                        return a;
+
+                    return a.merge(b);
+                });
+        }
+        catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/41f4225c/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/package-info.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/package-info.java b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/package-info.java
new file mode 100644
index 0000000..5f5de3b
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/standardscaling/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 Standard scaler preprocessor.
+ */
+package org.apache.ignite.ml.preprocessing.standardscaling;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/41f4225c/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerPreprocessorTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerPreprocessorTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerPreprocessorTest.java
new file mode 100644
index 0000000..3c325b3
--- /dev/null
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerPreprocessorTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.preprocessing.standardscaling;
+
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
+import org.junit.Test;
+
+import static org.junit.Assert.assertArrayEquals;
+
+/**
+ * Tests for {@link StandardScalerPreprocessor}.
+ */
+public class StandardScalerPreprocessorTest {
+
+    /** Test {@code apply()} method. */
+    @Test
+    public void testApply() {
+        double[][] inputData = new double[][] {
+            {0, 2., 4., .1},
+            {0, 1., -18., 2.2},
+            {1, 4., 10., -.1},
+            {1, 0., 22., 1.3}
+        };
+        double[] means = new double[] {0.5, 1.75, 4.5, 0.875};
+        double[] sigmas = new double[] {0.5, 1.47901995, 14.51723114, 0.93374247};
+
+        StandardScalerPreprocessor<Integer, Vector> preprocessor = new StandardScalerPreprocessor<>(
+            means,
+            sigmas,
+            (k, v) -> v
+        );
+
+        double[][] expectedData = new double[][] {
+            {-1., 0.16903085, -0.03444183, -0.82999331},
+            {-1., -0.50709255, -1.54988233, 1.41902081},
+            {1., 1.52127766, 0.37886012, -1.04418513},
+            {1., -1.18321596, 1.20546403, 0.45515762}
+        };
+
+        for (int i = 0; i < inputData.length; i++)
+            assertArrayEquals(expectedData[i], preprocessor.apply(i, VectorUtils.of(inputData[i])).asArray(), 1e-8);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/41f4225c/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
new file mode 100644
index 0000000..679cc48
--- /dev/null
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/preprocessing/standardscaling/StandardScalerTrainerTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.preprocessing.standardscaling;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.ignite.ml.common.TrainerTest;
+import org.apache.ignite.ml.dataset.DatasetBuilder;
+import org.apache.ignite.ml.dataset.impl.local.LocalDatasetBuilder;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertArrayEquals;
+
+/**
+ * Tests for {@link StandardScalerTrainer}.
+ */
+public class StandardScalerTrainerTest extends TrainerTest {
+
+    /** Data. */
+    private DatasetBuilder<Integer, Vector> datasetBuilder;
+
+    /** Trainer to be tested. */
+    private StandardScalerTrainer<Integer, Vector> standardizationTrainer;
+
+    /** */
+    @Before
+    public void prepareDataset() {
+        Map<Integer, Vector> data = new HashMap<>();
+        data.put(1, VectorUtils.of(0, 2., 4., .1));
+        data.put(2, VectorUtils.of(0, 1., -18., 2.2));
+        data.put(3, VectorUtils.of(1, 4., 10., -.1));
+        data.put(4, VectorUtils.of(1, 0., 22., 1.3));
+        datasetBuilder = new LocalDatasetBuilder<>(data, parts);
+    }
+
+    /** */
+    @Before
+    public void createTrainer() {
+        standardizationTrainer = new StandardScalerTrainer<>();
+    }
+
+    /** Test {@code fit()} method. */
+    @Test
+    public void testCalculatesCorrectMeans() {
+        double[] expectedMeans = new double[] {0.5, 1.75, 4.5, 0.875};
+
+        StandardScalerPreprocessor<Integer, Vector> preprocessor = standardizationTrainer.fit(
+            datasetBuilder,
+            (k, v) -> v
+        );
+
+        assertArrayEquals(expectedMeans, preprocessor.getMeans(), 1e-8);
+    }
+
+    /** Test {@code fit()} method. */
+    @Test
+    public void testCalculatesCorrectStandardDeviations() {
+        double[] expectedSigmas = new double[] {0.5, 1.47901995, 14.51723114, 0.93374247};
+
+        StandardScalerPreprocessor<Integer, Vector> preprocessor = standardizationTrainer.fit(
+            datasetBuilder,
+            (k, v) -> v
+        );
+
+        assertArrayEquals(expectedSigmas, preprocessor.getSigmas(), 1e-8);
+    }
+}


[27/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/5f94fca8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5f94fca8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5f94fca8

Branch: refs/heads/ignite-10044
Commit: 5f94fca8ddc3671677871f83b59d89dda8a4dd10
Parents: ca660d3 41f4225
Author: sboikov <sb...@apache.org>
Authored: Tue Nov 27 16:39:10 2018 +0300
Committer: sboikov <sb...@apache.org>
Committed: Tue Nov 27 16:39:10 2018 +0300

----------------------------------------------------------------------
 ...niteFunctionDistributedInferenceExample.java |  100 +
 .../TensorFlowDistributedInferenceExample.java  |   99 +
 .../TensorFlowLocalInferenceExample.java        |   85 +
 .../TensorFlowThreadedInferenceExample.java     |   95 +
 .../examples/ml/inference/package-info.java     |   22 +
 .../ml/preprocessing/StandardScalerExample.java |   84 +
 .../examples/ml/util/MLSandboxDatasets.java     |   16 +-
 .../ignite/examples/ml/util/SandboxMLCache.java |   11 +-
 .../ignite/examples/ml/util/datasets/README.md  |    2 -
 .../ml/util/datasets/boston_housing_dataset.txt |  505 ----
 .../ml/util/datasets/cleared_machines.csv       |  209 --
 .../ml/util/datasets/glass_identification.csv   |  116 -
 .../ignite/examples/ml/util/datasets/iris.txt   |  150 --
 .../examples/ml/util/datasets/mortalitydata.csv |   53 -
 .../examples/ml/util/datasets/titanic.csv       | 1310 ---------
 .../ml/util/datasets/titanic_10_rows.csv        |   11 -
 .../ml/util/datasets/two_classed_iris.csv       |  100 -
 .../ignite/examples/ml/util/datasets/wine.txt   |  178 --
 examples/src/main/resources/datasets/README.md  |    2 +
 .../datasets/boston_housing_dataset.txt         |  505 ++++
 .../resources/datasets/cleared_machines.csv     |  209 ++
 .../resources/datasets/glass_identification.csv |  116 +
 examples/src/main/resources/datasets/iris.txt   |  150 ++
 .../main/resources/datasets/mortalitydata.csv   |   53 +
 .../resources/datasets/t10k-images-idx3-ubyte   |  Bin 0 -> 9876027 bytes
 .../resources/datasets/t10k-labels-idx1-ubyte   |  Bin 0 -> 10008 bytes
 .../src/main/resources/datasets/titanic.csv     | 1310 +++++++++
 .../main/resources/datasets/titanic_10_rows.csv |   11 +
 .../resources/datasets/two_classed_iris.csv     |  100 +
 examples/src/main/resources/datasets/wine.txt   |  178 ++
 .../resources/ml/mnist_tf_model/saved_model.pb  |  Bin 0 -> 37185 bytes
 .../variables/variables.data-00000-of-00001     |  Bin 0 -> 13098544 bytes
 .../ml/mnist_tf_model/variables/variables.index |  Bin 0 -> 410 bytes
 .../ignite/examples/BasicExamplesSelfTest.java  |    6 +
 .../examples/CacheClientBinaryExampleTest.java  |    3 +
 .../CacheContinuousQueryExamplesSelfTest.java   |    4 +
 .../ignite/examples/CacheExamplesSelfTest.java  |    4 +
 .../ComputeClientBinaryExampleTest.java         |    2 +
 .../examples/EncryptedCacheExampleSelfTest.java |    3 +
 .../ignite/examples/EventsExamplesSelfTest.java |    2 +
 .../examples/MessagingExamplesSelfTest.java     |    3 +
 .../examples/SpringDataExampleSelfTest.java     |    2 +
 .../ignite/examples/SqlExamplesSelfTest.java    |    4 +
 .../IgniteExamplesJ8SelfTestSuite.java          |   53 +-
 .../testsuites/IgniteExamplesSelfTestSuite.java |   59 +-
 idea/ignite_inspections.xml                     |    2 +-
 .../jdbc2/JdbcDistributedJoinsQueryTest.java    |    4 -
 ...tingToWalV2SerializerWithCompactionTest.java |    5 -
 .../PersistenceBasicCompatibilityTest.java      |    5 -
 modules/compress/licenses/Snappy-LICENSE.txt    |   29 +
 .../compress/licenses/Snappy-java-LICENSE.txt   |  202 ++
 modules/compress/licenses/Zstd-LICENSE.txt      |   30 +
 modules/compress/licenses/Zstd-jni-LICENSE.txt  |   26 +
 modules/compress/licenses/jnr-ffi-LICENSE.txt   |   25 +
 modules/compress/licenses/jnr-posix-LICENSE.txt | 2486 ++++++++++++++++++
 modules/compress/licenses/lz4-LICENSE.txt       |   11 +
 modules/compress/licenses/lz4-java-LICENSE.txt  |  202 ++
 modules/compress/pom.xml                        |  113 +
 .../compress/CompressionProcessorImpl.java      |  403 +++
 .../compress/NativeFileSystemLinux.java         |  142 +
 .../compress/NativeFileSystemPosix.java         |   54 +
 .../compress/CompressionProcessorTest.java      | 1021 +++++++
 ...DiskPageCompressionIntegrationAsyncTest.java |   30 +
 .../DiskPageCompressionIntegrationTest.java     |  468 ++++
 .../compress/FileSystemUtilsTest.java           |  193 ++
 .../IgnitePdsCompressionTestSuite.java          |   56 +
 .../IgnitePdsCompressionTestSuite2.java         |   38 +
 .../org/apache/ignite/DataStorageMetrics.java   |   18 +
 .../apache/ignite/IgniteSystemProperties.java   |   47 +
 .../cache/affinity/AffinityKeyMapped.java       |    4 +-
 .../configuration/CacheConfiguration.java       |   60 +
 .../configuration/DataStorageConfiguration.java |   16 +-
 .../configuration/DiskPageCompression.java      |   38 +
 .../ignite/internal/GridKernalContext.java      |    6 +
 .../ignite/internal/GridKernalContextImpl.java  |   12 +
 .../ignite/internal/IgniteComponentType.java    |    7 +
 .../apache/ignite/internal/IgniteKernal.java    |    2 +
 .../internal/commandline/CommandHandler.java    |   50 +-
 .../internal/managers/discovery/DiscoCache.java |   15 -
 .../discovery/GridDiscoveryManager.java         |   21 +-
 .../internal/pagemem/store/PageStore.java       |   34 +-
 .../processors/affinity/AffinityAssignment.java |    6 -
 .../affinity/GridAffinityAssignment.java        |   15 +-
 .../affinity/GridAffinityAssignmentCache.java   |   22 +-
 .../affinity/GridAffinityProcessor.java         |    2 +-
 .../processors/affinity/GridAffinityUtils.java  |    2 +-
 .../affinity/HistoryAffinityAssignment.java     |   19 +-
 .../cache/CacheAffinitySharedManager.java       |   13 +-
 .../cache/CacheCompressionManager.java          |   95 +
 .../cache/CacheGroupMetricsMXBeanImpl.java      |   23 +-
 .../processors/cache/ExchangeContext.java       |   43 +-
 .../processors/cache/GridCacheAdapter.java      |   20 +-
 .../cache/GridCacheAffinityManager.java         |    5 -
 .../processors/cache/GridCacheContext.java      |   13 +
 .../processors/cache/GridCacheMapEntry.java     |    8 +-
 .../GridCachePartitionExchangeManager.java      |   12 +-
 .../processors/cache/GridCacheProcessor.java    |    3 +
 .../cache/IgniteCacheOffheapManager.java        |    5 +
 .../cache/IgniteCacheOffheapManagerImpl.java    |   18 +
 .../processors/cache/WalStateManager.java       |   24 +
 .../CacheDataStructuresManager.java             |   15 +-
 .../distributed/dht/GridDhtCacheEntry.java      |    8 +-
 .../dht/GridDhtTxAbstractEnlistFuture.java      |  169 +-
 .../distributed/dht/GridDhtTxEnlistFuture.java  |   13 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java |   23 -
 .../dht/atomic/GridDhtAtomicCache.java          |   30 +-
 .../GridNearAtomicAbstractUpdateFuture.java     |   43 +-
 .../dht/colocated/GridDhtColocatedCache.java    |    6 +-
 .../GridDhtPartitionsExchangeFuture.java        |   79 +-
 .../GridDhtPartitionsSingleMessage.java         |   68 +-
 .../topology/GridClientPartitionTopology.java   |    7 -
 .../dht/topology/GridDhtLocalPartition.java     |   33 +-
 .../dht/topology/GridDhtPartitionTopology.java  |    4 -
 .../topology/GridDhtPartitionTopologyImpl.java  |   17 +-
 ...arOptimisticSerializableTxPrepareFuture.java |   35 +-
 .../near/GridNearOptimisticTxPrepareFuture.java |   39 +-
 ...ridNearOptimisticTxPrepareFutureAdapter.java |  114 -
 .../GridNearPessimisticTxPrepareFuture.java     |   78 +-
 .../near/GridNearTxEnlistFuture.java            |   22 +-
 .../cache/distributed/near/GridNearTxLocal.java |   30 +-
 .../near/GridNearTxPrepareRequest.java          |   17 -
 .../near/GridNearTxPrepareResponse.java         |   52 +-
 .../GridNearTxQueryResultsEnlistFuture.java     |   21 +-
 .../mvcc/MvccPreviousCoordinatorQueries.java    |   13 +-
 .../processors/cache/mvcc/MvccProcessor.java    |   45 +-
 .../cache/mvcc/MvccProcessorImpl.java           |  383 +--
 .../cache/mvcc/MvccQueryTrackerImpl.java        |   12 +-
 .../processors/cache/mvcc/MvccUtils.java        |   48 +-
 .../persistence/DataStorageMetricsImpl.java     |   22 +-
 .../persistence/DataStorageMetricsSnapshot.java |   18 +
 .../GridCacheDatabaseSharedManager.java         |   91 +-
 .../persistence/GridCacheOffheapManager.java    |   14 +
 .../cache/persistence/file/AbstractFileIO.java  |    2 +-
 .../cache/persistence/file/AsyncFileIO.java     |   38 +-
 .../cache/persistence/file/EncryptedFileIO.java |   16 +-
 .../cache/persistence/file/FileIO.java          |   19 +
 .../cache/persistence/file/FileIODecorator.java |   17 +-
 .../cache/persistence/file/FilePageStore.java   |   72 +-
 .../persistence/file/FilePageStoreManager.java  |   65 +-
 .../cache/persistence/file/FilePageStoreV2.java |   21 +
 .../persistence/file/RandomAccessFileIO.java    |   35 +
 .../cache/persistence/file/UnzipFileIO.java     |   15 +
 .../persistence/pagemem/PageMemoryImpl.java     |   29 +-
 .../cache/persistence/tree/BPlusTree.java       |   31 +
 .../persistence/tree/io/AbstractDataPageIO.java |   79 +-
 .../cache/persistence/tree/io/BPlusIO.java      |   32 +-
 .../persistence/tree/io/CompactablePageIO.java  |   43 +
 .../persistence/tree/io/DataPagePayload.java    |   16 +
 .../cache/persistence/tree/io/PageIO.java       |  103 +-
 .../wal/reader/StandaloneGridKernalContext.java |    6 +
 .../wal/serializer/RecordDataV1Serializer.java  |   17 +-
 .../cache/transactions/IgniteTxAdapter.java     |   46 +-
 .../cache/transactions/IgniteTxHandler.java     |  239 +-
 .../cache/transactions/IgniteTxManager.java     |    4 +-
 .../cache/tree/mvcc/data/MvccUpdateDataRow.java |   11 +-
 .../cluster/GridClusterStateProcessor.java      |    3 +-
 .../compress/CompressionProcessor.java          |  173 ++
 .../processors/compress/FileSystemUtils.java    |  129 +
 .../processors/compress/NativeFileSystem.java   |   50 +
 .../datastructures/GridCacheSetImpl.java        |    4 +-
 .../processors/query/GridQueryProcessor.java    |    1 -
 .../apache/ignite/internal/util/GridUnsafe.java |    1 +
 .../ignite/internal/util/IgniteUtils.java       |  213 +-
 .../verify/VisorValidateIndexesJobResult.java   |    9 +
 .../verify/VisorValidateIndexesTaskArg.java     |   23 +-
 .../ignite/mxbean/CacheGroupMetricsMXBean.java  |   12 +
 .../ignite/mxbean/DataStorageMetricsMXBean.java |    8 +
 ...ndezvousAffinityFunctionSimpleBenchmark.java |   26 +-
 .../cache/store/CacheStoreWriteErrorTest.java   |  127 +
 .../GridMultithreadedJobStealingSelfTest.java   |    6 +-
 .../BinaryArrayIdentityResolverSelfTest.java    |    4 +-
 .../binary/BinaryFieldsOffheapSelfTest.java     |    4 +-
 .../BinaryFooterOffsetsOffheapSelfTest.java     |    4 +-
 .../BinarySerialiedFieldComparatorSelfTest.java |    4 +-
 .../cache/CacheConcurrentReadThroughTest.java   |    8 +
 .../cache/CacheEnumOperationsAbstractTest.java  |   18 +-
 .../cache/CrossCacheTxRandomOperationsTest.java |   23 +-
 .../cache/GridCacheAbstractMetricsSelfTest.java |    6 -
 .../cache/GridCacheBasicApiAbstractTest.java    |   27 +
 .../cache/GridCacheBasicStoreAbstractTest.java  |    8 +
 .../GridCacheEvictionEventAbstractTest.java     |    9 +
 .../GridCacheFinishPartitionsSelfTest.java      |    8 +
 ...idCacheGetAndTransformStoreAbstractTest.java |    8 +
 .../cache/GridCacheOffheapUpdateSelfTest.java   |   17 +-
 .../cache/GridCachePartitionedGetSelfTest.java  |    6 +
 .../GridCacheVariableTopologySelfTest.java      |    9 +
 .../IgniteCacheEntryProcessorNodeJoinTest.java  |  111 +-
 .../cache/IgniteCacheIncrementTxTest.java       |    7 +
 .../cache/IgniteCacheNoSyncForGetTest.java      |    8 +
 .../IgniteClientCacheStartFailoverTest.java     |   37 +
 .../IgniteClusterActivateDeactivateTest.java    |    2 +-
 ...erActivateDeactivateTestWithPersistence.java |   37 +
 ...ynamicCacheStartFailWithPersistenceTest.java |    1 +
 .../IgniteMvccTxMultiThreadedAbstractTest.java  |  121 +
 .../IgniteMvccTxSingleThreadedAbstractTest.java |   50 +
 .../cache/IgniteNearClientCacheCloseTest.java   |   22 +
 .../processors/cache/IgniteTxAbstractTest.java  |   16 +-
 .../IgniteTxMultiThreadedAbstractTest.java      |    1 -
 .../cache/WalModeChangeAbstractSelfTest.java    |   45 +-
 ...ntNodeBinaryObjectMetadataMultinodeTest.java |    4 +-
 .../GridCacheSetAbstractSelfTest.java           |   31 +-
 ...idCachePartitionedSetWithClientSelfTest.java |   52 +
 ...chePartitionedSetWithNodeFilterSelfTest.java |   37 +
 ...ridCacheReplicatedSetWithClientSelfTest.java |   52 +
 ...acheReplicatedSetWithNodeFilterSelfTest.java |   37 +
 .../distributed/CacheExchangeMergeTest.java     |    4 +-
 ...CacheLoadingConcurrentGridStartSelfTest.java |    8 +
 .../CacheLockReleaseNodeLeaveTest.java          |    8 +
 .../GridCacheAbstractPrimarySyncSelfTest.java   |    4 +
 .../GridCacheBasicOpAbstractTest.java           |    8 +
 .../distributed/GridCacheLockAbstractTest.java  |    8 +
 .../GridCacheMultiNodeAbstractTest.java         |    5 +
 .../GridCacheMultiNodeLockAbstractTest.java     |    9 +
 .../GridCacheNodeFailureAbstractTest.java       |    8 +
 ...ridCachePartitionNotLoadedEventSelfTest.java |   17 +-
 ...NearDisabledMvccTxMultiThreadedSelfTest.java |   31 +
 ...GridCachePreloadRestartAbstractSelfTest.java |   12 +
 .../GridCacheTransformEventSelfTest.java        |   70 +-
 ...niteCacheClientNodeChangingTopologyTest.java |   12 +-
 .../distributed/IgniteCacheGetRestartTest.java  |   29 +-
 .../IgniteCacheTxIteratorSelfTest.java          |   27 +-
 .../IgniteMvccTxTimeoutAbstractTest.java        |  146 +
 .../IgniteTxTimeoutAbstractTest.java            |   39 +-
 ...heColocatedMvccTxSingleThreadedSelfTest.java |   85 +
 .../dht/GridCacheDhtEntrySelfTest.java          |    5 +
 .../dht/GridCacheDhtMappingSelfTest.java        |    8 +
 .../GridCacheDhtPreloadDisabledSelfTest.java    |    8 +
 ...ridCacheDhtPreloadMultiThreadedSelfTest.java |    3 +
 .../dht/GridCacheDhtPreloadPutGetSelfTest.java  |    7 +
 .../dht/GridCacheDhtPreloadSelfTest.java        |    2 -
 .../IgniteCacheClearDuringRebalanceTest.java    |    9 +
 ...artitionedBackupNodeFailureRecoveryTest.java |    2 +-
 .../near/GridCacheNearClientHitTest.java        |    5 +-
 .../near/GridCacheNearMultiGetSelfTest.java     |   73 +-
 .../near/GridCacheNearMultiNodeSelfTest.java    |   10 +
 .../near/GridCacheNearOneNodeSelfTest.java      |   11 +-
 .../GridCacheNearPartitionedClearSelfTest.java  |    8 +
 .../GridCacheNearReaderPreloadSelfTest.java     |    8 +
 .../near/GridCacheNearReadersSelfTest.java      |   10 +-
 ...ePartitionedBasicStoreMultiNodeSelfTest.java |    6 +
 .../near/GridCachePartitionedEventSelfTest.java |    8 +
 ...titionedExplicitLockNodeFailureSelfTest.java |    8 +
 .../GridCachePartitionedLoadCacheSelfTest.java  |    8 +
 ...ePartitionedMvccTxMultiThreadedSelfTest.java |  101 +
 ...PartitionedMvccTxSingleThreadedSelfTest.java |   84 +
 ...idCachePartitionedMvccTxTimeoutSelfTest.java |   47 +
 ...achePartitionedPreloadLifecycleSelfTest.java |    1 -
 .../GridCachePartitionedTxTimeoutSelfTest.java  |   21 -
 .../near/GridNearCacheStoreUpdateTest.java      |    9 +
 .../near/NearCacheSyncUpdateTest.java           |   17 +
 .../near/NoneRebalanceModeSelfTest.java         |    9 +
 .../GridCacheReplicatedTxTimeoutSelfTest.java   |   18 -
 .../local/GridCacheLocalBasicApiSelfTest.java   |    8 +
 .../local/GridCacheLocalBasicStoreSelfTest.java |    8 +
 .../local/GridCacheLocalEventSelfTest.java      |    9 +
 .../GridCacheLocalEvictionEventSelfTest.java    |    8 +
 ...dCacheLocalGetAndTransformStoreSelfTest.java |    8 +
 .../GridCacheLocalIsolatedNodesSelfTest.java    |    8 +
 .../local/GridCacheLocalLoadAllSelfTest.java    |    8 +
 .../cache/local/GridCacheLocalLockSelfTest.java |    8 +
 .../GridCacheLocalMultithreadedSelfTest.java    |    8 +
 .../GridCacheLocalTxMultiThreadedSelfTest.java  |    9 +
 .../GridCacheLocalTxSingleThreadedSelfTest.java |    8 +
 .../local/GridCacheLocalTxTimeoutSelfTest.java  |    8 +
 ...vccAbstractBasicCoordinatorFailoverTest.java |  184 ++
 .../cache/mvcc/CacheMvccAbstractTest.java       |   19 +-
 ...eMvccPartitionedCoordinatorFailoverTest.java |   35 +
 .../cache/mvcc/CacheMvccTransactionsTest.java   |   28 +
 .../cache/mvcc/MvccUnsupportedTxModesTest.java  |  316 +++
 .../cache/persistence/DummyPageIO.java          |   21 +-
 .../IgniteDataStorageMetricsSelfTest.java       |   17 +-
 ...tePdsBinaryMetadataOnClusterRestartTest.java |    4 +-
 .../persistence/IgnitePdsDynamicCacheTest.java  |    3 +-
 .../IgnitePdsExchangeDuringCheckpointTest.java  |    1 +
 .../persistence/IgnitePdsPageSizesTest.java     |    8 +
 .../IgnitePdsPartitionsStateRecoveryTest.java   |  170 ++
 ...lWalModeChangeDuringRebalancingSelfTest.java |   15 +
 .../db/IgnitePdsCacheRestoreTest.java           |    8 +-
 .../db/IgnitePdsDataRegionMetricsTest.java      |   10 +-
 .../db/IgnitePdsReserveWalSegmentsTest.java     |    2 -
 ...gniteCheckpointDirtyPagesForLowLoadTest.java |    1 -
 ...faultPageSizeBackwardsCompatibilityTest.java |   19 +-
 .../IgniteUidAsConsistentIdMigrationTest.java   |   26 +-
 .../persistence/db/wal/WalCompactionTest.java   |   26 +-
 .../db/wal/WalDeletionArchiveAbstractTest.java  |    1 -
 .../db/wal/reader/IgniteWalReaderTest.java      |    9 +-
 ...tinuousQueryAsyncFailoverMvccTxSelfTest.java |    5 +
 ...heContinuousQueryFailoverMvccTxSelfTest.java |    5 +
 ...teCacheContinuousQueryNoUnsubscribeTest.java |    5 -
 .../cache/transactions/TxRollbackAsyncTest.java |    6 +-
 .../database/IgniteDbAbstractTest.java          |    2 -
 ...aStreamProcessorMvccPersistenceSelfTest.java |   28 +
 .../DataStreamProcessorPersistenceSelfTest.java |   28 +
 .../DataStreamProcessorSelfTest.java            |   63 +-
 .../internal/util/IgniteUtilsSelfTest.java      |   43 -
 .../loadtests/hashmap/GridCacheTestContext.java |    2 +
 ...mmunicationSpiConcurrentConnectSelfTest.java |    4 +-
 ...dTcpCommunicationSpiRecoveryAckSelfTest.java |    4 +-
 ...GridTcpCommunicationSpiRecoverySelfTest.java |    4 +-
 ...CommunicationRecoveryAckClosureSelfTest.java |    4 +-
 .../TcpDiscoveryPendingMessageDeliveryTest.java |    8 +-
 .../discovery/tcp/TcpDiscoveryRestartTest.java  |    8 +-
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java |    4 +-
 .../testframework/MvccFeatureChecker.java       |  137 +
 .../testframework/junits/GridAbstractTest.java  |   86 +-
 .../junits/common/GridAbstractExamplesTest.java |    5 +-
 .../junits/common/GridCommonAbstractTest.java   |    4 +-
 .../junits/spi/GridSpiAbstractTest.java         |    6 +-
 .../testsuites/IgniteBinaryCacheTestSuite.java  |    2 +
 .../IgniteCacheDataStructuresSelfTestSuite.java |    8 +
 .../testsuites/IgniteCacheMvccTestSuite.java    |    5 +
 .../testsuites/IgniteCacheMvccTestSuite2.java   |  197 ++
 .../ignite/testsuites/IgniteCacheTestSuite.java |    4 +
 .../testsuites/IgniteCacheTestSuite2.java       |  321 +--
 .../testsuites/IgniteCacheTestSuite6.java       |    3 -
 .../ignite/testsuites/IgnitePdsTestSuite2.java  |    3 +
 .../util/mbeans/GridMBeanDisableSelfTest.java   |    4 +-
 modules/direct-io/pom.xml                       |   17 +-
 .../file/AlignedBuffersDirectFileIO.java        |  112 +-
 .../file/AlignedBuffersDirectFileIOFactory.java |   16 +-
 .../persistence/file/IgniteNativeIoLib.java     |    2 +-
 ...kPageCompressionIntegrationDirectIOTest.java |   31 +
 .../persistence/file/IgniteFileIOTest.java      |   15 +
 .../testsuites/IgnitePdsNativeIoTestSuite2.java |    4 +
 .../visor/verify/ValidateIndexesClosure.java    |    8 +-
 .../visor/verify/VisorValidateIndexesTask.java  |   29 +
 .../IgniteBinaryObjectFieldsQuerySelfTest.java  |    5 -
 .../mvcc/CacheMvccBackupsAbstractTest.java      |    2 +
 ...ccPartitionedSqlCoordinatorFailoverTest.java |   49 +-
 .../mvcc/CacheMvccSqlTxQueriesAbstractTest.java |    2 -
 .../db/wal/IgniteWalRecoveryTest.java           |    3 +-
 ...IgniteSqlSkipReducerOnUpdateDmlSelfTest.java |    5 -
 .../processors/query/SqlSchemaSelfTest.java     |   25 +-
 .../util/GridCommandHandlerIndexingTest.java    |    2 +-
 .../kafka/connect/IgniteSinkConnectorTest.java  |    2 -
 modules/ml/pom.xml                              |   13 +
 .../apache/ignite/ml/inference/InfModel.java    |   37 +
 .../ignite/ml/inference/ModelDescriptor.java    |   86 +
 .../ignite/ml/inference/ModelSignature.java     |   62 +
 .../inference/builder/AsyncInfModelBuilder.java |   43 +
 .../IgniteDistributedInfModelBuilder.java       |  367 +++
 .../builder/SingleInfModelBuilder.java          |   34 +
 .../inference/builder/SyncInfModelBuilder.java  |   42 +
 .../builder/ThreadedInfModelBuilder.java        |   86 +
 .../ml/inference/builder/package-info.java      |   22 +
 .../ignite/ml/inference/package-info.java       |   22 +
 .../parser/IgniteFunctionInfModelParser.java    |   76 +
 .../ml/inference/parser/InfModelParser.java     |   38 +
 .../parser/TensorFlowBaseInfModelParser.java    |  216 ++
 .../parser/TensorFlowGraphInfModelParser.java   |   40 +
 .../TensorFlowSavedModelInfModelParser.java     |   70 +
 .../ml/inference/parser/package-info.java       |   22 +
 .../reader/FileSystemInfModelReader.java        |   61 +
 .../reader/InMemoryInfModelReader.java          |   67 +
 .../ml/inference/reader/InfModelReader.java     |   33 +
 .../ml/inference/reader/package-info.java       |   22 +
 .../storage/IgniteModelDescriptorStorage.java   |   57 +
 .../storage/LocalModelDescriptorStorage.java    |   45 +
 .../storage/ModelDescriptorStorage.java         |   48 +
 .../ml/inference/storage/package-info.java      |   22 +
 .../ml/inference/util/DirectorySerializer.java  |  133 +
 .../ignite/ml/inference/util/package-info.java  |   22 +
 .../encoding/EncoderSortingStrategy.java        |   31 +
 .../preprocessing/encoding/EncoderTrainer.java  |   25 +-
 .../standardscaling/StandardScalerData.java     |   56 +
 .../StandardScalerPreprocessor.java             |   91 +
 .../standardscaling/StandardScalerTrainer.java  |  101 +
 .../standardscaling/package-info.java           |   22 +
 .../org/apache/ignite/ml/util/MnistUtils.java   |   79 +-
 .../org/apache/ignite/ml/IgniteMLTestSuite.java |    2 +
 .../ignite/ml/inference/InferenceTestSuite.java |   38 +
 .../IgniteDistributedInfModelBuilderTest.java   |   71 +
 .../builder/InfModelBuilderTestUtil.java        |   53 +
 .../builder/SingleInfModelBuilderTest.java      |   42 +
 .../builder/ThreadedInfModelBuilderTest.java    |   44 +
 .../inference/util/DirectorySerializerTest.java |  124 +
 .../encoding/EncoderTrainerTest.java            |   27 +
 .../StandardScalerPreprocessorTest.java         |   59 +
 .../StandardScalerTrainerTest.java              |   85 +
 .../docs/source/pyignite.datatypes.base.rst     |    7 +
 .../python/docs/source/pyignite.datatypes.rst   |    1 +
 .../platforms/python/pyignite/datatypes/base.py |   24 +
 .../python/pyignite/datatypes/complex.py        |   23 +-
 .../python/pyignite/datatypes/internal.py       |   19 +-
 .../python/pyignite/datatypes/null_object.py    |    3 +-
 .../python/pyignite/datatypes/primitive.py      |    3 +-
 .../pyignite/datatypes/primitive_arrays.py      |    3 +-
 .../pyignite/datatypes/primitive_objects.py     |    3 +-
 .../python/pyignite/datatypes/standard.py       |    9 +-
 modules/platforms/python/pyignite/utils.py      |    6 +-
 modules/platforms/python/setup.py               |    2 +-
 .../platforms/python/tests/test_key_value.py    |   75 +-
 .../zk/internal/ZookeeperDiscoverySpiTest.java  |    4 +-
 parent/pom.xml                                  |    8 +-
 pom.xml                                         |    1 +
 395 files changed, 17764 insertions(+), 4849 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5f94fca8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/5f94fca8/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/5f94fca8/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/5f94fca8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------


[38/50] [abbrv] ignite git commit: IGNITE-8542: [ML] Add OneVsRest Trainer to handle cases with multiple class labels in dataset.

Posted by sb...@apache.org.
IGNITE-8542: [ML] Add OneVsRest Trainer to handle cases with
multiple class labels in dataset.

This closes #5512


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c3fd4a93
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c3fd4a93
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c3fd4a93

Branch: refs/heads/ignite-10044
Commit: c3fd4a930cc1a76b4d1fbccc6d764bdfe88da941
Parents: 3885f3f
Author: zaleslaw <za...@gmail.com>
Authored: Wed Nov 28 01:45:11 2018 +0300
Committer: Yury Babak <yb...@gridgain.com>
Committed: Wed Nov 28 01:45:11 2018 +0300

----------------------------------------------------------------------
 .../ignite/ml/multiclass/MultiClassModel.java   | 115 +++++++++++++++
 .../ignite/ml/multiclass/OneVsRestTrainer.java  | 147 +++++++++++++++++++
 .../org/apache/ignite/ml/IgniteMLTestSuite.java |   4 +-
 .../ml/multiclass/MultiClassTestSuite.java      |  32 ++++
 .../ml/multiclass/OneVsRestTrainerTest.java     | 126 ++++++++++++++++
 5 files changed, 423 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c3fd4a93/modules/ml/src/main/java/org/apache/ignite/ml/multiclass/MultiClassModel.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/multiclass/MultiClassModel.java b/modules/ml/src/main/java/org/apache/ignite/ml/multiclass/MultiClassModel.java
new file mode 100644
index 0000000..8520aa9
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/multiclass/MultiClassModel.java
@@ -0,0 +1,115 @@
+/*
+ * 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.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;
+
+/** Base class for multi-classification model for set of classifiers. */
+public class MultiClassModel<M extends Model<Vector, Double>> implements Model<Vector, Double>, Exportable<MultiClassModel>, Serializable {
+    /** */
+    private static final long serialVersionUID = -114986533359917L;
+
+    /** List of models associated with each class. */
+    private Map<Double, M> models;
+
+    /** */
+    public MultiClassModel() {
+        this.models = new HashMap<>();
+    }
+
+    /**
+     * Adds a specific 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, M mdl) {
+        models.put(clsLb, mdl);
+    }
+
+    /**
+     * @param clsLb Class label.
+     * @return model for class label if it exists.
+     */
+    public Optional<M> getModel(Double clsLb) {
+        return Optional.ofNullable(models.get(clsLb));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Double apply(Vector input) {
+        TreeMap<Double, Double> maxMargins = new TreeMap<>();
+
+        models.forEach((k, v) -> maxMargins.put(v.apply(input), k));
+
+        // returns value the most closest to 1
+        return maxMargins.lastEntry().getValue();
+    }
+
+    /** {@inheritDoc} */
+    @Override public <P> void saveModel(Exporter<MultiClassModel, 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;
+
+        MultiClassModel mdl = (MultiClassModel)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();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c3fd4a93/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
new file mode 100644
index 0000000..7426506
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/multiclass/OneVsRestTrainer.java
@@ -0,0 +1,147 @@
+/*
+ * 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.multiclass;
+
+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.Model;
+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;
+
+/**
+ * This is a common heuristic trainer for multi-class labeled models.
+ *
+ * NOTE: The current implementation suffers from unbalanced training over the dataset due to unweighted approach
+ * during the process of reassign labels from all range of labels to 0,1.
+ */
+public class OneVsRestTrainer<M extends Model<Vector, Double>>
+    extends SingleLabelDatasetTrainer<MultiClassModel<M>> {
+    /** The common binary classifier with all hyper-parameters to spread them for all separate trainings . */
+    private SingleLabelDatasetTrainer<M> classifier;
+
+    /** */
+    public OneVsRestTrainer(SingleLabelDatasetTrainer<M> classifier) {
+        this.classifier = classifier;
+    }
+
+    /**
+     * 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> MultiClassModel<M> 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> MultiClassModel<M> updateModel(MultiClassModel<M> 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);
+
+        MultiClassModel<M> multiClsMdl = new MultiClassModel<>();
+
+        classes.forEach(clsLb -> {
+            IgniteBiFunction<K, V, Double> lbTransformer = (k, v) -> {
+                Double lb = lbExtractor.apply(k, v);
+
+                if (lb.equals(clsLb))
+                    return 1.0;
+                else
+                    return 0.0;
+            };
+
+            M mdl = Optional.ofNullable(newMdl)
+                .flatMap(multiClassModel -> multiClassModel.getModel(clsLb))
+                .map(learnedModel -> classifier.update(learnedModel, datasetBuilder, featureExtractor, lbTransformer))
+                .orElseGet(() -> classifier.fit(datasetBuilder, featureExtractor, lbTransformer));
+
+            multiClsMdl.add(clsLb, mdl);
+        });
+
+        return multiClsMdl;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean checkState(MultiClassModel<M> 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(
+            (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;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c3fd4a93/modules/ml/src/test/java/org/apache/ignite/ml/IgniteMLTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/IgniteMLTestSuite.java b/modules/ml/src/test/java/org/apache/ignite/ml/IgniteMLTestSuite.java
index f9645d8..78d6659 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/IgniteMLTestSuite.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/IgniteMLTestSuite.java
@@ -26,6 +26,7 @@ import org.apache.ignite.ml.genetic.GAGridTestSuite;
 import org.apache.ignite.ml.inference.InferenceTestSuite;
 import org.apache.ignite.ml.knn.KNNTestSuite;
 import org.apache.ignite.ml.math.MathImplMainTestSuite;
+import org.apache.ignite.ml.multiclass.MultiClassTestSuite;
 import org.apache.ignite.ml.nn.MLPTestSuite;
 import org.apache.ignite.ml.pipeline.PipelineTestSuite;
 import org.apache.ignite.ml.preprocessing.PreprocessingTestSuite;
@@ -61,7 +62,8 @@ import org.junit.runners.Suite;
     StructuresTestSuite.class,
     CommonTestSuite.class,
     InferenceTestSuite.class,
-    BaggingTest.class
+    BaggingTest.class,
+    MultiClassTestSuite.class
 })
 public class IgniteMLTestSuite {
     // No-op.

http://git-wip-us.apache.org/repos/asf/ignite/blob/c3fd4a93/modules/ml/src/test/java/org/apache/ignite/ml/multiclass/MultiClassTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/multiclass/MultiClassTestSuite.java b/modules/ml/src/test/java/org/apache/ignite/ml/multiclass/MultiClassTestSuite.java
new file mode 100644
index 0000000..551597f
--- /dev/null
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/multiclass/MultiClassTestSuite.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.ml.multiclass;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite for multilayer perceptrons.
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    OneVsRestTrainerTest.class
+})
+public class MultiClassTestSuite {
+    // No-op.
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c3fd4a93/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
new file mode 100644
index 0000000..9842d92
--- /dev/null
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/multiclass/OneVsRestTrainerTest.java
@@ -0,0 +1,126 @@
+/*
+ * 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.multiclass;
+
+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.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.Assert;
+import org.junit.Test;
+
+/**
+ * Tests for {@link OneVsRestTrainer}.
+ */
+public class OneVsRestTrainerTest extends TrainerTest {
+    /**
+     * Test trainer on 2 linearly separable sets.
+     */
+    @Test
+    public void testTrainWithTheLinearlySeparableCase() {
+        Map<Integer, double[]> cacheMock = new HashMap<>();
+
+        for (int i = 0; i < twoLinearlySeparableClasses.length; i++)
+            cacheMock.put(i, twoLinearlySeparableClasses[i]);
+
+        LogisticRegressionSGDTrainer<?> binaryTrainer = new LogisticRegressionSGDTrainer<>()
+            .withUpdatesStgy(new UpdatesStrategy<>(new SimpleGDUpdateCalculator(0.2),
+                SimpleGDParameterUpdate::sumLocal, SimpleGDParameterUpdate::avg))
+            .withMaxIterations(1000)
+            .withLocIterations(10)
+            .withBatchSize(100)
+            .withSeed(123L);
+
+        OneVsRestTrainer<LogisticRegressionModel> trainer = new OneVsRestTrainer<>(binaryTrainer);
+
+        MultiClassModel 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(-100, 0)), PRECISION);
+        TestUtils.assertEquals(0, mdl.apply(VectorUtils.of(100, 0)), PRECISION);
+    }
+
+    /** */
+    @Test
+    public void testUpdate() {
+        Map<Integer, double[]> cacheMock = new HashMap<>();
+
+        for (int i = 0; i < twoLinearlySeparableClasses.length; i++)
+            cacheMock.put(i, twoLinearlySeparableClasses[i]);
+
+        LogisticRegressionSGDTrainer<?> binaryTrainer = new LogisticRegressionSGDTrainer<>()
+            .withUpdatesStgy(new UpdatesStrategy<>(new SimpleGDUpdateCalculator(0.2),
+                SimpleGDParameterUpdate::sumLocal, SimpleGDParameterUpdate::avg))
+            .withMaxIterations(1000)
+            .withLocIterations(10)
+            .withBatchSize(100)
+            .withSeed(123L);
+
+        OneVsRestTrainer<LogisticRegressionModel> trainer = new OneVsRestTrainer<>(binaryTrainer);
+
+        MultiClassModel originalMdl = trainer.fit(
+            cacheMock,
+            parts,
+            (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
+            (k, v) -> v[0]
+        );
+
+        MultiClassModel updatedOnSameDS = trainer.update(
+            originalMdl,
+            cacheMock,
+            parts,
+            (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
+            (k, v) -> v[0]
+        );
+
+        MultiClassModel 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(-100, 0),
+            VectorUtils.of(100, 0)
+        );
+
+        for (Vector vec : vectors) {
+            TestUtils.assertEquals(originalMdl.apply(vec), updatedOnSameDS.apply(vec), PRECISION);
+            TestUtils.assertEquals(originalMdl.apply(vec), updatedOnEmptyDS.apply(vec), PRECISION);
+        }
+    }
+}


[37/50] [abbrv] ignite git commit: IGNITE-10429: ML: TensorFlowLocalInferenceExample fails on Windows

Posted by sb...@apache.org.
IGNITE-10429: ML: TensorFlowLocalInferenceExample fails on Windows

This closes #5514


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3885f3f1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3885f3f1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3885f3f1

Branch: refs/heads/ignite-10044
Commit: 3885f3f16c159c841a9219942156d12968f5f9d6
Parents: 566adaa
Author: Anton Dmitriev <dm...@gmail.com>
Authored: Wed Nov 28 00:02:09 2018 +0300
Committer: Yury Babak <yb...@gridgain.com>
Committed: Wed Nov 28 00:02:09 2018 +0300

----------------------------------------------------------------------
 .../inference/util/DirectorySerializerTest.java   | 18 ++++++++++--------
 parent/pom.xml                                    |  1 +
 2 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3885f3f1/modules/ml/src/test/java/org/apache/ignite/ml/inference/util/DirectorySerializerTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/inference/util/DirectorySerializerTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/inference/util/DirectorySerializerTest.java
index d2d6b16..87a515c 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/inference/util/DirectorySerializerTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/inference/util/DirectorySerializerTest.java
@@ -63,10 +63,11 @@ public class DirectorySerializerTest {
             assertEquals(1, files.length);
             assertEquals("test.txt", files[0].getName());
 
-            Scanner scanner = new Scanner(files[0]);
-            assertTrue(scanner.hasNextLine());
-            assertEquals("Hello, world!", scanner.nextLine());
-            assertFalse(scanner.hasNextLine());
+            try (Scanner scanner = new Scanner(files[0])) {
+                assertTrue(scanner.hasNextLine());
+                assertEquals("Hello, world!", scanner.nextLine());
+                assertFalse(scanner.hasNextLine());
+            }
         }
         finally {
             DirectorySerializer.deleteDirectory(src);
@@ -111,10 +112,11 @@ public class DirectorySerializerTest {
             assertEquals(1, files.length);
             assertEquals("test.txt", files[0].getName());
 
-            Scanner scanner = new Scanner(files[0]);
-            assertTrue(scanner.hasNextLine());
-            assertEquals("Hello, world!", scanner.nextLine());
-            assertFalse(scanner.hasNextLine());
+            try (Scanner scanner = new Scanner(files[0])) {
+                assertTrue(scanner.hasNextLine());
+                assertEquals("Hello, world!", scanner.nextLine());
+                assertFalse(scanner.hasNextLine());
+            }
         }
         finally {
             DirectorySerializer.deleteDirectory(src);

http://git-wip-us.apache.org/repos/asf/ignite/blob/3885f3f1/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 23e0a0d..2032f1d 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -878,6 +878,7 @@
                                         <exclude>src/main/java/org/apache/ignite/examples/streaming/wordcount/*.txt</exclude><!--books examples-->
                                         <exclude>examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/*.txt</exclude><!--books examples-->
                                         <exclude>**/resources/datasets/**/*</exclude><!--Datasets in ml module-->
+                                        <exclude>**/*.pb</exclude><!--Pre-trained TF model-->
                                         <exclude>src/main/java/org/jetbrains/annotations/*.java</exclude><!--copyright-->
                                         <exclude>dev-tools/IGNITE-*.patch</exclude>
                                         <exclude>dev-tools/.gradle/**/*</exclude>


[30/50] [abbrv] ignite git commit: IGNITE-9948 Fixed ettyRestProcessorAuthenticationWithTokenSelfTest.testGetOrCreate - Fixes #5038.

Posted by sb...@apache.org.
IGNITE-9948 Fixed ettyRestProcessorAuthenticationWithTokenSelfTest.testGetOrCreate - Fixes #5038.

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/882b5a4a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/882b5a4a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/882b5a4a

Branch: refs/heads/ignite-10044
Commit: 882b5a4a80dd1c49d4ff17818a07e38f4279ff3c
Parents: 9031733
Author: NSAmelchev <ns...@gmail.com>
Authored: Tue Nov 27 19:21:08 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Tue Nov 27 19:21:08 2018 +0300

----------------------------------------------------------------------
 .../JettyRestProcessorAbstractSelfTest.java     | 90 ++++++++++----------
 ...RestProcessorAuthenticationAbstractTest.java |  6 +-
 2 files changed, 50 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/882b5a4a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
index 703f50d..81f0a36f 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.rest;
 
+import com.fasterxml.jackson.databind.JsonNode;
 import java.io.IOException;
 import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
@@ -34,9 +35,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
@@ -238,17 +236,21 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
     }
 
     /**
+     * Validates JSON response.
+     *
      * @param content Content to check.
      * @return REST result.
+     * @throws IOException If parsing failed.
      */
-    protected JsonNode jsonResponse(String content) throws IOException {
+    protected JsonNode validateJsonResponse(String content) throws IOException {
         assertNotNull(content);
         assertFalse(content.isEmpty());
 
         JsonNode node = JSON_MAPPER.readTree(content);
 
+        assertTrue("Unexpected error: " + node.get("error").asText(), node.get("error").isNull());
+
         assertEquals(STATUS_SUCCESS, node.get("successStatus").asInt());
-        assertTrue(node.get("error").isNull());
 
         assertNotSame(securityEnabled(), node.get("sessionToken").isNull());
 
@@ -341,7 +343,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
         // Test with SQL.
         SqlFieldsQuery qry = new SqlFieldsQuery(
             "create table employee(id integer primary key, name varchar(100), salary integer);" +
-            "insert into employee(id, name, salary) values (1, 'Alex', 300);"
+                "insert into employee(id, name, salary) values (1, 'Alex', 300);"
         );
 
         grid(0).context().query().querySqlFields(qry, true, false);
@@ -420,7 +422,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
 
         info("Get command result: " + ret);
 
-        JsonNode res = jsonResponse(ret);
+        JsonNode res = validateJsonResponse(ret);
 
         assertEquals(F.asMap("", null, "key", "value"), JSON_MAPPER.treeToValue(res, HashMap.class));
 
@@ -434,7 +436,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
 
         info("Get command result: " + ret);
 
-        res = jsonResponse(ret);
+        res = validateJsonResponse(ret);
 
         assertEquals(F.asMap("", "value", "key", null), JSON_MAPPER.treeToValue(res, HashMap.class));
     }
@@ -565,7 +567,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
 
         info("Name command result: " + ret);
 
-        assertEquals(getTestIgniteInstanceName(0), jsonResponse(ret).asText());
+        assertEquals(getTestIgniteInstanceName(0), validateJsonResponse(ret).asText());
     }
 
     /**
@@ -588,6 +590,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
 
         info("GetOrCreateCache command result: " + ret);
 
+        validateJsonResponse(ret);
+
         IgniteCache<String, String> cache = grid(0).cache(cacheName);
 
         cache.put("1", "1");
@@ -606,7 +610,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
 
         ret = content(cacheName, GridRestCommand.DESTROY_CACHE);
 
-        assertTrue(jsonResponse(ret).isNull());
+        assertTrue(validateJsonResponse(ret).isNull());
         assertNull(grid(0).cache(cacheName));
     }
 
@@ -1117,7 +1121,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
             "delta", "3"
         );
 
-        JsonNode res = jsonResponse(ret);
+        JsonNode res = validateJsonResponse(ret);
 
         assertEquals(5, res.asInt());
         assertEquals(5, grid(0).atomicLong("incrKey", 0, true).get());
@@ -1127,7 +1131,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
             "delta", "10"
         );
 
-        res = jsonResponse(ret);
+        res = validateJsonResponse(ret);
 
         assertEquals(15, res.asInt());
         assertEquals(15, grid(0).atomicLong("incrKey", 0, true).get());
@@ -1143,7 +1147,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
             "delta", "10"
         );
 
-        JsonNode res = jsonResponse(ret);
+        JsonNode res = validateJsonResponse(ret);
 
         assertEquals(5, res.asInt());
         assertEquals(5, grid(0).atomicLong("decrKey", 0, true).get());
@@ -1153,7 +1157,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
             "delta", "3"
         );
 
-        res = jsonResponse(ret);
+        res = validateJsonResponse(ret);
 
         assertEquals(2, res.asInt());
         assertEquals(2, grid(0).atomicLong("decrKey", 0, true).get());
@@ -1321,7 +1325,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
 
         info("Cache metadata: " + ret);
 
-        JsonNode arrRes = jsonResponse(ret);
+        JsonNode arrRes = validateJsonResponse(ret);
 
         // TODO: IGNITE-7740 uncomment after IGNITE-7740 will be fixed.
         // assertEquals(cachesCnt, arrRes.size());
@@ -1334,7 +1338,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
 
         info("Cache metadata: " + ret);
 
-        arrRes = jsonResponse(ret);
+        arrRes = validateJsonResponse(ret);
 
         assertEquals(1, arrRes.size());
 
@@ -1361,7 +1365,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
 
         info("Cache metadata: " + ret);
 
-        JsonNode arrRes = jsonResponse(ret);
+        JsonNode arrRes = validateJsonResponse(ret);
 
         // TODO: IGNITE-7740 uncomment after IGNITE-7740 will be fixed.
         // int cachesCnt = grid(1).cacheNames().size();
@@ -1373,7 +1377,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
 
         info("Cache metadata with cacheName parameter: " + ret);
 
-        arrRes = jsonResponse(ret);
+        arrRes = validateJsonResponse(ret);
 
         assertEquals(1, arrRes.size());
 
@@ -1394,7 +1398,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
 
         info("Topology command result: " + ret);
 
-        JsonNode res = jsonResponse(ret);
+        JsonNode res = validateJsonResponse(ret);
 
         assertEquals(gridCount(), res.size());
 
@@ -1438,7 +1442,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
 
         info("Topology command result: " + ret);
 
-        res = jsonResponse(ret);
+        res = validateJsonResponse(ret);
 
         assertEquals(gridCount(), res.size());
 
@@ -1461,7 +1465,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
 
         info("Topology command result: " + ret);
 
-        JsonNode res = jsonResponse(ret);
+        JsonNode res = validateJsonResponse(ret);
 
         assertTrue(res.get("attributes").isObject());
         assertTrue(res.get("metrics").isObject());
@@ -1480,7 +1484,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
 
         info("Topology command result: " + ret);
 
-        res = jsonResponse(ret);
+        res = validateJsonResponse(ret);
 
         assertTrue(res.get("attributes").isNull());
         assertTrue(res.get("metrics").isNull());
@@ -1494,7 +1498,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
 
         info("Topology command result: " + ret);
 
-        res = jsonResponse(ret);
+        res = validateJsonResponse(ret);
 
         assertTrue(res.isNull());
 
@@ -1508,7 +1512,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
 
         info("Topology command result: " + ret);
 
-        res = jsonResponse(ret);
+        res = validateJsonResponse(ret);
 
         assertTrue(res.get("attributes").isNull());
         assertTrue(res.get("metrics").isNull());
@@ -1927,7 +1931,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
     public void testVersion() throws Exception {
         String ret = content(null, GridRestCommand.VERSION);
 
-        JsonNode res = jsonResponse(ret);
+        JsonNode res = validateJsonResponse(ret);
 
         assertEquals(VER_STR, res.asText());
     }
@@ -1946,7 +1950,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
             "arg2", "2000"
         );
 
-        JsonNode items = jsonResponse(ret).get("items");
+        JsonNode items = validateJsonResponse(ret).get("items");
 
         assertEquals(2, items.size());
 
@@ -1962,7 +1966,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
             "cacheName", "person"
         );
 
-        JsonNode items = jsonResponse(ret).get("items");
+        JsonNode items = validateJsonResponse(ret).get("items");
 
         assertEquals(4, items.size());
 
@@ -1978,7 +1982,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
             "className", ScanFilter.class.getName()
         );
 
-        JsonNode items = jsonResponse(ret).get("items");
+        JsonNode items = validateJsonResponse(ret).get("items");
 
         assertEquals(2, items.size());
 
@@ -2013,18 +2017,18 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
             "qry", URLEncoder.encode("select * from String", CHARSET)
         );
 
-        JsonNode qryId = jsonResponse(ret).get("queryId");
+        JsonNode qryId = validateJsonResponse(ret).get("queryId");
 
-        assertFalse(jsonResponse(ret).get("queryId").isNull());
+        assertFalse(validateJsonResponse(ret).get("queryId").isNull());
 
         ret = content(DEFAULT_CACHE_NAME, GridRestCommand.FETCH_SQL_QUERY,
             "pageSize", "1",
             "qryId", qryId.asText()
         );
 
-        JsonNode res = jsonResponse(ret);
+        JsonNode res = validateJsonResponse(ret);
 
-        JsonNode qryId0 = jsonResponse(ret).get("queryId");
+        JsonNode qryId0 = validateJsonResponse(ret).get("queryId");
 
         assertEquals(qryId0, qryId);
         assertFalse(res.get("last").asBoolean());
@@ -2034,9 +2038,9 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
             "qryId", qryId.asText()
         );
 
-        res = jsonResponse(ret);
+        res = validateJsonResponse(ret);
 
-        qryId0 = jsonResponse(ret).get("queryId");
+        qryId0 = validateJsonResponse(ret).get("queryId");
 
         assertEquals(qryId0, qryId);
         assertTrue(res.get("last").asBoolean());
@@ -2060,7 +2064,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
             "arg1", "o1"
         );
 
-        JsonNode items = jsonResponse(ret).get("items");
+        JsonNode items = validateJsonResponse(ret).get("items");
 
         assertEquals(2, items.size());
 
@@ -2078,7 +2082,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
             "qry", URLEncoder.encode(qry, CHARSET)
         );
 
-        JsonNode items = jsonResponse(ret).get("items");
+        JsonNode items = validateJsonResponse(ret).get("items");
 
         assertEquals(4, items.size());
 
@@ -2097,7 +2101,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
             "qry", URLEncoder.encode(qry, CHARSET)
         );
 
-        JsonNode items = jsonResponse(ret).get("items");
+        JsonNode items = validateJsonResponse(ret).get("items");
 
         assertEquals(4, items.size());
 
@@ -2115,7 +2119,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
             "qry", URLEncoder.encode(qry, CHARSET)
         );
 
-        JsonNode res = jsonResponse(ret);
+        JsonNode res = validateJsonResponse(ret);
 
         JsonNode items = res.get("items");
 
@@ -2148,7 +2152,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
             "arg2", "2000"
         );
 
-        JsonNode res = jsonResponse(ret);
+        JsonNode res = validateJsonResponse(ret);
 
         assertEquals(1, res.get("items").size());
 
@@ -2180,7 +2184,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
                 "arg2", "2000"
             );
 
-        JsonNode items = jsonResponse(ret).get("items");
+        JsonNode items = validateJsonResponse(ret).get("items");
 
         assertEquals(1, items.size());
 
@@ -2397,7 +2401,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
 
         info("Command result: " + ret);
 
-        JsonNode json = jsonResponse(ret);
+        JsonNode json = validateJsonResponse(ret);
 
         assertEquals(exp, json.isObject() ? json.toString() : json.asText());
     }
@@ -3027,7 +3031,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
         String ret = content("cmd", GridRestCommand.CLUSTER_CURRENT_STATE);
 
         info("Cluster state: " + ret);
-        JsonNode res = jsonResponse(ret);
+        JsonNode res = validateJsonResponse(ret);
 
         assertEquals(exp, res.asBoolean());
         assertEquals(exp, grid(0).cluster().active());
@@ -3042,7 +3046,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
     private void changeClusterState(GridRestCommand cmd) throws Exception {
         String ret = content(null, cmd);
 
-        JsonNode res = jsonResponse(ret);
+        JsonNode res = validateJsonResponse(ret);
 
         assertFalse(res.isNull());
         assertTrue(res.asText().startsWith(cmd.key()));

http://git-wip-us.apache.org/repos/asf/ignite/blob/882b5a4a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAuthenticationAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAuthenticationAbstractTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAuthenticationAbstractTest.java
index 0ed9e95..8f99cdb 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAuthenticationAbstractTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAuthenticationAbstractTest.java
@@ -105,7 +105,7 @@ public abstract class JettyRestProcessorAuthenticationAbstractTest extends Jetty
             "user", "user1",
             "password", "password1");
 
-        JsonNode res = jsonResponse(ret);
+        JsonNode res = validateJsonResponse(ret);
 
         assertTrue(res.asBoolean());
 
@@ -118,7 +118,7 @@ public abstract class JettyRestProcessorAuthenticationAbstractTest extends Jetty
             "user", "user1",
             "password", "password2");
 
-        res = jsonResponse(ret);
+        res = validateJsonResponse(ret);
 
         assertTrue(res.asBoolean());
 
@@ -128,7 +128,7 @@ public abstract class JettyRestProcessorAuthenticationAbstractTest extends Jetty
         ret = content(null, GridRestCommand.REMOVE_USER,
             "user", "user1");
 
-        res = jsonResponse(ret);
+        res = validateJsonResponse(ret);
 
         assertTrue(res.asBoolean());
 


[50/50] [abbrv] ignite git commit: 10044

Posted by sb...@apache.org.
10044


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e0657d71
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e0657d71
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e0657d71

Branch: refs/heads/ignite-10044
Commit: e0657d718fcf54862295b3fc224580a901ef6d59
Parents: c969d6a
Author: sboikov <sb...@apache.org>
Authored: Thu Nov 29 14:47:09 2018 +0300
Committer: sboikov <sb...@apache.org>
Committed: Thu Nov 29 15:15:12 2018 +0300

----------------------------------------------------------------------
 .../GridDhtPartitionsExchangeFuture.java        |  7 +++---
 .../topology/GridClientPartitionTopology.java   | 20 ++++++++---------
 .../topology/GridDhtPartitionTopologyImpl.java  | 23 ++++++++------------
 .../IgniteCachePartitionLossPolicySelfTest.java |  2 +-
 .../junits/common/GridCommonAbstractTest.java   |  5 +++++
 5 files changed, 28 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e0657d71/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 2322d8b..000791d 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
@@ -3255,6 +3255,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
 
             if (firstDiscoEvt.type() == EVT_DISCOVERY_CUSTOM_EVT) {
                 assert firstDiscoEvt instanceof DiscoveryCustomEvent;
+                assert !events().hasServerJoin() && !events().hasServerLeft();
 
                 if (activateCluster() || changedBaseline())
                     assignPartitionsStates();
@@ -3276,11 +3277,11 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
                     assignPartitionsStates();
             }
             else {
-                if (exchCtx.events().hasServerJoin())
-                    assignPartitionsStates();
-
                 if (exchCtx.events().hasServerLeft())
                     detectLostPartitions(resTopVer, true);
+
+                if (exchCtx.events().hasServerJoin())
+                    assignPartitionsStates();
             }
 
             // Recalculate new affinity based on partitions availability.

http://git-wip-us.apache.org/repos/asf/ignite/blob/e0657d71/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 b1f6e19..feca1e7 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
@@ -944,6 +944,15 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
             if (cur == null || !cur.equals(parts))
                 changed = true;
 
+            if (lostParts != null) {
+                for (Integer lostPart : lostParts) {
+                    GridDhtPartitionState state0 = parts.get(lostPart);
+
+                    if (state0 != null && state0.active())
+                        parts.put(lostPart, LOST);
+                }
+            }
+
             node2part.put(parts.nodeId(), parts);
 
             // Add new mappings.
@@ -1245,17 +1254,6 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
                 }
             }
 
-            if (lostParts != null) {
-                for (Map.Entry<UUID, GridDhtPartitionMap> e : node2part.entrySet()) {
-                    for (Integer part : lostParts) {
-                        GridDhtPartitionState state = e.getValue().get(part);
-
-                        if (state != null && state.active())
-                            e.getValue().put(part, LOST);
-                    }
-                }
-            }
-
             for (Map.Entry<Integer, Set<UUID>> entry : ownersByUpdCounters.entrySet())
                 part2node.put(entry.getKey(), entry.getValue());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e0657d71/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 187bf9c..d518467 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
@@ -1807,6 +1807,15 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
                 if (cur == null || !cur.equals(parts))
                     changed = true;
 
+                if (lostParts != null) {
+                    for (Integer lostPart : lostParts) {
+                        GridDhtPartitionState state0 = parts.get(lostPart);
+
+                        if (state0 != null && state0.active())
+                            parts.put(lostPart, LOST);
+                    }
+                }
+
                 node2part.put(parts.nodeId(), parts);
 
                 // During exchange diff is calculated after all messages are received and affinity initialized.
@@ -2260,20 +2269,6 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
                     }
                 }
 
-                if (lostParts != null) {
-                    for (Map.Entry<UUID, GridDhtPartitionMap> e : node2part.entrySet()) {
-                        if (e.getKey().equals(ctx.localNodeId()))
-                            continue;
-
-                        for (Integer part : lostParts) {
-                            GridDhtPartitionState state = e.getValue().get(part);
-
-                            if (state != null && state.active())
-                                e.getValue().put(part, LOST);
-                        }
-                    }
-                }
-
                 node2part = new GridDhtPartitionFullMap(node2part, updateSeq.incrementAndGet());
             } finally {
                 lock.writeLock().unlock();

http://git-wip-us.apache.org/repos/asf/ignite/blob/e0657d71/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePartitionLossPolicySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePartitionLossPolicySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePartitionLossPolicySelfTest.java
index 6f4b260..100cc74 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePartitionLossPolicySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePartitionLossPolicySelfTest.java
@@ -626,7 +626,7 @@ public class IgniteCachePartitionLossPolicySelfTest extends GridCommonAbstractTe
         }
 
         // Make sure cache did not really start on coordinator,
-        if (!clientCacheOnCrd)
+        if (!clientCacheOnCrd && topChanger.aliveNodes.contains(0))
             assertNull(((IgniteEx)ignite(0)).context().cache().cacheGroup(CU.cacheId(CACHE_EXCLUDE_ON_CRD)));
 
         // Start new nodes after lost partitions reset.

http://git-wip-us.apache.org/repos/asf/ignite/blob/e0657d71/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index c931a0d..3017a71 100755
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -647,6 +647,9 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
                         long start = 0;
 
                         for (int i = 0; ; i++) {
+                            if (c.lostPartitions().contains(p))
+                                break;
+
                             boolean match = false;
 
                             GridCachePartitionExchangeManager<?, ?> exchMgr = dht.context().shared().exchange();
@@ -701,6 +704,8 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
                                             ", affNodes=" + F.nodeIds(affNodes) +
                                             ", owners=" + F.nodeIds(owners) +
                                             ", topFut=" + topFut +
+                                            ", lostParts=" + c.lostPartitions() +
+                                            ", locState=" + (loc != null ? loc.state() : null) +
                                             ", locNode=" + g.cluster().localNode() + ']');
                                 }
                                 else


[41/50] [abbrv] ignite git commit: IGNITE-10432: Fixed data types in world.sql.

Posted by sb...@apache.org.
IGNITE-10432: Fixed data types in world.sql.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d21f86f9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d21f86f9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d21f86f9

Branch: refs/heads/ignite-10044
Commit: d21f86f9e7817481acbb9438a9e07ca605246807
Parents: 3606b21
Author: devozerov <vo...@gridgain.com>
Authored: Wed Nov 28 11:11:20 2018 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Nov 28 11:11:20 2018 +0300

----------------------------------------------------------------------
 examples/sql/world.sql | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d21f86f9/examples/sql/world.sql
----------------------------------------------------------------------
diff --git a/examples/sql/world.sql b/examples/sql/world.sql
index a34ee71..829fba1 100644
--- a/examples/sql/world.sql
+++ b/examples/sql/world.sql
@@ -2,30 +2,30 @@ DROP TABLE IF EXISTS Country;
 
 CREATE TABLE Country (
   Code CHAR(3) PRIMARY KEY,
-  Name CHAR(52),
-  Continent CHAR(50),
-  Region CHAR(26),
+  Name VARCHAR,
+  Continent VARCHAR,
+  Region VARCHAR,
   SurfaceArea DECIMAL(10,2),
-  IndepYear SMALLINT(6),
-  Population INT(11),
+  IndepYear SMALLINT,
+  Population INT,
   LifeExpectancy DECIMAL(3,1),
   GNP DECIMAL(10,2),
   GNPOld DECIMAL(10,2),
-  LocalName CHAR(45),
-  GovernmentForm CHAR(45),
-  HeadOfState CHAR(60),
-  Capital INT(11),
+  LocalName VARCHAR,
+  GovernmentForm VARCHAR,
+  HeadOfState VARCHAR,
+  Capital INT,
   Code2 CHAR(2)
 ) WITH "template=partitioned, backups=1, CACHE_NAME=Country, VALUE_TYPE=demo.model.Country";
 
 DROP TABLE IF EXISTS City;
 
 CREATE TABLE City (
-  ID INT(11),
-  Name CHAR(35),
+  ID INT,
+  Name VARCHAR,
   CountryCode CHAR(3),
-  District CHAR(20),
-  Population INT(11),
+  District VARCHAR,
+  Population INT,
   PRIMARY KEY (ID, CountryCode)
 ) WITH "template=partitioned, backups=1, affinityKey=CountryCode, CACHE_NAME=City, KEY_TYPE=demo.model.CityKey, VALUE_TYPE=demo.model.City";
 
@@ -35,7 +35,7 @@ DROP TABLE IF EXISTS CountryLanguage;
 
 CREATE TABLE CountryLanguage (
   CountryCode CHAR(3),
-  Language CHAR(30),
+  Language VARCHAR,
   IsOfficial CHAR(2),
   Percentage DECIMAL(4,1),
   PRIMARY KEY (CountryCode, Language)


[24/50] [abbrv] ignite git commit: IGNITE-10002: MVCC: Create "Cache 2" test suite for MVCC mode. This closes #5198.

Posted by sb...@apache.org.
IGNITE-10002: MVCC: Create "Cache 2" test suite for MVCC mode. This closes #5198.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7577c877
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7577c877
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7577c877

Branch: refs/heads/ignite-10044
Commit: 7577c8770eaf29e21f1d46f650af1d8fbd891c42
Parents: c63a60a
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Tue Nov 27 11:45:12 2018 +0300
Committer: Igor Seliverstov <gv...@gmail.com>
Committed: Tue Nov 27 11:45:26 2018 +0300

----------------------------------------------------------------------
 .../apache/ignite/IgniteSystemProperties.java   |   3 +
 .../cache/mvcc/MvccProcessorImpl.java           |  11 +
 .../cache/CacheConcurrentReadThroughTest.java   |   8 +
 .../cache/CacheEnumOperationsAbstractTest.java  |  18 +-
 .../cache/CrossCacheTxRandomOperationsTest.java |  23 +-
 .../cache/GridCacheBasicApiAbstractTest.java    |  27 ++
 .../cache/GridCacheBasicStoreAbstractTest.java  |   8 +
 .../GridCacheEvictionEventAbstractTest.java     |   9 +
 .../GridCacheFinishPartitionsSelfTest.java      |   8 +
 ...idCacheGetAndTransformStoreAbstractTest.java |   8 +
 .../cache/GridCacheOffheapUpdateSelfTest.java   |  17 +-
 .../cache/GridCachePartitionedGetSelfTest.java  |   6 +
 .../GridCacheVariableTopologySelfTest.java      |   9 +
 .../IgniteCacheEntryProcessorNodeJoinTest.java  | 111 ++++---
 .../cache/IgniteCacheIncrementTxTest.java       |   7 +
 .../cache/IgniteCacheNoSyncForGetTest.java      |   8 +
 .../IgniteClientCacheStartFailoverTest.java     |  37 +++
 .../IgniteMvccTxMultiThreadedAbstractTest.java  | 121 +++++++
 .../IgniteMvccTxSingleThreadedAbstractTest.java |  50 +++
 .../cache/IgniteNearClientCacheCloseTest.java   |  22 ++
 .../processors/cache/IgniteTxAbstractTest.java  |  16 +-
 .../IgniteTxMultiThreadedAbstractTest.java      |   1 -
 ...CacheLoadingConcurrentGridStartSelfTest.java |   8 +
 .../CacheLockReleaseNodeLeaveTest.java          |   8 +
 .../GridCacheAbstractPrimarySyncSelfTest.java   |   4 +
 .../GridCacheBasicOpAbstractTest.java           |   8 +
 .../distributed/GridCacheLockAbstractTest.java  |   8 +
 .../GridCacheMultiNodeAbstractTest.java         |   5 +
 .../GridCacheMultiNodeLockAbstractTest.java     |   9 +
 .../GridCacheNodeFailureAbstractTest.java       |   8 +
 ...ridCachePartitionNotLoadedEventSelfTest.java |  13 +-
 ...NearDisabledMvccTxMultiThreadedSelfTest.java |  31 ++
 ...GridCachePreloadRestartAbstractSelfTest.java |  12 +
 .../GridCacheTransformEventSelfTest.java        |  64 +++-
 ...niteCacheClientNodeChangingTopologyTest.java |   8 +
 .../IgniteCacheTxIteratorSelfTest.java          |  27 +-
 .../IgniteMvccTxTimeoutAbstractTest.java        | 146 +++++++++
 .../IgniteTxTimeoutAbstractTest.java            |  39 ++-
 ...heColocatedMvccTxSingleThreadedSelfTest.java |  85 +++++
 .../dht/GridCacheDhtEntrySelfTest.java          |   5 +
 .../dht/GridCacheDhtMappingSelfTest.java        |   8 +
 .../GridCacheDhtPreloadDisabledSelfTest.java    |   8 +
 ...ridCacheDhtPreloadMultiThreadedSelfTest.java |   3 +
 .../dht/GridCacheDhtPreloadPutGetSelfTest.java  |   7 +
 .../dht/GridCacheDhtPreloadSelfTest.java        |   2 -
 .../IgniteCacheClearDuringRebalanceTest.java    |   9 +
 ...artitionedBackupNodeFailureRecoveryTest.java |   2 +-
 .../near/GridCacheNearClientHitTest.java        |   5 +-
 .../near/GridCacheNearMultiGetSelfTest.java     |  73 +++--
 .../near/GridCacheNearMultiNodeSelfTest.java    |  10 +
 .../near/GridCacheNearOneNodeSelfTest.java      |  11 +-
 .../GridCacheNearPartitionedClearSelfTest.java  |   8 +
 .../GridCacheNearReaderPreloadSelfTest.java     |   8 +
 .../near/GridCacheNearReadersSelfTest.java      |  10 +-
 ...ePartitionedBasicStoreMultiNodeSelfTest.java |   6 +
 .../near/GridCachePartitionedEventSelfTest.java |   8 +
 ...titionedExplicitLockNodeFailureSelfTest.java |   8 +
 .../GridCachePartitionedLoadCacheSelfTest.java  |   8 +
 ...ePartitionedMvccTxMultiThreadedSelfTest.java | 101 ++++++
 ...PartitionedMvccTxSingleThreadedSelfTest.java |  84 +++++
 ...idCachePartitionedMvccTxTimeoutSelfTest.java |  47 +++
 ...achePartitionedPreloadLifecycleSelfTest.java |   1 -
 .../GridCachePartitionedTxTimeoutSelfTest.java  |  21 --
 .../near/GridNearCacheStoreUpdateTest.java      |   9 +
 .../near/NearCacheSyncUpdateTest.java           |  17 +
 .../near/NoneRebalanceModeSelfTest.java         |   9 +
 .../GridCacheReplicatedTxTimeoutSelfTest.java   |  18 --
 .../local/GridCacheLocalBasicApiSelfTest.java   |   8 +
 .../local/GridCacheLocalBasicStoreSelfTest.java |   8 +
 .../local/GridCacheLocalEventSelfTest.java      |   9 +
 .../GridCacheLocalEvictionEventSelfTest.java    |   8 +
 ...dCacheLocalGetAndTransformStoreSelfTest.java |   8 +
 .../GridCacheLocalIsolatedNodesSelfTest.java    |   8 +
 .../local/GridCacheLocalLoadAllSelfTest.java    |   8 +
 .../cache/local/GridCacheLocalLockSelfTest.java |   8 +
 .../GridCacheLocalMultithreadedSelfTest.java    |   8 +
 .../GridCacheLocalTxMultiThreadedSelfTest.java  |   9 +
 .../GridCacheLocalTxSingleThreadedSelfTest.java |   8 +
 .../local/GridCacheLocalTxTimeoutSelfTest.java  |   8 +
 .../testframework/MvccFeatureChecker.java       | 137 ++++++++
 .../testsuites/IgniteCacheMvccTestSuite2.java   | 197 ++++++++++++
 .../testsuites/IgniteCacheTestSuite2.java       | 321 ++++++++++---------
 .../testsuites/IgniteCacheTestSuite6.java       |   3 -
 83 files changed, 1949 insertions(+), 324 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/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 2d27840..3c59ea1 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -1039,6 +1039,9 @@ public final class IgniteSystemProperties {
      */
     public static final String IGNITE_ALLOW_START_CACHES_IN_PARALLEL = "IGNITE_ALLOW_START_CACHES_IN_PARALLEL";
 
+    /** For test purposes only. Force Mvcc mode. */
+    public static final String IGNITE_FORCE_MVCC_MODE_IN_TESTS = "IGNITE_FORCE_MVCC_MODE_IN_TESTS";
+
     /**
      * Allows to log additional information about all restored partitions after binary and logical recovery phases.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/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 c6515c2..3ea8f4c 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
@@ -34,6 +34,7 @@ import java.util.stream.Collectors;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.IgniteSystemProperties;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.DataRegionConfiguration;
@@ -106,6 +107,7 @@ import org.apache.ignite.thread.IgniteThread;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
 import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
 import static org.apache.ignite.events.EventType.EVT_NODE_JOINED;
@@ -134,6 +136,10 @@ import static org.apache.ignite.internal.processors.cache.persistence.CacheDataR
 @SuppressWarnings("serial")
 public class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, DatabaseLifecycleListener {
     /** */
+    private static final boolean FORCE_MVCC =
+        IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, false);
+
+    /** */
     private static final IgniteProductVersion MVCC_SUPPORTED_SINCE = IgniteProductVersion.fromString("2.7.0");
 
     /** */
@@ -262,6 +268,11 @@ public class MvccProcessorImpl extends GridProcessorAdapter implements MvccProce
 
     /** {@inheritDoc} */
     @Override public void preProcessCacheConfiguration(CacheConfiguration ccfg) {
+        if (FORCE_MVCC && ccfg.getAtomicityMode() == TRANSACTIONAL && !CU.isSystemCache(ccfg.getName())) {
+            ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
+            ccfg.setNearConfiguration(null);
+        }
+
         if (ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) {
             if (!mvccSupported)
                 throw new IgniteException("Cannot start MVCC transactional cache. " +

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java
index 26f54a2..1e8ed4d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.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;
 
 /**
@@ -50,6 +51,13 @@ public class CacheConcurrentReadThroughTest extends GridCommonAbstractTest {
     private boolean client;
 
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
index 148b60e..480d959 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
@@ -32,11 +32,15 @@ import org.apache.ignite.marshaller.Marshaller;
 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.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.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.junit.Assert.fail;
 
 /**
  *
@@ -92,7 +96,19 @@ public abstract class CacheEnumOperationsAbstractTest extends GridCommonAbstract
      * @throws Exception If failed.
      */
     public void testTx() throws Exception {
-        CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED, 1, ATOMIC);
+        CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED, 1, TRANSACTIONAL);
+
+        enumOperations(ccfg);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testMvccTx() throws Exception {
+        if (!singleNode())
+            fail("https://issues.apache.org/jira/browse/IGNITE-7187");
+
+        CacheConfiguration<Object, Object> ccfg = cacheConfiguration(PARTITIONED, 1, TRANSACTIONAL_SNAPSHOT);
 
         enumOperations(ccfg);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
index cc9823b..cba3771 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
@@ -38,6 +38,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 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;
@@ -92,6 +93,9 @@ public class CrossCacheTxRandomOperationsTest extends GridCommonAbstractTest {
 
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
+        if (nearCacheEnabled())
+            MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
         super.beforeTestsStarted();
 
         startGridsMultiThreaded(GRID_CNT - 1);
@@ -194,6 +198,13 @@ public class CrossCacheTxRandomOperationsTest extends GridCommonAbstractTest {
     private void txOperations(CacheMode cacheMode,
         CacheWriteSynchronizationMode writeSync,
         boolean crossCacheTx) throws Exception {
+        if (MvccFeatureChecker.forcedMvcc()) {
+            assert !nearCacheEnabled();
+
+            if(writeSync != CacheWriteSynchronizationMode.FULL_SYNC)
+                return;
+        }
+
         Ignite ignite = ignite(0);
 
         try {
@@ -203,12 +214,14 @@ public class CrossCacheTxRandomOperationsTest extends GridCommonAbstractTest {
             txOperations(PESSIMISTIC, REPEATABLE_READ, crossCacheTx, false);
             txOperations(PESSIMISTIC, REPEATABLE_READ, crossCacheTx, true);
 
-            txOperations(OPTIMISTIC, REPEATABLE_READ, crossCacheTx, false);
-            txOperations(OPTIMISTIC, REPEATABLE_READ, crossCacheTx, true);
+            if(!MvccFeatureChecker.forcedMvcc()) {
+                txOperations(OPTIMISTIC, REPEATABLE_READ, crossCacheTx, false);
+                txOperations(OPTIMISTIC, REPEATABLE_READ, crossCacheTx, true);
 
-            if (writeSync == FULL_SYNC) {
-                txOperations(OPTIMISTIC, SERIALIZABLE, crossCacheTx, false);
-                txOperations(OPTIMISTIC, SERIALIZABLE, crossCacheTx, true);
+                if (writeSync == FULL_SYNC) {
+                    txOperations(OPTIMISTIC, SERIALIZABLE, crossCacheTx, false);
+                    txOperations(OPTIMISTIC, SERIALIZABLE, crossCacheTx, true);
+                }
             }
         }
         finally {

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java
index f766d01..0b7de6e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java
@@ -38,6 +38,7 @@ import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestThread;
+import org.apache.ignite.testframework.MvccFeatureChecker;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jetbrains.annotations.Nullable;
 
@@ -89,6 +90,8 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws Exception If test failed.
      */
     public void testBasicLock() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
         IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         Lock lock = cache.lock(1);
@@ -106,6 +109,8 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws IgniteCheckedException If test failed.
      */
     public void testSingleLockReentry() throws IgniteCheckedException {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
         IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         Lock lock = cache.lock(1);
@@ -134,6 +139,8 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws Exception If test failed.
      */
     public void testReentry() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
         IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         Lock lock = cache.lock(1);
@@ -173,6 +180,8 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      *
      */
     public void testInterruptLock() throws InterruptedException {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
         final IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         final Lock lock = cache.lock(1);
@@ -217,6 +226,8 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      *
      */
     public void testInterruptLockWithTimeout() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
         final IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         startGrid(1);
@@ -276,6 +287,8 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws IgniteCheckedException If test failed.
      */
     public void testManyLockReentries() throws IgniteCheckedException {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
         IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         Integer key = 1;
@@ -319,6 +332,8 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws Exception If test failed.
      */
     public void testLockMultithreaded() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
         final IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         final CountDownLatch l1 = new CountDownLatch(1);
@@ -437,6 +452,9 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws Exception If error occur.
      */
     public void testBasicOps() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS);
+
         IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         CountDownLatch latch = new CountDownLatch(1);
@@ -498,6 +516,9 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws Exception If error occur.
      */
     public void testBasicOpsWithReentry() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS);
+
         IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         int key = (int)System.currentTimeMillis();
@@ -570,6 +591,8 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws Exception If test failed.
      */
     public void testMultiLocks() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
         IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         Collection<Integer> keys = Arrays.asList(1, 2, 3);
@@ -625,6 +648,10 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws Exception In case of error.
      */
     public void testPutWithExpiration() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.EXPIRATION);
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS);
+
         IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         CacheEventListener lsnr = new CacheEventListener(new CountDownLatch(1));

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java
index 1ae8be2..3ebb398 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java
@@ -33,6 +33,7 @@ import org.apache.ignite.internal.util.typedef.P2;
 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.jetbrains.annotations.Nullable;
@@ -53,6 +54,13 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract
     /** Cache store. */
     private static final GridCacheTestStore store = new GridCacheTestStore();
 
+    /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+        super.setUp();
+    }
+
     /**
      *
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEventAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEventAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEventAbstractTest.java
index 554a7a9..b2c87a9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEventAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEventAbstractTest.java
@@ -35,6 +35,7 @@ import org.apache.ignite.lang.IgnitePredicate;
 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.events.EventType.EVT_CACHE_ENTRY_EVICTED;
@@ -49,6 +50,14 @@ public abstract class GridCacheEvictionEventAbstractTest extends GridCommonAbstr
     /** */
     private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 
+    /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.EVICTION);
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS);
+
+        super.setUp();
+    }
+
     /**
      *
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java
index 9732272..d60e4c6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java
@@ -34,6 +34,7 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.util.typedef.CI1;
 import org.apache.ignite.internal.util.typedef.F;
 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;
@@ -57,6 +58,13 @@ public class GridCacheFinishPartitionsSelfTest extends GridCacheAbstractSelfTest
     }
 
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
         grid = (IgniteKernal)grid(0);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGetAndTransformStoreAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGetAndTransformStoreAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGetAndTransformStoreAbstractTest.java
index f140945..af9751f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGetAndTransformStoreAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGetAndTransformStoreAbstractTest.java
@@ -32,6 +32,7 @@ import org.apache.ignite.internal.IgniteInternalFuture;
 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;
@@ -48,6 +49,13 @@ public abstract class GridCacheGetAndTransformStoreAbstractTest extends GridComm
     /** Cache store. */
     private static final GridCacheTestStore store = new GridCacheTestStore();
 
+    /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+        super.setUp();
+    }
+
     /**
      *
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapUpdateSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapUpdateSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapUpdateSelfTest.java
index b8f6858..cf16417 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapUpdateSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapUpdateSelfTest.java
@@ -127,12 +127,19 @@ public class GridCacheOffheapUpdateSelfTest extends GridCommonAbstractTest {
 
             assertEquals(10, cache.get(key));
 
-            try (Transaction ignored = grid.transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) {
-                assertEquals(10, cache.get(key));
+            if(((IgniteCacheProxy)cache).context().config().getAtomicityMode() != CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) {
+                try (Transaction ignored = grid.transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) {
+                    assertEquals(10, cache.get(key));
+                }
+
+                try (Transaction ignored = grid.transactions().txStart(PESSIMISTIC, READ_COMMITTED)) {
+                    assertEquals(10, cache.get(key));
+                }
             }
-
-            try (Transaction ignored = grid.transactions().txStart(PESSIMISTIC, READ_COMMITTED)) {
-                assertEquals(10, cache.get(key));
+            else {
+                try (Transaction ignored = grid.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
+                    assertEquals(10, cache.get(key));
+                }
             }
         }
         finally {

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedGetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedGetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedGetSelfTest.java
index 1ed5a12..f4c32ee 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedGetSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedGetSelfTest.java
@@ -33,6 +33,7 @@ import org.apache.ignite.spi.discovery.DiscoverySpi;
 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;
@@ -129,6 +130,11 @@ public class GridCachePartitionedGetSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testGetFromBackupNode() throws Exception {
+        if (MvccFeatureChecker.forcedMvcc())
+            fail("https://issues.apache.org/jira/browse/IGNITE-10274");
+
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.EVICTION);
+
         for (int i = 0; i < GRID_CNT; i++) {
             IgniteCache<String, Integer> c = grid(i).cache(DEFAULT_CACHE_NAME);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/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 25817a1..b9f7a35 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
@@ -35,6 +35,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.TransactionRollbackException;
@@ -52,6 +53,14 @@ public class GridCacheVariableTopologySelfTest extends GridCommonAbstractTest {
     /** */
     private TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 
+    /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        if (MvccFeatureChecker.forcedMvcc())
+            fail("https://issues.apache.org/jira/browse/IGNITE-7388");
+
+        super.setUp();
+    }
+
     /** Constructs test. */
     public GridCacheVariableTopologySelfTest() {
         super(/* don't start grid */ false);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java
index d6afb49..5f99b55 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java
@@ -43,9 +43,11 @@ 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.GridTestUtils.SF;
+import org.apache.ignite.testframework.MvccFeatureChecker;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 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.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
@@ -115,7 +117,7 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
 
     /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
-        startGrids(GRID_CNT);
+        startGridsMultiThreaded(GRID_CNT, true);
     }
 
     /** {@inheritDoc} */
@@ -141,10 +143,13 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
      * @throws Exception If failed.
      */
     public void testEntryProcessorNodeLeave() throws Exception {
+        if (MvccFeatureChecker.forcedMvcc())
+            fail("https://issues.apache.org/jira/browse/IGNITE-10254");
+
         startGrid(GRID_CNT);
 
         // TODO: IGNITE-1525 (test fails with one-phase commit).
-        boolean createCache = atomicityMode() == TRANSACTIONAL;
+        boolean createCache = atomicityMode() != ATOMIC;
 
         String cacheName = DEFAULT_CACHE_NAME;
 
@@ -212,32 +217,34 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
      * @throws Exception If failed.
      */
     private void checkEntryProcessorNodeJoin(boolean invokeAll) throws Exception {
+        if (MvccFeatureChecker.forcedMvcc())
+            fail("https://issues.apache.org/jira/browse/IGNITE-10391");
+
         final AtomicBoolean stop = new AtomicBoolean();
         final AtomicReference<Throwable> error = new AtomicReference<>();
         final int started = 6;
 
-        try {
-            IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
-                @Override public void run() {
-                    try {
-                        for (int i = 0; i < started; i++) {
-                            U.sleep(1_000);
+        IgniteInternalFuture fut = GridTestUtils.runAsync(new Runnable() {
+            @Override public void run() {
+                try {
+                    for (int i = 0; i < started && !stop.get(); i++) {
+                        U.sleep(1_000);
 
+                        if (!stop.get())
                             startGrid(GRID_CNT + i);
-                        }
-                    }
-                    catch (Exception e) {
-                        error.compareAndSet(null, e);
                     }
                 }
-            }, 1, "starter");
+                catch (Exception e) {
+                    error.compareAndSet(null, e);
+                }
+            }
+        }, "starter");
 
+        try {
             try {
                 checkIncrement(DEFAULT_CACHE_NAME, invokeAll, null, null);
             }
             finally {
-                stop.set(true);
-
                 fut.get(getTestTimeout());
             }
 
@@ -251,8 +258,10 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
             }
         }
         finally {
-            for (int i = 0; i < started; i++)
-                stopGrid(GRID_CNT + i);
+            stop.set(true);
+
+            if (!fut.isDone())
+                fut.cancel();
         }
     }
 
@@ -331,51 +340,51 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
         final AtomicReference<Throwable> error = new AtomicReference<>();
         final int started = 6;
 
-        try {
-            int keys = 100;
+        int keys = 100;
 
-            final AtomicBoolean done = new AtomicBoolean(false);
+        final AtomicBoolean stop = new AtomicBoolean(false);
 
-            for (int i = 0; i < keys; i++)
-                ignite(0).cache(DEFAULT_CACHE_NAME).put(i, 0);
+        for (int i = 0; i < keys; i++)
+            ignite(0).cache(DEFAULT_CACHE_NAME).put(i, 0);
 
-            IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
-                @Override public void run() {
-                    try {
-                        for (int i = 0; i < started; i++) {
-                            U.sleep(1_000);
+        IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
+            @Override public void run() {
+                try {
+                    for (int i = 0; i < started && !stop.get(); i++) {
+                        U.sleep(1_000);
 
-                            IgniteEx grid = startGrid(GRID_CNT + i);
+                        if (stop.get())
+                            continue;
 
-                            info("Test started grid [idx=" + (GRID_CNT + i) + ", nodeId=" + grid.localNode().id() + ']');
-                        }
-                    }
-                    catch (Exception e) {
-                        error.compareAndSet(null, e);
-                    }
-                    finally {
-                        done.set(true);
+                        IgniteEx grid = startGrid(GRID_CNT + i);
+
+                        info("Test started grid [idx=" + (GRID_CNT + i) + ", nodeId=" + grid.localNode().id() + ']');
                     }
                 }
-            }, 1, "starter");
+                catch (Exception e) {
+                    error.compareAndSet(null, e);
+                }
+                finally {
+                    stop.set(true);
+                }
+            }
+        }, 1, "starter");
 
+        try {
             int updVal = 0;
 
-            try {
-                while (!done.get()) {
-                    info("Will put: " + (updVal + 1));
+            while (!stop.get()) {
+                info("Will put: " + (updVal + 1));
 
-                    for (int i = 0; i < keys; i++)
-                        assertTrue("Failed [key=" + i + ", oldVal=" + updVal + ']',
-                            ignite(0).cache(DEFAULT_CACHE_NAME).replace(i, updVal, updVal + 1));
+                for (int i = 0; i < keys; i++)
+                    assertTrue("Failed [key=" + i + ", oldVal=" + updVal + ']',
+                        ignite(0).cache(DEFAULT_CACHE_NAME).replace(i, updVal, updVal + 1));
 
-                    updVal++;
-                }
-            }
-            finally {
-                fut.get(getTestTimeout());
+                updVal++;
             }
 
+            fut.get(getTestTimeout());
+
             for (int i = 0; i < keys; i++) {
                 for (int g = 0; g < GRID_CNT + started; g++) {
                     Integer val = ignite(g).<Integer, Integer>cache(DEFAULT_CACHE_NAME).get(i);
@@ -390,8 +399,10 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
             }
         }
         finally {
-            for (int i = 0; i < started; i++)
-                stopGrid(GRID_CNT + i);
+            stop.set(true);
+
+            if (!fut.isDone())
+                fut.cancel();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheIncrementTxTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheIncrementTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheIncrementTxTest.java
index b3a5055..918d655 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheIncrementTxTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheIncrementTxTest.java
@@ -36,6 +36,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;
 
@@ -88,6 +89,9 @@ public class IgniteCacheIncrementTxTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testIncrementTxTopologyChange1() throws Exception {
+        if (MvccFeatureChecker.forcedMvcc())
+            fail("https://issues.apache.org/jira/browse/IGNITE-10264");
+
         nodeJoin(cacheConfiguration(1));
     }
 
@@ -95,6 +99,9 @@ public class IgniteCacheIncrementTxTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testIncrementTxTopologyChange2() throws Exception {
+        if (MvccFeatureChecker.forcedMvcc())
+            fail("https://issues.apache.org/jira/browse/IGNITE-10264");
+
         nodeJoin(cacheConfiguration(2));
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoSyncForGetTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoSyncForGetTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoSyncForGetTest.java
index b14fecc..6324df4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoSyncForGetTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoSyncForGetTest.java
@@ -47,6 +47,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.CacheWriteSynchronizationMode.FULL_SYNC;
 
 /**
@@ -103,6 +104,13 @@ public class IgniteCacheNoSyncForGetTest extends GridCommonAbstractTest {
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testMvccTxGet() throws Exception {
+        getTest(TRANSACTIONAL_SNAPSHOT);
+    }
+
+    /**
      * @param atomicityMode Cache atomicity mode.
      * @throws Exception If failed.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/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 a2d9da7..fa7d0a8 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
@@ -56,6 +56,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.CacheWriteSynchronizationMode.FULL_SYNC;
 
 /**
@@ -82,6 +83,13 @@ public class IgniteClientCacheStartFailoverTest extends GridCommonAbstractTest {
     }
 
     /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        client = false;
+    }
+
+    /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
         stopAllGrids();
 
@@ -103,6 +111,13 @@ public class IgniteClientCacheStartFailoverTest extends GridCommonAbstractTest {
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testClientStartCoordinatorFailsMvccTx() throws Exception {
+        clientStartCoordinatorFails(TRANSACTIONAL_SNAPSHOT);
+    }
+
+    /**
      * @param atomicityMode Cache atomicity mode.
      * @throws Exception If failed.
      */
@@ -164,6 +179,16 @@ public class IgniteClientCacheStartFailoverTest extends GridCommonAbstractTest {
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testClientStartLastServerFailsMvccTx() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-10262");
+
+        clientStartLastServerFails(TRANSACTIONAL_SNAPSHOT);
+    }
+
+
+    /**
      * @param atomicityMode Cache atomicity mode.
      * @throws Exception If failed.
      */
@@ -547,6 +572,18 @@ public class IgniteClientCacheStartFailoverTest extends GridCommonAbstractTest {
             cache.putAll(map);
         }
 
+        //TODO: uncomment TRANSACTIONAL_SNAPSHOT cache creation when IGNITE-9470 will be fixed.
+       /* for (int i = 0; i < 3; i++) {
+            CacheConfiguration<Object, Object> ccfg = cacheConfiguration("mvcc-" + i, TRANSACTIONAL_SNAPSHOT, i);
+
+            IgniteCache<Object, Object> cache = node.createCache(ccfg);
+
+            cacheNames.add(ccfg.getName());
+
+            cache.putAll(map);
+        }*/
+
+
         return cacheNames;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMvccTxMultiThreadedAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMvccTxMultiThreadedAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMvccTxMultiThreadedAbstractTest.java
new file mode 100644
index 0000000..9e4609b
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMvccTxMultiThreadedAbstractTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
+
+/**
+ * Tests for local transactions.
+ */
+public abstract class IgniteMvccTxMultiThreadedAbstractTest extends IgniteTxAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9470");
+
+        super.beforeTestsStarted();
+    }
+
+    /**
+     * @return Thread count.
+     */
+    protected abstract int threadCount();
+
+    /**
+     /**
+     * @throws IgniteCheckedException If test failed.
+     */
+    public void testPessimisticRepeatableReadCommitMultithreaded() throws Exception {
+        checkCommitMultithreaded(PESSIMISTIC, REPEATABLE_READ);
+
+        finalChecks();
+    }
+
+    /**
+     * @throws IgniteCheckedException If test failed.
+     */
+    public void testPessimisticRepeatableReadRollbackMultithreaded() throws Exception {
+        checkRollbackMultithreaded(PESSIMISTIC, REPEATABLE_READ);
+
+        finalChecks();
+    }
+
+    /**
+     * @param concurrency Concurrency.
+     * @param isolation Isolation.
+     * @throws Exception If check failed.
+     */
+    protected void checkCommitMultithreaded(final TransactionConcurrency concurrency,
+        final TransactionIsolation isolation) throws Exception {
+        GridTestUtils.runMultiThreaded(new Callable<Object>() {
+            @Nullable @Override public Object call() throws Exception {
+                Thread t = Thread.currentThread();
+
+                t.setName(t.getName() + "-id-" + t.getId());
+
+                info("Starting commit thread: " + Thread.currentThread().getName());
+
+                try {
+                    checkCommit(concurrency, isolation);
+                }
+                finally {
+                    info("Finished commit thread: " + Thread.currentThread().getName());
+                }
+
+                return null;
+            }
+        }, threadCount(), concurrency + "-" + isolation);
+    }
+
+    /**
+     * @param concurrency Concurrency.
+     * @param isolation Isolation.
+     * @throws Exception If check failed.
+     */
+    protected void checkRollbackMultithreaded(final TransactionConcurrency concurrency,
+        final TransactionIsolation isolation) throws Exception {
+        final ConcurrentMap<Integer, String> map = new ConcurrentHashMap<>();
+        GridTestUtils.runMultiThreaded(new Callable<Object>() {
+            @Nullable @Override public Object call() throws Exception {
+                Thread t = Thread.currentThread();
+
+                t.setName(t.getName() + "-id-" + t.getId());
+
+                info("Starting rollback thread: " + Thread.currentThread().getName());
+
+                try {
+                    checkRollback(map, concurrency, isolation);
+
+                    return null;
+                }
+                finally {
+                    info("Finished rollback thread: " + Thread.currentThread().getName());
+                }
+            }
+        }, threadCount(), concurrency + "-" + isolation);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMvccTxSingleThreadedAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMvccTxSingleThreadedAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMvccTxSingleThreadedAbstractTest.java
new file mode 100644
index 0000000..b9e7cee
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMvccTxSingleThreadedAbstractTest.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.internal.processors.cache;
+
+import org.apache.ignite.IgniteCheckedException;
+
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
+
+/**
+ * Tests for local transactions.
+ */
+public abstract class IgniteMvccTxSingleThreadedAbstractTest extends IgniteTxAbstractTest {
+    /**
+     * @throws IgniteCheckedException If test failed.
+     */
+    public void testPessimisticRepeatableReadCommit() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-10261");
+
+        checkCommit(PESSIMISTIC, REPEATABLE_READ);
+
+        finalChecks();
+    }
+
+    /**
+     * @throws IgniteCheckedException If test failed.
+     */
+    public void testPessimisticRepeatableReadRollback() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-10261");
+
+        checkRollback(PESSIMISTIC, REPEATABLE_READ);
+
+        finalChecks();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteNearClientCacheCloseTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteNearClientCacheCloseTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteNearClientCacheCloseTest.java
index e7ab805..0ca0f3e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteNearClientCacheCloseTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteNearClientCacheCloseTest.java
@@ -37,10 +37,12 @@ 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.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;
 
 /**
@@ -108,6 +110,26 @@ public class IgniteNearClientCacheCloseTest extends GridCommonAbstractTest {
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testNearCacheCloseMvccTx1() throws Exception {
+        nearCacheClose(1, false, TRANSACTIONAL_SNAPSHOT);
+
+        if (MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE))
+            nearCacheClose(1, true, TRANSACTIONAL_SNAPSHOT);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNearCacheCloseMvccTx2() throws Exception {
+        nearCacheClose(4, false, TRANSACTIONAL_SNAPSHOT);
+
+        if (MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE))
+            nearCacheClose(4, true, TRANSACTIONAL_SNAPSHOT);
+    }
+
+    /**
      * @param srvs Number of server nodes.
      * @param srvNearCache {@code True} to enable near cache on server nodes.
      * @param atomicityMode Cache atomicity mode.

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
index 1830db0..3ae4224 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
@@ -57,7 +57,7 @@ abstract class IgniteTxAbstractTest extends GridCommonAbstractTest {
     private static final AtomicInteger cntr = new AtomicInteger();
 
     /** */
-    private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+    private final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 
     /**
      * Start grid by default.
@@ -115,12 +115,16 @@ abstract class IgniteTxAbstractTest extends GridCommonAbstractTest {
             info(msg);
     }
 
-    /**
-     * @throws Exception If failed.
-     */
+    /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
-        for (int i = 0; i < gridCount(); i++)
-            startGrid(i);
+        startGridsMultiThreaded(gridCount());
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+
+        super.afterTestsStopped();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiThreadedAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiThreadedAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiThreadedAbstractTest.java
index 9a385a3..65dc2e7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiThreadedAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiThreadedAbstractTest.java
@@ -85,7 +85,6 @@ public abstract class IgniteTxMultiThreadedAbstractTest extends IgniteTxAbstract
     protected void checkRollbackMultithreaded(final TransactionConcurrency concurrency,
         final TransactionIsolation isolation) throws Exception {
         final ConcurrentMap<Integer, String> map = new ConcurrentHashMap<>();
-
         GridTestUtils.runMultiThreaded(new Callable<Object>() {
             @Nullable @Override public Object call() throws Exception {
                 Thread t = Thread.currentThread();

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/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 5cb206f..10d04bd 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
@@ -49,6 +49,7 @@ import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
 import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jetbrains.annotations.Nullable;
 
@@ -80,6 +81,13 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
     protected volatile boolean restarts;
 
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java
index 852e855..844a430 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java
@@ -36,6 +36,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;
 
@@ -56,6 +57,13 @@ public class CacheLockReleaseNodeLeaveTest extends GridCommonAbstractTest {
     private static final String REPLICATED_TEST_CACHE = "REPLICATED_TEST_CACHE";
 
     /** {@inheritDoc} */
+    @Override public void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPrimarySyncSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPrimarySyncSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPrimarySyncSelfTest.java
index 625cb18..f6b9302 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPrimarySyncSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPrimarySyncSelfTest.java
@@ -24,6 +24,7 @@ import org.apache.ignite.configuration.NearCacheConfiguration;
 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;
 
@@ -70,6 +71,9 @@ public abstract class GridCacheAbstractPrimarySyncSelfTest extends GridCommonAbs
 
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
+        if (nearConfiguration() != null)
+            MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
         assert GRID_CNT > 1;
 
         startGrids(GRID_CNT);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java
index a55ff2d..0398813 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java
@@ -32,6 +32,7 @@ import org.apache.ignite.lang.IgnitePredicate;
 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;
 
@@ -73,6 +74,11 @@ public abstract class GridCacheBasicOpAbstractTest extends GridCommonAbstractTes
 
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS);
+
+        if (MvccFeatureChecker.forcedMvcc())
+            fail("https://issues.apache.org/jira/browse/IGNITE-7952");
+
         startGridsMultiThreaded(3);
 
         ignite1 = grid(0);
@@ -327,6 +333,8 @@ public abstract class GridCacheBasicOpAbstractTest extends GridCommonAbstractTes
      * @throws Exception In case of error.
      */
     public void testPutWithExpiration() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.EXPIRATION);
+
         IgniteCache<String, String> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
         IgniteCache<String, String> cache2 = ignite2.cache(DEFAULT_CACHE_NAME);
         IgniteCache<String, String> cache3 = ignite3.cache(DEFAULT_CACHE_NAME);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java
index 48b9a20..5909213 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java
@@ -38,6 +38,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestThread;
 import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jetbrains.annotations.Nullable;
 
@@ -65,6 +66,13 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
     /** Ip-finder. */
     private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 
+    /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
+        super.setUp();
+    }
+
     /**
      *
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
index 1d56ab6..912aece 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
@@ -35,6 +35,7 @@ import org.apache.ignite.lang.IgnitePredicate;
 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 java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -87,6 +88,8 @@ public abstract class GridCacheMultiNodeAbstractTest extends GridCommonAbstractT
 
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS);
+
         ignite1 = startGrid(1);
         ignite2 = startGrid(2);
         ignite3 = startGrid(3);
@@ -228,6 +231,8 @@ public abstract class GridCacheMultiNodeAbstractTest extends GridCommonAbstractT
      * @throws Exception If test failed.
      */
     public void testLockUnlock() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
         CacheEventListener lockLsnr1 = new CacheEventListener(ignite1, new CountDownLatch(1), EVT_CACHE_OBJECT_LOCKED);
 
         addListener(ignite1, lockLsnr1, EVT_CACHE_OBJECT_LOCKED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java
index cc3b894..6636196 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java
@@ -38,6 +38,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.GridTestThread;
+import org.apache.ignite.testframework.MvccFeatureChecker;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jetbrains.annotations.Nullable;
 
@@ -63,6 +64,14 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
     /** Listeners. */
     private static Collection<IgnitePredicate<Event>> lsnrs = new ArrayList<>();
 
+    /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS);
+
+        super.setUp();
+    }
+
     /**
      *
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
index 8de2d79..6375e3e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
@@ -37,6 +37,7 @@ import org.apache.ignite.lang.IgniteFuture;
 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;
@@ -75,6 +76,13 @@ public abstract class GridCacheNodeFailureAbstractTest extends GridCommonAbstrac
     /** Grid instances. */
     private static final List<Ignite> IGNITEs = new ArrayList<>();
 
+    /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
+        super.setUp();
+    }
+
     /**
      * Start grid by default.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/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 334608d..f5695ca 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
@@ -40,6 +40,7 @@ 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.GridTestUtils.SF;
+import org.apache.ignite.testframework.MvccFeatureChecker;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.util.TestTcpCommunicationSpi;
 
@@ -57,6 +58,13 @@ public class GridCachePartitionNotLoadedEventSelfTest extends GridCommonAbstract
     private int backupCnt;
 
     /** {@inheritDoc} */
+    @Override public void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
@@ -101,10 +109,7 @@ public class GridCachePartitionNotLoadedEventSelfTest extends GridCommonAbstract
     public void testPrimaryAndBackupDead() throws Exception {
         backupCnt = 1;
 
-        startGrid(0);
-        startGrid(1);
-        startGrid(2);
-        startGrid(3);
+        startGridsMultiThreaded(4);
 
         awaitPartitionMapExchange();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedNearDisabledMvccTxMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedNearDisabledMvccTxMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedNearDisabledMvccTxMultiThreadedSelfTest.java
new file mode 100644
index 0000000..cf8115c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedNearDisabledMvccTxMultiThreadedSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMvccTxMultiThreadedSelfTest;
+
+/**
+ *
+ */
+public class GridCachePartitionedNearDisabledMvccTxMultiThreadedSelfTest
+    extends GridCachePartitionedMvccTxMultiThreadedSelfTest {
+    /** {@inheritDoc} */
+    @Override protected boolean nearEnabled() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadRestartAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadRestartAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadRestartAbstractSelfTest.java
index 2ea1ed8..8ef5fb8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadRestartAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadRestartAbstractSelfTest.java
@@ -27,6 +27,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;
@@ -97,6 +98,14 @@ public abstract class GridCachePreloadRestartAbstractSelfTest extends GridCommon
     private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        if (nearEnabled())
+            MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
 
@@ -197,6 +206,9 @@ public abstract class GridCachePreloadRestartAbstractSelfTest extends GridCommon
      * @throws Exception If failed.
      */
     public void testDisabledPreloadRestart() throws Exception {
+        if (MvccFeatureChecker.forcedMvcc())
+            fail("https://issues.apache.org/jira/browse/IGNITE-10261");
+
         preloadMode = NONE;
 
         checkRestart();

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
index 913321e..8cb0885 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
@@ -49,6 +49,7 @@ import org.apache.ignite.transactions.TransactionIsolation;
 
 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;
@@ -74,6 +75,9 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest {
     /** Cache name. */
     private static final String CACHE_NAME = "cache";
 
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
     /** Key 1. */
     private Integer key1;
 
@@ -83,9 +87,6 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest {
     /** Two keys in form of a set. */
     private Set<Integer> keys;
 
-    /** IP finder. */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
     /** Nodes. */
     private Ignite[] ignites;
 
@@ -328,6 +329,17 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Test TRANSACTIONAL_SNAPSHOT LOCAL cache with PESSIMISTIC/REPEATABLE_READ transaction.
+     *
+     * @throws Exception If failed.
+     */
+    public void testMvccTxLocalPessimisticRepeatableRead() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9530");
+
+        checkMvccTx(LOCAL, PESSIMISTIC, REPEATABLE_READ);
+    }
+
+    /**
      * Test TRANSACTIONAL PARTITIONED cache with OPTIMISTIC/REPEATABLE_READ transaction.
      *
      * @throws Exception If failed.
@@ -382,6 +394,18 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Test TRANSACTIONAL_SNAPSHOT PARTITIONED cache with PESSIMISTIC/REPEATABLE_READ transaction.
+     *
+     * @throws Exception If failed.
+     */
+    public void testMvccTxPartitionedPessimisticRepeatableRead() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9321");
+
+        checkMvccTx(PARTITIONED, PESSIMISTIC, REPEATABLE_READ);
+    }
+
+
+    /**
      * Test TRANSACTIONAL REPLICATED cache with OPTIMISTIC/REPEATABLE_READ transaction.
      *
      * @throws Exception If failed.
@@ -436,6 +460,17 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Test TRANSACTIONAL_SNAPSHOT REPLICATED cache with PESSIMISTIC/REPEATABLE_READ transaction.
+     *
+     * @throws Exception If failed.
+     */
+    public void testMvccTxReplicatedPessimisticRepeatableRead() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9321");
+
+        checkMvccTx(REPLICATED, PESSIMISTIC, REPEATABLE_READ);
+    }
+
+    /**
      * Test ATOMIC LOCAL cache.
      *
      * @throws Exception If failed.
@@ -495,6 +530,21 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Check TRANSACTIONAL_SNAPSHOT cache.
+     *
+     * @param cacheMode Cache mode.
+     * @param txConcurrency TX concurrency.
+     * @param txIsolation TX isolation.
+     * @throws Exception If failed.
+     */
+    private void checkMvccTx(CacheMode cacheMode, TransactionConcurrency txConcurrency,
+        TransactionIsolation txIsolation) throws Exception {
+        initialize(cacheMode, TRANSACTIONAL_SNAPSHOT, txConcurrency, txIsolation);
+
+        checkTx0();
+    }
+
+    /**
      * Check TRANSACTIONAL cache.
      *
      * @param cacheMode Cache mode.
@@ -506,6 +556,14 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest {
         TransactionIsolation txIsolation) throws Exception {
         initialize(cacheMode, TRANSACTIONAL, txConcurrency, txIsolation);
 
+        checkTx0();
+    }
+
+    /**
+     * Check TX cache.
+     */
+    private void checkTx0()  {
+
         System.out.println("BEFORE: " + evts.size());
 
         caches[0].invoke(key1, new Transformer());


[14/50] [abbrv] ignite git commit: IGNITE-9937 Primary response error can be lost due to unwrapping a key - Fixes #5078.

Posted by sb...@apache.org.
IGNITE-9937 Primary response error can be lost due to unwrapping a key - Fixes #5078.

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/7e1d1783
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7e1d1783
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7e1d1783

Branch: refs/heads/ignite-10044
Commit: 7e1d17830429a78ca62e2f007fece7de6466eb0f
Parents: e8eeea3
Author: Roman Guseinov <gr...@gmail.com>
Authored: Mon Nov 26 16:57:47 2018 +0300
Committer: Pavel Kovalenko <jo...@gmail.com>
Committed: Mon Nov 26 16:57:47 2018 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridDhtAtomicCache.java          |  30 ++++-
 .../GridNearAtomicAbstractUpdateFuture.java     |  43 ++++++-
 .../cache/store/CacheStoreWriteErrorTest.java   | 127 +++++++++++++++++++
 .../ignite/testsuites/IgniteCacheTestSuite.java |   2 +
 4 files changed, 196 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7e1d1783/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 86d7b3c..74be8e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -34,6 +34,7 @@ import javax.cache.processor.EntryProcessorResult;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.binary.BinaryInvalidTypeException;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.NodeStoppingException;
@@ -2725,6 +2726,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
 
             final GridDhtAtomicAbstractUpdateFuture dhtFut = dhtUpdRes.dhtFuture();
 
+            Collection<Object> failedToUnwrapKeys = null;
+
             // Avoid iterator creation.
             for (int i = 0; i < entries.size(); i++) {
                 GridDhtCacheEntry entry = entries.get(i);
@@ -2737,9 +2740,26 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                     continue;
                 }
 
-                if (storeErr != null &&
-                    storeErr.failedKeys().contains(entry.key().value(ctx.cacheObjectContext(), false)))
-                    continue;
+                if (storeErr != null) {
+                    Object key = entry.key();
+
+                    try {
+                        key = entry.key().value(ctx.cacheObjectContext(), false);
+                    }
+                    catch (BinaryInvalidTypeException e) {
+                        if (log.isDebugEnabled()) {
+                            if (failedToUnwrapKeys == null)
+                                failedToUnwrapKeys = new ArrayList<>();
+
+                            // To limit keys count in log message.
+                            if (failedToUnwrapKeys.size() < 5)
+                                failedToUnwrapKeys.add(key);
+                        }
+                    }
+
+                    if (storeErr.failedKeys().contains(key))
+                        continue;
+                }
 
                 try {
                     // We are holding java-level locks on entries at this point.
@@ -2868,6 +2888,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                 dhtUpdRes.processedEntriesCount(firstEntryIdx + i + 1);
             }
 
+            if (failedToUnwrapKeys != null) {
+                log.warning("Failed to get values of keys: " + failedToUnwrapKeys +
+                    " (the binary objects will be used instead).");
+            }
         }
         catch (IgniteCheckedException e) {
             res.addFailedKeys(putMap != null ? putMap.keySet() : rmvKeys, e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7e1d1783/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
index f91e3f3..983b094 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
@@ -30,6 +30,7 @@ import java.util.concurrent.atomic.AtomicReference;
 import javax.cache.expiry.ExpiryPolicy;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.binary.BinaryInvalidTypeException;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.IgniteInternalFuture;
@@ -399,10 +400,46 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridCacheFuture
 
         Collection<Object> keys = new ArrayList<>(keys0.size());
 
-        for (KeyCacheObject key : keys0)
-            keys.add(cctx.cacheObjectContext().unwrapBinaryIfNeeded(key, keepBinary, false));
+        Collection<Object> failedToUnwrapKeys = null;
 
-        err.add(keys, res.error(), req.topologyVersion());
+        Exception suppressedErr = null;
+
+        for (KeyCacheObject key : keys0) {
+            try {
+                keys.add(cctx.cacheObjectContext().unwrapBinaryIfNeeded(key, keepBinary, false));
+            }
+            catch (BinaryInvalidTypeException e) {
+                keys.add(cctx.toCacheKeyObject(key));
+
+                if (log.isDebugEnabled()) {
+                    if (failedToUnwrapKeys == null)
+                        failedToUnwrapKeys = new ArrayList<>();
+
+                    // To limit keys count in log message.
+                    if (failedToUnwrapKeys.size() < 5)
+                        failedToUnwrapKeys.add(key);
+                }
+
+                suppressedErr = e;
+            }
+            catch (Exception e) {
+                keys.add(cctx.toCacheKeyObject(key));
+
+                suppressedErr = e;
+            }
+        }
+
+        if (failedToUnwrapKeys != null) {
+            log.warning("Failed to unwrap keys: " + failedToUnwrapKeys +
+                " (the binary objects will be used instead).");
+        }
+
+        IgniteCheckedException error = res.error();
+
+        if (suppressedErr != null)
+            error.addSuppressed(suppressedErr);
+
+        err.add(keys, error, req.topologyVersion());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/7e1d1783/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreWriteErrorTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreWriteErrorTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreWriteErrorTest.java
new file mode 100644
index 0000000..fce1f5d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreWriteErrorTest.java
@@ -0,0 +1,127 @@
+/*
+ * 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.cache.store;
+
+import com.google.common.base.Throwables;
+import java.util.HashMap;
+import java.util.concurrent.Callable;
+import javax.cache.Cache;
+import javax.cache.configuration.FactoryBuilder;
+import javax.cache.integration.CacheLoaderException;
+import javax.cache.integration.CacheWriterException;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * This class tests handling exceptions from {@link CacheStore#write(Cache.Entry)}.
+ */
+public class CacheStoreWriteErrorTest extends GridCommonAbstractTest {
+    /** */
+    public static final String CACHE_NAME = "cache";
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        CacheConfiguration cacheCfg = new CacheConfiguration(CACHE_NAME)
+            .setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC)
+            .setCacheStoreFactory(FactoryBuilder.factoryOf(ThrowableCacheStore.class))
+            .setWriteThrough(true)
+            .setStoreKeepBinary(true);
+
+        return super.getConfiguration(gridName)
+            .setCacheConfiguration(cacheCfg);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * Checks primary error while saving batch with one entry.
+     */
+    public void testPrimaryErrorForBatchSize1() {
+        checkPrimaryError(1);
+    }
+
+    /**
+     * Checks primary error while saving batch with two entries.
+     */
+    public void testPrimaryErrorForBatchSize2() {
+        checkPrimaryError(2);
+    }
+
+    /**
+     * Checks that primary error ({@link CacheWriterException}) is not lost due to unwrapping a key.
+     *
+     * @param batchSize Batch size.
+     */
+    private void checkPrimaryError(int batchSize) {
+        Throwable t = GridTestUtils.assertThrows(log,
+            new Callable<Object>() {
+                @Override public Object call() throws Exception {
+                    try (Ignite grid = startGrid()) {
+                        IgniteCache<BinaryObject, String> cache = grid.cache(CACHE_NAME);
+
+                        HashMap<BinaryObject, String> batch = new HashMap<>();
+
+                        for (int i = 0; i < batchSize; i++) {
+                            BinaryObject key = grid.binary().builder("KEY_TYPE_NAME").setField("id", i).build();
+
+                            batch.put(key, "VALUE");
+                        }
+
+                        cache.putAllAsync(batch).get();
+                    }
+
+                    return null;
+                }
+            }, CacheWriterException.class, null);
+
+        assertTrue("Stacktrace should contain the message of the original exception",
+            Throwables.getStackTraceAsString(t).contains(ThrowableCacheStore.EXCEPTION_MESSAGE));
+    }
+
+    /**
+     * {@link CacheStore} implementation which throws {@link RuntimeException} for every write operation.
+     */
+    public static class ThrowableCacheStore extends CacheStoreAdapter<Object, Object> {
+        /** */
+        private static final String EXCEPTION_MESSAGE = "WRITE CACHE STORE EXCEPTION";
+
+        /** {@inheritDoc} */
+        @Override public Object load(Object o) throws CacheLoaderException {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void write(Cache.Entry<?, ?> entry) throws CacheWriterException {
+            throw new RuntimeException(EXCEPTION_MESSAGE);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void delete(Object o) throws CacheWriterException {
+            // No-op.
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7e1d1783/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index 5d7b306..52e2ba2 100755
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -22,6 +22,7 @@ import junit.framework.TestSuite;
 import org.apache.ignite.cache.IgniteCacheEntryProcessorSequentialCallTest;
 import org.apache.ignite.cache.IgniteWarmupClosureSelfTest;
 import org.apache.ignite.cache.store.CacheStoreReadFromBackupTest;
+import org.apache.ignite.cache.store.CacheStoreWriteErrorTest;
 import org.apache.ignite.cache.store.CacheTransactionalStoreReadFromBackupTest;
 import org.apache.ignite.cache.store.GridCacheBalancingStoreSelfTest;
 import org.apache.ignite.cache.store.GridCacheLoadOnlyStoreAdapterSelfTest;
@@ -333,6 +334,7 @@ public class IgniteCacheTestSuite extends TestSuite {
 
         suite.addTestSuite(GridStoreLoadCacheTest.class);
         suite.addTestSuite(CacheStoreReadFromBackupTest.class);
+        suite.addTestSuite(CacheStoreWriteErrorTest.class);
         suite.addTestSuite(CacheTransactionalStoreReadFromBackupTest.class);
 
         //suite.addTestSuite(CacheAtomicSingleMessageCountSelfTest.class);


[29/50] [abbrv] ignite git commit: IGNITE-8718: Fixed doxygen comments in C++

Posted by sb...@apache.org.
IGNITE-8718: Fixed doxygen comments in C++


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/90317330
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/90317330
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/90317330

Branch: refs/heads/ignite-10044
Commit: 9031733028ed79a35924319301279d3a2de8afbb
Parents: 1906002
Author: Igor Sapego <is...@apache.org>
Authored: Tue Nov 27 19:17:16 2018 +0300
Committer: Igor Sapego <is...@apache.org>
Committed: Tue Nov 27 19:17:16 2018 +0300

----------------------------------------------------------------------
 .../include/ignite/binary/binary_object.h       |  1 +
 .../include/ignite/binary/binary_raw_reader.h   | 20 ++++++++++
 .../include/ignite/binary/binary_raw_writer.h   | 38 +++++++++++++++++-
 .../include/ignite/binary/binary_reader.h       | 26 ++++++++++--
 .../include/ignite/binary/binary_writer.h       | 42 ++++++++++++++++++--
 5 files changed, 120 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/90317330/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h
index 4edbe84..bbad488 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h
@@ -68,6 +68,7 @@ namespace ignite
              * @param mem Binary object memory.
              * @param start Object starting position in memory.
              * @param idRslvr ID resolver.
+             * @param metaMgr Metadata manager.
              */
             BinaryObject(impl::interop::InteropMemory& mem, int32_t start,
                 impl::binary::BinaryIdResolver* idRslvr, impl::binary::BinaryTypeManager* metaMgr) :

http://git-wip-us.apache.org/repos/asf/ignite/blob/90317330/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h
index 73d2525..dd7a696 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h
@@ -342,6 +342,11 @@ namespace ignite
             /**
              * Start string array read.
              *
+             * Every time you get a BinaryStringArrayReader from BinaryRawReader
+             * you start reading session. Only one single reading session can be
+             * open at a time. So it is not allowed to start new reading session
+             * until all elements of the collection have been read.
+             *
              * @return String array reader.
              */
             BinaryStringArrayReader ReadStringArray();
@@ -349,6 +354,11 @@ namespace ignite
             /**
              * Start array read.
              *
+             * Every time you get a BinaryArrayReader from BinaryRawReader you
+             * start reading session. Only one single reading session can be
+             * open at a time. So it is not allowed to start new reading session
+             * until all elements of the collection have been read.
+             *
              * @return Array reader.
              */
             template<typename T>
@@ -364,6 +374,11 @@ namespace ignite
             /**
              * Start collection read.
              *
+             * Every time you get a BinaryCollectionReader from BinaryRawReader
+             * you start reading session. Only one single reading session can be
+             * open at a time. So it is not allowed to start new reading session
+             * until all elements of the collection have been read.
+             *
              * @return Collection reader.
              */
             template<typename T>
@@ -392,6 +407,11 @@ namespace ignite
             /**
              * Start map read.
              *
+             * Every time you get a BinaryMapReader from BinaryRawReader you
+             * start reading session. Only one single reading session can be
+             * open at a time. So it is not allowed to start new reading session
+             * until all elements of the collection have been read.
+             *
              * @return Map reader.
              */
             template<typename K, typename V>

http://git-wip-us.apache.org/repos/asf/ignite/blob/90317330/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_writer.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_writer.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_writer.h
index 9dc73df..857d7f2 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_writer.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_writer.h
@@ -242,7 +242,7 @@ namespace ignite
              * @param val Array.
              * @param len Array length.
              */
-            void WriteTimeArray(const Time* val, const int32_t len);
+            void WriteTimeArray(const Time* val, int32_t len);
 
             /**
              * Write string.
@@ -272,6 +272,12 @@ namespace ignite
             /**
              * Start string array write.
              *
+             * Every time you get a BinaryStringArrayWriter from BinaryRawWriter
+             * you start writing session. Only one single writing session can be
+             * open at a time. So it is not allowed to start new writing session
+             * without calling BinaryStringArrayWriter::Close() method prior on
+             * obtained BinaryStringArrayWriter class instance.
+             *
              * @return String array writer.
              */
             BinaryStringArrayWriter WriteStringArray();
@@ -284,6 +290,12 @@ namespace ignite
             /**
              * Start array write.
              *
+             * Every time you get a BinaryArrayWriter from BinaryRawWriter you
+             * start writing session. Only one single writing session can be
+             * open at a time. So it is not allowed to start new writing session
+             * without calling BinaryArrayWriter::Close() method prior on
+             * obtained BinaryArrayWriter class instance.
+             *
              * @return Array writer.
              */
             template<typename T>
@@ -297,6 +309,12 @@ namespace ignite
             /**
              * Start collection write.
              *
+             * Every time you get a BinaryCollectionWriter from BinaryRawWriter
+             * you start writing session. Only one single writing session can be
+             * open at a time. So it is not allowed to start new writing session
+             * without calling BinaryCollectionWriter::Close() method prior on
+             * obtained BinaryCollectionWriter class instance.
+             *
              * @return Collection writer.
              */
             template<typename T>
@@ -308,6 +326,12 @@ namespace ignite
             /**
              * Start collection write.
              *
+             * Every time you get a BinaryCollectionWriter from BinaryRawWriter
+             * you start writing session. Only one single writing session can be
+             * open at a time. So it is not allowed to start new writing session
+             * without calling BinaryCollectionWriter::Close() method prior on
+             * obtained BinaryCollectionWriter class instance.
+             *
              * @param typ Collection type.
              * @return Collection writer.
              */
@@ -347,6 +371,12 @@ namespace ignite
             /**
              * Start map write.
              *
+             * Every time you get a BinaryMapWriter from BinaryRawWriter you
+             * start writing session. Only one single writing session can be
+             * open at a time. So it is not allowed to start new writing session
+             * without calling BinaryMapWriter::Close() method prior on obtained
+             * BinaryMapWriter class instance.
+             *
              * @return Map writer.
              */
             template<typename K, typename V>
@@ -358,6 +388,12 @@ namespace ignite
             /**
              * Start map write.
              *
+             * Every time you get a BinaryMapWriter from BinaryRawWriter you
+             * start writing session. Only one single writing session can be
+             * open at a time. So it is not allowed to start new writing session
+             * without calling BinaryMapWriter::Close() method prior on obtained
+             * BinaryMapWriter class instance.
+             *
              * @param typ Map type.
              * @return Map writer.
              */

http://git-wip-us.apache.org/repos/asf/ignite/blob/90317330/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h
index 7103fec..acd9d61 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h
@@ -272,7 +272,7 @@ namespace ignite
              *     to resulting array and returned value will contain required array length.
              *     -1 will be returned in case array in stream was null.
              */
-            int32_t ReadDateArray(const char* fieldName, Date* res, const int32_t len);
+            int32_t ReadDateArray(const char* fieldName, Date* res, int32_t len);
 
             /**
              * Read Timestamp. Maps to "Timestamp" type in Java.
@@ -293,7 +293,7 @@ namespace ignite
              *     to resulting array and returned value will contain required array length.
              *     -1 will be returned in case array in stream was null.
              */
-            int32_t ReadTimestampArray(const char* fieldName, Timestamp* res, const int32_t len);
+            int32_t ReadTimestampArray(const char* fieldName, Timestamp* res, int32_t len);
 
             /**
              * Read Time. Maps to "Time" type in Java.
@@ -314,7 +314,7 @@ namespace ignite
              *     to resulting array and returned value will contain required array length.
              *     -1 will be returned in case array in stream was null.
              */
-            int32_t ReadTimeArray(const char* fieldName, Time* res, const int32_t len);
+            int32_t ReadTimeArray(const char* fieldName, Time* res, int32_t len);
 
             /**
              * Read string.
@@ -355,6 +355,11 @@ namespace ignite
             /**
              * Start string array read.
              *
+             * Every time you get a BinaryStringArrayReader from BinaryReader
+             * you start reading session. Only one single reading session can be
+             * open at a time. So it is not allowed to start new reading session
+             * until all elements of the collection have been read.
+             *
              * @param fieldName Field name.
              * @return String array reader.
              */
@@ -363,6 +368,11 @@ namespace ignite
             /**
              * Start array read.
              *
+             * Every time you get a BinaryArrayReader from BinaryReader you
+             * start reading session. Only one single reading session can be
+             * open at a time. So it is not allowed to start new reading session
+             * until all elements of the collection have been read.
+             *
              * @param fieldName Field name.
              * @return Array reader.
              */
@@ -379,6 +389,11 @@ namespace ignite
             /**
              * Start collection read.
              *
+             * Every time you get a BinaryCollectionReader from BinaryReader you
+             * start reading session. Only one single reading session can be
+             * open at a time. So it is not allowed to start new reading session
+             * until all elements of the collection have been read.
+             *
              * @param fieldName Field name.
              * @return Collection reader.
              */
@@ -409,6 +424,11 @@ namespace ignite
             /**
              * Start map read.
              *
+             * Every time you get a BinaryMapReader from BinaryReader you start
+             * reading session. Only one single reading session can be open at
+             * a time. So it is not allowed to start new reading session until
+             * all elements of the collection have been read.
+             *
              * @param fieldName Field name.
              * @return Map reader.
              */

http://git-wip-us.apache.org/repos/asf/ignite/blob/90317330/modules/platforms/cpp/binary/include/ignite/binary/binary_writer.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_writer.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_writer.h
index e609591..3dc1241 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_writer.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_writer.h
@@ -228,7 +228,7 @@ namespace ignite
              * @param val Array.
              * @param len Array length.
              */
-            void WriteDateArray(const char* fieldName, const Date* val, const int32_t len);
+            void WriteDateArray(const char* fieldName, const Date* val, int32_t len);
 
             /**
              * Write Timestamp. Maps to "Timestamp" type in Java.
@@ -245,7 +245,7 @@ namespace ignite
              * @param val Array.
              * @param len Array length.
              */
-            void WriteTimestampArray(const char* fieldName, const Timestamp* val, const int32_t len);
+            void WriteTimestampArray(const char* fieldName, const Timestamp* val, int32_t len);
 
             /**
              * Write Time. Maps to "Time" type in Java.
@@ -262,7 +262,7 @@ namespace ignite
              * @param val Array.
              * @param len Array length.
              */
-            void WriteTimeArray(const char* fieldName, const Time* val, const int32_t len);
+            void WriteTimeArray(const char* fieldName, const Time* val, int32_t len);
 
             /**
              * Write string.
@@ -295,6 +295,12 @@ namespace ignite
             /**
              * Start string array write.
              *
+             * Every time you get a BinaryStringArrayWriter from BinaryWriter
+             * you start writing session. Only one single writing session can be
+             * open at a time. So it is not allowed to start new writing session
+             * without calling BinaryStringArrayWriter::Close() method prior on
+             * obtained BinaryStringArrayWriter class instance.
+             *
              * @param fieldName Field name.
              * @return String array writer.
              */
@@ -310,6 +316,12 @@ namespace ignite
             /**
              * Start array write.
              *
+             * Every time you get a BinaryArrayWriter from BinaryWriter you
+             * start writing session. Only one single writing session can be
+             * open at a time. So it is not allowed to start new writing session
+             * without calling BinaryArrayWriter::Close() method prior on
+             * obtained BinaryArrayWriter class instance.
+             *
              * @param fieldName Field name.
              * @return Array writer.
              */
@@ -324,6 +336,12 @@ namespace ignite
             /**
              * Start collection write.
              *
+             * Every time you get a BinaryCollectionWriter from BinaryWriter you
+             * start writing session. Only one single writing session can be
+             * open at a time. So it is not allowed to start new writing session
+             * without calling BinaryCollectionWriter::Close() method prior on
+             * obtained BinaryCollectionWriter class instance.
+             *
              * @param fieldName Field name.
              * @return Collection writer.
              */
@@ -336,6 +354,12 @@ namespace ignite
             /**
              * Start collection write.
              *
+             * Every time you get a BinaryCollectionWriter from BinaryWriter you
+             * start writing session. Only one single writing session can be
+             * open at a time. So it is not allowed to start new writing session
+             * without calling BinaryCollectionWriter::Close() method prior on
+             * obtained BinaryCollectionWriter class instance.
+             *
              * @param fieldName Field name.
              * @param typ Collection type.
              * @return Collection writer.
@@ -378,6 +402,12 @@ namespace ignite
             /**
              * Start map write.
              *
+             * Every time you get a BinaryMapWriter from BinaryWriter you start
+             * writing session. Only one single writing session can be open at
+             * a time. So it is not allowed to start new writing session without
+             * calling BinaryMapWriter::Close() method prior on obtained
+             * BinaryMapWriter class instance.
+             *
              * @param fieldName Field name.
              * @return Map writer.
              */
@@ -390,6 +420,12 @@ namespace ignite
             /**
              * Start map write.
              *
+             * Every time you get a BinaryMapWriter from BinaryWriter you start
+             * writing session. Only one single writing session can be open at
+             * a time. So it is not allowed to start new writing session without
+             * calling BinaryMapWriter::Close() method prior on obtained
+             * BinaryMapWriter class instance.
+             *
              * @param fieldName Field name.
              * @param typ Map type.
              * @return Map writer.


[08/50] [abbrv] ignite git commit: IGNITE-10330: Disk page compression. - Fixes #5200.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/direct-io/src/test/java/org/apache/ignite/internal/processors/cache/persistence/file/IgniteFileIOTest.java
----------------------------------------------------------------------
diff --git a/modules/direct-io/src/test/java/org/apache/ignite/internal/processors/cache/persistence/file/IgniteFileIOTest.java b/modules/direct-io/src/test/java/org/apache/ignite/internal/processors/cache/persistence/file/IgniteFileIOTest.java
index 9620eb0..640932dc 100644
--- a/modules/direct-io/src/test/java/org/apache/ignite/internal/processors/cache/persistence/file/IgniteFileIOTest.java
+++ b/modules/direct-io/src/test/java/org/apache/ignite/internal/processors/cache/persistence/file/IgniteFileIOTest.java
@@ -55,6 +55,21 @@ public class IgniteFileIOTest extends TestCase {
         }
 
         /** {@inheritDoc} */
+        @Override public int getFileSystemBlockSize() {
+            return -1;
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getSparseSize() {
+            return -1;
+        }
+
+        /** {@inheritDoc} */
+        @Override public int punchHole(long position, int len) {
+            throw new UnsupportedOperationException();
+        }
+
+        /** {@inheritDoc} */
         @Override public long position() throws IOException {
             return position;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/direct-io/src/test/java/org/apache/ignite/testsuites/IgnitePdsNativeIoTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/direct-io/src/test/java/org/apache/ignite/testsuites/IgnitePdsNativeIoTestSuite2.java b/modules/direct-io/src/test/java/org/apache/ignite/testsuites/IgnitePdsNativeIoTestSuite2.java
index 2ed7450..dab99c9 100644
--- a/modules/direct-io/src/test/java/org/apache/ignite/testsuites/IgnitePdsNativeIoTestSuite2.java
+++ b/modules/direct-io/src/test/java/org/apache/ignite/testsuites/IgnitePdsNativeIoTestSuite2.java
@@ -19,6 +19,7 @@ package org.apache.ignite.testsuites;
 import junit.framework.TestSuite;
 import org.apache.ignite.internal.processors.cache.persistence.IgniteNativeIoLocalWalModeChangeDuringRebalancingSelfTest;
 import org.apache.ignite.internal.processors.cache.persistence.IgniteNativeIoPdsRecoveryAfterFileCorruptionTest;
+import org.apache.ignite.internal.processors.cache.persistence.DiskPageCompressionIntegrationDirectIOTest;
 import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteNativeIoWalFlushFsyncSelfTest;
 
 /**
@@ -34,6 +35,9 @@ public class IgnitePdsNativeIoTestSuite2 extends TestSuite {
 
         IgnitePdsTestSuite2.addRealPageStoreTests(suite);
 
+        // Direct IO + Page compression.
+        suite.addTestSuite(DiskPageCompressionIntegrationDirectIOTest.class);
+
         //Integrity test with reduced count of pages.
         suite.addTestSuite(IgniteNativeIoPdsRecoveryAfterFileCorruptionTest.class);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 14f970e..23e0a0d 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -84,6 +84,8 @@
         <jetty.version>9.4.11.v20180605</jetty.version>
         <jmh.version>1.13</jmh.version>
         <jms.spec.version>1.1.1</jms.spec.version>
+        <jna.version>4.5.2</jna.version>
+        <jnr.posix.version>3.0.46</jnr.posix.version>
         <jsch.bundle.version>0.1.54_1</jsch.bundle.version>
         <jsch.version>0.1.54</jsch.version>
         <jsonlib.bundle.version>2.4_1</jsonlib.bundle.version>
@@ -94,6 +96,7 @@
         <log4j.version>2.11.0</log4j.version>
         <lucene.bundle.version>7.4.0_1</lucene.bundle.version>
         <lucene.version>7.4.0</lucene.version>
+        <lz4.version>1.5.0</lz4.version>
         <maven.bundle.plugin.version>3.5.0</maven.bundle.plugin.version>
         <mockito.version>1.10.19</mockito.version>
         <mysql.connector.version>5.1.39</mysql.connector.version>
@@ -110,6 +113,7 @@
         <scala.test.version>2.2.6</scala.test.version>
         <slf4j.version>1.7.7</slf4j.version>
         <slf4j16.version>1.6.4</slf4j16.version>
+        <snappy.version>1.1.7.2</snappy.version>
         <spark.hadoop.version>2.6.5</spark.hadoop.version>
         <spark.version>2.3.0</spark.version>
         <spring.data.version>1.13.14.RELEASE</spring.data.version> <!-- don't forget to update spring version -->
@@ -125,6 +129,7 @@
         <yardstick.version>0.8.3</yardstick.version>
         <zkclient.version>0.5</zkclient.version>
         <zookeeper.version>3.4.13</zookeeper.version>
+        <zstd.version>1.3.7-2</zstd.version>
 
         <!-- OSGI Manifest generation default property values -->
         <osgi.import.package>*</osgi.import.package>

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6de435a..54756bb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,6 +45,7 @@
         <module>modules/apache-license-gen</module>
         <module>modules/tools</module>
         <module>modules/core</module>
+        <module>modules/compress</module>
         <module>modules/dev-utils</module>
         <module>modules/direct-io</module>
         <module>modules/hadoop</module>


[32/50] [abbrv] ignite git commit: IGNITE-10390 Fixed BPlusTree#isEmpty - Fixes #5486.

Posted by sb...@apache.org.
IGNITE-10390 Fixed BPlusTree#isEmpty - Fixes #5486.

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/0b4282be
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0b4282be
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0b4282be

Branch: refs/heads/ignite-10044
Commit: 0b4282be26b4d042637ce57821e9a3448043d56d
Parents: 23de743
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Tue Nov 27 19:31:51 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Tue Nov 27 19:33:26 2018 +0300

----------------------------------------------------------------------
 .../persistence/GridCacheOffheapManager.java    |  4 +---
 .../cache/persistence/tree/BPlusTree.java       | 23 ++++++++++++--------
 .../processors/database/BPlusTreeSelfTest.java  | 23 ++++++++++++++++++++
 3 files changed, 38 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0b4282be/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 7d4a3ae..44ae6f1 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
@@ -1463,7 +1463,6 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
          * @return Store delegate.
          * @throws IgniteCheckedException If failed.
          */
-        @SuppressWarnings("SizeReplaceableByIsEmpty")
         private CacheDataStore init0(boolean checkExists) throws IgniteCheckedException {
             CacheDataStore delegate0 = delegate;
 
@@ -1574,8 +1573,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
 
                     pendingTree = pendingTree0;
 
-                    // TODO IGNITE-10390 replace size() > 0 with isEmpty()
-                    if (!hasPendingEntries && pendingTree0.size() > 0)
+                    if (!hasPendingEntries && !pendingTree0.isEmpty())
                         hasPendingEntries = true;
 
                     int grpId = grp.groupId();

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b4282be/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java
index 7852008..476667a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java
@@ -2109,21 +2109,26 @@ public abstract class BPlusTree<L, T extends L> extends DataStructure implements
 
             long rootId, rootPage = acquirePage(rootId = treeMeta.rootId);
 
-            long rootAddr = readLock(rootId, rootPage);
+            try {
+                long rootAddr = readLock(rootId, rootPage);
 
-            if (rootAddr == 0) {
-                checkDestroyed();
+                if (rootAddr == 0) {
+                    checkDestroyed();
 
-                continue;
-            }
+                    continue;
+                }
 
-            try {
-                BPlusIO<L> io = io(rootAddr);
+                try {
+                    BPlusIO<L> io = io(rootAddr);
 
-                return io.getCount(rootAddr) == 0;
+                    return io.getCount(rootAddr) == 0;
+                }
+                finally {
+                    readUnlock(rootId, rootPage, rootAddr);
+                }
             }
             finally {
-                readUnlock(rootId, rootPage, rootAddr);
+                releasePage(rootId, rootPage);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b4282be/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
index fa72978..ae9aff8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
@@ -252,6 +252,29 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * @throws Exception if failed.
+     */
+    public void testIsEmpty() throws Exception {
+        TestTree tree = createTestTree(true);
+
+        assertTrue(tree.isEmpty());
+
+        for (long i = 1; i <= 500; i++) {
+            tree.put(i);
+
+            assertFalse(tree.isEmpty());
+        }
+
+        for (long i = 1; i <= 500; i++) {
+            assertFalse(tree.isEmpty());
+
+            tree.remove(i);
+        }
+
+        assertTrue(tree.isEmpty());
+    }
+
+    /**
      * @throws IgniteCheckedException If failed.
      */
     public void testFindWithClosure() throws IgniteCheckedException {


[34/50] [abbrv] ignite git commit: IGNITE-1793 [Failed Test] IgnitePartitionedCountDownLatchSelfTest.testLatch hangs on TC sometimes - Fixes #2882.

Posted by sb...@apache.org.
IGNITE-1793
[Failed Test] IgnitePartitionedCountDownLatchSelfTest.testLatch hangs on TC sometimes - Fixes #2882.

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/07f1dbfc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/07f1dbfc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/07f1dbfc

Branch: refs/heads/ignite-10044
Commit: 07f1dbfcb899d604d6637a71c956b14e6d52ac9c
Parents: 9d3c757
Author: vd-pyatkov <vp...@gridgain.com>
Authored: Tue Nov 27 19:58:54 2018 +0300
Committer: Dmitriy Pavlov <dp...@apache.org>
Committed: Tue Nov 27 19:58:54 2018 +0300

----------------------------------------------------------------------
 .../partitioned/IgnitePartitionedCountDownLatchSelfTest.java    | 5 -----
 1 file changed, 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/07f1dbfc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedCountDownLatchSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedCountDownLatchSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedCountDownLatchSelfTest.java
index fc9356e..fbd3779 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedCountDownLatchSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedCountDownLatchSelfTest.java
@@ -30,9 +30,4 @@ public class IgnitePartitionedCountDownLatchSelfTest extends IgniteCountDownLatc
     @Override protected CacheMode atomicsCacheMode() {
         return PARTITIONED;
     }
-
-    /** {@inheritDoc} */
-    @Override public void testLatch() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-1793");
-    }
 }


[36/50] [abbrv] ignite git commit: IGNITE-10193 Removed non-actual muted baseline deletion test - Fixes #5446.

Posted by sb...@apache.org.
IGNITE-10193 Removed non-actual muted baseline deletion test - Fixes #5446.

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/566adaac
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/566adaac
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/566adaac

Branch: refs/heads/ignite-10044
Commit: 566adaac9b70cbba94b97afadecb9525b3900733
Parents: be97bcd
Author: Alexey Platonov <ap...@gmail.com>
Authored: Tue Nov 27 20:30:42 2018 +0300
Committer: Pavel Kovalenko <jo...@gmail.com>
Committed: Tue Nov 27 20:30:42 2018 +0300

----------------------------------------------------------------------
 ...eBaselineAffinityTopologyActivationTest.java | 59 --------------------
 1 file changed, 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/566adaac/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 f44e792..838c732 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
@@ -1030,65 +1030,6 @@ public class IgniteBaselineAffinityTopologyActivationTest extends GridCommonAbst
     }
 
     /**
-     * Restore this test when requirements for BaselineTopology deletion are clarified and this feature
-     * is covered with more tests.
-     */
-    public void _testBaselineTopologyHistoryIsDeletedOnBaselineDelete() throws Exception {
-        BaselineTopologyHistoryVerifier verifier = new BaselineTopologyHistoryVerifier() {
-            @Override public void verify(BaselineTopologyHistory bltHist) {
-                assertNotNull(bltHist);
-
-                assertEquals(0, bltHist.history().size());
-            }
-        };
-
-        Ignite nodeA = startGridWithConsistentId("A");
-        startGridWithConsistentId("B");
-        startGridWithConsistentId("C");
-
-        nodeA.cluster().active(true);
-
-        stopAllGrids(false);
-
-        nodeA = startGridWithConsistentId("A");
-        startGridWithConsistentId("B");
-
-        nodeA.cluster().active(true);
-
-        nodeA.cluster().setBaselineTopology(baselineNodes(nodeA.cluster().forServers().nodes()));
-
-        stopAllGrids(false);
-
-        nodeA = startGridWithConsistentId("A");
-
-        nodeA.cluster().active(true);
-
-        nodeA.cluster().setBaselineTopology(baselineNodes(nodeA.cluster().forServers().nodes()));
-
-        stopAllGrids(false);
-
-        final Ignite node = startGridWithConsistentId("A");
-
-        boolean activated = GridTestUtils.waitForCondition(new GridAbsPredicate() {
-            @Override public boolean apply() {
-                return node.cluster().active();
-            }
-        }, 10_000);
-
-        assertTrue(activated);
-
-        node.cluster().setBaselineTopology(null);
-
-        verifyBaselineTopologyHistoryOnNodes(verifier, new Ignite[] {node});
-
-        stopAllGrids(false);
-
-        nodeA = startGridWithConsistentId("A");
-
-        verifyBaselineTopologyHistoryOnNodes(verifier, new Ignite[] {nodeA});
-    }
-
-    /**
      * Retrieves baseline topology from ignite node instance.
      *
      * @param ig Ig.


[19/50] [abbrv] ignite git commit: IGNITE-9442 Collocated IgniteSet#close is not working on non-affinity node.

Posted by sb...@apache.org.
IGNITE-9442 Collocated IgniteSet#close is not working on non-affinity node.

Signed-off-by: Anton Vinogradov <av...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/507aeb21
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/507aeb21
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/507aeb21

Branch: refs/heads/ignite-10044
Commit: 507aeb21bf6792bb9efb6518f83049ebc7eab53f
Parents: 6fd6c32
Author: pereslegin-pa <xx...@gmail.com>
Authored: Mon Nov 26 18:53:10 2018 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Mon Nov 26 18:53:10 2018 +0300

----------------------------------------------------------------------
 .../CacheDataStructuresManager.java             | 15 +++---
 .../datastructures/GridCacheSetImpl.java        |  4 +-
 .../GridCacheSetAbstractSelfTest.java           | 31 ++++++++++--
 ...idCachePartitionedSetWithClientSelfTest.java | 52 ++++++++++++++++++++
 ...chePartitionedSetWithNodeFilterSelfTest.java | 37 ++++++++++++++
 ...ridCacheReplicatedSetWithClientSelfTest.java | 52 ++++++++++++++++++++
 ...acheReplicatedSetWithNodeFilterSelfTest.java | 37 ++++++++++++++
 .../IgniteCacheDataStructuresSelfTestSuite.java |  8 +++
 8 files changed, 224 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/507aeb21/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
index 932f000..9c3c4a6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
@@ -63,6 +63,7 @@ import org.apache.ignite.internal.processors.datastructures.GridTransactionalCac
 import org.apache.ignite.internal.processors.datastructures.SetItemKey;
 import org.apache.ignite.internal.processors.task.GridInternal;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
+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.IgniteFuture;
@@ -472,7 +473,7 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter {
             while (true) {
                 AffinityTopologyVersion topVer = cctx.topologyVersionFuture().get();
 
-                Collection<ClusterNode> nodes = CU.affinityNodes(cctx, topVer);
+                Collection<ClusterNode> nodes = F.view(cctx.discovery().nodes(topVer), node -> !node.isDaemon());
 
                 try {
                     cctx.closures().callAsyncNoFailover(BROADCAST,
@@ -502,10 +503,12 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter {
                         throw e;
                 }
 
+                Collection<ClusterNode> affNodes = CU.affinityNodes(cctx, topVer);
+
                 try {
                     cctx.closures().callAsyncNoFailover(BROADCAST,
                         new RemoveSetDataCallable(cctx.name(), id, topVer),
-                        nodes,
+                        affNodes,
                         true,
                         0, false).get();
                 }
@@ -516,7 +519,7 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter {
 
                         continue;
                     }
-                    else if (!pingNodes(nodes)) {
+                    else if (!pingNodes(affNodes)) {
                         if (log.isDebugEnabled())
                             log.debug("RemoveSetData job failed and set data node left, will retry: " + e);
 
@@ -650,9 +653,9 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter {
 
             GridCacheAdapter cache = ((IgniteKernal)ignite).context().cache().internalCache(cacheName);
 
-            assert cache != null : cacheName;
-
-            cache.context().dataStructures().blockSet(setId);
+            // On non-affinity node cache starts on demand, so it may not be running.
+            if (cache != null)
+                cache.context().dataStructures().blockSet(setId);
 
             return null;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/507aeb21/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
index 8aae9d0..97d34f0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
@@ -514,7 +514,9 @@ public class GridCacheSetImpl<T> extends AbstractCollection<T> implements Ignite
      * @throws IgniteCheckedException If all cache nodes left grid.
      */
     private Collection<ClusterNode> dataNodes(AffinityTopologyVersion topVer) throws IgniteCheckedException {
-        if (ctx.isLocal() || ctx.isReplicated())
+        assert ctx.isPartitioned() || collocated : "Non-collocated mode is supported only for PARTITIONED caches.";
+
+        if (ctx.isLocal() || (ctx.isReplicated() && ctx.affinityNode()))
             return Collections.singleton(ctx.localNode());
 
         Collection<ClusterNode> nodes;

http://git-wip-us.apache.org/repos/asf/ignite/blob/507aeb21/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
index fef55b8..4e888aa 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
@@ -32,6 +32,7 @@ import junit.framework.AssertionFailedError;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteCluster;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteSet;
 import org.apache.ignite.cache.CacheMode;
@@ -181,13 +182,22 @@ public abstract class GridCacheSetAbstractSelfTest extends IgniteCollectionAbstr
      * @param collocated Collocation flag.
      * @throws Exception If failed.
      */
-    private void testCreateRemove(boolean collocated) throws Exception {
+    protected void testCreateRemove(boolean collocated) throws Exception {
+        testCreateRemove(collocated, 0);
+    }
+
+    /**
+     * @param collocated Collocation flag.
+     * @param nodeIdx Index of the node from which to create set.
+     * @throws Exception If failed.
+     */
+    protected void testCreateRemove(boolean collocated, int nodeIdx) throws Exception {
         for (int i = 0; i < gridCount(); i++)
             assertNull(grid(i).set(SET_NAME, null));
 
         CollectionConfiguration colCfg0 = config(collocated);
 
-        IgniteSet<Integer> set0 = grid(0).set(SET_NAME, colCfg0);
+        IgniteSet<Integer> set0 = grid(nodeIdx).set(SET_NAME, colCfg0);
 
         assertNotNull(set0);
 
@@ -411,10 +421,19 @@ public abstract class GridCacheSetAbstractSelfTest extends IgniteCollectionAbstr
      * @param collocated Collocation flag.
      * @throws Exception If failed.
      */
-    private void testIterator(boolean collocated) throws Exception {
+    protected void testIterator(boolean collocated) throws Exception {
+        testIterator(collocated, 0);
+    }
+
+    /**
+     * @param collocated Collocation flag.
+     * @param nodeIdx Index of the node from which to create set.
+     * @throws Exception If failed.
+     */
+    protected void testIterator(boolean collocated, int nodeIdx) throws Exception {
         CollectionConfiguration colCfg = config(collocated);
 
-        final IgniteSet<Integer> set0 = grid(0).set(SET_NAME, colCfg);
+        final IgniteSet<Integer> set0 = grid(nodeIdx).set(SET_NAME, colCfg);
 
         for (int i = 0; i < gridCount(); i++) {
             IgniteSet<Integer> set = grid(i).set(SET_NAME, null);
@@ -839,7 +858,9 @@ public abstract class GridCacheSetAbstractSelfTest extends IgniteCollectionAbstr
         for (int i = 0; i < 10; i++)
             set.add(i);
 
-        Collection<Integer> c = grid(0).compute().broadcast(new IgniteCallable<Integer>() {
+        IgniteCluster cluster = grid(0).cluster();
+
+        Collection<Integer> c = grid(0).compute(cluster).broadcast(new IgniteCallable<Integer>() {
             @Override public Integer call() throws Exception {
                 assertEquals(SET_NAME, set.name());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/507aeb21/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedSetWithClientSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedSetWithClientSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedSetWithClientSelfTest.java
new file mode 100644
index 0000000..97be50d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedSetWithClientSelfTest.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.processors.cache.datastructures.partitioned;
+
+import org.apache.ignite.configuration.IgniteConfiguration;
+
+/**
+ * Tests IgniteSet with client node on {@code PARTITIONED} cache.
+ */
+public class GridCachePartitionedSetWithClientSelfTest extends GridCachePartitionedSetSelfTest {
+    /** */
+    private static final int CLIENT_NODE_IDX = 4;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        cfg.setClientMode(getTestIgniteInstanceIndex(igniteInstanceName) == CLIENT_NODE_IDX);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void testCreateRemove(boolean collocated) throws Exception {
+        testCreateRemove(collocated, CLIENT_NODE_IDX);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void testIterator(boolean collocated) throws Exception {
+        testIterator(collocated, CLIENT_NODE_IDX);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 5;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/507aeb21/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedSetWithNodeFilterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedSetWithNodeFilterSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedSetWithNodeFilterSelfTest.java
new file mode 100644
index 0000000..116f383
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedSetWithNodeFilterSelfTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.datastructures.partitioned;
+
+import org.apache.ignite.configuration.CollectionConfiguration;
+import org.apache.ignite.util.AttributeNodeFilter;
+
+import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_IGNITE_INSTANCE_NAME;
+
+/**
+ * Tests IgniteSet with node filter on {@code PARTITIONED} cache.
+ */
+public class GridCachePartitionedSetWithNodeFilterSelfTest extends GridCachePartitionedSetSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CollectionConfiguration collectionConfiguration() {
+        CollectionConfiguration cfg = super.collectionConfiguration();
+
+        cfg.setNodeFilter(new AttributeNodeFilter(ATTR_IGNITE_INSTANCE_NAME, getTestIgniteInstanceName(0)));
+
+        return cfg;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/507aeb21/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedSetWithClientSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedSetWithClientSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedSetWithClientSelfTest.java
new file mode 100644
index 0000000..0c975ac
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedSetWithClientSelfTest.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.processors.cache.datastructures.replicated;
+
+import org.apache.ignite.configuration.IgniteConfiguration;
+
+/**
+ * Tests IgniteSet with client node on {@code REPLICATED} cache.
+ */
+public class GridCacheReplicatedSetWithClientSelfTest extends GridCacheReplicatedSetSelfTest {
+    /** */
+    private static final int CLIENT_NODE_IDX = 4;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        cfg.setClientMode(getTestIgniteInstanceIndex(igniteInstanceName) == CLIENT_NODE_IDX);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void testCreateRemove(boolean collocated) throws Exception {
+        testCreateRemove(collocated, CLIENT_NODE_IDX);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void testIterator(boolean collocated) throws Exception {
+        testIterator(collocated, CLIENT_NODE_IDX);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 5;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/507aeb21/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedSetWithNodeFilterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedSetWithNodeFilterSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedSetWithNodeFilterSelfTest.java
new file mode 100644
index 0000000..1db790b
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/GridCacheReplicatedSetWithNodeFilterSelfTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.datastructures.replicated;
+
+import org.apache.ignite.configuration.CollectionConfiguration;
+import org.apache.ignite.util.AttributeNodeFilter;
+
+import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_IGNITE_INSTANCE_NAME;
+
+/**
+ * Tests IgniteSet with node filter on {@code REPLICATED} cache.
+ */
+public class GridCacheReplicatedSetWithNodeFilterSelfTest extends GridCacheReplicatedSetSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CollectionConfiguration collectionConfiguration() {
+        CollectionConfiguration cfg = super.collectionConfiguration();
+
+        cfg.setNodeFilter(new AttributeNodeFilter(ATTR_IGNITE_INSTANCE_NAME, getTestIgniteInstanceName(0)));
+
+        return cfg;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/507aeb21/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
index db74c72..bca706e 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
@@ -62,6 +62,8 @@ import org.apache.ignite.internal.processors.cache.datastructures.partitioned.Gr
 import org.apache.ignite.internal.processors.cache.datastructures.partitioned.GridCachePartitionedSequenceMultiNodeSelfTest;
 import org.apache.ignite.internal.processors.cache.datastructures.partitioned.GridCachePartitionedSetFailoverSelfTest;
 import org.apache.ignite.internal.processors.cache.datastructures.partitioned.GridCachePartitionedSetSelfTest;
+import org.apache.ignite.internal.processors.cache.datastructures.partitioned.GridCachePartitionedSetWithClientSelfTest;
+import org.apache.ignite.internal.processors.cache.datastructures.partitioned.GridCachePartitionedSetWithNodeFilterSelfTest;
 import org.apache.ignite.internal.processors.cache.datastructures.partitioned.IgnitePartitionedAtomicLongApiSelfTest;
 import org.apache.ignite.internal.processors.cache.datastructures.partitioned.IgnitePartitionedCountDownLatchSelfTest;
 import org.apache.ignite.internal.processors.cache.datastructures.partitioned.IgnitePartitionedQueueNoBackupsTest;
@@ -76,6 +78,8 @@ import org.apache.ignite.internal.processors.cache.datastructures.replicated.Gri
 import org.apache.ignite.internal.processors.cache.datastructures.replicated.GridCacheReplicatedSequenceApiSelfTest;
 import org.apache.ignite.internal.processors.cache.datastructures.replicated.GridCacheReplicatedSequenceMultiNodeSelfTest;
 import org.apache.ignite.internal.processors.cache.datastructures.replicated.GridCacheReplicatedSetSelfTest;
+import org.apache.ignite.internal.processors.cache.datastructures.replicated.GridCacheReplicatedSetWithClientSelfTest;
+import org.apache.ignite.internal.processors.cache.datastructures.replicated.GridCacheReplicatedSetWithNodeFilterSelfTest;
 import org.apache.ignite.internal.processors.cache.datastructures.replicated.IgniteReplicatedAtomicLongApiSelfTest;
 import org.apache.ignite.internal.processors.cache.datastructures.replicated.IgniteReplicatedCountDownLatchSelfTest;
 import org.apache.ignite.internal.processors.cache.datastructures.replicated.IgniteReplicatedLockSelfTest;
@@ -112,6 +116,8 @@ public class IgniteCacheDataStructuresSelfTestSuite extends TestSuite {
         suite.addTest(new TestSuite(GridCacheReplicatedQueueMultiNodeSelfTest.class));
         suite.addTest(new TestSuite(GridCacheReplicatedQueueRotativeMultiNodeTest.class));
         suite.addTest(new TestSuite(GridCacheReplicatedSetSelfTest.class));
+        suite.addTest(new TestSuite(GridCacheReplicatedSetWithClientSelfTest.class));
+        suite.addTest(new TestSuite(GridCacheReplicatedSetWithNodeFilterSelfTest.class));
         suite.addTest(new TestSuite(GridCacheReplicatedDataStructuresFailoverSelfTest.class));
         suite.addTest(new TestSuite(IgniteReplicatedCountDownLatchSelfTest.class));
         suite.addTest(new TestSuite(IgniteReplicatedSemaphoreSelfTest.class));
@@ -129,6 +135,8 @@ public class IgniteCacheDataStructuresSelfTestSuite extends TestSuite {
         suite.addTest(new TestSuite(GridCachePartitionedQueueCreateMultiNodeSelfTest.class));
         suite.addTest(new TestSuite(GridCachePartitionedAtomicQueueCreateMultiNodeSelfTest.class));
         suite.addTest(new TestSuite(GridCachePartitionedSetSelfTest.class));
+        suite.addTest(new TestSuite(GridCachePartitionedSetWithClientSelfTest.class));
+        suite.addTest(new TestSuite(GridCachePartitionedSetWithNodeFilterSelfTest.class));
         suite.addTest(new TestSuite(IgnitePartitionedSetNoBackupsSelfTest.class));
         suite.addTest(new TestSuite(GridCachePartitionedAtomicSetSelfTest.class));
         suite.addTest(new TestSuite(IgnitePartitionedCountDownLatchSelfTest.class));


[04/50] [abbrv] ignite git commit: IGNITE-10392 Use lasdAffChangedTopVer if DiscoCache for the requested topVer isn't ready - Fixes #5488.

Posted by sb...@apache.org.
IGNITE-10392 Use lasdAffChangedTopVer if DiscoCache for the requested topVer isn't ready - Fixes #5488.

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/5c01c419
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5c01c419
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5c01c419

Branch: refs/heads/ignite-10044
Commit: 5c01c4199df3ba3a479d4566561335d57adffd0f
Parents: 5b656e2
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Fri Nov 23 20:23:16 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Nov 23 20:23:16 2018 +0300

----------------------------------------------------------------------
 .../internal/managers/discovery/GridDiscoveryManager.java    | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5c01c419/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 476fe7e..0a982b0 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
@@ -2058,6 +2058,14 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
             snap.discoCache : discoCacheHist.get(topVer);
 
         if (cache == null) {
+            AffinityTopologyVersion lastAffChangedTopVer =
+                ctx.cache().context().exchange().lastAffinityChangedTopologyVersion(topVer);
+
+            DiscoCache lastAffChangedDiscoCache = discoCacheHist.get(lastAffChangedTopVer);
+
+            if (lastAffChangedDiscoCache != null)
+                return lastAffChangedDiscoCache;
+
             CacheGroupDescriptor desc = ctx.cache().cacheGroupDescriptors().get(grpId);
 
             throw new IgniteException("Failed to resolve nodes topology [" +


[28/50] [abbrv] ignite git commit: IGNITE-7441 Drop IGNITE_SERVICES_COMPATIBILITY_MODE system property - Fixes #5482.

Posted by sb...@apache.org.
IGNITE-7441 Drop IGNITE_SERVICES_COMPATIBILITY_MODE system property - Fixes #5482.

Signed-off-by: Ilya Kasnacheev <il...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/19060028
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/19060028
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/19060028

Branch: refs/heads/ignite-10044
Commit: 19060028185a82878891768ec34adc553384ef5e
Parents: 41f4225
Author: Vyacheslav Daradur <da...@gmail.com>
Authored: Tue Nov 27 18:45:28 2018 +0300
Committer: Ilya Kasnacheev <il...@gmail.com>
Committed: Tue Nov 27 18:45:28 2018 +0300

----------------------------------------------------------------------
 .../apache/ignite/IgniteSystemProperties.java   | 15 -------
 .../ignite/internal/IgniteNodeAttributes.java   |  3 --
 .../discovery/GridDiscoveryManager.java         | 17 --------
 .../service/GridServiceProcessor.java           | 12 ------
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 41 --------------------
 .../GridDiscoveryManagerAttributesSelfTest.java | 37 ------------------
 6 files changed, 125 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/19060028/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 3c59ea1..d581e75 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -591,21 +591,6 @@ public final class IgniteSystemProperties {
         "IGNITE_H2_INDEXING_CACHE_THREAD_USAGE_TIMEOUT";
 
     /**
-     * Manages backward compatibility of {@link IgniteServices}. All nodes in cluster must have identical value
-     * of this property.
-     * <p>
-     * If property is {@code false} then node is not required to have service implementation class if service is not
-     * deployed on this node.
-     * <p>
-     * If the property is {@code true} then service implementation class is required on node even if service
-     * is not deployed on this node.
-     * <p>
-     * If the property is not set ({@code null}) then Ignite will automatically detect which compatibility mode
-     * should be used.
-     */
-    public static final String IGNITE_SERVICES_COMPATIBILITY_MODE = "IGNITE_SERVICES_COMPATIBILITY_MODE";
-
-    /**
      * Manages backward compatibility of {@link StreamTransformer#from(CacheEntryProcessor)} method.
      * <p>
      * If the property is {@code true}, then the wrapped {@link CacheEntryProcessor} won't be able to be loaded over

http://git-wip-us.apache.org/repos/asf/ignite/blob/19060028/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
index 4ca4f1b..24a71a8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
@@ -174,9 +174,6 @@ public final class IgniteNodeAttributes {
     /** Late affinity assignment mode. */
     public static final String ATTR_LATE_AFFINITY_ASSIGNMENT = ATTR_PREFIX + ".cache.lateAffinity";
 
-    /** Ignite services compatibility mode (can be {@code null}). */
-    public static final String ATTR_SERVICES_COMPATIBILITY_MODE = ATTR_PREFIX + ".services.compatibility.enabled";
-
     /** Late affinity assignment mode. */
     public static final String ATTR_ACTIVE_ON_START = ATTR_PREFIX + ".active.on.start";
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/19060028/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 0a982b0..9a0ca92 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
@@ -144,7 +144,6 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_BINARY_MARSHALLER_
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_DISCOVERY_HISTORY_SIZE;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_OPTIMIZED_MARSHALLER_USE_DEFAULT_SUID;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_SECURITY_COMPATIBILITY_MODE;
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_SERVICES_COMPATIBILITY_MODE;
 import static org.apache.ignite.IgniteSystemProperties.getInteger;
 import static org.apache.ignite.events.EventType.EVT_CLIENT_NODE_DISCONNECTED;
 import static org.apache.ignite.events.EventType.EVT_CLIENT_NODE_RECONNECTED;
@@ -165,7 +164,6 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_OFFHEAP_SIZE;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PEER_CLASSLOADING;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PHY_RAM;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SECURITY_COMPATIBILITY_MODE;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SERVICES_COMPATIBILITY_MODE;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_USER_NAME;
 import static org.apache.ignite.internal.IgniteVersionUtils.VER;
 import static org.apache.ignite.internal.events.DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT;
@@ -1219,7 +1217,6 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
 
         boolean locDelayAssign = locNode.attribute(ATTR_LATE_AFFINITY_ASSIGNMENT);
 
-        Boolean locSrvcCompatibilityEnabled = locNode.attribute(ATTR_SERVICES_COMPATIBILITY_MODE);
         Boolean locSecurityCompatibilityEnabled = locNode.attribute(ATTR_SECURITY_COMPATIBILITY_MODE);
 
         for (ClusterNode n : nodes) {
@@ -1305,20 +1302,6 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
                     ", rmtAddrs=" + U.addressesAsString(n) + ", rmtNode=" + U.toShortString(n) + "]");
             }
 
-            Boolean rmtSrvcCompatibilityEnabled = n.attribute(ATTR_SERVICES_COMPATIBILITY_MODE);
-
-            if (!F.eq(locSrvcCompatibilityEnabled, rmtSrvcCompatibilityEnabled)) {
-                throw new IgniteCheckedException("Local node's " + IGNITE_SERVICES_COMPATIBILITY_MODE +
-                    " property value differs from remote node's value " +
-                    "(to make sure all nodes in topology have identical IgniteServices compatibility mode enabled, " +
-                    "configure system property explicitly) " +
-                    "[locSrvcCompatibilityEnabled=" + locSrvcCompatibilityEnabled +
-                    ", rmtSrvcCompatibilityEnabled=" + rmtSrvcCompatibilityEnabled +
-                    ", locNodeAddrs=" + U.addressesAsString(locNode) +
-                    ", rmtNodeAddrs=" + U.addressesAsString(n) +
-                    ", locNodeId=" + locNode.id() + ", rmtNode=" + U.toShortString(n) + "]");
-            }
-
             if (n.version().compareToIgnoreTimestamp(SERVICE_PERMISSIONS_SINCE) >= 0
                 && ctx.security().enabled() // Matters only if security enabled.
                ) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/19060028/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index 271204c..d4ec78f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -110,11 +110,8 @@ import org.apache.ignite.transactions.Transaction;
 import org.jetbrains.annotations.Nullable;
 
 import static javax.cache.event.EventType.REMOVED;
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_SERVICES_COMPATIBILITY_MODE;
-import static org.apache.ignite.IgniteSystemProperties.getString;
 import static org.apache.ignite.configuration.DeploymentMode.ISOLATED;
 import static org.apache.ignite.configuration.DeploymentMode.PRIVATE;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SERVICES_COMPATIBILITY_MODE;
 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;
@@ -124,9 +121,6 @@ import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_REA
  */
 @SuppressWarnings({"SynchronizationOnLocalVariableOrMethodParameter", "ConstantConditions"})
 public class GridServiceProcessor extends GridProcessorAdapter implements IgniteChangeGlobalStateSupport {
-    /** */
-    private final Boolean srvcCompatibilitySysProp;
-
     /** Time to wait before reassignment retries. */
     private static final long RETRY_TIMEOUT = 1000;
 
@@ -183,10 +177,6 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
 
         depExe = Executors.newSingleThreadExecutor(new IgniteThreadFactory(ctx.igniteInstanceName(),
             "srvc-deploy", oomeHnd));
-
-        String servicesCompatibilityMode = getString(IGNITE_SERVICES_COMPATIBILITY_MODE);
-
-        srvcCompatibilitySysProp = servicesCompatibilityMode == null ? null : Boolean.valueOf(servicesCompatibilityMode);
     }
 
     /**
@@ -205,8 +195,6 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
 
     /** {@inheritDoc} */
     @Override public void start() throws IgniteCheckedException {
-        ctx.addNodeAttribute(ATTR_SERVICES_COMPATIBILITY_MODE, srvcCompatibilitySysProp);
-
         if (ctx.isDaemon())
             return;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/19060028/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 2c3569e..4c74706 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
@@ -150,7 +150,6 @@ import org.jetbrains.annotations.Nullable;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_BINARY_MARSHALLER_USE_STRING_SERIALIZATION_VER_2;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_DISCOVERY_CLIENT_RECONNECT_HISTORY_SIZE;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_OPTIMIZED_MARSHALLER_USE_DEFAULT_SUID;
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_SERVICES_COMPATIBILITY_MODE;
 import static org.apache.ignite.IgniteSystemProperties.getInteger;
 import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
 import static org.apache.ignite.events.EventType.EVT_NODE_JOINED;
@@ -164,7 +163,6 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_COMPACT_FOOTER;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_BINARY_STRING_SER_VER_2;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_DFLT_SUID;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SERVICES_COMPATIBILITY_MODE;
 import static org.apache.ignite.spi.IgnitePortProtocol.TCP;
 import static org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoverySpiState.AUTH_FAILED;
 import static org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoverySpiState.CHECK_FAILED;
@@ -4030,45 +4028,6 @@ class ServerImpl extends TcpDiscoveryImpl {
                     return;
                 }
 
-                final Boolean locSrvcCompatibilityEnabled = locNode.attribute(ATTR_SERVICES_COMPATIBILITY_MODE);
-
-                final Boolean rmtSrvcCompatibilityEnabled = node.attribute(ATTR_SERVICES_COMPATIBILITY_MODE);
-
-                if (!F.eq(locSrvcCompatibilityEnabled, rmtSrvcCompatibilityEnabled)) {
-                    utilityPool.execute(
-                        new Runnable() {
-                            @Override public void run() {
-                                String errMsg = "Local node's " + IGNITE_SERVICES_COMPATIBILITY_MODE +
-                                    " property value differs from remote node's value " +
-                                    "(to make sure all nodes in topology have identical IgniteServices compatibility mode, " +
-                                    "configure system property explicitly) " +
-                                    "[locSrvcCompatibilityEnabled=" + locSrvcCompatibilityEnabled +
-                                    ", rmtSrvcCompatibilityEnabled=" + rmtSrvcCompatibilityEnabled +
-                                    ", locNodeAddrs=" + U.addressesAsString(locNode) +
-                                    ", rmtNodeAddrs=" + U.addressesAsString(node) +
-                                    ", locNodeId=" + locNode.id() + ", rmtNodeId=" + msg.creatorNodeId() + ']';
-
-                                String sndMsg = "Local node's " + IGNITE_SERVICES_COMPATIBILITY_MODE +
-                                    " property value differs from remote node's value " +
-                                    "(to make sure all nodes in topology have identical IgniteServices compatibility mode, " +
-                                    "configure system property explicitly) " +
-                                    "[locSrvcCompatibilityEnabled=" + rmtSrvcCompatibilityEnabled +
-                                    ", rmtSrvcCompatibilityEnabled=" + locSrvcCompatibilityEnabled +
-                                    ", locNodeAddrs=" + U.addressesAsString(node) + ", locPort=" + node.discoveryPort() +
-                                    ", rmtNodeAddr=" + U.addressesAsString(locNode) + ", locNodeId=" + node.id() +
-                                    ", rmtNodeId=" + locNode.id() + ']';
-
-                                nodeCheckError(
-                                    node,
-                                    errMsg,
-                                    sndMsg);
-                            }
-                        });
-
-                    // Ignore join request.
-                    return;
-                }
-
                 // Handle join.
                 node.internalOrder(ring.nextNodeOrder());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/19060028/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 69f95e8..d19ae72 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
@@ -34,7 +34,6 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_BINARY_MARSHALLER_USE_STRING_SERIALIZATION_VER_2;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_OPTIMIZED_MARSHALLER_USE_DEFAULT_SUID;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_SECURITY_COMPATIBILITY_MODE;
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_SERVICES_COMPATIBILITY_MODE;
 import static org.apache.ignite.configuration.DeploymentMode.CONTINUOUS;
 import static org.apache.ignite.configuration.DeploymentMode.SHARED;
 
@@ -248,42 +247,6 @@ public abstract class GridDiscoveryManagerAttributesSelfTest extends GridCommonA
     /**
      * @throws Exception If failed.
      */
-    public void testServiceCompatibilityEnabled() throws Exception {
-        String backup = System.getProperty(IGNITE_SERVICES_COMPATIBILITY_MODE);
-
-        try {
-            doTestServiceCompatibilityEnabled(true, null, true);
-            doTestServiceCompatibilityEnabled(false, null, true);
-            doTestServiceCompatibilityEnabled(null, false, true);
-            doTestServiceCompatibilityEnabled(true, false, true);
-            doTestServiceCompatibilityEnabled(null, true, true);
-            doTestServiceCompatibilityEnabled(false, true, true);
-
-            doTestServiceCompatibilityEnabled(true, true, false);
-            doTestServiceCompatibilityEnabled(false, false, false);
-            doTestServiceCompatibilityEnabled(null, null, false);
-        }
-        finally {
-            if (backup != null)
-                System.setProperty(IGNITE_SERVICES_COMPATIBILITY_MODE, backup);
-            else
-                System.clearProperty(IGNITE_SERVICES_COMPATIBILITY_MODE);
-        }
-    }
-
-    /**
-     * @param first Service compatibility enabled flag for first node.
-     * @param second Service compatibility enabled flag for second node.
-     * @param fail Fail flag.
-     * @throws Exception If failed.
-     */
-    private void doTestServiceCompatibilityEnabled(Object first, Object second, boolean fail) throws Exception {
-        doTestCompatibilityEnabled(IGNITE_SERVICES_COMPATIBILITY_MODE, first, second, fail);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
     public void testSecurityCompatibilityEnabled() throws Exception {
         TestReconnectPluginProvider.enabled = true;
         TestReconnectProcessor.enabled = true;


[06/50] [abbrv] ignite git commit: IGNITE-10216: disable sort annotations in inspection config - Fixes #5471.

Posted by sb...@apache.org.
IGNITE-10216: disable sort annotations in inspection config - Fixes #5471.

Signed-off-by: Nikolay Izhikov <ni...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cdaeda10
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cdaeda10
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cdaeda10

Branch: refs/heads/ignite-10044
Commit: cdaeda108c7ce42e9b32264a37ce4ccbdbf55e42
Parents: 475a0a7
Author: Maxim Muzafarov <ma...@gmail.com>
Authored: Fri Nov 23 23:03:15 2018 +0300
Committer: Nikolay Izhikov <ni...@apache.org>
Committed: Fri Nov 23 23:03:15 2018 +0300

----------------------------------------------------------------------
 idea/ignite_inspections.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cdaeda10/idea/ignite_inspections.xml
----------------------------------------------------------------------
diff --git a/idea/ignite_inspections.xml b/idea/ignite_inspections.xml
index 7ce5af8..9695fca 100644
--- a/idea/ignite_inspections.xml
+++ b/idea/ignite_inspections.xml
@@ -518,7 +518,7 @@
     <option name="ignoreAnonymousClassMethods" value="false" />
   </inspection_tool>
   <inspection_tool class="MissortedModifiers" enabled="true" level="WARNING" enabled_by_default="true">
-    <option name="m_requireAnnotationsFirst" value="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" />


[35/50] [abbrv] ignite git commit: IGNITE-10158 Some tests in IgniteCacheAbstractQuerySelfTest are incorrectly muted - Fixes #5344.

Posted by sb...@apache.org.
IGNITE-10158 Some tests in IgniteCacheAbstractQuerySelfTest are incorrectly muted - Fixes #5344.

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/be97bcdc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/be97bcdc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/be97bcdc

Branch: refs/heads/ignite-10044
Commit: be97bcdcfa6f0ae0bc37d156806bbac4c09259dc
Parents: 07f1dbf
Author: Oleg Ignatenko <oi...@gridgain.com>
Authored: Tue Nov 27 20:02:47 2018 +0300
Committer: Pavel Kovalenko <jo...@gmail.com>
Committed: Tue Nov 27 20:02:47 2018 +0300

----------------------------------------------------------------------
 .../cache/IgniteCacheAbstractQuerySelfTest.java | 54 +++-----------------
 .../IgniteCacheQueryMultiThreadedSelfTest.java  |  6 +--
 2 files changed, 8 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/be97bcdc/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
index 1c1b879..d5b8ccc 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
@@ -286,21 +286,12 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
      *
      * @throws Exception In case of error.
      */
-    public void _testDifferentKeyTypes() throws Exception {
-        fail("http://atlassian.gridgain.com/jira/browse/GG-11216");
-
+    public void testDifferentKeyTypes() throws Exception {
         final IgniteCache<Object, Object> cache = jcache(Object.class, Object.class);
 
         cache.put(1, "value");
 
-        try {
-            cache.put("key", "value");
-
-            fail();
-        }
-        catch (CacheException ignored) {
-            // No-op.
-        }
+        cache.put("key", "value");
     }
 
     /**
@@ -521,7 +512,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
 
         QueryCursor<Cache.Entry<Key, GridCacheQueryTestValue>> qry = cache
             .query(new SqlQuery<Key, GridCacheQueryTestValue>(GridCacheQueryTestValue.class,
-                    "fieldName='field1' and field2=1 and field3=1 and id=100500 and embeddedField2=11 and x=3"));
+                "fieldName='field1' and field2=1 and field3=1 and id=100500 and embeddedField2=11 and x=3"));
 
         Cache.Entry<Key, GridCacheQueryTestValue> entry = F.first(qry.getAll());
 
@@ -2232,39 +2223,6 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
     }
 
     /**
-     * Empty test object.
-     */
-    private static class EmptyObject {
-        /** */
-        private int val;
-
-        /**
-         * @param val Value.
-         */
-        private EmptyObject(int val) {
-            this.val = val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-
-            if (!(o instanceof EmptyObject))
-                return false;
-
-            EmptyObject that = (EmptyObject)o;
-
-            return val == that.val;
-        }
-    }
-
-    /**
      *
      */
     private static class BadHashKeyObject implements Serializable, Comparable<BadHashKeyObject> {
@@ -2404,9 +2362,9 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
          */
         @Override public String toString() {
             return "EnumObject{" +
-                    "id=" + id +
-                    ", type=" + type +
-                    '}';
+                "id=" + id +
+                ", type=" + type +
+                '}';
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/be97bcdc/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
index 8f28501..e9ebc18 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
@@ -360,9 +360,7 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes
      * @throws Exception If failed.
      */
     @SuppressWarnings({"TooBroadScope"})
-    public void _testMultiThreadedSwapUnswapLongString() throws Exception {
-        fail("http://atlassian.gridgain.com/jira/browse/GG-11216");
-
+    public void testMultiThreadedSwapUnswapLongString() throws Exception {
         int threadCnt = 50;
         final int keyCnt = 2000;
         final int valCnt = 10000;
@@ -758,4 +756,4 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes
             return val;
         }
     }
-}
\ No newline at end of file
+}


[16/50] [abbrv] ignite git commit: IGNITE-9517: Replace uses of ConcurrentHashSet with GridConcurrentHashSet in tests. - Fixes #5397.

Posted by sb...@apache.org.
IGNITE-9517: Replace uses of ConcurrentHashSet with GridConcurrentHashSet in tests. - Fixes #5397.

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/acc10241
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/acc10241
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/acc10241

Branch: refs/heads/ignite-10044
Commit: acc1024158ef600cdb078b0de8a9859beaa8b330
Parents: c870500
Author: shroman <rs...@yahoo.com>
Authored: Mon Nov 26 17:33:30 2018 +0300
Committer: Dmitriy Pavlov <dp...@apache.org>
Committed: Mon Nov 26 17:33:30 2018 +0300

----------------------------------------------------------------------
 .../internal/GridMultithreadedJobStealingSelfTest.java       | 6 +++---
 .../internal/binary/BinaryArrayIdentityResolverSelfTest.java | 4 ++--
 .../ignite/internal/binary/BinaryFieldsOffheapSelfTest.java  | 4 ++--
 .../internal/binary/BinaryFooterOffsetsOffheapSelfTest.java  | 4 ++--
 .../binary/BinarySerialiedFieldComparatorSelfTest.java       | 4 ++--
 ...GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java | 4 ++--
 .../processors/cache/distributed/CacheExchangeMergeTest.java | 4 ++--
 .../GridCachePartitionNotLoadedEventSelfTest.java            | 4 ++--
 .../cache/distributed/GridCacheTransformEventSelfTest.java   | 6 +++---
 .../IgniteCacheClientNodeChangingTopologyTest.java           | 4 ++--
 .../GridTcpCommunicationSpiConcurrentConnectSelfTest.java    | 4 ++--
 .../tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java      | 4 ++--
 .../tcp/GridTcpCommunicationSpiRecoverySelfTest.java         | 4 ++--
 .../IgniteTcpCommunicationRecoveryAckClosureSelfTest.java    | 4 ++--
 .../tcp/TcpDiscoveryPendingMessageDeliveryTest.java          | 8 ++++----
 .../ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java    | 8 ++++----
 .../ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java       | 4 ++--
 17 files changed, 40 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/modules/core/src/test/java/org/apache/ignite/internal/GridMultithreadedJobStealingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridMultithreadedJobStealingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridMultithreadedJobStealingSelfTest.java
index 293c859..605cb3d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridMultithreadedJobStealingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridMultithreadedJobStealingSelfTest.java
@@ -37,6 +37,7 @@ import org.apache.ignite.compute.ComputeJobAdapter;
 import org.apache.ignite.compute.ComputeJobResult;
 import org.apache.ignite.compute.ComputeTaskAdapter;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.typedef.G;
 import org.apache.ignite.resources.IgniteInstanceResource;
 import org.apache.ignite.resources.LoggerResource;
@@ -45,7 +46,6 @@ import org.apache.ignite.spi.failover.jobstealing.JobStealingFailoverSpi;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.testframework.junits.common.GridCommonTest;
-import org.eclipse.jetty.util.ConcurrentHashSet;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -86,7 +86,7 @@ public class GridMultithreadedJobStealingSelfTest extends GridCommonAbstractTest
 
         final AtomicInteger stolen = new AtomicInteger(0);
         final AtomicInteger noneStolen = new AtomicInteger(0);
-        final ConcurrentHashSet nodes = new ConcurrentHashSet();
+        final GridConcurrentHashSet nodes = new GridConcurrentHashSet();
 
         int threadsNum = 10;
 
@@ -141,7 +141,7 @@ public class GridMultithreadedJobStealingSelfTest extends GridCommonAbstractTest
 
         final AtomicInteger stolen = new AtomicInteger(0);
         final AtomicInteger noneStolen = new AtomicInteger(0);
-        final ConcurrentHashSet nodes = new ConcurrentHashSet();
+        final GridConcurrentHashSet nodes = new GridConcurrentHashSet();
 
         int threadsNum = 10;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryArrayIdentityResolverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryArrayIdentityResolverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryArrayIdentityResolverSelfTest.java
index 27c39c3..7548cf0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryArrayIdentityResolverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryArrayIdentityResolverSelfTest.java
@@ -26,10 +26,10 @@ import org.apache.ignite.binary.BinaryWriter;
 import org.apache.ignite.binary.Binarylizable;
 import org.apache.ignite.configuration.BinaryConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.GridUnsafe;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.eclipse.jetty.util.ConcurrentHashSet;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -42,7 +42,7 @@ import static org.junit.Assert.assertNotEquals;
  */
 public class BinaryArrayIdentityResolverSelfTest extends GridCommonAbstractTest {
     /** Pointers to release. */
-    private final Set<Long> ptrs = new ConcurrentHashSet<>();
+    private final Set<Long> ptrs = new GridConcurrentHashSet<>();
 
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {

http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldsOffheapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldsOffheapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldsOffheapSelfTest.java
index ca4bdd2..e5b3648 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldsOffheapSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldsOffheapSelfTest.java
@@ -17,15 +17,15 @@
 
 package org.apache.ignite.internal.binary;
 
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.GridUnsafe;
-import org.eclipse.jetty.util.ConcurrentHashSet;
 
 /**
  * Field tests for heap-based binaries.
  */
 public class BinaryFieldsOffheapSelfTest extends BinaryFieldsAbstractSelfTest {
     /** Allocated unsafe pointer. */
-    private final ConcurrentHashSet<Long> ptrs = new ConcurrentHashSet<>();
+    private final GridConcurrentHashSet<Long> ptrs = new GridConcurrentHashSet<>();
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {

http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFooterOffsetsOffheapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFooterOffsetsOffheapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFooterOffsetsOffheapSelfTest.java
index 052e652..8e00457 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFooterOffsetsOffheapSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFooterOffsetsOffheapSelfTest.java
@@ -17,15 +17,15 @@
 
 package org.apache.ignite.internal.binary;
 
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.GridUnsafe;
-import org.eclipse.jetty.util.ConcurrentHashSet;
 
 /**
  * Compact offsets tests for offheap binary objects.
  */
 public class BinaryFooterOffsetsOffheapSelfTest extends BinaryFooterOffsetsAbstractSelfTest {
     /** Allocated unsafe pointer. */
-    private final ConcurrentHashSet<Long> ptrs = new ConcurrentHashSet<>();
+    private final GridConcurrentHashSet<Long> ptrs = new GridConcurrentHashSet<>();
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {

http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/modules/core/src/test/java/org/apache/ignite/internal/binary/BinarySerialiedFieldComparatorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinarySerialiedFieldComparatorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinarySerialiedFieldComparatorSelfTest.java
index 4278ef4..1e0c5c9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinarySerialiedFieldComparatorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinarySerialiedFieldComparatorSelfTest.java
@@ -19,10 +19,10 @@ package org.apache.ignite.internal.binary;
 
 import org.apache.ignite.binary.BinaryObjectBuilder;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.GridUnsafe;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.eclipse.jetty.util.ConcurrentHashSet;
 
 import java.math.BigDecimal;
 import java.sql.Timestamp;
@@ -42,7 +42,7 @@ public class BinarySerialiedFieldComparatorSelfTest extends GridCommonAbstractTe
     private static final String FIELD_SINGLE = "single";
 
     /** Pointers to release. */
-    private final Set<Long> ptrs = new ConcurrentHashSet<>();
+    private final Set<Long> ptrs = new GridConcurrentHashSet<>();
 
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {

http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java
index 81614cb..3da8605 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java
@@ -31,6 +31,7 @@ import org.apache.ignite.IgniteBinary;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.binary.BinaryMarshaller;
@@ -41,7 +42,6 @@ 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;
-import org.eclipse.jetty.util.ConcurrentHashSet;
 
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 
@@ -91,7 +91,7 @@ public class GridCacheClientNodeBinaryObjectMetadataMultinodeTest extends GridCo
 
         final AtomicBoolean stop = new AtomicBoolean();
 
-        final ConcurrentHashSet<String> allTypes = new ConcurrentHashSet<>();
+        final GridConcurrentHashSet<String> allTypes = new GridConcurrentHashSet<>();
 
         IgniteInternalFuture<?> fut;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/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 93c1066..03ea539 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
@@ -58,6 +58,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleRequest;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.future.GridCompoundFuture;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.G;
@@ -74,7 +75,6 @@ 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.eclipse.jetty.util.ConcurrentHashSet;
 
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_EXCHANGE_HISTORY_SIZE;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
@@ -354,7 +354,7 @@ public class CacheExchangeMergeTest extends GridCommonAbstractTest {
 
             final AtomicInteger idx = new AtomicInteger(initNodes);
 
-            final ConcurrentHashSet<Integer> stopNodes = new ConcurrentHashSet<>();
+            final GridConcurrentHashSet<Integer> stopNodes = new GridConcurrentHashSet<>();
 
             IgniteInternalFuture fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
                 @Override public Void call() throws Exception {

http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/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 92783b0..334608d 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
@@ -32,6 +32,7 @@ import org.apache.ignite.events.EventType;
 import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -41,7 +42,6 @@ import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.GridTestUtils.SF;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.util.TestTcpCommunicationSpi;
-import org.eclipse.jetty.util.ConcurrentHashSet;
 
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -277,7 +277,7 @@ public class GridCachePartitionNotLoadedEventSelfTest extends GridCommonAbstract
      */
     private static class PartitionNotFullyLoadedListener implements IgnitePredicate<Event> {
         /** */
-        private Collection<Integer> lostParts = new ConcurrentHashSet<>();
+        private Collection<Integer> lostParts = new GridConcurrentHashSet<>();
 
         /** {@inheritDoc} */
         @Override public boolean apply(Event evt) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
index b1701a4..913321e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
@@ -36,6 +36,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.TransactionConfiguration;
 import org.apache.ignite.events.CacheEvent;
 import org.apache.ignite.events.Event;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.resources.IgniteInstanceResource;
@@ -45,7 +46,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
-import org.eclipse.jetty.util.ConcurrentHashSet;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -96,7 +96,7 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest {
     private IgniteCache<Integer, Integer>[] caches;
 
     /** Recorded events. */
-    private ConcurrentHashSet<CacheEvent> evts;
+    private GridConcurrentHashSet<CacheEvent> evts;
 
     /** Cache mode. */
     private CacheMode cacheMode;
@@ -174,7 +174,7 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest {
         this.txConcurrency = txConcurrency;
         this.txIsolation = txIsolation;
 
-        evts = new ConcurrentHashSet<>();
+        evts = new GridConcurrentHashSet<>();
 
         startGridsMultiThreaded(GRID_CNT, true);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/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 300ecb9..ce8749c 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
@@ -68,6 +68,7 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCach
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareRequest;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.G;
@@ -89,7 +90,6 @@ 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.eclipse.jetty.util.ConcurrentHashSet;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
@@ -1802,7 +1802,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         final int THREADS = CLIENT_CNT * 3;
 
-        final ConcurrentHashSet<Integer> putKeys = new ConcurrentHashSet<>();
+        final GridConcurrentHashSet<Integer> putKeys = new GridConcurrentHashSet<>();
 
         IgniteInternalFuture<?> fut;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
index ce96c55..9013016 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
@@ -39,6 +39,7 @@ import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteNodeAttributes;
 import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.nio.GridCommunicationClient;
 import org.apache.ignite.internal.util.nio.GridNioServer;
@@ -58,7 +59,6 @@ import org.apache.ignite.testframework.junits.IgniteMock;
 import org.apache.ignite.testframework.junits.IgniteTestResources;
 import org.apache.ignite.testframework.junits.spi.GridSpiAbstractTest;
 import org.apache.ignite.testframework.junits.spi.GridSpiTest;
-import org.eclipse.jetty.util.ConcurrentHashSet;
 
 /**
  *
@@ -125,7 +125,7 @@ public class GridTcpCommunicationSpiConcurrentConnectSelfTest<T extends Communic
         private final AtomicInteger cntr = new AtomicInteger();
 
         /** */
-        private final ConcurrentHashSet<Long> msgIds = new ConcurrentHashSet<>();
+        private final GridConcurrentHashSet<Long> msgIds = new GridConcurrentHashSet<>();
 
         /**
          * @param latch Latch.

http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
index e8a535b..16ad2c8 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
@@ -29,6 +29,7 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.nio.GridNioRecoveryDescriptor;
 import org.apache.ignite.internal.util.nio.GridNioServer;
@@ -49,7 +50,6 @@ import org.apache.ignite.testframework.junits.GridTestKernalContext;
 import org.apache.ignite.testframework.junits.IgniteTestResources;
 import org.apache.ignite.testframework.junits.spi.GridSpiAbstractTest;
 import org.apache.ignite.testframework.junits.spi.GridSpiTest;
-import org.eclipse.jetty.util.ConcurrentHashSet;
 
 /**
  *
@@ -92,7 +92,7 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS
     /** */
     private class TestListener implements CommunicationListener<Message> {
         /** */
-        private ConcurrentHashSet<Long> msgIds = new ConcurrentHashSet<>();
+        private GridConcurrentHashSet<Long> msgIds = new GridConcurrentHashSet<>();
 
         /** */
         private AtomicInteger rcvCnt = new AtomicInteger();

http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
index 5d09fbb..12cf4d9 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
@@ -34,6 +34,7 @@ import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
 import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.nio.GridNioServer;
 import org.apache.ignite.internal.util.nio.GridNioSession;
@@ -54,7 +55,6 @@ import org.apache.ignite.testframework.junits.IgniteMock;
 import org.apache.ignite.testframework.junits.IgniteTestResources;
 import org.apache.ignite.testframework.junits.spi.GridSpiAbstractTest;
 import org.apache.ignite.testframework.junits.spi.GridSpiTest;
-import org.eclipse.jetty.util.ConcurrentHashSet;
 
 /**
  *
@@ -114,7 +114,7 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
         private CountDownLatch blockLatch;
 
         /** */
-        private ConcurrentHashSet<Long> msgIds = new ConcurrentHashSet<>();
+        private GridConcurrentHashSet<Long> msgIds = new GridConcurrentHashSet<>();
 
         /** */
         private AtomicInteger rcvCnt = new AtomicInteger();

http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
index 8f8d101..5bee756 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
@@ -30,6 +30,7 @@ import org.apache.ignite.IgniteException;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.nio.GridNioRecoveryDescriptor;
 import org.apache.ignite.internal.util.nio.GridNioServer;
@@ -52,7 +53,6 @@ import org.apache.ignite.testframework.junits.GridTestKernalContext;
 import org.apache.ignite.testframework.junits.IgniteTestResources;
 import org.apache.ignite.testframework.junits.spi.GridSpiAbstractTest;
 import org.apache.ignite.testframework.junits.spi.GridSpiTest;
-import org.eclipse.jetty.util.ConcurrentHashSet;
 
 /**
  *
@@ -96,7 +96,7 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends Communic
     /** */
     private class TestListener implements CommunicationListener<Message> {
         /** */
-        private ConcurrentHashSet<Long> msgIds = new ConcurrentHashSet<>();
+        private GridConcurrentHashSet<Long> msgIds = new GridConcurrentHashSet<>();
 
         /** */
         private AtomicInteger rcvCnt = new AtomicInteger();

http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryPendingMessageDeliveryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryPendingMessageDeliveryTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryPendingMessageDeliveryTest.java
index 9b3dfee..5c1b5fe 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryPendingMessageDeliveryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryPendingMessageDeliveryTest.java
@@ -29,13 +29,13 @@ import org.apache.ignite.internal.managers.discovery.DiscoCache;
 import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
 import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.eclipse.jetty.util.ConcurrentHashSet;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -54,7 +54,7 @@ public class TcpDiscoveryPendingMessageDeliveryTest extends GridCommonAbstractTe
     /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
         blockMsgs = false;
-        receivedEnsuredMsgs = new ConcurrentHashSet<>();
+        receivedEnsuredMsgs = new GridConcurrentHashSet<>();
     }
 
     /** {@inheritDoc} */
@@ -88,7 +88,7 @@ public class TcpDiscoveryPendingMessageDeliveryTest extends GridCommonAbstractTe
         Ignite coord = startGrid("coordinator");
         TcpDiscoverySpi coordDisco = (TcpDiscoverySpi)coord.configuration().getDiscoverySpi();
 
-        Set<TcpDiscoveryAbstractMessage> sentEnsuredMsgs = new ConcurrentHashSet<>();
+        Set<TcpDiscoveryAbstractMessage> sentEnsuredMsgs = new GridConcurrentHashSet<>();
         coordDisco.addSendMessageListener(msg -> {
             if (coordDisco.ensured(msg))
                 sentEnsuredMsgs.add(msg);
@@ -143,7 +143,7 @@ public class TcpDiscoveryPendingMessageDeliveryTest extends GridCommonAbstractTe
         Ignite coord = startGrid("coordinator");
         TcpDiscoverySpi coordDisco = (TcpDiscoverySpi)coord.configuration().getDiscoverySpi();
 
-        Set<TcpDiscoveryAbstractMessage> sentEnsuredMsgs = new ConcurrentHashSet<>();
+        Set<TcpDiscoveryAbstractMessage> sentEnsuredMsgs = new GridConcurrentHashSet<>();
         coordDisco.addSendMessageListener(msg -> {
             if (coordDisco.ensured(msg))
                 sentEnsuredMsgs.add(msg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java
index cacefa5..96ac260 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java
@@ -30,13 +30,13 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.events.DiscoveryEvent;
 import org.apache.ignite.events.Event;
 import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.lang.IgnitePredicate;
 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.eclipse.jetty.util.ConcurrentHashSet;
 
 import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
 import static org.apache.ignite.events.EventType.EVT_NODE_JOINED;
@@ -90,7 +90,7 @@ public class TcpDiscoveryRestartTest extends GridCommonAbstractTest {
 
         startGrids(NODE_CNT);
 
-        final ConcurrentHashSet<UUID> nodeIds = new ConcurrentHashSet<>();
+        final GridConcurrentHashSet<UUID> nodeIds = new GridConcurrentHashSet<>();
 
         final AtomicInteger id = new AtomicInteger(NODE_CNT);
 
@@ -172,10 +172,10 @@ public class TcpDiscoveryRestartTest extends GridCommonAbstractTest {
      */
     private class TestEventListener implements IgnitePredicate<Event> {
         /** */
-        private final ConcurrentHashSet<UUID> joinIds = new ConcurrentHashSet<>();
+        private final GridConcurrentHashSet<UUID> joinIds = new GridConcurrentHashSet<>();
 
         /** */
-        private final ConcurrentHashSet<UUID> leftIds = new ConcurrentHashSet<>();
+        private final GridConcurrentHashSet<UUID> leftIds = new GridConcurrentHashSet<>();
 
         /** {@inheritDoc} */
         @Override public boolean apply(Event evt) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/acc10241/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 1aae8fb..32df795 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
@@ -58,6 +58,7 @@ import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
 import org.apache.ignite.internal.processors.continuous.StartRoutineAckDiscoveryMessage;
 import org.apache.ignite.internal.processors.port.GridPortRecord;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.G;
@@ -89,7 +90,6 @@ import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeLeftMessage;
 import org.apache.ignite.testframework.GridStringLogger;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.eclipse.jetty.util.ConcurrentHashSet;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -2372,7 +2372,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
      */
     private static class TestEventDiscardSpi extends TcpDiscoverySpi {
         /** */
-        private ConcurrentHashSet<IgniteUuid> msgIds = new ConcurrentHashSet<>();
+        private GridConcurrentHashSet<IgniteUuid> msgIds = new GridConcurrentHashSet<>();
 
         /** */
         private volatile boolean checkDuplicates;


[46/50] [abbrv] ignite git commit: IGNITE-10301 GridToStringBuilder is broken for classes with inheritance - Fixes #5463.

Posted by sb...@apache.org.
IGNITE-10301 GridToStringBuilder is broken for classes with inheritance - Fixes #5463.

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/2fca099f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2fca099f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2fca099f

Branch: refs/heads/ignite-10044
Commit: 2fca099fd30a5b425dd7d5798f57bd21bdbc9be1
Parents: 371586a
Author: Dmitrii Ryabov <So...@gmail.com>
Authored: Thu Nov 29 11:05:42 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Nov 29 11:05:42 2018 +0300

----------------------------------------------------------------------
 .../util/tostring/GridToStringBuilder.java      | 101 ++++++++++++++-----
 .../internal/util/tostring/SBLimitedLength.java |   1 -
 .../tostring/GridToStringBuilderSelfTest.java   |  82 +++++++++++++++
 3 files changed, 160 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2fca099f/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java b/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java
index 5394e3b..9313733 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java
@@ -116,13 +116,21 @@ public class GridToStringBuilder {
      * have to keep a map of this objects pointed to the position of previous occurrence
      * and remove/add them in each {@code toString()} apply.
      */
-    private static ThreadLocal<IdentityHashMap<Object, Integer>> savedObjects = new ThreadLocal<IdentityHashMap<Object, Integer>>() {
-        @Override protected IdentityHashMap<Object, Integer> initialValue() {
+    private static ThreadLocal<IdentityHashMap<Object, EntryReference>> savedObjects = new ThreadLocal<IdentityHashMap<Object, EntryReference>>() {
+        @Override protected IdentityHashMap<Object, EntryReference> initialValue() {
             return new IdentityHashMap<>();
         }
     };
 
     /**
+     * @param obj Object.
+     * @return Hexed identity hashcode.
+     */
+    public static String identity(Object obj) {
+        return '@' + Integer.toHexString(System.identityHashCode(obj));
+    }
+
+    /**
      * Produces auto-generated output of string presentation for given object and its declaration class.
      *
      * @param <T> Type of the object.
@@ -822,12 +830,12 @@ public class GridToStringBuilder {
             return;
         }
 
-        IdentityHashMap<Object, Integer> svdObjs = savedObjects.get();
+        IdentityHashMap<Object, EntryReference> svdObjs = savedObjects.get();
 
-        if (handleRecursion(buf, val, svdObjs))
+        if (handleRecursion(buf, val, cls, svdObjs))
             return;
 
-        svdObjs.put(val, buf.length());
+        svdObjs.put(val, new EntryReference(buf.length()));
 
         try {
             if (cls.isArray())
@@ -974,19 +982,22 @@ public class GridToStringBuilder {
 
         boolean newStr = buf.length() == 0;
 
-        IdentityHashMap<Object, Integer> svdObjs = savedObjects.get();
+        IdentityHashMap<Object, EntryReference> svdObjs = savedObjects.get();
 
         if (newStr)
-            svdObjs.put(obj, buf.length());
+            svdObjs.put(obj, new EntryReference(buf.length()));
 
         try {
+            int len = buf.length();
+
             String s = toStringImpl0(cls, buf, obj, addNames, addVals, addSens, addLen);
 
             if (newStr)
                 return s;
 
-            // Called from another GTSB.toString(), so this string is already in the buffer and shouldn't be returned.
-            return "";
+            buf.setLength(len);
+
+            return s.substring(len);
         }
         finally {
             if (newStr)
@@ -1021,7 +1032,17 @@ public class GridToStringBuilder {
 
             assert cd != null;
 
-            buf.a(cd.getSimpleClassName()).a(" [");
+            buf.a(cd.getSimpleClassName());
+
+            EntryReference ref = savedObjects.get().get(obj);
+
+            if (ref != null && ref.hashNeeded) {
+                buf.a(identity(obj));
+
+                ref.hashNeeded = false;
+            }
+
+            buf.a(" [");
 
             boolean first = true;
 
@@ -1776,24 +1797,37 @@ public class GridToStringBuilder {
      *
      * @param buf String builder buffer.
      * @param obj Object.
+     * @param cls Class.
      * @param svdObjs Map with saved objects to handle recursion.
      * @return {@code True} if object is already saved and name@hash was added to buffer.
      * {@code False} if it wasn't saved previously and it should be saved.
      */
-    private static boolean handleRecursion(SBLimitedLength buf, Object obj, IdentityHashMap<Object, Integer> svdObjs) {
-        Integer pos = svdObjs.get(obj);
+    private static boolean handleRecursion(
+        SBLimitedLength buf,
+        Object obj,
+        @NotNull Class cls,
+        IdentityHashMap<Object, EntryReference> svdObjs
+    ) {
+        EntryReference ref = svdObjs.get(obj);
 
-        if (pos == null)
+        if (ref == null)
             return false;
 
-        String name = obj.getClass().getSimpleName();
-        String hash = '@' + Integer.toHexString(System.identityHashCode(obj));
+        int pos = ref.pos;
+
+        String name = cls.getSimpleName();
+        String hash = identity(obj);
         String savedName = name + hash;
+        String charsAtPos = buf.impl().substring(pos, pos + savedName.length());
 
-        if (!buf.isOverflowed() && buf.impl().indexOf(savedName, pos) != pos) {
-            buf.i(pos + name.length(), hash);
+        if (!buf.isOverflowed() && !savedName.equals(charsAtPos)) {
+            if (charsAtPos.startsWith(cls.getSimpleName())) {
+                buf.i(pos + name.length(), hash);
 
-            incValues(svdObjs, obj, hash.length());
+                incValues(svdObjs, obj, hash.length());
+            }
+            else
+                ref.hashNeeded = true;
         }
 
         buf.a(savedName);
@@ -1808,14 +1842,35 @@ public class GridToStringBuilder {
      * @param obj Object.
      * @param hashLen Length of the object's hash.
      */
-    private static void incValues(IdentityHashMap<Object, Integer> svdObjs, Object obj, int hashLen) {
-        Integer baseline = svdObjs.get(obj);
+    private static void incValues(IdentityHashMap<Object, EntryReference> svdObjs, Object obj, int hashLen) {
+        int baseline = svdObjs.get(obj).pos;
+
+        for (IdentityHashMap.Entry<Object, EntryReference> entry : svdObjs.entrySet()) {
+            EntryReference ref = entry.getValue();
 
-        for (IdentityHashMap.Entry<Object, Integer> entry : svdObjs.entrySet()) {
-            Integer pos = entry.getValue();
+            int pos = ref.pos;
 
             if (pos > baseline)
-                entry.setValue(pos + hashLen);
+                ref.pos = pos + hashLen;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class EntryReference {
+        /** Position. */
+        int pos;
+
+        /** First object entry needs hash to be written. */
+        boolean hashNeeded;
+
+        /**
+         * @param pos Position.
+         */
+        private EntryReference(int pos) {
+            this.pos = pos;
+            hashNeeded = false;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/2fca099f/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/SBLimitedLength.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/SBLimitedLength.java b/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/SBLimitedLength.java
index b524b3d..640555a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/SBLimitedLength.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/tostring/SBLimitedLength.java
@@ -62,7 +62,6 @@ public class SBLimitedLength extends GridStringBuilder {
             tail.reset();
     }
 
-
     /**
      * @return tail string builder.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/2fca099f/modules/core/src/test/java/org/apache/ignite/internal/util/tostring/GridToStringBuilderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/tostring/GridToStringBuilderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/tostring/GridToStringBuilderSelfTest.java
index d249914..bf33f4a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/tostring/GridToStringBuilderSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/tostring/GridToStringBuilderSelfTest.java
@@ -40,6 +40,7 @@ import org.apache.ignite.testframework.junits.common.GridCommonTest;
 
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_TO_STRING_COLLECTION_LIMIT;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_TO_STRING_MAX_LENGTH;
+import static org.apache.ignite.internal.util.tostring.GridToStringBuilder.identity;
 
 /**
  * Tests for {@link GridToStringBuilder}.
@@ -517,6 +518,39 @@ public class GridToStringBuilderSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     *
+     */
+    public void testHierarchy() {
+        Wrapper w = new Wrapper();
+        Parent p = w.p;
+        String hash = identity(p);
+
+        checkHierarchy("Wrapper [p=Child [b=0, pb=Parent[] [null], super=Parent [a=0, pa=Parent[] [null]]]]", w);
+
+        p.pa[0] = p;
+
+        checkHierarchy("Wrapper [p=Child" + hash +
+            " [b=0, pb=Parent[] [null], super=Parent [a=0, pa=Parent[] [Child" + hash + "]]]]", w);
+
+        ((Child)p).pb[0] = p;
+
+        checkHierarchy("Wrapper [p=Child" + hash + " [b=0, pb=Parent[] [Child" + hash
+            + "], super=Parent [a=0, pa=Parent[] [Child" + hash + "]]]]", w);
+    }
+
+    /**
+     * @param exp Expected.
+     * @param w Wrapper.
+     */
+    private void checkHierarchy(String exp, Wrapper w) {
+        String wS = w.toString();
+
+        info(wS);
+
+        assertEquals(exp, wS);
+    }
+
+    /**
      * Test class.
      */
     private static class TestClass1 {
@@ -651,4 +685,52 @@ public class GridToStringBuilderSelfTest extends GridCommonAbstractTest {
             this.str = str;
         }
     }
+
+    /**
+     *
+     */
+    private static class Parent {
+        /** */
+        private int a;
+
+        /** */
+        @GridToStringInclude
+        private Parent pa[] = new Parent[1];
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(Parent.class, this);
+        }
+    }
+
+    /**
+     *
+     */
+    private static class Child extends Parent {
+        /** */
+        private int b;
+
+        /** */
+        @GridToStringInclude
+        private Parent pb[] = new Parent[1];
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(Child.class, this, super.toString());
+        }
+    }
+
+    /**
+     *
+     */
+    private static class Wrapper {
+        /** */
+        @GridToStringInclude
+        Parent p = new Child();
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(Wrapper.class, this);
+        }
+    }
 }


[20/50] [abbrv] ignite git commit: IGNITE-10399 Remove unused import. - Fixes #5493.

Posted by sb...@apache.org.
IGNITE-10399 Remove unused import. - Fixes #5493.

Signed-off-by: Nikolay Izhikov <ni...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/25c41fa1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/25c41fa1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/25c41fa1

Branch: refs/heads/ignite-10044
Commit: 25c41fa1de910a0eab29b2e9b3c53ca3307d3a97
Parents: 507aeb2
Author: Sergey Antonov <an...@gmail.com>
Authored: Mon Nov 26 22:43:55 2018 +0300
Committer: Nikolay Izhikov <ni...@apache.org>
Committed: Mon Nov 26 22:43:55 2018 +0300

----------------------------------------------------------------------
 .../processors/cache/persistence/pagemem/PageMemoryImpl.java        | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/25c41fa1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
index 03f66c0..f6aa059 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
@@ -85,7 +85,6 @@ import org.apache.ignite.internal.util.offheap.GridOffHeapOutOfMemoryException;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.spi.encryption.EncryptionSpi;
 import org.apache.ignite.spi.encryption.noop.NoopEncryptionSpi;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;


[44/50] [abbrv] ignite git commit: IGNITE-10080 Optimized Cache 6 long-running tests - Fixes #5243.

Posted by sb...@apache.org.
IGNITE-10080 Optimized Cache 6 long-running tests - Fixes #5243.

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/0e340428
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0e340428
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0e340428

Branch: refs/heads/ignite-10044
Commit: 0e3404281666668741fb8600d6e9021cccabe6d3
Parents: fe8c8cc
Author: pereslegin-pa <xx...@gmail.com>
Authored: Wed Nov 28 15:51:15 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Nov 28 15:51:15 2018 +0300

----------------------------------------------------------------------
 .../distributed/CacheExchangeMergeTest.java     |   4 +-
 ...ptimisticTxSuspendResumeMultiServerTest.java |  30 ---
 .../IgniteOptimisticTxSuspendResumeTest.java    | 228 +++++++++++++------
 ...OptimisticPrepareOnUnstableTopologyTest.java | 164 ++++++-------
 .../transactions/TxRollbackOnTimeoutTest.java   |   3 +-
 .../ignite/testframework/GridTestUtils.java     |   6 +-
 .../testsuites/IgniteCacheTestSuite6.java       |   2 -
 7 files changed, 238 insertions(+), 199 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0e340428/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 03ea539..2dad0b5 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
@@ -419,7 +419,9 @@ public class CacheExchangeMergeTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     private void concurrentStart(final boolean withClients) throws Exception {
-        for (int i = 0; i < 5; i++) {
+        int iterations = GridTestUtils.SF.applyLB(5, 1);
+
+        for (int i = 0; i < iterations; i++) {
             log.info("Iteration: " + i);
 
             startGrid(0);

http://git-wip-us.apache.org/repos/asf/ignite/blob/0e340428/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteOptimisticTxSuspendResumeMultiServerTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteOptimisticTxSuspendResumeMultiServerTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteOptimisticTxSuspendResumeMultiServerTest.java
deleted file mode 100644
index b7003d4..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteOptimisticTxSuspendResumeMultiServerTest.java
+++ /dev/null
@@ -1,30 +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.distributed;
-
-/**
- *
- */
-public class IgniteOptimisticTxSuspendResumeMultiServerTest extends IgniteOptimisticTxSuspendResumeTest {
-    /**
-     * @return Number of server nodes.
-     */
-    @Override protected int serversNumber() {
-        return 4;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0e340428/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteOptimisticTxSuspendResumeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteOptimisticTxSuspendResumeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteOptimisticTxSuspendResumeTest.java
index 66c204d..73a7dc1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteOptimisticTxSuspendResumeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteOptimisticTxSuspendResumeTest.java
@@ -19,17 +19,21 @@ package org.apache.ignite.internal.processors.cache.distributed;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.Callable;
+import java.util.concurrent.ThreadLocalRandom;
 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.cache.CacheMode;
+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.internal.util.typedef.CI1;
 import org.apache.ignite.internal.util.typedef.CI2;
 import org.apache.ignite.internal.util.typedef.PA;
@@ -62,7 +66,13 @@ public class IgniteOptimisticTxSuspendResumeTest extends GridCommonAbstractTest
     private static final int FUT_TIMEOUT = 5000;
 
     /** */
-    private boolean client = false;
+    private static final int CLIENT_CNT = 2;
+
+    /** */
+    private static final int SERVER_CNT = 4;
+
+    /** */
+    private static final int GRID_CNT = CLIENT_CNT + SERVER_CNT;
 
     /**
      * List of closures to execute transaction operation that prohibited in suspended state.
@@ -109,6 +119,10 @@ public class IgniteOptimisticTxSuspendResumeTest extends GridCommonAbstractTest
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
+        int idx = getTestIgniteInstanceIndex(igniteInstanceName);
+
+        boolean client = idx >= SERVER_CNT && idx < GRID_CNT;
+
         cfg.setClientMode(client);
 
         return cfg;
@@ -118,16 +132,21 @@ public class IgniteOptimisticTxSuspendResumeTest extends GridCommonAbstractTest
     @Override protected void beforeTestsStarted() throws Exception {
         super.beforeTestsStarted();
 
-        startGrids(serversNumber());
+        startGridsMultiThreaded(gridCount());
+    }
 
-        if (serversNumber() > 1) {
-            client = true;
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
 
-            startGrid(serversNumber());
+        Ignite client = ignite(gridCount() - 1);
 
-            startGrid(serversNumber() + 1);
+        assertTrue(client.cluster().localNode().isClient());
+
+        for (CacheConfiguration<Integer, Integer> ccfg : cacheConfigurations()) {
+            grid(0).createCache(ccfg);
 
-            client = false;
+            client.createNearCache(ccfg.getName(), new NearCacheConfiguration<>());
         }
 
         awaitPartitionMapExchange();
@@ -138,11 +157,19 @@ public class IgniteOptimisticTxSuspendResumeTest extends GridCommonAbstractTest
         stopAllGrids(true);
     }
 
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        for (CacheConfiguration ccfg : cacheConfigurations())
+            ignite(0).destroyCache(ccfg.getName());
+
+        super.afterTest();
+    }
+
     /**
      * @return Number of server nodes.
      */
-    protected int serversNumber() {
-        return 1;
+    protected int gridCount() {
+        return GRID_CNT;
     }
 
     /**
@@ -215,8 +242,8 @@ public class IgniteOptimisticTxSuspendResumeTest extends GridCommonAbstractTest
         executeTestForAllCaches(new CI2Exc<Ignite, IgniteCache<Integer, Integer>>() {
             @Override public void applyx(Ignite ignite, final IgniteCache<Integer, Integer> cache) throws Exception {
                 for (TransactionIsolation isolation : TransactionIsolation.values()) {
-                    final IgniteCache<Integer, Integer> otherCache =
-                        ignite.getOrCreateCache(cacheConfiguration(PARTITIONED, 0, false).setName("otherCache"));
+                    final IgniteCache<Integer, Integer> otherCache = ignite.getOrCreateCache(
+                        cacheConfiguration("otherCache", PARTITIONED, 0, false));
 
                     final Transaction tx = ignite.transactions().txStart(OPTIMISTIC, isolation);
 
@@ -435,10 +462,7 @@ public class IgniteOptimisticTxSuspendResumeTest extends GridCommonAbstractTest
 
                     tx.suspend();
 
-                    long start = U.currentTimeMillis();
-
-                    while(TX_TIMEOUT >= U.currentTimeMillis() - start)
-                        Thread.sleep(TX_TIMEOUT * 2);
+                    U.sleep(TX_TIMEOUT * 2);
 
                     GridTestUtils.assertThrowsWithCause(new Callable<Object>() {
                         @Override public Object call() throws Exception {
@@ -475,10 +499,7 @@ public class IgniteOptimisticTxSuspendResumeTest extends GridCommonAbstractTest
 
                     cache.put(1, 1);
 
-                    long start = U.currentTimeMillis();
-
-                    while(TX_TIMEOUT >= U.currentTimeMillis() - start)
-                        Thread.sleep(TX_TIMEOUT * 2);
+                    U.sleep(TX_TIMEOUT * 2);
 
                     GridTestUtils.assertThrowsWithCause(new Callable<Object>() {
                         @Override public Object call() throws Exception {
@@ -599,33 +620,92 @@ public class IgniteOptimisticTxSuspendResumeTest extends GridCommonAbstractTest
      * @throws Exception If failed.
      */
     public void testSuspendTxAndResumeAfterTopologyChange() throws Exception {
-        executeTestForAllCaches(new CI2Exc<Ignite, IgniteCache<Integer, Integer>>() {
-            @Override public void applyx(Ignite ignite, final IgniteCache<Integer, Integer> cache) throws Exception {
+        Ignite srv = ignite(ThreadLocalRandom.current().nextInt(SERVER_CNT));
+        Ignite client = ignite(SERVER_CNT);
+        Ignite clientNear = ignite(SERVER_CNT + 1);
+
+        Map<String, List<List<Integer>>> cacheKeys = generateKeys(srv, TransactionIsolation.values().length);
+
+        doCheckSuspendTxAndResume(srv, cacheKeys);
+        doCheckSuspendTxAndResume(client, cacheKeys);
+        doCheckSuspendTxAndResume(clientNear, cacheKeys);
+    }
+
+    /**
+     * @param node Ignite isntance.
+     * @param cacheKeys Different key types mapped to cache name.
+     * @throws Exception If failed.
+     */
+    private void doCheckSuspendTxAndResume(Ignite node, Map<String, List<List<Integer>>> cacheKeys) throws Exception {
+        ClusterNode locNode = node.cluster().localNode();
+
+        log.info("Run test for node [node=" + locNode.id() + ", client=" + locNode.isClient() + ']');
+
+        Map<IgniteCache<Integer, Integer>, Map<Transaction, Integer>> cacheTxMap = new IdentityHashMap<>();
+
+        for (Map.Entry<String, List<List<Integer>>> cacheKeysEntry : cacheKeys.entrySet()) {
+            String cacheName = cacheKeysEntry.getKey();
+
+            IgniteCache<Integer, Integer> cache = node.cache(cacheName);
+
+            Map<Transaction, Integer> suspendedTxs = new IdentityHashMap<>();
+
+            for (List<Integer> keysList : cacheKeysEntry.getValue()) {
                 for (TransactionIsolation isolation : TransactionIsolation.values()) {
-                    Transaction tx = ignite.transactions().txStart(OPTIMISTIC, isolation);
+                    Transaction tx = node.transactions().txStart(OPTIMISTIC, isolation);
 
-                    cache.put(1, 1);
+                    int key = keysList.get(isolation.ordinal());
+
+                    cache.put(key, key);
 
                     tx.suspend();
 
-                    assertEquals(SUSPENDED, tx.state());
+                    suspendedTxs.put(tx, key);
 
-                    try (IgniteEx g = startGrid(serversNumber() + 3)) {
-                        tx.resume();
+                    String msg = "node=" + node.cluster().localNode() +
+                        ", cache=" + cacheName + ", isolation=" + isolation + ", key=" + key;
 
-                        assertEquals(ACTIVE, tx.state());
+                    assertEquals(msg, SUSPENDED, tx.state());
+                }
+            }
 
-                        assertEquals(1, (int)cache.get(1));
+            cacheTxMap.put(cache, suspendedTxs);
+        }
 
-                        tx.commit();
+        int newNodeIdx = gridCount();
 
-                        assertEquals(1, (int)cache.get(1));
-                    }
+        startGrid(newNodeIdx);
 
-                    cache.removeAll();
+        try {
+            for (Map.Entry<IgniteCache<Integer, Integer>, Map<Transaction, Integer>>  entry : cacheTxMap.entrySet()) {
+                IgniteCache<Integer, Integer> cache = entry.getKey();
+
+                for (Map.Entry<Transaction, Integer> suspendedTx : entry.getValue().entrySet()) {
+                    Transaction tx = suspendedTx.getKey();
+
+                    Integer key = suspendedTx.getValue();
+
+                    tx.resume();
+
+                    String msg = "node=" + node.cluster().localNode() +
+                        ", cache=" + cache.getName() + ", isolation=" + tx.isolation() + ", key=" + key;
+
+                    assertEquals(msg, ACTIVE, tx.state());
+
+                    assertEquals(msg, key, cache.get(key));
+
+                    tx.commit();
+
+                    assertEquals(msg, key, cache.get(key));
                 }
             }
-        });
+        }
+        finally {
+            stopGrid(newNodeIdx);
+
+            for (IgniteCache<Integer, Integer> cache : cacheTxMap.keySet())
+                cache.removeAll();
+        }
     }
 
     /**
@@ -666,10 +746,10 @@ public class IgniteOptimisticTxSuspendResumeTest extends GridCommonAbstractTest
     private List<CacheConfiguration<Integer, Integer>> cacheConfigurations() {
         List<CacheConfiguration<Integer, Integer>> cfgs = new ArrayList<>();
 
-        cfgs.add(cacheConfiguration(PARTITIONED, 0, false));
-        cfgs.add(cacheConfiguration(PARTITIONED, 1, false));
-        cfgs.add(cacheConfiguration(PARTITIONED, 1, true));
-        cfgs.add(cacheConfiguration(REPLICATED, 0, false));
+        cfgs.add(cacheConfiguration("cache1", PARTITIONED, 0, false));
+        cfgs.add(cacheConfiguration("cache2", PARTITIONED, 1, false));
+        cfgs.add(cacheConfiguration("cache3", PARTITIONED, 1, true));
+        cfgs.add(cacheConfiguration("cache4", REPLICATED, 0, false));
 
         return cfgs;
     }
@@ -681,10 +761,11 @@ public class IgniteOptimisticTxSuspendResumeTest extends GridCommonAbstractTest
      * @return Cache configuration.
      */
     private CacheConfiguration<Integer, Integer> cacheConfiguration(
+        String name,
         CacheMode cacheMode,
         int backups,
         boolean nearCache) {
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(name);
 
         ccfg.setCacheMode(cacheMode);
         ccfg.setAtomicityMode(TRANSACTIONAL);
@@ -701,37 +782,56 @@ public class IgniteOptimisticTxSuspendResumeTest extends GridCommonAbstractTest
 
     /**
      * @param c Closure.
-     * @throws Exception If failed.
      */
-    private void executeTestForAllCaches(CI2<Ignite, IgniteCache<Integer, Integer>> c) throws Exception {
-        for (CacheConfiguration<Integer, Integer> ccfg : cacheConfigurations()) {
-            ignite(0).createCache(ccfg);
+    private void executeTestForAllCaches(CI2<Ignite, IgniteCache<Integer, Integer>> c) {
+        for (int i = 0; i < gridCount(); i++) {
+            Ignite ignite = ignite(i);
 
-            log.info("Run test for cache [cache=" + ccfg.getCacheMode() +
-                ", backups=" + ccfg.getBackups() +
-                ", near=" + (ccfg.getNearConfiguration() != null) + "]");
+            ClusterNode locNode = ignite.cluster().localNode();
 
-            awaitPartitionMapExchange();
+            log.info("Run test for node [node=" + locNode.id() + ", client=" + locNode.isClient() + ']');
 
-            int srvNum = serversNumber();
-            if (serversNumber() > 1) {
-                ignite(serversNumber() + 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>());
-                srvNum += 2;
-            }
+            for (CacheConfiguration ccfg : cacheConfigurations())
+                c.apply(ignite, ignite.cache(ccfg.getName()));
+        }
+    }
 
-            try {
-                for (int i = 0; i < srvNum; i++) {
-                    Ignite ignite = ignite(i);
+    /**
+     * Generates list of keys (primary, backup and neither primary nor backup).
+     *
+     * @param ignite Ignite instance.
+     * @param keysCnt The number of keys generated for each type of key.
+     * @return List of different keys mapped to cache name.
+     */
+    private Map<String, List<List<Integer>>> generateKeys(Ignite ignite, int keysCnt) {
+        Map<String, List<List<Integer>>> cacheKeys = new HashMap<>();
 
-                    log.info("Run test for node [node=" + i + ", client=" + ignite.configuration().isClientMode() + ']');
+        for (CacheConfiguration cfg : cacheConfigurations()) {
+            String cacheName = cfg.getName();
 
-                    c.apply(ignite, ignite.<Integer, Integer>cache(ccfg.getName()));
-                }
-            }
-            finally {
-                ignite(0).destroyCache(ccfg.getName());
+            IgniteCache cache = ignite.cache(cacheName);
+
+            List<List<Integer>> keys = new ArrayList<>();
+
+            // Generate different keys: 0 - primary, 1 - backup, 2 - neither primary nor backup.
+            for (int type = 0; type < 3; type++) {
+                if (type == 1 && cfg.getCacheMode() == PARTITIONED && cfg.getBackups() == 0)
+                    continue;
+
+                if (type == 2 && cfg.getCacheMode() == REPLICATED)
+                    continue;
+
+                List<Integer> keys0 = findKeys(cache, keysCnt, type * 100_000, type);
+
+                assertEquals(cacheName, keysCnt, keys0.size());
+
+                keys.add(keys0);
             }
+
+            cacheKeys.put(cacheName, keys);
         }
+
+        return cacheKeys;
     }
 
     /**
@@ -750,7 +850,7 @@ public class IgniteOptimisticTxSuspendResumeTest extends GridCommonAbstractTest
          */
         public abstract void applyx(E1 e1, E2 e2) throws Exception;
 
-        /** {@inheritdoc} */
+        /** {@inheritDoc} */
         @Override public void apply(E1 e1, E2 e2) {
             try {
                 applyx(e1, e2);
@@ -775,7 +875,7 @@ public class IgniteOptimisticTxSuspendResumeTest extends GridCommonAbstractTest
          */
         public abstract void applyx(T o) throws Exception;
 
-        /** {@inheritdoc} */
+        /** {@inheritDoc} */
         @Override public void apply(T o) {
             try {
                 applyx(o);
@@ -797,7 +897,7 @@ public class IgniteOptimisticTxSuspendResumeTest extends GridCommonAbstractTest
          */
         public abstract void runx() throws Exception;
 
-        /** {@inheritdoc} */
+        /** {@inheritDoc} */
         @Override public void run() {
             try {
                 runx();

http://git-wip-us.apache.org/repos/asf/ignite/blob/0e340428/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 21dcf90..cbdcffe 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
@@ -17,22 +17,23 @@
 
 package org.apache.ignite.internal.processors.cache.transactions;
 
-import java.util.ArrayList;
-import java.util.Collection;
 import java.util.TreeMap;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 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.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.future.GridCompoundFuture;
 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.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
@@ -49,21 +50,17 @@ public class TxOptimisticPrepareOnUnstableTopologyTest extends GridCommonAbstrac
     /** */
     public static final String CACHE_NAME = "part_cache";
 
-    /** IP finder. */
-    private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
     /** */
-    private volatile boolean run = true;
+    private static final int STARTUP_DELAY = 500;
 
     /** */
-    private boolean client;
+    private static final int GRID_CNT = 4;
 
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 
-        assertEquals(0, G.allGrids().size());
-    }
+    /** */
+    private boolean client;
 
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
@@ -110,58 +107,42 @@ public class TxOptimisticPrepareOnUnstableTopologyTest extends GridCommonAbstrac
      */
     private void doPrepareOnUnstableTopology(int keys, boolean testClient, TransactionIsolation isolation,
         long timeout) throws Exception {
-        Collection<Thread> threads = new ArrayList<>();
-
-        try {
-            // Start grid 1.
-            IgniteEx grid1 = startGrid(0);
-
-            assertFalse(grid1.configuration().isClientMode());
-
-            threads.add(runCacheOperations(grid1, isolation, timeout, keys));
-
-            TimeUnit.SECONDS.sleep(3L);
-
-            client = testClient; // If test client start on node in client mode.
-
-            // Start grid 2.
-            IgniteEx grid2 = startGrid(1);
-
-            assertEquals((Object)testClient, grid2.configuration().isClientMode());
+        GridCompoundFuture<Void, Object> compFut = new GridCompoundFuture<>();
 
-            client = false;
+        AtomicBoolean stopFlag = new AtomicBoolean();
 
-            threads.add(runCacheOperations(grid2, isolation, timeout, keys));
-
-            TimeUnit.SECONDS.sleep(3L);
-
-            // Start grid 3.
-            IgniteEx grid3 = startGrid(2);
+        try {
+            int clientIdx = testClient ? 1 : -1;
 
-            assertFalse(grid3.configuration().isClientMode());
+            try {
+                for (int i = 0; i < GRID_CNT; i++) {
+                    client = (clientIdx == i);
 
-            if (testClient)
-                log.info("Started client node: " + grid3.name());
+                    IgniteEx grid = startGrid(i);
 
-            threads.add(runCacheOperations(grid3, isolation, timeout, keys));
+                    assertEquals(client, grid.configuration().isClientMode().booleanValue());
 
-            TimeUnit.SECONDS.sleep(3L);
+                    client = false;
 
-            // Start grid 4.
-            IgniteEx grid4 = startGrid(3);
+                    IgniteInternalFuture<Void> fut = runCacheOperationsAsync(grid, stopFlag, isolation, timeout, keys);
 
-            assertFalse(grid4.configuration().isClientMode());
+                    compFut.add(fut);
 
-            threads.add(runCacheOperations(grid4, isolation, timeout, keys));
+                    U.sleep(STARTUP_DELAY);
+                }
+            }
+            finally {
+                stopFlag.set(true);
+            }
 
-            TimeUnit.SECONDS.sleep(3L);
+            compFut.markInitialized();
 
-            stopThreads(threads);
+            compFut.get();
 
-            for (int i = 0; i < 4; i++) {
+            for (int i = 0; i < GRID_CNT; i++) {
                 IgniteTxManager tm = ((IgniteKernal)grid(i)).internalCache(CACHE_NAME).context().tm();
 
-                assertEquals("txMap is not empty:" + i, 0, tm.idMapSize());
+                assertEquals("txMap is not empty: " + i, 0, tm.idMapSize());
             }
         }
         finally {
@@ -170,63 +151,50 @@ public class TxOptimisticPrepareOnUnstableTopologyTest extends GridCommonAbstrac
     }
 
     /**
-     * @param threads Thread which will be stopped.
-     */
-    private void stopThreads(Iterable<Thread> threads) {
-        try {
-            run = false;
-
-            for (Thread thread : threads)
-                thread.join();
-        }
-        catch (Exception e) {
-            U.error(log(), "Couldn't stop threads.", e);
-        }
-    }
-
-    /**
      * @param node Node.
      * @param isolation Isolation.
      * @param timeout Timeout.
      * @param keys Number of keys.
-     * @return Running thread.
+     * @return Future representing pending completion of the operation.
      */
-    private Thread runCacheOperations(Ignite node, TransactionIsolation isolation, long timeout, final int keys) {
-        Thread t = new Thread() {
-            @Override public void run() {
-                while (run) {
-                    TreeMap<Integer, String> vals = generateValues(keys);
-
-                    try {
-                        try (Transaction tx = node.transactions().txStart(TransactionConcurrency.OPTIMISTIC, isolation,
-                            timeout, keys)){
-
-                            IgniteCache<Object, Object> cache = node.cache(CACHE_NAME);
-
-                            // Put or remove.
-                            if (ThreadLocalRandom.current().nextDouble(1) < 0.65)
-                                cache.putAll(vals);
-                            else
-                                cache.removeAll(vals.keySet());
-
-                            tx.commit();
-                        }
-                        catch (Exception e) {
-                            U.error(log(), "Failed cache operation.", e);
-                        }
-
-                        U.sleep(100);
+    private IgniteInternalFuture<Void> runCacheOperationsAsync(
+        Ignite node,
+        AtomicBoolean stopFlag,
+        TransactionIsolation isolation,
+        long timeout,
+        final int keys
+    ) {
+        return GridTestUtils.runAsync(() -> {
+            while (!stopFlag.get()) {
+                TreeMap<Integer, String> vals = generateValues(keys);
+
+                try {
+                    try (Transaction tx = node.transactions().txStart(TransactionConcurrency.OPTIMISTIC, isolation,
+                        timeout, keys)) {
+
+                        IgniteCache<Object, Object> cache = node.cache(CACHE_NAME);
+
+                        // Put or remove.
+                        if (ThreadLocalRandom.current().nextDouble(1) < 0.65)
+                            cache.putAll(vals);
+                        else
+                            cache.removeAll(vals.keySet());
+
+                        tx.commit();
                     }
-                    catch (Exception e){
-                        U.error(log(), "Failed unlock.", e);
+                    catch (Exception e) {
+                        U.error(log(), "Failed cache operation.", e);
                     }
+
+                    U.sleep(100);
+                }
+                catch (Exception e) {
+                    U.error(log(), "Failed unlock.", e);
                 }
             }
-        };
-
-        t.start();
 
-        return t;
+            return null;
+        });
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/0e340428/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java
index 177444d..61e39ff 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java
@@ -56,6 +56,7 @@ import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.GridTestUtils.SF;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
@@ -78,7 +79,7 @@ import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
  */
 public class TxRollbackOnTimeoutTest extends GridCommonAbstractTest {
     /** */
-    private static final long DURATION = 60 * 1000L;
+    private static final long DURATION = SF.apply(60 * 1000);
 
     /** */
     private static final long TX_MIN_TIMEOUT = 1;

http://git-wip-us.apache.org/repos/asf/ignite/blob/0e340428/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index dad5344..ee25b7a 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
@@ -2024,7 +2024,7 @@ public final class GridTestUtils {
 
         /** */
         public static int apply(int val) {
-            return (int) (TEST_SCALE_FACTOR_VALUE * val);
+            return (int) Math.round(TEST_SCALE_FACTOR_VALUE * val);
         }
 
         /** */
@@ -2034,12 +2034,12 @@ public final class GridTestUtils {
 
         /** Apply scale factor with lower bound */
         public static int applyLB(int val, int lowerBound) {
-            return Math.max((int) (TEST_SCALE_FACTOR_VALUE * val), lowerBound);
+            return Math.max(apply(val), lowerBound);
         }
 
         /** Apply scale factor with upper bound */
         public static int applyUB(int val, int upperBound) {
-            return Math.min((int) (TEST_SCALE_FACTOR_VALUE * val), upperBound);
+            return Math.min(apply(val), upperBound);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0e340428/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java
index 7bb476f..03cfb9f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java
@@ -33,7 +33,6 @@ import org.apache.ignite.internal.processors.cache.distributed.CacheTryLockMulti
 import org.apache.ignite.internal.processors.cache.distributed.GridCachePartitionEvictionDuringReadThroughSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.IgniteCache150ClientsTest;
 import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheThreadLocalTxTest;
-import org.apache.ignite.internal.processors.cache.distributed.IgniteOptimisticTxSuspendResumeMultiServerTest;
 import org.apache.ignite.internal.processors.cache.distributed.IgniteOptimisticTxSuspendResumeTest;
 import org.apache.ignite.internal.processors.cache.distributed.IgnitePessimisticTxSuspendResumeTest;
 import org.apache.ignite.internal.processors.cache.transactions.TxLabelTest;
@@ -64,7 +63,6 @@ public class IgniteCacheTestSuite6 extends TestSuite {
 
         suite.addTestSuite(GridCachePartitionEvictionDuringReadThroughSelfTest.class);
         suite.addTestSuite(IgniteOptimisticTxSuspendResumeTest.class);
-        suite.addTestSuite(IgniteOptimisticTxSuspendResumeMultiServerTest.class);
         suite.addTestSuite(IgnitePessimisticTxSuspendResumeTest.class);
 
         suite.addTestSuite(CacheExchangeMergeTest.class);


[02/50] [abbrv] ignite git commit: IGNITE-10381 Fixed U.doInParallel not to terminate early - Fixes #5483.

Posted by sb...@apache.org.
IGNITE-10381 Fixed U.doInParallel not to terminate early - Fixes #5483.

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/97d24226
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/97d24226
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/97d24226

Branch: refs/heads/ignite-10044
Commit: 97d242263a2b2f8f2c6677df1007a6bd3188522b
Parents: ae5bfad
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Nov 23 19:11:31 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Nov 23 19:11:31 2018 +0300

----------------------------------------------------------------------
 .../GridCachePartitionExchangeManager.java      |   4 +-
 .../GridDhtPartitionsExchangeFuture.java        |   3 +-
 .../ignite/internal/util/IgniteUtils.java       | 189 +++----------------
 ...ynamicCacheStartFailWithPersistenceTest.java |   1 +
 .../internal/util/IgniteUtilsSelfTest.java      |  43 -----
 5 files changed, 34 insertions(+), 206 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/97d24226/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 fed5686..6dad367 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
@@ -2906,8 +2906,8 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                                             "topVer=" + exchFut.initialVersion() +
                                             ", node=" + cctx.localNodeId() + "]. " +
                                             (curTimeout <= 0 && !txRolledBack ? "Consider changing " +
-                                                    "TransactionConfiguration.txTimeoutOnPartitionMapSynchronization" +
-                                                    " to non default value to avoid this message. " : "") +
+                                            "TransactionConfiguration.txTimeoutOnPartitionMapSynchronization" +
+                                            " to non default value to avoid this message. " : "") +
                                             "Dumping pending objects that might be the cause: ");
 
                                         try {

http://git-wip-us.apache.org/repos/asf/ignite/blob/97d24226/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 9d81405..3384bb9 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
@@ -1189,7 +1189,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
                 // This exception will be handled by init() method.
                 throw e;
 
-            U.error(log, "Failed to initialize cache(s) (will try to rollback). " + exchId, e);
+            U.error(log, "Failed to initialize cache(s) (will try to rollback) [exchId=" + exchId +
+                ", caches=" + exchActions.cacheGroupsToStart() + ']', e);
 
             exchangeLocE = new IgniteCheckedException(
                 "Failed to initialize exchange locally [locNodeId=" + cctx.localNodeId() + "]", e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/97d24226/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 f1f4253..2d6b584 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
@@ -202,7 +202,6 @@ import java.sql.SQLException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Calendar;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
@@ -221,7 +220,6 @@ import java.util.Random;
 import java.util.ServiceLoader;
 import java.util.Set;
 import java.util.StringTokenizer;
-import java.util.TimeZone;
 import java.util.TreeMap;
 import java.util.UUID;
 import java.util.concurrent.BrokenBarrierException;
@@ -7193,137 +7191,6 @@ public abstract class IgniteUtils {
     }
 
     /**
-     *
-     * @param str ISO date.
-     * @return Calendar instance.
-     * @throws IgniteCheckedException Thrown in case of any errors.
-     */
-    public static Calendar parseIsoDate(String str) throws IgniteCheckedException {
-        StringTokenizer t = new StringTokenizer(str, "+-:.TZ", true);
-
-        Calendar cal = Calendar.getInstance();
-        cal.clear();
-
-        try {
-            if (t.hasMoreTokens())
-                cal.set(Calendar.YEAR, Integer.parseInt(t.nextToken()));
-            else
-                return cal;
-
-            if (checkNextToken(t, "-", str) && t.hasMoreTokens())
-                cal.set(Calendar.MONTH, Integer.parseInt(t.nextToken()) - 1);
-            else
-                return cal;
-
-            if (checkNextToken(t, "-", str) && t.hasMoreTokens())
-                cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(t.nextToken()));
-            else
-                return cal;
-
-            if (checkNextToken(t, "T", str) && t.hasMoreTokens())
-                cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(t.nextToken()));
-            else {
-                cal.set(Calendar.HOUR_OF_DAY, 0);
-                cal.set(Calendar.MINUTE, 0);
-                cal.set(Calendar.SECOND, 0);
-                cal.set(Calendar.MILLISECOND, 0);
-
-                return cal;
-            }
-
-            if (checkNextToken(t, ":", str) && t.hasMoreTokens())
-                cal.set(Calendar.MINUTE, Integer.parseInt(t.nextToken()));
-            else {
-                cal.set(Calendar.MINUTE, 0);
-                cal.set(Calendar.SECOND, 0);
-                cal.set(Calendar.MILLISECOND, 0);
-
-                return cal;
-            }
-
-            if (!t.hasMoreTokens())
-                return cal;
-
-            String tok = t.nextToken();
-
-            if (":".equals(tok)) { // Seconds.
-                if (t.hasMoreTokens()) {
-                    cal.set(Calendar.SECOND, Integer.parseInt(t.nextToken()));
-
-                    if (!t.hasMoreTokens())
-                        return cal;
-
-                    tok = t.nextToken();
-
-                    if (".".equals(tok)) {
-                        String nt = t.nextToken();
-
-                        while (nt.length() < 3)
-                            nt += "0";
-
-                        nt = nt.substring(0, 3); // Cut trailing chars.
-
-                        cal.set(Calendar.MILLISECOND, Integer.parseInt(nt));
-
-                        if (!t.hasMoreTokens())
-                            return cal;
-
-                        tok = t.nextToken();
-                    }
-                    else
-                        cal.set(Calendar.MILLISECOND, 0);
-                }
-                else
-                    throw new IgniteCheckedException("Invalid date format: " + str);
-            }
-            else {
-                cal.set(Calendar.SECOND, 0);
-                cal.set(Calendar.MILLISECOND, 0);
-            }
-
-            if (!"Z".equals(tok)) {
-                if (!"+".equals(tok) && !"-".equals(tok))
-                    throw new IgniteCheckedException("Invalid date format: " + str);
-
-                boolean plus = "+".equals(tok);
-
-                if (!t.hasMoreTokens())
-                    throw new IgniteCheckedException("Invalid date format: " + str);
-
-                tok = t.nextToken();
-
-                int tzHour;
-                int tzMin;
-
-                if (tok.length() == 4) {
-                    tzHour = Integer.parseInt(tok.substring(0, 2));
-                    tzMin = Integer.parseInt(tok.substring(2, 4));
-                }
-                else {
-                    tzHour = Integer.parseInt(tok);
-
-                    if (checkNextToken(t, ":", str) && t.hasMoreTokens())
-                        tzMin = Integer.parseInt(t.nextToken());
-                    else
-                        throw new IgniteCheckedException("Invalid date format: " + str);
-                }
-
-                if (plus)
-                    cal.set(Calendar.ZONE_OFFSET, (tzHour * 60 + tzMin) * 60 * 1000);
-                else
-                    cal.set(Calendar.ZONE_OFFSET, -(tzHour * 60 + tzMin) * 60 * 1000);
-            }
-            else
-                cal.setTimeZone(TimeZone.getTimeZone("GMT"));
-        }
-        catch (NumberFormatException ex) {
-            throw new IgniteCheckedException("Invalid date format: " + str, ex);
-        }
-
-        return cal;
-    }
-
-    /**
      * Adds values to collection and returns the same collection to allow chaining.
      *
      * @param c Collection to add values to.
@@ -7429,20 +7296,6 @@ public abstract class IgniteUtils {
     }
 
     /**
-     * Parses passed string with specified date.
-     *
-     * @param src String to parse.
-     * @param ptrn Pattern.
-     * @return Parsed date.
-     * @throws java.text.ParseException If exception occurs while parsing.
-     */
-    public static Date parse(String src, String ptrn) throws java.text.ParseException {
-        java.text.DateFormat format = new java.text.SimpleDateFormat(ptrn);
-
-        return format.parse(src);
-    }
-
-    /**
      * Checks if class loader is an internal P2P class loader.
      *
      * @param o Object to check.
@@ -10841,7 +10694,7 @@ public abstract class IgniteUtils {
 
                 batch.result(res);
             }
-            catch (IgniteCheckedException e) {
+            catch (Throwable e) {
                 batch.result(e);
             }
         }
@@ -10854,10 +10707,7 @@ public abstract class IgniteUtils {
                 Throwable err = batch.error;
 
                 if (err != null) {
-                    if (error == null)
-                        error = err;
-                    else
-                        error.addSuppressed(err);
+                    error = addSuppressed(error, err);
 
                     continue;
                 }
@@ -10875,16 +10725,10 @@ public abstract class IgniteUtils {
                 throw new IgniteInterruptedCheckedException(e);
             }
             catch (ExecutionException e) {
-                if(error == null)
-                    error = e.getCause();
-                else
-                    error.addSuppressed(e.getCause());
+                error = addSuppressed(error, e.getCause());
             }
             catch (CancellationException e) {
-                if(error == null)
-                    error = e;
-                else
-                    error.addSuppressed(e);
+                error = addSuppressed(error, e);
             }
         }
 
@@ -10905,6 +10749,31 @@ public abstract class IgniteUtils {
     }
 
     /**
+     * Utility method to add the given throwable error to the given throwable root error. If the given
+     * suppressed throwable is an {@code Error}, but the root error is not, will change the root to the {@code Error}.
+     *
+     * @param root Root error to add suppressed error to.
+     * @param err Error to add.
+     * @return New root error.
+     */
+    private static Throwable addSuppressed(Throwable root, Throwable err) {
+        assert err != null;
+
+        if (root == null)
+            return err;
+
+        if (err instanceof Error && !(root instanceof Error)) {
+            err.addSuppressed(root);
+
+            root = err;
+        }
+        else
+            root.addSuppressed(err);
+
+        return root;
+    }
+
+    /**
      * The batch of tasks with a batch index in global array.
      */
     private static class Batch<T,R> {

http://git-wip-us.apache.org/repos/asf/ignite/blob/97d24226/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 24c9342..8643b66 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
@@ -34,6 +34,7 @@ public class IgniteDynamicCacheStartFailWithPersistenceTest extends IgniteAbstra
         return 5 * 60 * 1000;
     }
 
+    /** {@inheritDoc} */
     @Override protected boolean persistenceEnabled() {
         return true;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/97d24226/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
index 39bb21ea..310705b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
@@ -38,7 +38,6 @@ import java.net.URL;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Calendar;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -401,48 +400,6 @@ public class IgniteUtilsSelfTest extends GridCommonAbstractTest {
     }
 
     /**
-     *
-     * @throws Exception If failed.
-     */
-    public void testParseIsoDate() throws Exception {
-        Calendar cal = U.parseIsoDate("2009-12-08T13:30:44.000Z");
-
-        assert cal.get(Calendar.YEAR) == 2009;
-        assert cal.get(Calendar.MONTH) == 11;
-        assert cal.get(Calendar.DAY_OF_MONTH) == 8;
-        assert cal.get(Calendar.HOUR_OF_DAY) == 13;
-        assert cal.get(Calendar.MINUTE) == 30;
-        assert cal.get(Calendar.SECOND) == 44;
-        assert cal.get(Calendar.MILLISECOND) == 0;
-        assert cal.get(Calendar.ZONE_OFFSET) == 0 :
-            "Unexpected value: " + cal.get(Calendar.ZONE_OFFSET);
-
-        cal = U.parseIsoDate("2009-12-08T13:30:44.000+03:00");
-
-        assert cal.get(Calendar.YEAR) == 2009;
-        assert cal.get(Calendar.MONTH) == 11;
-        assert cal.get(Calendar.DAY_OF_MONTH) == 8;
-        assert cal.get(Calendar.HOUR_OF_DAY) == 13;
-        assert cal.get(Calendar.MINUTE) == 30;
-        assert cal.get(Calendar.SECOND) == 44;
-        assert cal.get(Calendar.MILLISECOND) == 0;
-        assert cal.get(Calendar.ZONE_OFFSET) == 3 * 60 * 60 * 1000 :
-            "Unexpected value: " + cal.get(Calendar.ZONE_OFFSET);
-
-        cal = U.parseIsoDate("2009-12-08T13:30:44.000+0300");
-
-        assert cal.get(Calendar.YEAR) == 2009;
-        assert cal.get(Calendar.MONTH) == 11;
-        assert cal.get(Calendar.DAY_OF_MONTH) == 8;
-        assert cal.get(Calendar.HOUR_OF_DAY) == 13;
-        assert cal.get(Calendar.MINUTE) == 30;
-        assert cal.get(Calendar.SECOND) == 44;
-        assert cal.get(Calendar.MILLISECOND) == 0;
-        assert cal.get(Calendar.ZONE_OFFSET) == 3 * 60 * 60 * 1000 :
-            "Unexpected value: " + cal.get(Calendar.ZONE_OFFSET);
-    }
-
-    /**
      * @throws Exception If test failed.
      */
     public void testPeerDeployAware0() throws Exception {


[18/50] [abbrv] ignite git commit: IGNITE-9818 Fix javadoc for annotation AffinityKeyMapped - Fixes #4927.

Posted by sb...@apache.org.
IGNITE-9818 Fix javadoc for annotation AffinityKeyMapped - Fixes #4927.

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/6fd6c320
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6fd6c320
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6fd6c320

Branch: refs/heads/ignite-10044
Commit: 6fd6c320ed0f79dc71a54981982361ab8dc30f44
Parents: 04fae6d
Author: Max-Pudov <pu...@gmail.com>
Authored: Mon Nov 26 17:46:56 2018 +0300
Committer: Dmitriy Pavlov <dp...@apache.org>
Committed: Mon Nov 26 17:46:56 2018 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6fd6c320/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java b/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java
index 8b19338..e7e9eba 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityKeyMapped.java
@@ -91,8 +91,8 @@ import java.util.concurrent.Callable;
  * is otherwise known as {@code Collocation Of Computations And Data}. In this case,
  * {@code @AffinityKeyMapped} annotation allows to specify a routing affinity key for a
  * {@link org.apache.ignite.compute.ComputeJob} or any other grid computation, such as {@link Runnable},
- * {@link Callable}, or {@link org.apache.ignite.lang.IgniteClosure}. It should be attached to a method or
- * field that provides affinity key for the computation. Only one annotation per class is allowed.
+ * {@link Callable}, or {@link org.apache.ignite.lang.IgniteClosure}. It should be attached to a field
+ * that provides affinity key for the computation. Only one annotation per class is allowed.
  * Whenever such annotation is detected, then {@link org.apache.ignite.spi.loadbalancing.LoadBalancingSpi}
  * will be bypassed, and computation will be routed to the grid node where the specified affinity key is cached.
  * <p>


[22/50] [abbrv] ignite git commit: IGNITE-10002: MVCC: Create "Cache 2" test suite for MVCC mode. This closes #5198.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIsolatedNodesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIsolatedNodesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIsolatedNodesSelfTest.java
index 53122c7..e5d3b48 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIsolatedNodesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIsolatedNodesSelfTest.java
@@ -23,6 +23,7 @@ import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.testframework.MvccFeatureChecker;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
 import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -31,6 +32,13 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
  * Isolated nodes LOCAL cache self test.
  */
 public class GridCacheLocalIsolatedNodesSelfTest extends GridCommonAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+        super.beforeTestsStarted();
+    }
+
     /**
      *
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalLoadAllSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalLoadAllSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalLoadAllSelfTest.java
index f10cefd..647027f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalLoadAllSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalLoadAllSelfTest.java
@@ -27,6 +27,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 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.LOCAL;
@@ -35,6 +36,13 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
  * Load-All self test.
  */
 public class GridCacheLocalLoadAllSelfTest extends GridCommonAbstractTest {
+    /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+        super.setUp();
+    }
+
     /**
      *
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalLockSelfTest.java
index c7809df..8f27b1b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalLockSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalLockSelfTest.java
@@ -28,6 +28,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestThread;
+import org.apache.ignite.testframework.MvccFeatureChecker;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jetbrains.annotations.Nullable;
 
@@ -37,6 +38,13 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
  * Test cases for multi-threaded tests.
  */
 public class GridCacheLocalLockSelfTest extends GridCommonAbstractTest {
+    /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+        super.setUp();
+    }
+
     /** Grid. */
     private Ignite ignite;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java
index f6dc535..4911631 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java
@@ -34,6 +34,7 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestThread;
 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;
@@ -42,6 +43,13 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
  * Multithreaded local cache locking test.
  */
 public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest {
+    /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+        super.setUp();
+    }
+
     /** Cache. */
     private IgniteCache<Integer, String> cache;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxMultiThreadedSelfTest.java
index 6776550..816168f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxMultiThreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxMultiThreadedSelfTest.java
@@ -21,6 +21,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
 import org.apache.ignite.internal.processors.cache.IgniteTxMultiThreadedAbstractTest;
+import org.apache.ignite.testframework.MvccFeatureChecker;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 
@@ -34,6 +35,14 @@ public class GridCacheLocalTxMultiThreadedSelfTest extends IgniteTxMultiThreaded
     private static final boolean CACHE_DEBUG = false;
 
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings({"ConstantConditions"})
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxSingleThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxSingleThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxSingleThreadedSelfTest.java
index 22809c7..27ce919 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxSingleThreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxSingleThreadedSelfTest.java
@@ -21,6 +21,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
 import org.apache.ignite.internal.processors.cache.IgniteTxSingleThreadedAbstractTest;
+import org.apache.ignite.testframework.MvccFeatureChecker;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 
@@ -30,6 +31,13 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
  * Tests for local transactions.
  */
 public class GridCacheLocalTxSingleThreadedSelfTest extends IgniteTxSingleThreadedAbstractTest {
+    /** {@inheritDoc} */
+    @Override public void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+        super.beforeTestsStarted();
+    }
+
     /** Cache debug flag. */
     private static final boolean CACHE_DEBUG = false;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxTimeoutSelfTest.java
index 160e251..62af452 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxTimeoutSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxTimeoutSelfTest.java
@@ -25,6 +25,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 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;
@@ -42,6 +43,13 @@ import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
  *
  */
 public class GridCacheLocalTxTimeoutSelfTest extends GridCommonAbstractTest {
+    /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+        super.setUp();
+    }
+
     /** Grid. */
     private Ignite ignite;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/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
new file mode 100644
index 0000000..ee9b02a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/MvccFeatureChecker.java
@@ -0,0 +1,137 @@
+/*
+ * 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;
+
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.cache.CacheMode;
+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.junit.Assert.fail;
+
+/**
+ * Provides checks for features supported when FORCE_MVCC mode is on.
+ */
+public class MvccFeatureChecker {
+    /** */
+    private static final boolean FORCE_MVCC =
+        IgniteSystemProperties.getBoolean(IGNITE_FORCE_MVCC_MODE_IN_TESTS, false);
+
+    /** */
+    public enum Feature {
+        CACHE_STORE,
+        NEAR_CACHE,
+        LOCAL_CACHE,
+        ENTRY_LOCK,
+        CACHE_EVENTS,
+        EVICTION,
+        EXPIRATION
+    }
+
+    /**
+     * Fails if feature is not supported.
+     *
+     * @param f feature.
+     * @throws AssertionError If failed.
+     */
+    public static void failIfNotSupported(Feature f) {
+        if (!forcedMvcc())
+            return;
+
+        validateFeature(f);
+    }
+
+    /**
+     * @return {@code True} if Mvcc mode is forced.
+     */
+    public static boolean forcedMvcc() {
+        return FORCE_MVCC;
+    }
+
+    /**
+     * Check if feature is supported.
+     *
+     * @param f Feature.
+     * @return {@code True} if feature is supported, {@code False} otherwise.
+     */
+    public static boolean isSupported(Feature f) {
+        try {
+            validateFeature(f);
+
+            return true;
+        }
+        catch (AssertionError ignore) {
+            return false;
+        }
+    }
+
+    /**
+     * Check if Tx mode is supported.
+     *
+     * @param conc Transaction concurrency.
+     * @param iso Transaction isolation.
+     * @return {@code True} if feature is supported, {@code False} otherwise.
+     */
+    public static boolean isSupported(TransactionConcurrency conc, TransactionIsolation iso) {
+            return conc == TransactionConcurrency.PESSIMISTIC &&
+                iso == TransactionIsolation.REPEATABLE_READ;
+    }
+
+
+    /**
+     * Check if Cache mode is supported.
+     *
+     * @param mode Cache mode.
+     * @return {@code True} if feature is supported, {@code False} otherwise.
+     */
+    public static boolean isSupported(CacheMode mode) {
+        return mode != CacheMode.LOCAL || isSupported(Feature.LOCAL_CACHE);
+    }
+
+    /**
+     * Fails if feature is not supported in Mvcc mode.
+     *
+     * @param feature Mvcc feature.
+     * @throws AssertionError If failed.
+     */
+    private static void validateFeature(Feature feature) {
+        switch (feature) {
+            case NEAR_CACHE:
+                fail("https://issues.apache.org/jira/browse/IGNITE-7187");
+
+            case LOCAL_CACHE:
+                fail("https://issues.apache.org/jira/browse/IGNITE-9530");
+
+            case CACHE_STORE:
+                fail("https://issues.apache.org/jira/browse/IGNITE-8582");
+
+            case ENTRY_LOCK:
+                fail("https://issues.apache.org/jira/browse/IGNITE-9324");
+
+            case CACHE_EVENTS:
+                fail("https://issues.apache.org/jira/browse/IGNITE-9321");
+
+            case EVICTION:
+                fail("https://issues.apache.org/jira/browse/IGNITE-7956");
+
+            case EXPIRATION:
+                fail("https://issues.apache.org/jira/browse/IGNITE-7311");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/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
new file mode 100644
index 0000000..e0d1eef
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite2.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.affinity.rendezvous.ClusterNodeAttributeAffinityBackupFilterSelfTest;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunctionBackupFilterSelfTest;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunctionExcludeNeighborsSelfTest;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunctionFastPowerOfTwoHashSelfTest;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunctionSelfTest;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunctionStandardHashSelfTest;
+import org.apache.ignite.internal.IgniteReflectionFactorySelfTest;
+import org.apache.ignite.internal.processors.cache.CacheComparatorTest;
+import org.apache.ignite.internal.processors.cache.CacheConfigurationLeakTest;
+import org.apache.ignite.internal.processors.cache.CacheEnumOperationsSingleNodeTest;
+import org.apache.ignite.internal.processors.cache.CacheEnumOperationsTest;
+import org.apache.ignite.internal.processors.cache.CacheExchangeMessageDuplicatedStateTest;
+import org.apache.ignite.internal.processors.cache.CacheGroupLocalConfigurationSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheOptimisticTransactionsWithFilterSingleServerTest;
+import org.apache.ignite.internal.processors.cache.CacheOptimisticTransactionsWithFilterTest;
+import org.apache.ignite.internal.processors.cache.GridCacheAtomicMessageCountSelfTest;
+import org.apache.ignite.internal.processors.cache.GridCachePartitionedProjectionAffinitySelfTest;
+import org.apache.ignite.internal.processors.cache.IgniteAtomicCacheEntryProcessorNodeJoinTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheNoSyncForGetTest;
+import org.apache.ignite.internal.processors.cache.IgniteCachePartitionMapUpdateTest;
+import org.apache.ignite.internal.processors.cache.IgniteClientCacheStartFailoverTest;
+import org.apache.ignite.internal.processors.cache.IgniteDynamicCacheAndNodeStop;
+import org.apache.ignite.internal.processors.cache.IgniteNearClientCacheCloseTest;
+import org.apache.ignite.internal.processors.cache.IgniteOnePhaseCommitInvokeTest;
+import org.apache.ignite.internal.processors.cache.IgniteOnePhaseCommitNearReadersTest;
+import org.apache.ignite.internal.processors.cache.MemoryPolicyConfigValidationTest;
+import org.apache.ignite.internal.processors.cache.NonAffinityCoordinatorDynamicStartStopTest;
+import org.apache.ignite.internal.processors.cache.distributed.CacheLoadingConcurrentGridStartSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.CacheLoadingConcurrentGridStartSelfTestAllowOverwrite;
+import org.apache.ignite.internal.processors.cache.distributed.CachePartitionStateTest;
+import org.apache.ignite.internal.processors.cache.distributed.GridCachePartitionedNearDisabledMvccTxMultiThreadedSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.GridCachePartitionedNearDisabledTxMultiThreadedSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.GridCacheTransformEventSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheClientNodePartitionsExchangeTest;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheServerNodeConcurrentStart;
+import org.apache.ignite.internal.processors.cache.distributed.dht.CachePartitionPartialCountersMapSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheColocatedMvccTxSingleThreadedSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheColocatedOptimisticTransactionSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheColocatedTxSingleThreadedSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtAtomicEvictionNearReadersSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtPreloadOnheapSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedUnloadEventsSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCachePartitionedBackupNodeFailureRecoveryTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearEvictionEventSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearMultiNodeSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearReadersSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearClientHitTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearJobExecutionSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearMultiGetSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearTxForceKeyTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedAffinitySelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedAtomicGetAndTransformStoreSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMultiThreadedPutGetSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMvccTxMultiThreadedSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMvccTxSingleThreadedSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMvccTxTimeoutSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedTxMultiThreadedSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedTxSingleThreadedSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedTxTimeoutSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheRendezvousAffinityClientSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.NearCacheSyncUpdateTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.NoneRebalanceModeSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedJobExecutionTest;
+import org.apache.ignite.internal.processors.cache.local.GridCacheLocalAtomicBasicStoreSelfTest;
+import org.apache.ignite.internal.processors.cache.local.GridCacheLocalAtomicGetAndTransformStoreSelfTest;
+import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicyInitializationTest;
+import org.apache.ignite.internal.processors.continuous.IgniteNoCustomEventsOnNodeStart;
+
+/**
+ * Test suite.
+ */
+public class IgniteCacheMvccTestSuite2 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(GridCacheTransformEventSelfTest.class);
+        ignoredTests.add(IgniteClientCacheStartFailoverTest.class);
+        ignoredTests.add(IgniteNearClientCacheCloseTest.class);
+        ignoredTests.add(IgniteCacheNoSyncForGetTest.class);
+        ignoredTests.add(CacheEnumOperationsSingleNodeTest.class);
+        ignoredTests.add(CacheEnumOperationsTest.class);
+        ignoredTests.add(NearCacheSyncUpdateTest.class);
+        ignoredTests.add(GridCacheNearMultiGetSelfTest.class);
+
+        // Optimistic tx tests.
+        ignoredTests.add(GridCacheColocatedOptimisticTransactionSelfTest.class);
+        ignoredTests.add(CacheOptimisticTransactionsWithFilterSingleServerTest.class);
+        ignoredTests.add(CacheOptimisticTransactionsWithFilterTest.class);
+
+        // Irrelevant Tx tests.
+        ignoredTests.add(IgniteOnePhaseCommitInvokeTest.class);
+        ignoredTests.add(IgniteOnePhaseCommitNearReadersTest.class);
+        ignoredTests.add(GridCacheDhtPreloadOnheapSelfTest.class);
+        ignoredTests.add(GridCachePartitionedMultiThreadedPutGetSelfTest.class); // On-heap test.
+
+        // Atomic cache tests.
+        ignoredTests.add(GridCacheLocalAtomicBasicStoreSelfTest.class);
+        ignoredTests.add(GridCacheLocalAtomicGetAndTransformStoreSelfTest.class);
+        ignoredTests.add(GridCacheAtomicNearMultiNodeSelfTest.class);
+        ignoredTests.add(GridCacheAtomicNearReadersSelfTest.class);
+        ignoredTests.add(GridCachePartitionedAtomicGetAndTransformStoreSelfTest.class);
+        ignoredTests.add(GridCacheAtomicNearEvictionEventSelfTest.class);
+        ignoredTests.add(GridCacheAtomicMessageCountSelfTest.class);
+        ignoredTests.add(IgniteAtomicCacheEntryProcessorNodeJoinTest.class);
+        ignoredTests.add(GridCacheDhtAtomicEvictionNearReadersSelfTest.class);
+        ignoredTests.add(GridCacheNearClientHitTest.class);
+        ignoredTests.add(GridCacheNearTxForceKeyTest.class);
+        ignoredTests.add(CacheLoadingConcurrentGridStartSelfTest.class);
+        ignoredTests.add(CacheLoadingConcurrentGridStartSelfTestAllowOverwrite.class);
+        ignoredTests.add(IgniteCachePartitionedBackupNodeFailureRecoveryTest.class);
+
+        // Other non-tx tests.
+        ignoredTests.add(RendezvousAffinityFunctionSelfTest.class);
+        ignoredTests.add(RendezvousAffinityFunctionExcludeNeighborsSelfTest.class);
+        ignoredTests.add(RendezvousAffinityFunctionFastPowerOfTwoHashSelfTest.class);
+        ignoredTests.add(RendezvousAffinityFunctionStandardHashSelfTest.class);
+        ignoredTests.add(GridCachePartitionedAffinitySelfTest.class);
+        ignoredTests.add(GridCacheRendezvousAffinityClientSelfTest.class);
+        ignoredTests.add(GridCachePartitionedProjectionAffinitySelfTest.class);
+        ignoredTests.add(RendezvousAffinityFunctionBackupFilterSelfTest.class);
+        ignoredTests.add(ClusterNodeAttributeAffinityBackupFilterSelfTest.class);
+        ignoredTests.add(NonAffinityCoordinatorDynamicStartStopTest.class);
+
+        ignoredTests.add(NoneRebalanceModeSelfTest.class);
+        ignoredTests.add(IgniteCachePartitionMapUpdateTest.class);
+        ignoredTests.add(IgniteCacheClientNodePartitionsExchangeTest.class);
+        ignoredTests.add(IgniteCacheServerNodeConcurrentStart.class);
+
+        ignoredTests.add(GridCachePartitionedUnloadEventsSelfTest.class);
+
+        ignoredTests.add(IgniteNoCustomEventsOnNodeStart.class);
+        ignoredTests.add(CacheExchangeMessageDuplicatedStateTest.class);
+        ignoredTests.add(IgniteDynamicCacheAndNodeStop.class);
+
+        ignoredTests.add(GridCacheReplicatedJobExecutionTest.class);
+        ignoredTests.add(GridCacheNearJobExecutionSelfTest.class);
+
+        ignoredTests.add(CacheConfigurationLeakTest.class);
+        ignoredTests.add(MemoryPolicyConfigValidationTest.class);
+        ignoredTests.add(MemoryPolicyInitializationTest.class);
+        ignoredTests.add(CacheGroupLocalConfigurationSelfTest.class);
+
+        ignoredTests.add(CachePartitionStateTest.class);
+        ignoredTests.add(CacheComparatorTest.class);
+        ignoredTests.add(CachePartitionPartialCountersMapSelfTest.class);
+        ignoredTests.add(IgniteReflectionFactorySelfTest.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(GridCachePartitionedTxSingleThreadedSelfTest.class); // See GridCachePartitionedMvccTxSingleThreadedSelfTest
+        ignoredTests.add(GridCacheColocatedTxSingleThreadedSelfTest.class); // See GridCacheColocatedMvccTxSingleThreadedSelfTest
+        ignoredTests.add(GridCachePartitionedTxMultiThreadedSelfTest.class); // See GridCachePartitionedMvccTxMultiThreadedSelfTest
+        ignoredTests.add(GridCachePartitionedNearDisabledTxMultiThreadedSelfTest.class); // See GridCachePartitionedNearDisabledMvccTxMultiThreadedSelfTest
+        ignoredTests.add(GridCachePartitionedTxTimeoutSelfTest.class); // See GridCachePartitionedMvccTxTimeoutSelfTest
+
+        TestSuite suite = new TestSuite("IgniteCache Mvcc Test Suite part 2");
+
+        suite.addTest(IgniteCacheTestSuite2.suite(ignoredTests));
+
+        // Add Mvcc clones.
+        suite.addTestSuite(GridCachePartitionedMvccTxSingleThreadedSelfTest.class);
+        suite.addTestSuite(GridCacheColocatedMvccTxSingleThreadedSelfTest.class);
+        suite.addTestSuite(GridCachePartitionedMvccTxMultiThreadedSelfTest.class);
+        suite.addTestSuite(GridCachePartitionedNearDisabledMvccTxMultiThreadedSelfTest.class);
+        suite.addTestSuite(GridCachePartitionedMvccTxTimeoutSelfTest.class);
+
+        return suite;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index fe09c07..179f5e9 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.testsuites;
 
+import java.util.HashSet;
 import junit.framework.TestSuite;
 import org.apache.ignite.cache.affinity.rendezvous.ClusterNodeAttributeAffinityBackupFilterSelfTest;
 import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunctionBackupFilterSelfTest;
@@ -144,6 +145,7 @@ import org.apache.ignite.internal.processors.cache.local.GridCacheLocalTxSingleT
 import org.apache.ignite.internal.processors.cache.local.GridCacheLocalTxTimeoutSelfTest;
 import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicyInitializationTest;
 import org.apache.ignite.internal.processors.continuous.IgniteNoCustomEventsOnNodeStart;
+import org.apache.ignite.testframework.GridTestUtils;
 
 /**
  * Test suite.
@@ -153,180 +155,197 @@ public class IgniteCacheTestSuite2 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.
+     * @throws Exception Thrown in case of the failure.
+     */
+    public static TestSuite suite(HashSet<Class> ignoredTests) {
         TestSuite suite = new TestSuite("IgniteCache Test Suite part 2");
 
         // Local cache.
-        suite.addTestSuite(GridCacheLocalBasicApiSelfTest.class);
-        suite.addTestSuite(GridCacheLocalBasicStoreSelfTest.class);
-        //suite.addTestSuite(GridCacheLocalBasicStoreMultithreadedSelfTest.class);
-        suite.addTestSuite(GridCacheLocalAtomicBasicStoreSelfTest.class);
-        suite.addTestSuite(GridCacheLocalGetAndTransformStoreSelfTest.class);
-        suite.addTestSuite(GridCacheLocalAtomicGetAndTransformStoreSelfTest.class);
-        suite.addTestSuite(GridCacheLocalLoadAllSelfTest.class);
-        suite.addTestSuite(GridCacheLocalLockSelfTest.class);
-        suite.addTestSuite(GridCacheLocalMultithreadedSelfTest.class);
-        suite.addTestSuite(GridCacheLocalTxSingleThreadedSelfTest.class);
-        //suite.addTestSuite(GridCacheLocalTxReadTest.class);
-        suite.addTestSuite(GridCacheLocalTxTimeoutSelfTest.class);
-        suite.addTestSuite(GridCacheLocalEventSelfTest.class);
-        suite.addTestSuite(GridCacheLocalEvictionEventSelfTest.class);
-        suite.addTestSuite(GridCacheVariableTopologySelfTest.class);
-        suite.addTestSuite(GridCacheLocalTxMultiThreadedSelfTest.class);
-        suite.addTestSuite(GridCacheTransformEventSelfTest.class);
-        suite.addTestSuite(GridCacheLocalIsolatedNodesSelfTest.class);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheLocalBasicApiSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheLocalBasicStoreSelfTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,GridCacheLocalBasicStoreMultithreadedSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheLocalAtomicBasicStoreSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheLocalGetAndTransformStoreSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheLocalAtomicGetAndTransformStoreSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheLocalLoadAllSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheLocalLockSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheLocalMultithreadedSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheLocalTxSingleThreadedSelfTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,GridCacheLocalTxReadTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheLocalTxTimeoutSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheLocalEventSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheLocalEvictionEventSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheLocalTxMultiThreadedSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheLocalIsolatedNodesSelfTest.class, ignoredTests);
+
+        GridTestUtils.addTestIfNeeded(suite, GridCacheTransformEventSelfTest.class, ignoredTests);
 
         // Partitioned cache.
-        suite.addTestSuite(GridCachePartitionedGetSelfTest.class);
-        suite.addTest(new TestSuite(GridCachePartitionedBasicApiTest.class));
-        suite.addTest(new TestSuite(GridCacheNearMultiGetSelfTest.class));
-        suite.addTest(new TestSuite(NoneRebalanceModeSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheNearJobExecutionSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheReplicatedJobExecutionTest.class));
-        suite.addTest(new TestSuite(GridCacheNearOneNodeSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheNearMultiNodeSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheAtomicNearMultiNodeSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheNearReadersSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheNearReaderPreloadSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheAtomicNearReadersSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedAffinitySelfTest.class));
-        //suite.addTest(new TestSuite(RendezvousAffinityFunctionSelfTest.class));
-        suite.addTest(new TestSuite(RendezvousAffinityFunctionExcludeNeighborsSelfTest.class));
-        suite.addTest(new TestSuite(RendezvousAffinityFunctionFastPowerOfTwoHashSelfTest.class));
-        suite.addTest(new TestSuite(RendezvousAffinityFunctionStandardHashSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheRendezvousAffinityClientSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedProjectionAffinitySelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedBasicOpSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedBasicStoreSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedGetAndTransformStoreSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedAtomicGetAndTransformStoreSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedBasicStoreMultiNodeSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedNearDisabledBasicStoreMultiNodeSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedEventSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedLockSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedNearDisabledLockSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedMultiNodeLockSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedMultiNodeSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedMultiThreadedPutGetSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedNodeFailureSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedExplicitLockNodeFailureSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedTxSingleThreadedSelfTest.class));
-        //suite.addTest(new TestSuite(GridCachePartitionedEntryLockSelfTest.class));
-        //suite.addTest(new TestSuite(GridCachePartitionedEvictionSelfTest.class));
-        //suite.addTest(new TestSuite(GridCachePartitionedNestedTxTest.class));
-        //suite.addTest(new TestSuite(GridCachePartitionedStorePutSelfTest.class));
-        //suite.addTest(new TestSuite(GridCachePartitionedTxConcurrentGetTest.class));
-        //suite.addTest(new TestSuite(GridCachePartitionedTxMultiNodeSelfTest.class));
-        //suite.addTest(new TestSuite(GridCachePartitionedTxReadTest.class));
-        suite.addTest(new TestSuite(GridCacheColocatedTxSingleThreadedSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedTxTimeoutSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheFinishPartitionsSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheDhtEntrySelfTest.class));
-        suite.addTest(new TestSuite(GridCacheDhtMappingSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedTxMultiThreadedSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedNearDisabledTxMultiThreadedSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheDhtPreloadSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheDhtPreloadOnheapSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheDhtPreloadBigDataSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheDhtPreloadPutGetSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheDhtPreloadDisabledSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheDhtPreloadMultiThreadedSelfTest.class));
-        suite.addTest(new TestSuite(CacheDhtLocalPartitionAfterRemoveSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheColocatedPreloadRestartSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheNearPreloadRestartSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheDhtPreloadStartStopSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheDhtPreloadUnloadSelfTest.class));
-        suite.addTest(new TestSuite(RendezvousAffinityFunctionBackupFilterSelfTest.class));
-        suite.addTest(new TestSuite(ClusterNodeAttributeAffinityBackupFilterSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedPreloadLifecycleSelfTest.class));
-        suite.addTest(new TestSuite(CacheLoadingConcurrentGridStartSelfTest.class));
-        suite.addTest(new TestSuite(CacheLoadingConcurrentGridStartSelfTestAllowOverwrite.class));
-        suite.addTest(new TestSuite(CacheTxLoadingConcurrentGridStartSelfTestAllowOverwrite.class));
-        suite.addTest(new TestSuite(GridCacheDhtPreloadDelayedSelfTest.class));
-        suite.addTest(new TestSuite(GridPartitionedBackupLoadSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedLoadCacheSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionNotLoadedEventSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheDhtEvictionsDisabledSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheNearEvictionEventSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheAtomicNearEvictionEventSelfTest.class));
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedGetSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedBasicApiTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedBasicOpSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheNearMultiGetSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, NoneRebalanceModeSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheNearOneNodeSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheNearMultiNodeSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheAtomicNearMultiNodeSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheNearReadersSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheNearReaderPreloadSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheAtomicNearReadersSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedGetAndTransformStoreSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedAtomicGetAndTransformStoreSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedBasicStoreSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridNearCacheStoreUpdateTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,GridCachePartitionedStorePutSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedBasicStoreMultiNodeSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedNearDisabledBasicStoreMultiNodeSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, CacheConcurrentReadThroughTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedLockSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedNearDisabledLockSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedMultiNodeLockSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedMultiNodeSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedMultiThreadedPutGetSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedNodeFailureSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedExplicitLockNodeFailureSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, CacheLockReleaseNodeLeaveTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,GridCachePartitionedEntryLockSelfTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,GridCachePartitionedNestedTxTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,GridCachePartitionedTxConcurrentGetTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,GridCachePartitionedTxMultiNodeSelfTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,GridCachePartitionedTxReadTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedTxSingleThreadedSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheColocatedTxSingleThreadedSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedTxTimeoutSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheFinishPartitionsSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedTxMultiThreadedSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedNearDisabledTxMultiThreadedSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheDhtEntrySelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheDhtMappingSelfTest.class, ignoredTests);
+
+        // Preload
+        GridTestUtils.addTestIfNeeded(suite, GridCacheDhtPreloadSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheDhtPreloadOnheapSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheDhtPreloadBigDataSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheDhtPreloadPutGetSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheDhtPreloadDisabledSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheDhtPreloadMultiThreadedSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheColocatedPreloadRestartSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheNearPreloadRestartSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheDhtPreloadStartStopSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheDhtPreloadUnloadSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedPreloadLifecycleSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheDhtPreloadDelayedSelfTest.class, ignoredTests);
+
+        GridTestUtils.addTestIfNeeded(suite, CacheDhtLocalPartitionAfterRemoveSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, CacheLoadingConcurrentGridStartSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, CacheLoadingConcurrentGridStartSelfTestAllowOverwrite.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, CacheTxLoadingConcurrentGridStartSelfTestAllowOverwrite.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridPartitionedBackupLoadSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedLoadCacheSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedEventSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionNotLoadedEventSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheDhtEvictionsDisabledSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheNearEvictionEventSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheAtomicNearEvictionEventSelfTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,GridCachePartitionedEvictionSelfTest.class, ignoredTests);
+
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedTopologyChangeSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedUnloadEventsSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheColocatedOptimisticTransactionSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheAtomicMessageCountSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheNearPartitionedClearSelfTest.class, ignoredTests);
 
-        suite.addTest(new TestSuite(GridCachePartitionedTopologyChangeSelfTest.class));
-        suite.addTest(new TestSuite(GridCachePartitionedUnloadEventsSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheColocatedOptimisticTransactionSelfTest.class));
-        suite.addTestSuite(GridCacheAtomicMessageCountSelfTest.class);
-        suite.addTest(new TestSuite(GridCacheNearPartitionedClearSelfTest.class));
+        GridTestUtils.addTestIfNeeded(suite, GridCacheOffheapUpdateSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheNearClientHitTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheNearPrimarySyncSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheColocatedPrimarySyncSelfTest.class, ignoredTests);
 
-        suite.addTest(new TestSuite(GridCacheOffheapUpdateSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheNearClientHitTest.class));
-        suite.addTest(new TestSuite(GridCacheNearPrimarySyncSelfTest.class));
-        suite.addTest(new TestSuite(GridCacheColocatedPrimarySyncSelfTest.class));
+        GridTestUtils.addTestIfNeeded(suite, IgniteCachePartitionMapUpdateTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, IgniteCacheClientNodePartitionsExchangeTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, IgniteCacheClientNodeChangingTopologyTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, IgniteCacheServerNodeConcurrentStart.class, ignoredTests);
 
-        suite.addTest(new TestSuite(IgniteCachePartitionMapUpdateTest.class));
-        suite.addTest(new TestSuite(IgniteCacheClientNodePartitionsExchangeTest.class));
-        suite.addTest(new TestSuite(IgniteCacheClientNodeChangingTopologyTest.class));
-        suite.addTest(new TestSuite(IgniteCacheServerNodeConcurrentStart.class));
+        GridTestUtils.addTestIfNeeded(suite, IgniteCacheEntryProcessorNodeJoinTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, IgniteAtomicCacheEntryProcessorNodeJoinTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheNearTxForceKeyTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, CrossCacheTxRandomOperationsTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, CrossCacheTxNearEnabledRandomOperationsTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, IgniteDynamicCacheAndNodeStop.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, NearCacheSyncUpdateTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, CacheEnumOperationsSingleNodeTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, CacheEnumOperationsTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, IgniteCacheIncrementTxTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, IgniteCachePartitionedBackupNodeFailureRecoveryTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheVariableTopologySelfTest.class, ignoredTests);
 
-        suite.addTest(new TestSuite(IgniteCacheEntryProcessorNodeJoinTest.class));
-        suite.addTest(new TestSuite(IgniteAtomicCacheEntryProcessorNodeJoinTest.class));
-        suite.addTest(new TestSuite(GridCacheNearTxForceKeyTest.class));
-        suite.addTest(new TestSuite(CrossCacheTxRandomOperationsTest.class));
-        suite.addTest(new TestSuite(CrossCacheTxNearEnabledRandomOperationsTest.class));
-        suite.addTest(new TestSuite(IgniteDynamicCacheAndNodeStop.class));
-        suite.addTest(new TestSuite(CacheLockReleaseNodeLeaveTest.class));
-        suite.addTest(new TestSuite(NearCacheSyncUpdateTest.class));
-        suite.addTest(new TestSuite(CacheConfigurationLeakTest.class));
-        suite.addTest(new TestSuite(MemoryPolicyConfigValidationTest.class));
-        suite.addTest(new TestSuite(MemoryPolicyInitializationTest.class));
-        suite.addTest(new TestSuite(CacheGroupLocalConfigurationSelfTest.class));
-        suite.addTest(new TestSuite(CacheEnumOperationsSingleNodeTest.class));
-        suite.addTest(new TestSuite(CacheEnumOperationsTest.class));
-        suite.addTest(new TestSuite(IgniteCacheIncrementTxTest.class));
-        suite.addTest(new TestSuite(IgniteCachePartitionedBackupNodeFailureRecoveryTest.class));
+        GridTestUtils.addTestIfNeeded(suite, IgniteNoCustomEventsOnNodeStart.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, CacheExchangeMessageDuplicatedStateTest.class, ignoredTests);
 
-        suite.addTest(new TestSuite(IgniteNoCustomEventsOnNodeStart.class));
+        //GridTestUtils.addTestIfNeeded(suite,NearCacheMultithreadedUpdateTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,NearCachePutAllMultinodeTest.class, ignoredTests);
 
-        suite.addTest(new TestSuite(CacheExchangeMessageDuplicatedStateTest.class));
-        suite.addTest(new TestSuite(CacheConcurrentReadThroughTest.class));
+        GridTestUtils.addTestIfNeeded(suite, IgniteOnePhaseCommitInvokeTest.class, ignoredTests);
 
-        suite.addTest(new TestSuite(GridNearCacheStoreUpdateTest.class));
-        //suite.addTest(new TestSuite(NearCacheMultithreadedUpdateTest.class));
-        //suite.addTest(new TestSuite(NearCachePutAllMultinodeTest.class));
+        GridTestUtils.addTestIfNeeded(suite, IgniteCacheNoSyncForGetTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,IgniteCacheContainsKeyNearSelfTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,IgniteCacheNearTxRollbackTest.class, ignoredTests);
 
-        suite.addTest(new TestSuite(IgniteOnePhaseCommitInvokeTest.class));
+        GridTestUtils.addTestIfNeeded(suite, IgniteOnePhaseCommitNearReadersTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, IgniteNearClientCacheCloseTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, IgniteClientCacheStartFailoverTest.class, ignoredTests);
 
-        suite.addTest(new TestSuite(IgniteCacheNoSyncForGetTest.class));
-        //suite.addTest(new TestSuite(IgniteCacheContainsKeyNearSelfTest.class));
-        //suite.addTest(new TestSuite(IgniteCacheNearTxRollbackTest.class));
+        GridTestUtils.addTestIfNeeded(suite, CacheOptimisticTransactionsWithFilterSingleServerTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, CacheOptimisticTransactionsWithFilterTest.class, ignoredTests);
 
-        suite.addTest(new TestSuite(IgniteOnePhaseCommitNearReadersTest.class));
-        suite.addTest(new TestSuite(IgniteNearClientCacheCloseTest.class));
-        suite.addTest(new TestSuite(IgniteClientCacheStartFailoverTest.class));
+        GridTestUtils.addTestIfNeeded(suite, NonAffinityCoordinatorDynamicStartStopTest.class, ignoredTests);
 
-        suite.addTest(new TestSuite(CacheOptimisticTransactionsWithFilterSingleServerTest.class));
-        suite.addTest(new TestSuite(CacheOptimisticTransactionsWithFilterTest.class));
+        GridTestUtils.addTestIfNeeded(suite, IgniteCacheClearDuringRebalanceTest.class, ignoredTests);
 
-        suite.addTest(new TestSuite(NonAffinityCoordinatorDynamicStartStopTest.class));
+        //GridTestUtils.addTestIfNeeded(suite,GridCacheColocatedDebugTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite, GridCacheDhtAtomicEvictionNearReadersSelfTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,GridCacheDhtEntrySetSelfTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,GridCacheDhtEvictionNearReadersSelfTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,GridCacheDhtMultiBackupTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,GridCacheDhtPreloadMessageCountTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,GridCachePartitionedNearDisabledMetricsSelfTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,IgniteCacheContainsKeyColocatedSelfTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,IgniteCrossCacheTxNearEnabledSelfTest.class, ignoredTests);
+        //GridTestUtils.addTestIfNeeded(suite,IgniteTxConsistencyColocatedRestartSelfTest.class, ignoredTests);
 
-        suite.addTest(new TestSuite(IgniteCacheClearDuringRebalanceTest.class));
+        // Configuration validation
+        GridTestUtils.addTestIfNeeded(suite, CacheConfigurationLeakTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, MemoryPolicyConfigValidationTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, MemoryPolicyInitializationTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, CacheGroupLocalConfigurationSelfTest.class, ignoredTests);
 
-        suite.addTest(new TestSuite(CachePartitionStateTest.class));
+        // Affinity and collocation
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedAffinitySelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedProjectionAffinitySelfTest.class, ignoredTests);
 
-        suite.addTest(new TestSuite(CacheComparatorTest.class));
+        // Other tests.
+        GridTestUtils.addTestIfNeeded(suite, GridCacheNearJobExecutionSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheReplicatedJobExecutionTest.class, ignoredTests);
 
-        suite.addTest(new TestSuite(CachePartitionPartialCountersMapSelfTest.class));
+        //GridTestUtils.addTestIfNeeded(suite,RendezvousAffinityFunctionSelfTest.class), ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, RendezvousAffinityFunctionExcludeNeighborsSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, RendezvousAffinityFunctionFastPowerOfTwoHashSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, RendezvousAffinityFunctionStandardHashSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridCacheRendezvousAffinityClientSelfTest.class, ignoredTests);
 
-        suite.addTest(new TestSuite(IgniteReflectionFactorySelfTest.class));
+        GridTestUtils.addTestIfNeeded(suite, RendezvousAffinityFunctionBackupFilterSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, ClusterNodeAttributeAffinityBackupFilterSelfTest.class, ignoredTests);
 
-        //suite.addTest(new TestSuite(GridCacheColocatedDebugTest.class));
-        //suite.addTest(new TestSuite(GridCacheDhtAtomicEvictionNearReadersSelfTest.class));
-        //suite.addTest(new TestSuite(GridCacheDhtEntrySetSelfTest.class));
-        //suite.addTest(new TestSuite(GridCacheDhtEvictionNearReadersSelfTest.class));
-        //suite.addTest(new TestSuite(GridCacheDhtMultiBackupTest.class));
-        //suite.addTest(new TestSuite(GridCacheDhtPreloadMessageCountTest.class));
-        //suite.addTest(new TestSuite(GridCachePartitionedNearDisabledMetricsSelfTest.class));
-        //suite.addTest(new TestSuite(IgniteCacheContainsKeyColocatedSelfTest.class));
-        //suite.addTest(new TestSuite(IgniteCrossCacheTxNearEnabledSelfTest.class));
-        //suite.addTest(new TestSuite(IgniteTxConsistencyColocatedRestartSelfTest.class));
+        GridTestUtils.addTestIfNeeded(suite, CachePartitionStateTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, CacheComparatorTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, CachePartitionPartialCountersMapSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, IgniteReflectionFactorySelfTest.class, ignoredTests);
 
         return suite;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java
index c5384b9..7bb476f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java
@@ -29,7 +29,6 @@ import org.apache.ignite.internal.processors.cache.ReplicatedTransactionalPessim
 import org.apache.ignite.internal.processors.cache.datastructures.IgniteExchangeLatchManagerCoordinatorFailTest;
 import org.apache.ignite.internal.processors.cache.distributed.CacheExchangeMergeTest;
 import org.apache.ignite.internal.processors.cache.distributed.CacheParallelStartTest;
-import org.apache.ignite.internal.processors.cache.distributed.CachePartitionStateTest;
 import org.apache.ignite.internal.processors.cache.distributed.CacheTryLockMultithreadedTest;
 import org.apache.ignite.internal.processors.cache.distributed.GridCachePartitionEvictionDuringReadThroughSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.IgniteCache150ClientsTest;
@@ -63,8 +62,6 @@ public class IgniteCacheTestSuite6 extends TestSuite {
     public static TestSuite suite() throws Exception {
         TestSuite suite = new TestSuite("IgniteCache Test Suite part 6");
 
-        suite.addTestSuite(CachePartitionStateTest.class);
-
         suite.addTestSuite(GridCachePartitionEvictionDuringReadThroughSelfTest.class);
         suite.addTestSuite(IgniteOptimisticTxSuspendResumeTest.class);
         suite.addTestSuite(IgniteOptimisticTxSuspendResumeMultiServerTest.class);


[12/50] [abbrv] ignite git commit: IGNITE-10330: Disk page compression. - Fixes #5200.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/licenses/jnr-posix-LICENSE.txt
----------------------------------------------------------------------
diff --git a/modules/compress/licenses/jnr-posix-LICENSE.txt b/modules/compress/licenses/jnr-posix-LICENSE.txt
new file mode 100644
index 0000000..58011d4
--- /dev/null
+++ b/modules/compress/licenses/jnr-posix-LICENSE.txt
@@ -0,0 +1,2486 @@
+jnr-posix is released under a tri EPL/GPL/LGPL license. You can use it,
+redistribute it and/or modify it under the terms of the:
+
+  Eclipse Public License version 1.0
+  GNU General Public License version 2
+  GNU Lesser General Public License version 2.1
+
+The complete text of the Eclipse Public License is as follows:
+
+  Eclipse Public License - v 1.0
+
+  THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+  PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
+  OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+  1. DEFINITIONS
+
+  "Contribution" means:
+
+      a) in the case of the initial Contributor, the initial code and
+         documentation distributed under this Agreement, and
+
+      b) in the case of each subsequent Contributor:
+
+          i) changes to the Program, and
+
+          ii) additions to the Program;
+              where such changes and/or additions to the Program
+              originate from and are distributed by that particular
+              Contributor. A Contribution 'originates' from a
+              Contributor if it was added to the Program by such
+              Contributor itself or anyone acting on such
+              Contributor's behalf. Contributions do not include
+              additions to the Program which: (i) are separate modules
+              of software distributed in conjunction with the Program
+              under their own license agreement, and (ii) are not
+              derivative works of the Program.
+
+  "Contributor" means any person or entity that distributes the Program.
+
+  "Licensed Patents" mean patent claims licensable by a Contributor
+  which are necessarily infringed by the use or sale of its
+  Contribution alone or when combined with the Program.
+
+  "Program" means the Contributions distributed in accordance with
+  this Agreement.
+
+  "Recipient" means anyone who receives the Program under this
+  Agreement, including all Contributors.
+
+  2. GRANT OF RIGHTS
+
+      a) Subject to the terms of this Agreement, each Contributor
+         hereby grants Recipient a non-exclusive, worldwide,
+         royalty-free copyright license to reproduce, prepare
+         derivative works of, publicly display, publicly perform,
+         distribute and sublicense the Contribution of such
+         Contributor, if any, and such derivative works, in source
+         code and object code form.
+
+      b) Subject to the terms of this Agreement, each Contributor
+         hereby grants Recipient a non-exclusive, worldwide,
+         royalty-free patent license under Licensed Patents to make,
+         use, sell, offer to sell, import and otherwise transfer the
+         Contribution of such Contributor, if any, in source code and
+         object code form. This patent license shall apply to the
+         combination of the Contribution and the Program if, at the
+         time the Contribution is added by the Contributor, such
+         addition of the Contribution causes such combination to be
+         covered by the Licensed Patents. The patent license shall not
+         apply to any other combinations which include the
+         Contribution. No hardware per se is licensed hereunder.
+
+      c) Recipient understands that although each Contributor grants
+         the licenses to its Contributions set forth herein, no
+         assurances are provided by any Contributor that the Program
+         does not infringe the patent or other intellectual property
+         rights of any other entity. Each Contributor disclaims any
+         liability to Recipient for claims brought by any other entity
+         based on infringement of intellectual property rights or
+         otherwise. As a condition to exercising the rights and
+         licenses granted hereunder, each Recipient hereby assumes
+         sole responsibility to secure any other intellectual property
+         rights needed, if any. For example, if a third party patent
+         license is required to allow Recipient to distribute the
+         Program, it is Recipient's responsibility to acquire that
+         license before distributing the Program.
+
+      d) Each Contributor represents that to its knowledge it has
+         sufficient copyright rights in its Contribution, if any, to
+         grant the copyright license set forth in this Agreement.
+
+  3. REQUIREMENTS
+
+  A Contributor  may choose to  distribute the Program in  object code
+  form under its own license agreement, provided that:
+
+      a) it complies with the terms and conditions of this Agreement; and
+
+      b) its license agreement:
+
+          i) effectively disclaims on behalf of all Contributors all
+             warranties and conditions, express and implied, including
+             warranties or conditions of title and non-infringement,
+             and implied warranties or conditions of merchantability
+             and fitness for a particular purpose;
+
+          ii) effectively excludes on behalf of all Contributors all
+              liability for damages, including direct, indirect,
+              special, incidental and consequential damages, such as
+              lost profits;
+
+          iii) states that any provisions which differ from this
+               Agreement are offered by that Contributor alone and not
+               by any other party; and
+
+          iv) states that source code for the Program is available
+              from such Contributor, and informs licensees how to
+              obtain it in a reasonable manner on or through a medium
+              customarily used for software exchange.
+
+  When the Program is made available in source code form:
+
+      a) it must be made available under this Agreement; and
+
+      b) a copy of this Agreement must be included with each copy of
+         the Program.
+
+  Contributors may not remove or alter any copyright notices contained
+  within the Program.
+
+  Each Contributor must identify itself as the originator of its
+  Contribution, if any, in a manner that reasonably allows subsequent
+  Recipients to identify the originator of the Contribution.
+
+  4. COMMERCIAL DISTRIBUTION
+
+  Commercial distributors of software may accept certain
+  responsibilities with respect to end users, business partners and
+  the like. While this license is intended to facilitate the
+  commercial use of the Program, the Contributor who includes the
+  Program in a commercial product offering should do so in a manner
+  which does not create potential liability for other Contributors.
+  Therefore, if a Contributor includes the Program in a commercial
+  product offering, such Contributor ("Commercial Contributor") hereby
+  agrees to defend and indemnify every other Contributor ("Indemnified
+  Contributor") against any losses, damages and costs (collectively
+  "Losses") arising from claims, lawsuits and other legal actions
+  brought by a third party against the Indemnified Contributor to the
+  extent caused by the acts or omissions of such Commercial
+  Contributor in connection with its distribution of the Program in a
+  commercial product offering. The obligations in this section do not
+  apply to any claims or Losses relating to any actual or alleged
+  intellectual property infringement. In order to qualify, an
+  Indemnified Contributor must: a) promptly notify the Commercial
+  Contributor in writing of such claim, and b) allow the Commercial
+  Contributor to control, and cooperate with the Commercial
+  Contributor in, the defense and any related settlement negotiations.
+  The Indemnified Contributor may participate in any such claim at its
+  own expense.
+
+  For example, a Contributor might include the Program in a commercial
+  product offering, Product X. That Contributor is then a Commercial
+  Contributor. If that Commercial Contributor then makes performance
+  claims, or offers warranties related to Product X, those performance
+  claims and warranties are such Commercial Contributor's
+  responsibility alone. Under this section, the Commercial Contributor
+  would have to defend claims against the other Contributors related
+  to those performance claims and warranties, and if a court requires
+  any other Contributor to pay any damages as a result, the Commercial
+  Contributor must pay those damages.
+
+  5. NO WARRANTY
+
+  EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+  PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+  ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+  ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+  MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient
+  is solely responsible for determining the appropriateness of using
+  and distributing the Program and assumes all risks associated with
+  its exercise of rights under this Agreement , including but not
+  limited to the risks and costs of program errors, compliance with
+  applicable laws, damage to or loss of data, programs or equipment,
+  and unavailability or interruption of operations.
+
+  6. DISCLAIMER OF LIABILITY
+
+  EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+  NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT,
+  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+  (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON
+  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+  THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
+  GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+  DAMAGES.
+
+  7. GENERAL
+
+  If any provision of this Agreement is invalid or unenforceable under
+  applicable law, it shall not affect the validity or enforceability
+  of the remainder of the terms of this Agreement, and without further
+  action by the parties hereto, such provision shall be reformed to
+  the minimum extent necessary to make such provision valid and
+  enforceable.
+
+  If Recipient institutes patent litigation against any entity
+  (including a cross-claim or counterclaim in a lawsuit) alleging that
+  the Program itself (excluding combinations of the Program with other
+  software or hardware) infringes such Recipient's patent(s), then
+  such Recipient's rights granted under Section 2(b) shall terminate
+  as of the date such litigation is filed.
+
+  All Recipient's rights under this Agreement shall terminate if it
+  fails to comply with any of the material terms or conditions of this
+  Agreement and does not cure such failure in a reasonable period of
+  time after becoming aware of such noncompliance. If all Recipient's
+  rights under this Agreement terminate, Recipient agrees to cease use
+  and distribution of the Program as soon as reasonably practicable.
+  However, Recipient's obligations under this Agreement and any
+  licenses granted by Recipient relating to the Program shall continue
+  and survive.
+
+  Everyone is permitted to copy and distribute copies of this
+  Agreement, but in order to avoid inconsistency the Agreement is
+  copyrighted and may only be modified in the following manner. The
+  Agreement Steward reserves the right to publish new versions
+  (including revisions) of this Agreement from time to time. No one
+  other than the Agreement Steward has the right to modify this
+  Agreement. The Eclipse Foundation is the initial Agreement Steward.
+  The Eclipse Foundation may assign the responsibility to serve as the
+  Agreement Steward to a suitable separate entity. Each new version of
+  the Agreement will be given a distinguishing version number. The
+  Program (including Contributions) may always be distributed subject
+  to the version of the Agreement under which it was received. In
+  addition, after a new version of the Agreement is published,
+  Contributor may elect to distribute the Program (including its
+  Contributions) under the new version. Except as expressly stated in
+  Sections 2(a) and 2(b) above, Recipient receives no rights or
+  licenses to the intellectual property of any Contributor under this
+  Agreement, whether expressly, by implication, estoppel or otherwise.
+  All rights in the Program not expressly granted under this Agreement
+  are reserved.
+
+  This Agreement is governed by the laws of the State of New York and
+  the intellectual property laws of the United States of America. No
+  party to this Agreement will bring a legal action under this
+  Agreement more than one year after the cause of action arose. Each
+  party waives its rights to a jury trial in any resulting litigation.
+
+The complete text of the Eclipse Public License is as follows:
+
+  Eclipse Public License - v 1.0
+
+  THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON
+  PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF
+  THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+  1. DEFINITIONS
+
+  "Contribution" means:
+
+  a) in the case of the initial Contributor, the initial code and
+    documentation distributed under this Agreement, and
+
+  b) in the case of each subsequent Contributor:
+
+  i) changes to the Program, and
+
+  ii) additions to the Program;
+
+  where such changes and/or additions to the Program originate
+  from and are distributed by that particular Contributor. A
+  Contribution 'originates' from a Contributor if it was added to the
+  Program by such Contributor itself or anyone acting on such
+  Contributor's behalf. Contributions do not include additions to the
+  Program which: (i) are separate modules of software distributed in
+  conjunction with the Program under their own license agreement,
+  and (ii) are not derivative works of the Program.
+
+  "Contributor" means any person or entity that distributes the Program.
+
+  "Licensed Patents " mean patent claims licensable by a Contributor
+  which are necessarily infringed by the use or sale of its Contribution
+  alone or when combined with the Program.
+
+  "Program" means the Contributions distributed in accordance with this Agreement.
+
+  "Recipient" means anyone who receives the Program under this
+  Agreement, including all Contributors.
+
+  2. GRANT OF RIGHTS
+
+  a) Subject to the terms of this Agreement, each Contributor
+  hereby grants Recipient a non-exclusive, worldwide, royalty-free
+  copyright license to reproduce, prepare derivative works of, publicly
+  display, publicly perform, distribute and sublicense the Contribution
+  of such Contributor, if any, and such derivative works, in source code
+  and object code form.
+
+  b) Subject to the terms of this Agreement, each Contributor
+  hereby grants Recipient a non-exclusive, worldwide, royalty-free
+  patent license under Licensed Patents to make, use, sell, offer to
+  sell, import and otherwise transfer the Contribution of such
+  Contributor, if any, in source code and object code form. This patent
+  license shall apply to the combination of the Contribution and the
+  Program if, at the time the Contribution is added by the Contributor,
+  such addition of the Contribution causes such combination to be
+  covered by the Licensed Patents. The patent license shall not apply to
+  any other combinations which include the Contribution. No hardware per
+  se is licensed hereunder.
+
+  c) Recipient understands that although each Contributor grants
+  the licenses to its Contributions set forth herein, no assurances are
+  provided by any Contributor that the Program does not infringe the
+  patent or other intellectual property rights of any other entity. Each
+  Contributor disclaims any liability to Recipient for claims brought by
+  any other entity based on infringement of intellectual property rights
+  or otherwise. As a condition to exercising the rights and licenses
+  granted hereunder, each Recipient hereby assumes sole responsibility
+  to secure any other intellectual property rights needed, if any. For
+  example, if a third party patent license is required to allow
+  Recipient to distribute the Program, it is Recipient's responsibility
+  to acquire that license before distributing the Program.
+
+  d) Each Contributor represents that to its knowledge it has
+  sufficient copyright rights in its Contribution, if any, to grant the
+  copyright license set forth in this Agreement.
+
+  3. REQUIREMENTS
+
+  A Contributor may choose to distribute the Program in object code form
+  under its own license agreement, provided that:
+
+  a) it complies with the terms and conditions of this Agreement;
+    and
+
+  b) its license agreement:
+
+  i) effectively disclaims on behalf of all Contributors all
+  warranties and conditions, express and implied, including warranties
+  or conditions of title and non-infringement, and implied warranties or
+  conditions of merchantability and fitness for a particular purpose;
+
+  ii) effectively excludes on behalf of all Contributors all
+  liability for damages, including direct, indirect, special, incidental
+  and consequential damages, such as lost profits;
+
+  iii) states that any provisions which differ from this Agreement
+  are offered by that Contributor alone and not by any other party; and
+
+  iv) states that source code for the Program is available from
+  such Contributor, and informs licensees how to obtain it in a
+  reasonable manner on or through a medium customarily used for software
+  exchange.
+
+  When the Program is made available in source code form:
+
+  a) it must be made available under this Agreement; and 
+
+  b) a copy of this Agreement must be included with each copy of
+  the Program.
+
+  Contributors may not remove or alter any copyright notices contained
+  within the Program.
+
+  Each Contributor must identify itself as the originator of its
+  Contribution, if any, in a manner that reasonably allows subsequent
+  Recipients to identify the originator of the Contribution.
+
+  4. COMMERCIAL DISTRIBUTION
+
+  Commercial distributors of software may accept certain
+  responsibilities with respect to end users, business partners and the
+  like. While this license is intended to facilitate the commercial use
+  of the Program, the Contributor who includes the Program in a
+  commercial product offering should do so in a manner which does not
+  create potential liability for other Contributors. Therefore, if a
+  Contributor includes the Program in a commercial product offering,
+  such Contributor ("Commercial Contributor") hereby agrees to defend
+  and indemnify every other Contributor ("Indemnified Contributor")
+  against any losses, damages and costs (collectively "Losses") arising
+  from claims, lawsuits and other legal actions brought by a third party
+  against the Indemnified Contributor to the extent caused by the acts
+  or omissions of such Commercial Contributor in connection with its
+  distribution of the Program in a commercial product offering. The
+  obligations in this section do not apply to any claims or Losses
+  relating to any actual or alleged intellectual property
+  infringement. In order to qualify, an Indemnified Contributor must: a)
+  promptly notify the Commercial Contributor in writing of such claim,
+  and b) allow the Commercial Contributor to control, and cooperate with
+  the Commercial Contributor in, the defense and any related settlement
+  negotiations. The Indemnified Contributor may participate in any such
+  claim at its own expense.
+
+  For example, a Contributor might include the Program in a commercial
+  product offering, Product X. That Contributor is then a Commercial
+  Contributor. If that Commercial Contributor then makes performance
+  claims, or offers warranties related to Product X, those performance
+  claims and warranties are such Commercial Contributor's responsibility
+  alone. Under this section, the Commercial Contributor would have to
+  defend claims against the other Contributors related to those
+  performance claims and warranties, and if a court requires any other
+  Contributor to pay any damages as a result, the Commercial Contributor
+  must pay those damages.
+
+  5. NO WARRANTY
+
+  EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+  PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
+  WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+  OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+  responsible for determining the appropriateness of using and
+  distributing the Program and assumes all risks associated with its
+  exercise of rights under this Agreement, including but not limited to
+  the risks and costs of program errors, compliance with applicable
+  laws, damage to or loss of data, programs or equipment, and
+  unavailability or interruption of operations.
+
+  6. DISCLAIMER OF LIABILITY
+
+  EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
+  ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+  WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+  DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+  HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+  7. GENERAL
+
+  If any provision of this Agreement is invalid or unenforceable under
+  applicable law, it shall not affect the validity or enforceability of
+  the remainder of the terms of this Agreement, and without further
+  action by the parties hereto, such provision shall be reformed to the
+  minimum extent necessary to make such provision valid and enforceable.
+
+  If Recipient institutes patent litigation against a Contributor with
+  respect to a patent applicable to software (including a cross-claim or
+  counterclaim in a lawsuit), then any patent licenses granted by that
+  Contributor to such Recipient under this Agreement shall terminate as
+  of the date such litigation is filed. In addition, if Recipient
+  institutes patent litigation against any entity (including a
+  cross-claim or counterclaim in a lawsuit) alleging that the Program
+  itself (excluding combinations of the Program with other software or
+  hardware) infringes such Recipient's patent(s), then such Recipient's
+  rights granted under Section 2(b) shall terminate as of the date such
+  litigation is filed.
+
+  All Recipient's rights under this Agreement shall terminate if it
+  fails to comply with any of the material terms or conditions of this
+  Agreement and does not cure such failure in a reasonable period of
+  time after becoming aware of such noncompliance. If all Recipient's
+  rights under this Agreement terminate, Recipient agrees to cease use
+  and distribution of the Program as soon as reasonably
+  practicable. However, Recipient's obligations under this Agreement and
+  any licenses granted by Recipient relating to the Program shall
+  continue and survive.
+
+  Everyone is permitted to copy and distribute copies of this Agreement,
+  but in order to avoid inconsistency the Agreement is copyrighted and
+  may only be modified in the following manner. The Agreement Steward
+  reserves the right to publish new versions (including revisions) of
+  this Agreement from time to time. No one other than the Agreement
+  Steward has the right to modify this Agreement. IBM is the initial
+  Agreement Steward. IBM may assign the responsibility to serve as the
+  Agreement Steward to a suitable separate entity. Each new version of
+  the Agreement will be given a distinguishing version number. The
+  Program (including Contributions) may always be distributed subject to
+  the version of the Agreement under which it was received. In addition,
+  after a new version of the Agreement is published, Contributor may
+  elect to distribute the Program (including its Contributions) under
+  the new version. Except as expressly stated in Sections 2(a) and 2(b)
+  above, Recipient receives no rights or licenses to the intellectual
+  property of any Contributor under this Agreement, whether expressly,
+  by implication, estoppel or otherwise. All rights in the Program not
+  expressly granted under this Agreement are reserved.
+
+  This Agreement is governed by the laws of the State of New York and
+  the intellectual property laws of the United States of America. No
+  party to this Agreement will bring a legal action under this Agreement
+  more than one year after the cause of action arose. Each party waives
+ its rights to a jury trial in any resulting litigation.
+
+The complete text of the GNU General Public License v2 is as follows:
+
+          GNU GENERAL PUBLIC LICENSE
+             Version 2, June 1991
+
+   Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                         59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+   Everyone is permitted to copy and distribute verbatim copies
+   of this license document, but changing it is not allowed.
+
+            Preamble
+
+    The licenses for most software are designed to take away your
+  freedom to share and change it.  By contrast, the GNU General Public
+  License is intended to guarantee your freedom to share and change free
+  software--to make sure the software is free for all its users.  This
+  General Public License applies to most of the Free Software
+  Foundation's software and to any other program whose authors commit to
+  using it.  (Some other Free Software Foundation software is covered by
+  the GNU Library General Public License instead.)  You can apply it to
+  your programs, too.
+
+    When we speak of free software, we are referring to freedom, not
+  price.  Our General Public Licenses are designed to make sure that you
+  have the freedom to distribute copies of free software (and charge for
+  this service if you wish), that you receive source code or can get it
+  if you want it, that you can change the software or use pieces of it
+  in new free programs; and that you know you can do these things.
+
+    To protect your rights, we need to make restrictions that forbid
+  anyone to deny you these rights or to ask you to surrender the rights.
+  These restrictions translate to certain responsibilities for you if you
+  distribute copies of the software, or if you modify it.
+
+    For example, if you distribute copies of such a program, whether
+  gratis or for a fee, you must give the recipients all the rights that
+  you have.  You must make sure that they, too, receive or can get the
+  source code.  And you must show them these terms so they know their
+  rights.
+
+    We protect your rights with two steps: (1) copyright the software, and
+  (2) offer you this license which gives you legal permission to copy,
+  distribute and/or modify the software.
+
+    Also, for each author's protection and ours, we want to make certain
+  that everyone understands that there is no warranty for this free
+  software.  If the software is modified by someone else and passed on, we
+  want its recipients to know that what they have is not the original, so
+  that any problems introduced by others will not reflect on the original
+  authors' reputations.
+
+    Finally, any free program is threatened constantly by software
+  patents.  We wish to avoid the danger that redistributors of a free
+  program will individually obtain patent licenses, in effect making the
+  program proprietary.  To prevent this, we have made it clear that any
+  patent must be licensed for everyone's free use or not licensed at all.
+
+    The precise terms and conditions for copying, distribution and
+  modification follow.
+
+          GNU GENERAL PUBLIC LICENSE
+     TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+    0. This License applies to any program or other work which contains
+  a notice placed by the copyright holder saying it may be distributed
+  under the terms of this General Public License.  The "Program", below,
+  refers to any such program or work, and a "work based on the Program"
+  means either the Program or any derivative work under copyright law:
+  that is to say, a work containing the Program or a portion of it,
+  either verbatim or with modifications and/or translated into another
+  language.  (Hereinafter, translation is included without limitation in
+  the term "modification".)  Each licensee is addressed as "you".
+
+  Activities other than copying, distribution and modification are not
+  covered by this License; they are outside its scope.  The act of
+  running the Program is not restricted, and the output from the Program
+  is covered only if its contents constitute a work based on the
+  Program (independent of having been made by running the Program).
+  Whether that is true depends on what the Program does.
+
+    1. You may copy and distribute verbatim copies of the Program's
+  source code as you receive it, in any medium, provided that you
+  conspicuously and appropriately publish on each copy an appropriate
+  copyright notice and disclaimer of warranty; keep intact all the
+  notices that refer to this License and to the absence of any warranty;
+  and give any other recipients of the Program a copy of this License
+  along with the Program.
+
+  You may charge a fee for the physical act of transferring a copy, and
+  you may at your option offer warranty protection in exchange for a fee.
+
+    2. You may modify your copy or copies of the Program or any portion
+  of it, thus forming a work based on the Program, and copy and
+  distribute such modifications or work under the terms of Section 1
+  above, provided that you also meet all of these conditions:
+
+      a) You must cause the modified files to carry prominent notices
+      stating that you changed the files and the date of any change.
+
+      b) You must cause any work that you distribute or publish, that in
+      whole or in part contains or is derived from the Program or any
+      part thereof, to be licensed as a whole at no charge to all third
+      parties under the terms of this License.
+
+      c) If the modified program normally reads commands interactively
+      when run, you must cause it, when started running for such
+      interactive use in the most ordinary way, to print or display an
+      announcement including an appropriate copyright notice and a
+      notice that there is no warranty (or else, saying that you provide
+      a warranty) and that users may redistribute the program under
+      these conditions, and telling the user how to view a copy of this
+      License.  (Exception: if the Program itself is interactive but
+      does not normally print such an announcement, your work based on
+      the Program is not required to print an announcement.)
+
+  These requirements apply to the modified work as a whole.  If
+  identifiable sections of that work are not derived from the Program,
+  and can be reasonably considered independent and separate works in
+  themselves, then this License, and its terms, do not apply to those
+  sections when you distribute them as separate works.  But when you
+  distribute the same sections as part of a whole which is a work based
+  on the Program, the distribution of the whole must be on the terms of
+  this License, whose permissions for other licensees extend to the
+  entire whole, and thus to each and every part regardless of who wrote it.
+
+  Thus, it is not the intent of this section to claim rights or contest
+  your rights to work written entirely by you; rather, the intent is to
+  exercise the right to control the distribution of derivative or
+  collective works based on the Program.
+
+  In addition, mere aggregation of another work not based on the Program
+  with the Program (or with a work based on the Program) on a volume of
+  a storage or distribution medium does not bring the other work under
+  the scope of this License.
+
+    3. You may copy and distribute the Program (or a work based on it,
+  under Section 2) in object code or executable form under the terms of
+  Sections 1 and 2 above provided that you also do one of the following:
+
+      a) Accompany it with the complete corresponding machine-readable
+      source code, which must be distributed under the terms of Sections
+      1 and 2 above on a medium customarily used for software interchange; or,
+
+      b) Accompany it with a written offer, valid for at least three
+      years, to give any third party, for a charge no more than your
+      cost of physically performing source distribution, a complete
+      machine-readable copy of the corresponding source code, to be
+      distributed under the terms of Sections 1 and 2 above on a medium
+      customarily used for software interchange; or,
+
+      c) Accompany it with the information you received as to the offer
+      to distribute corresponding source code.  (This alternative is
+      allowed only for noncommercial distribution and only if you
+      received the program in object code or executable form with such
+      an offer, in accord with Subsection b above.)
+
+  The source code for a work means the preferred form of the work for
+  making modifications to it.  For an executable work, complete source
+  code means all the source code for all modules it contains, plus any
+  associated interface definition files, plus the scripts used to
+  control compilation and installation of the executable.  However, as a
+  special exception, the source code distributed need not include
+  anything that is normally distributed (in either source or binary
+  form) with the major components (compiler, kernel, and so on) of the
+  operating system on which the executable runs, unless that component
+  itself accompanies the executable.
+
+  If distribution of executable or object code is made by offering
+  access to copy from a designated place, then offering equivalent
+  access to copy the source code from the same place counts as
+  distribution of the source code, even though third parties are not
+  compelled to copy the source along with the object code.
+
+    4. You may not copy, modify, sublicense, or distribute the Program
+  except as expressly provided under this License.  Any attempt
+  otherwise to copy, modify, sublicense or distribute the Program is
+  void, and will automatically terminate your rights under this License.
+  However, parties who have received copies, or rights, from you under
+  this License will not have their licenses terminated so long as such
+  parties remain in full compliance.
+
+    5. You are not required to accept this License, since you have not
+  signed it.  However, nothing else grants you permission to modify or
+  distribute the Program or its derivative works.  These actions are
+  prohibited by law if you do not accept this License.  Therefore, by
+  modifying or distributing the Program (or any work based on the
+  Program), you indicate your acceptance of this License to do so, and
+  all its terms and conditions for copying, distributing or modifying
+  the Program or works based on it.
+
+    6. Each time you redistribute the Program (or any work based on the
+  Program), the recipient automatically receives a license from the
+  original licensor to copy, distribute or modify the Program subject to
+  these terms and conditions.  You may not impose any further
+  restrictions on the recipients' exercise of the rights granted herein.
+  You are not responsible for enforcing compliance by third parties to
+  this License.
+
+    7. If, as a consequence of a court judgment or allegation of patent
+  infringement or for any other reason (not limited to patent issues),
+  conditions are imposed on you (whether by court order, agreement or
+  otherwise) that contradict the conditions of this License, they do not
+  excuse you from the conditions of this License.  If you cannot
+  distribute so as to satisfy simultaneously your obligations under this
+  License and any other pertinent obligations, then as a consequence you
+  may not distribute the Program at all.  For example, if a patent
+  license would not permit royalty-free redistribution of the Program by
+  all those who receive copies directly or indirectly through you, then
+  the only way you could satisfy both it and this License would be to
+  refrain entirely from distribution of the Program.
+
+  If any portion of this section is held invalid or unenforceable under
+  any particular circumstance, the balance of the section is intended to
+  apply and the section as a whole is intended to apply in other
+  circumstances.
+
+  It is not the purpose of this section to induce you to infringe any
+  patents or other property right claims or to contest validity of any
+  such claims; this section has the sole purpose of protecting the
+  integrity of the free software distribution system, which is
+  implemented by public license practices.  Many people have made
+  generous contributions to the wide range of software distributed
+  through that system in reliance on consistent application of that
+  system; it is up to the author/donor to decide if he or she is willing
+  to distribute software through any other system and a licensee cannot
+  impose that choice.
+
+  This section is intended to make thoroughly clear what is believed to
+  be a consequence of the rest of this License.
+
+    8. If the distribution and/or use of the Program is restricted in
+  certain countries either by patents or by copyrighted interfaces, the
+  original copyright holder who places the Program under this License
+  may add an explicit geographical distribution limitation excluding
+  those countries, so that distribution is permitted only in or among
+  countries not thus excluded.  In such case, this License incorporates
+  the limitation as if written in the body of this License.
+
+    9. The Free Software Foundation may publish revised and/or new versions
+  of the General Public License from time to time.  Such new versions will
+  be similar in spirit to the present version, but may differ in detail to
+  address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the Program
+  specifies a version number of this License which applies to it and "any
+  later version", you have the option of following the terms and conditions
+  either of that version or of any later version published by the Free
+  Software Foundation.  If the Program does not specify a version number of
+  this License, you may choose any version ever published by the Free Software
+  Foundation.
+
+    10. If you wish to incorporate parts of the Program into other free
+  programs whose distribution conditions are different, write to the author
+  to ask for permission.  For software which is copyrighted by the Free
+  Software Foundation, write to the Free Software Foundation; we sometimes
+  make exceptions for this.  Our decision will be guided by the two goals
+  of preserving the free status of all derivatives of our free software and
+  of promoting the sharing and reuse of software generally.
+
+            NO WARRANTY
+
+    11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+  FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+  OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+  PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+  OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+  TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+  PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+  REPAIR OR CORRECTION.
+
+    12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+  WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+  REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+  INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+  OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+  TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+  YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+  PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGES.
+
+           END OF TERMS AND CONDITIONS
+
+The complete text of the GNU Lesser General Public License 2.1 is as follows:
+
+        GNU LESSER GENERAL PUBLIC LICENSE
+             Version 2.1, February 1999
+
+   Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+   Everyone is permitted to copy and distribute verbatim copies
+   of this license document, but changing it is not allowed.
+
+  [This is the first released version of the Lesser GPL.  It also counts
+   as the successor of the GNU Library Public License, version 2, hence
+   the version number 2.1.]
+
+            Preamble
+
+    The licenses for most software are designed to take away your
+  freedom to share and change it.  By contrast, the GNU General Public
+  Licenses are intended to guarantee your freedom to share and change
+  free software--to make sure the software is free for all its users.
+
+    This license, the Lesser General Public License, applies to some
+  specially designated software packages--typically libraries--of the
+  Free Software Foundation and other authors who decide to use it.  You
+  can use it too, but we suggest you first think carefully about whether
+  this license or the ordinary General Public License is the better
+  strategy to use in any particular case, based on the explanations below.
+
+    When we speak of free software, we are referring to freedom of use,
+  not price.  Our General Public Licenses are designed to make sure that
+  you have the freedom to distribute copies of free software (and charge
+  for this service if you wish); that you receive source code or can get
+  it if you want it; that you can change the software and use pieces of
+  it in new free programs; and that you are informed that you can do
+  these things.
+
+    To protect your rights, we need to make restrictions that forbid
+  distributors to deny you these rights or to ask you to surrender these
+  rights.  These restrictions translate to certain responsibilities for
+  you if you distribute copies of the library or if you modify it.
+
+    For example, if you distribute copies of the library, whether gratis
+  or for a fee, you must give the recipients all the rights that we gave
+  you.  You must make sure that they, too, receive or can get the source
+  code.  If you link other code with the library, you must provide
+  complete object files to the recipients, so that they can relink them
+  with the library after making changes to the library and recompiling
+  it.  And you must show them these terms so they know their rights.
+
+    We protect your rights with a two-step method: (1) we copyright the
+  library, and (2) we offer you this license, which gives you legal
+  permission to copy, distribute and/or modify the library.
+
+    To protect each distributor, we want to make it very clear that
+  there is no warranty for the free library.  Also, if the library is
+  modified by someone else and passed on, the recipients should know
+  that what they have is not the original version, so that the original
+  author's reputation will not be affected by problems that might be
+  introduced by others.
+
+    Finally, software patents pose a constant threat to the existence of
+  any free program.  We wish to make sure that a company cannot
+  effectively restrict the users of a free program by obtaining a
+  restrictive license from a patent holder.  Therefore, we insist that
+  any patent license obtained for a version of the library must be
+  consistent with the full freedom of use specified in this license.
+
+    Most GNU software, including some libraries, is covered by the
+  ordinary GNU General Public License.  This license, the GNU Lesser
+  General Public License, applies to certain designated libraries, and
+  is quite different from the ordinary General Public License.  We use
+  this license for certain libraries in order to permit linking those
+  libraries into non-free programs.
+
+    When a program is linked with a library, whether statically or using
+  a shared library, the combination of the two is legally speaking a
+  combined work, a derivative of the original library.  The ordinary
+  General Public License therefore permits such linking only if the
+  entire combination fits its criteria of freedom.  The Lesser General
+  Public License permits more lax criteria for linking other code with
+  the library.
+
+    We call this license the "Lesser" General Public License because it
+  does Less to protect the user's freedom than the ordinary General
+  Public License.  It also provides other free software developers Less
+  of an advantage over competing non-free programs.  These disadvantages
+  are the reason we use the ordinary General Public License for many
+  libraries.  However, the Lesser license provides advantages in certain
+  special circumstances.
+
+    For example, on rare occasions, there may be a special need to
+  encourage the widest possible use of a certain library, so that it becomes
+  a de-facto standard.  To achieve this, non-free programs must be
+  allowed to use the library.  A more frequent case is that a free
+  library does the same job as widely used non-free libraries.  In this
+  case, there is little to gain by limiting the free library to free
+  software only, so we use the Lesser General Public License.
+
+    In other cases, permission to use a particular library in non-free
+  programs enables a greater number of people to use a large body of
+  free software.  For example, permission to use the GNU C Library in
+  non-free programs enables many more people to use the whole GNU
+  operating system, as well as its variant, the GNU/Linux operating
+  system.
+
+    Although the Lesser General Public License is Less protective of the
+  users' freedom, it does ensure that the user of a program that is
+  linked with the Library has the freedom and the wherewithal to run
+  that program using a modified version of the Library.
+
+    The precise terms and conditions for copying, distribution and
+  modification follow.  Pay close attention to the difference between a
+  "work based on the library" and a "work that uses the library".  The
+  former contains code derived from the library, whereas the latter must
+  be combined with the library in order to run.
+
+        GNU LESSER GENERAL PUBLIC LICENSE
+     TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+    0. This License Agreement applies to any software library or other
+  program which contains a notice placed by the copyright holder or
+  other authorized party saying it may be distributed under the terms of
+  this Lesser General Public License (also called "this License").
+  Each licensee is addressed as "you".
+
+    A "library" means a collection of software functions and/or data
+  prepared so as to be conveniently linked with application programs
+  (which use some of those functions and data) to form executables.
+
+    The "Library", below, refers to any such software library or work
+  which has been distributed under these terms.  A "work based on the
+  Library" means either the Library or any derivative work under
+  copyright law: that is to say, a work containing the Library or a
+  portion of it, either verbatim or with modifications and/or translated
+  straightforwardly into another language.  (Hereinafter, translation is
+  included without limitation in the term "modification".)
+
+    "Source code" for a work means the preferred form of the work for
+  making modifications to it.  For a library, complete source code means
+  all the source code for all modules it contains, plus any associated
+  interface definition files, plus the scripts used to control compilation
+  and installation of the library.
+
+    Activities other than copying, distribution and modification are not
+  covered by this License; they are outside its scope.  The act of
+  running a program using the Library is not restricted, and output from
+  such a program is covered only if its contents constitute a work based
+  on the Library (independent of the use of the Library in a tool for
+  writing it).  Whether that is true depends on what the Library does
+  and what the program that uses the Library does.
+  
+    1. You may copy and distribute verbatim copies of the Library's
+  complete source code as you receive it, in any medium, provided that
+  you conspicuously and appropriately publish on each copy an
+  appropriate copyright notice and disclaimer of warranty; keep intact
+  all the notices that refer to this License and to the absence of any
+  warranty; and distribute a copy of this License along with the
+  Library.
+
+    You may charge a fee for the physical act of transferring a copy,
+  and you may at your option offer warranty protection in exchange for a
+  fee.
+
+    2. You may modify your copy or copies of the Library or any portion
+  of it, thus forming a work based on the Library, and copy and
+  distribute such modifications or work under the terms of Section 1
+  above, provided that you also meet all of these conditions:
+
+      a) The modified work must itself be a software library.
+
+      b) You must cause the files modified to carry prominent notices
+      stating that you changed the files and the date of any change.
+
+      c) You must cause the whole of the work to be licensed at no
+      charge to all third parties under the terms of this License.
+
+      d) If a facility in the modified Library refers to a function or a
+      table of data to be supplied by an application program that uses
+      the facility, other than as an argument passed when the facility
+      is invoked, then you must make a good faith effort to ensure that,
+      in the event an application does not supply such function or
+      table, the facility still operates, and performs whatever part of
+      its purpose remains meaningful.
+
+      (For example, a function in a library to compute square roots has
+      a purpose that is entirely well-defined independent of the
+      application.  Therefore, Subsection 2d requires that any
+      application-supplied function or table used by this function must
+      be optional: if the application does not supply it, the square
+      root function must still compute square roots.)
+
+  These requirements apply to the modified work as a whole.  If
+  identifiable sections of that work are not derived from the Library,
+  and can be reasonably considered independent and separate works in
+  themselves, then this License, and its terms, do not apply to those
+  sections when you distribute them as separate works.  But when you
+  distribute the same sections as part of a whole which is a work based
+  on the Library, the distribution of the whole must be on the terms of
+  this License, whose permissions for other licensees extend to the
+  entire whole, and thus to each and every part regardless of who wrote
+  it.
+
+  Thus, it is not the intent of this section to claim rights or contest
+  your rights to work written entirely by you; rather, the intent is to
+  exercise the right to control the distribution of derivative or
+  collective works based on the Library.
+
+  In addition, mere aggregation of another work not based on the Library
+  with the Library (or with a work based on the Library) on a volume of
+  a storage or distribution medium does not bring the other work under
+  the scope of this License.
+
+    3. You may opt to apply the terms of the ordinary GNU General Public
+  License instead of this License to a given copy of the Library.  To do
+  this, you must alter all the notices that refer to this License, so
+  that they refer to the ordinary GNU General Public License, version 2,
+  instead of to this License.  (If a newer version than version 2 of the
+  ordinary GNU General Public License has appeared, then you can specify
+  that version instead if you wish.)  Do not make any other change in
+  these notices.
+
+    Once this change is made in a given copy, it is irreversible for
+  that copy, so the ordinary GNU General Public License applies to all
+  subsequent copies and derivative works made from that copy.
+
+    This option is useful when you wish to copy part of the code of
+  the Library into a program that is not a library.
+
+    4. You may copy and distribute the Library (or a portion or
+  derivative of it, under Section 2) in object code or executable form
+  under the terms of Sections 1 and 2 above provided that you accompany
+  it with the complete corresponding machine-readable source code, which
+  must be distributed under the terms of Sections 1 and 2 above on a
+  medium customarily used for software interchange.
+
+    If distribution of object code is made by offering access to copy
+  from a designated place, then offering equivalent access to copy the
+  source code from the same place satisfies the requirement to
+  distribute the source code, even though third parties are not
+  compelled to copy the source along with the object code.
+
+    5. A program that contains no derivative of any portion of the
+  Library, but is designed to work with the Library by being compiled or
+  linked with it, is called a "work that uses the Library".  Such a
+  work, in isolation, is not a derivative work of the Library, and
+  therefore falls outside the scope of this License.
+
+    However, linking a "work that uses the Library" with the Library
+  creates an executable that is a derivative of the Library (because it
+  contains portions of the Library), rather than a "work that uses the
+  library".  The executable is therefore covered by this License.
+  Section 6 states terms for distribution of such executables.
+
+    When a "work that uses the Library" uses material from a header file
+  that is part of the Library, the object code for the work may be a
+  derivative work of the Library even though the source code is not.
+  Whether this is true is especially significant if the work can be
+  linked without the Library, or if the work is itself a library.  The
+  threshold for this to be true is not precisely defined by law.
+
+    If such an object file uses only numerical parameters, data
+  structure layouts and accessors, and small macros and small inline
+  functions (ten lines or less in length), then the use of the object
+  file is unrestricted, regardless of whether it is legally a derivative
+  work.  (Executables containing this object code plus portions of the
+  Library will still fall under Section 6.)
+
+    Otherwise, if the work is a derivative of the Library, you may
+  distribute the object code for the work under the terms of Section 6.
+  Any executables containing that work also fall under Section 6,
+  whether or not they are linked directly with the Library itself.
+
+    6. As an exception to the Sections above, you may also combine or
+  link a "work that uses the Library" with the Library to produce a
+  work containing portions of the Library, and distribute that work
+  under terms of your choice, provided that the terms permit
+  modification of the work for the customer's own use and reverse
+  engineering for debugging such modifications.
+
+    You must give prominent notice with each copy of the work that the
+  Library is used in it and that the Library and its use are covered by
+  this License.  You must supply a copy of this License.  If the work
+  during execution displays copyright notices, you must include the
+  copyright notice for the Library among them, as well as a reference
+  directing the user to the copy of this License.  Also, you must do one
+  of these things:
+
+      a) Accompany the work with the complete corresponding
+      machine-readable source code for the Library including whatever
+      changes were used in the work (which must be distributed under
+      Sections 1 and 2 above); and, if the work is an executable linked
+      with the Library, with the complete machine-readable "work that
+      uses the Library", as object code and/or source code, so that the
+      user can modify the Library and then relink to produce a modified
+      executable containing the modified Library.  (It is understood
+      that the user who changes the contents of definitions files in the
+      Library will not necessarily be able to recompile the application
+      to use the modified definitions.)
+
+      b) Use a suitable shared library mechanism for linking with the
+      Library.  A suitable mechanism is one that (1) uses at run time a
+      copy of the library already present on the user's computer system,
+      rather than copying library functions into the executable, and (2)
+      will operate properly with a modified version of the library, if
+      the user installs one, as long as the modified version is
+      interface-compatible with the version that the work was made with.
+
+      c) Accompany the work with a written offer, valid for at
+      least three years, to give the same user the materials
+      specified in Subsection 6a, above, for a charge no more
+      than the cost of performing this distribution.
+
+      d) If distribution of the work is made by offering access to copy
+      from a designated place, offer equivalent access to copy the above
+      specified materials from the same place.
+
+      e) Verify that the user has already received a copy of these
+      materials or that you have already sent this user a copy.
+
+    For an executable, the required form of the "work that uses the
+  Library" must include any data and utility programs needed for
+  reproducing the executable from it.  However, as a special exception,
+  the materials to be distributed need not include anything that is
+  normally distributed (in either source or binary form) with the major
+  components (compiler, kernel, and so on) of the operating system on
+  which the executable runs, unless that component itself accompanies
+  the executable.
+
+    It may happen that this requirement contradicts the license
+  restrictions of other proprietary libraries that do not normally
+  accompany the operating system.  Such a contradiction means you cannot
+  use both them and the Library together in an executable that you
+  distribute.
+
+    7. You may place library facilities that are a work based on the
+  Library side-by-side in a single library together with other library
+  facilities not covered by this License, and distribute such a combined
+  library, provided that the separate distribution of the work based on
+  the Library and of the other library facilities is otherwise
+  permitted, and provided that you do these two things:
+
+      a) Accompany the combined library with a copy of the same work
+      based on the Library, uncombined with any other library
+      facilities.  This must be distributed under the terms of the
+      Sections above.
+
+      b) Give prominent notice with the combined library of the fact
+      that part of it is a work based on the Library, and explaining
+      where to find the accompanying uncombined form of the same work.
+
+    8. You may not copy, modify, sublicense, link with, or distribute
+  the Library except as expressly provided under this License.  Any
+  attempt otherwise to copy, modify, sublicense, link with, or
+  distribute the Library is void, and will automatically terminate your
+  rights under this License.  However, parties who have received copies,
+  or rights, from you under this License will not have their licenses
+  terminated so long as such parties remain in full compliance.
+
+    9. You are not required to accept this License, since you have not
+  signed it.  However, nothing else grants you permission to modify or
+  distribute the Library or its derivative works.  These actions are
+  prohibited by law if you do not accept this License.  Therefore, by
+  modifying or distributing the Library (or any work based on the
+  Library), you indicate your acceptance of this License to do so, and
+  all its terms and conditions for copying, distributing or modifying
+  the Library or works based on it.
+
+    10. Each time you redistribute the Library (or any work based on the
+  Library), the recipient automatically receives a license from the
+  original licensor to copy, distribute, link with or modify the Library
+  subject to these terms and conditions.  You may not impose any further
+  restrictions on the recipients' exercise of the rights granted herein.
+  You are not responsible for enforcing compliance by third parties with
+  this License.
+
+    11. If, as a consequence of a court judgment or allegation of patent
+  infringement or for any other reason (not limited to patent issues),
+  conditions are imposed on you (whether by court order, agreement or
+  otherwise) that contradict the conditions of this License, they do not
+  excuse you from the conditions of this License.  If you cannot
+  distribute so as to satisfy simultaneously your obligations under this
+  License and any other pertinent obligations, then as a consequence you
+  may not distribute the Library at all.  For example, if a patent
+  license would not permit royalty-free redistribution of the Library by
+  all those who receive copies directly or indirectly through you, then
+  the only way you could satisfy both it and this License would be to
+  refrain entirely from distribution of the Library.
+
+  If any portion of this section is held invalid or unenforceable under any
+  particular circumstance, the balance of the section is intended to apply,
+  and the section as a whole is intended to apply in other circumstances.
+
+  It is not the purpose of this section to induce you to infringe any
+  patents or other property right claims or to contest validity of any
+  such claims; this section has the sole purpose of protecting the
+  integrity of the free software distribution system which is
+  implemented by public license practices.  Many people have made
+  generous contributions to the wide range of software distributed
+  through that system in reliance on consistent application of that
+  system; it is up to the author/donor to decide if he or she is willing
+  to distribute software through any other system and a licensee cannot
+  impose that choice.
+
+  This section is intended to make thoroughly clear what is believed to
+  be a consequence of the rest of this License.
+
+    12. If the distribution and/or use of the Library is restricted in
+  certain countries either by patents or by copyrighted interfaces, the
+  original copyright holder who places the Library under this License may add
+  an explicit geographical distribution limitation excluding those countries,
+  so that distribution is permitted only in or among countries not thus
+  excluded.  In such case, this License incorporates the limitation as if
+  written in the body of this License.
+
+    13. The Free Software Foundation may publish revised and/or new
+  versions of the Lesser General Public License from time to time.
+  Such new versions will be similar in spirit to the present version,
+  but may differ in detail to address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the Library
+  specifies a version number of this License which applies to it and
+  "any later version", you have the option of following the terms and
+  conditions either of that version or of any later version published by
+  the Free Software Foundation.  If the Library does not specify a
+  license version number, you may choose any version ever published by
+  the Free Software Foundation.
+
+    14. If you wish to incorporate parts of the Library into other free
+  programs whose distribution conditions are incompatible with these,
+  write to the author to ask for permission.  For software which is
+  copyrighted by the Free Software Foundation, write to the Free
+  Software Foundation; we sometimes make exceptions for this.  Our
+  decision will be guided by the two goals of preserving the free status
+  of all derivatives of our free software and of promoting the sharing
+  and reuse of software generally.
+
+            NO WARRANTY
+
+    15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+  WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+  OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+  PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+  LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+  THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+    16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+  WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+  AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+  FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+  CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+  LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+  RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+  FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+  SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+  DAMAGES.
+
+           END OF TERMS AND CONDITIONS
+
+             How to Apply These Terms to Your New Libraries
+
+    If you develop a new library, and you want it to be of the greatest
+  possible use to the public, we recommend making it free software that
+  everyone can redistribute and change.  You can do so by permitting
+  redistribution under these terms (or, alternatively, under the terms of the
+  ordinary General Public License).
+
+    To apply these terms, attach the following notices to the library.  It is
+  safest to attach them to the start of each source file to most effectively
+  convey the exclusion of warranty; and each file should have at least the
+  "copyright" line and a pointer to where the full notice is found.
+
+      <one line to give the library's name and a brief idea of what it does.>
+      Copyright (C) <year>  <name of author>
+
+      This library is free software; you can redistribute it and/or
+      modify it under the terms of the GNU Lesser General Public
+      License as published by the Free Software Foundation; either
+      version 2.1 of the License, or (at your option) any later version.
+
+      This library is distributed in the hope that it will be useful,
+      but WITHOUT ANY WARRANTY; without even the implied warranty of
+      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+      Lesser General Public License for more details.
+
+      You should have received a copy of the GNU Lesser General Public
+      License along with this library; if not, write to the Free Software
+      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+  Also add information on how to contact you by electronic and paper mail.
+
+  You should also get your employer (if you work as a programmer) or your
+  school, if any, to sign a "copyright disclaimer" for the library, if
+  necessary.  Here is a sample; alter the names:
+
+    Yoyodyne, Inc., hereby disclaims all copyright interest in the
+    library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+    <signature of Ty Coon>, 1 April 1990
+    Ty Coon, President of Vice
+
+  That's all there is to it!
+
+The following licenses cover code other than JRuby which is included with JRuby.
+
+Licenses listed below include:
+
+* GNU General Public License version 3
+* Apache 2.0 License
+* BSD License
+* Apache Software License Version 1.1
+* MIT License
+
+The complete text of the GNU General Public License version 3 is as follows:
+
+          GNU GENERAL PUBLIC LICENSE
+             Version 3, 29 June 2007
+
+   Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+   Everyone is permitted to copy and distribute verbatim copies
+   of this license document, but changing it is not allowed.
+
+            Preamble
+
+    The GNU General Public License is a free, copyleft license for
+  software and other kinds of works.
+
+    The licenses for most software and other practical works are designed
+  to take away your freedom to share and change the works.  By contrast,
+  the GNU General Public License is intended to guarantee your freedom to
+  share and change all versions of a program--to make sure it remains free
+  software for all its users.  We, the Free Software Foundation, use the
+  GNU General Public License for most of our software; it applies also to
+  any other work released this way by its authors.  You can apply it to
+  your programs, too.
+
+    When we speak of free software, we are referring to freedom, not
+  price.  Our General Public Licenses are designed to make sure that you
+  have the freedom to distribute copies of free software (and charge for
+  them if you wish), that you receive source code or can get it if you
+  want it, that you can change the software or use pieces of it in new
+  free programs, and that you know you can do these things.
+
+    To protect your rights, we need to prevent others from denying you
+  these rights or asking you to surrender the rights.  Therefore, you have
+  certain responsibilities if you distribute copies of the software, or if
+  you modify it: responsibilities to respect the freedom of others.
+
+    For example, if you distribute copies of such a program, whether
+  gratis or for a fee, you must pass on to the recipients the same
+  freedoms that you received.  You must make sure that they, too, receive
+  or can get the source code.  And you must show them these terms so they
+  know their rights.
+
+    Developers that use the GNU GPL protect your rights with two steps:
+  (1) assert copyright on the software, and (2) offer you this License
+  giving you legal permission to copy, distribute and/or modify it.
+
+    For the developers' and authors' protection, the GPL clearly explains
+  that there is no warranty for this free software.  For both users' and
+  authors' sake, the GPL requires that modified versions be marked as
+  changed, so that their problems will not be attributed erroneously to
+  authors of previous versions.
+
+    Some devices are designed to deny users access to install or run
+  modified versions of the software inside them, although the manufacturer
+  can do so.  This is fundamentally incompatible with the aim of
+  protecting users' freedom to change the software.  The systematic
+  pattern of such abuse occurs in the area of products for individuals to
+  use, which is precisely where it is most unacceptable.  Therefore, we
+  have designed this version of the GPL to prohibit the practice for those
+  products.  If such problems arise substantially in other domains, we
+  stand ready to extend this provision to those domains in future versions
+  of the GPL, as needed to protect the freedom of users.
+
+    Finally, every program is threatened constantly by software patents.
+  States should not allow patents to restrict development and use of
+  software on general-purpose computers, but in those that do, we wish to
+  avoid the special danger that patents applied to a free program could
+  make it effectively proprietary.  To prevent this, the GPL assures that
+  patents cannot be used to render the program non-free.
+
+    The precise terms and conditions for copying, distribution and
+  modification follow.
+
+             TERMS AND CONDITIONS
+
+    0. Definitions.
+
+    "This License" refers to version 3 of the GNU General Public License.
+
+    "Copyright" also means copyright-like laws that apply to other kinds of
+  works, such as semiconductor masks.
+ 
+    "The Program" refers to any copyrightable work licensed under this
+  License.  Each licensee is addressed as "you".  "Licensees" and
+  "recipients" may be individuals or organizations.
+
+    To "modify" a work means to copy from or adapt all or part of the work
+  in a fashion requiring copyright permission, other than the making of an
+  exact copy.  The resulting work is called a "modified version" of the
+  earlier work or a work "based on" the earlier work.
+
+    A "covered work" means either the unmodified Program or a work based
+  on the Program.
+
+    To "propagate" a work means to do anything with it that, without
+  permission, would make you directly or secondarily liable for
+  infringement under applicable copyright law, except executing it on a
+  computer or modifying a private copy.  Propagation includes copying,
+  distribution (with or without modification), making available to the
+  public, and in some countries other activities as well.
+
+    To "convey" a work means any kind of propagation that enables other
+  parties to make or receive copies.  Mere interaction with a user through
+  a computer network, with no transfer of a copy, is not conveying.
+
+    An interactive user interface displays "Appropriate Legal Notices"
+  to the extent that it includes a convenient and prominently visible
+  feature that (1) displays an appropriate copyright notice, and (2)
+  tells the user that there is no warranty for the work (except to the
+  extent that warranties are provided), that licensees may convey the
+  work under this License, and how to view a copy of this License.  If
+  the interface presents a list of user commands or options, such as a
+  menu, a prominent item in the list meets this criterion.
+
+    1. Source Code.
+
+    The "source code" for a work means the preferred form of the work
+  for making modifications to it.  "Object code" means any non-source
+  form of a work.
+
+    A "Standard Interface" means an interface that either is an official
+  standard defined by a recognized standards body, or, in the case of
+  interfaces specified for a particular programming language, one that
+  is widely used among developers working in that language.
+
+    The "System Libraries" of an executable work include anything, other
+  than the work as a whole, that (a) is included in the normal form of
+  packaging a Major Component, but which is not part of that Major
+  Component, and (b) serves only to enable use of the work with that
+  Major Component, or to implement a Standard Interface for which an
+  implementation is available to the public in source code form.  A
+  "Major Component", in this context, means a major essential component
+  (kernel, window system, and so on) of the specific operating system
+  (if any) on which the executable work runs, or a compiler used to
+  produce the work, or an object code interpreter used to run it.
+
+    The "Corresponding Source" for a work in object code form means all
+  the source code needed to generate, install, and (for an executable
+  work) run the object code and to modify the work, including scripts to
+  control those activities.  However, it does not include the work's
+  System Libraries, or general-purpose tools or generally available free
+  programs which are used unmodified in performing those activities but
+  which are not part of the work.  For example, Corresponding Source
+  includes interface definition files associated with source files for
+  the work, and the source code for shared libraries and dynamically
+  linked subprograms that the work is specifically designed to require,
+  such as by intimate data communication or control flow between those
+  subprograms and other parts of the work.
+
+    The Corresponding Source need not include anything that users
+  can regenerate automatically from other parts of the Corresponding
+  Source.
+
+    The Corresponding Source for a work in source code form is that
+  same work.
+
+    2. Basic Permissions.
+
+    All rights granted under this License are granted for the term of
+  copyright on the Program, and are irrevocable provided the stated
+  conditions are met.  This License explicitly affirms your unlimited
+  permission to run the unmodified Program.  The output from running a
+  covered work is covered by this License only if the output, given its
+  content, constitutes a covered work.  This License acknowledges your
+  rights of fair use or other equivalent, as provided by copyright law.
+
+    You may make, run and propagate covered works that you do not
+  convey, without conditions so long as your license otherwise remains
+  in force.  You may convey covered works to others for the sole purpose
+  of having them make modifications exclusively for you, or provide you
+  with facilities for running those works, provided that you comply with
+  the terms of this License in conveying all material for which you do
+  not control copyright.  Those thus making or running the covered works
+  for you must do so exclusively on your behalf, under your direction
+  and control, on terms that prohibit them from making any copies of
+  your copyrighted material outside their relationship with you.
+
+    Conveying under any other circumstances is permitted solely under
+  the conditions stated below.  Sublicensing is not allowed; section 10
+  makes it unnecessary.
+
+    3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+    No covered work shall be deemed part of an effective technological
+  measure under any applicable law fulfilling obligations under article
+  11 of the WIPO copyright treaty adopted on 20 December 1996, or
+  similar laws prohibiting or restricting circumvention of such
+  measures.
+
+    When you convey a covered work, you waive any legal power to forbid
+  circumvention of technological measures to the extent such circumvention
+  is effected by exercising rights under this License with respect to
+  the covered work, and you disclaim any intention to limit operation or
+  modification of the work as a means of enforcing, against the work's
+  users, your or third parties' legal rights to forbid circumvention of
+  technological measures.
+
+    4. Conveying Verbatim Copies.
+
+    You may convey verbatim copies of the Program's source code as you
+  receive it, in any medium, provided that you conspicuously and
+  appropriately publish on each copy an appropriate copyright notice;
+  keep intact all notices stating that this License and any
+  non-permissive terms added in accord with section 7 apply to the code;
+  keep intact all notices of the absence of any warranty; and give all
+  recipients a copy of this License along with the Program.
+
+    You may charge any price or no price for each copy that you convey,
+  and you may offer support or warranty protection for a fee.
+
+    5. Conveying Modified Source Versions.
+
+    You may convey a work based on the Program, or the modifications to
+  produce it from the Program, in the form of source code under the
+  terms of section 4, provided that you also meet all of these conditions:
+
+      a) The work must carry prominent notices stating that you modified
+      it, and giving a relevant date.
+
+      b) The work must carry prominent notices stating that it is
+      released under this License and any conditions added under section
+      7.  This requirement modifies the requirement in section 4 to
+      "keep intact all notices".
+
+      c) You must license the entire work, as a whole, under this
+      License to anyone who comes into possession of a copy.  This
+      License will therefore apply, along with any applicable section 7
+      additional terms, to the whole of the work, and all its parts,
+      regardless of how they are packaged.  This License gives no
+      permission to license the work in any other way, but it does not
+      invalidate such permission if you have separately received it.
+
+      d) If the work has interactive user interfaces, each must display
+      Appropriate Legal Notices; however, if the Program has interactive
+      interfaces that do not display Appropriate Legal Notices, your
+      work need not make them do so.
+
+    A compilation of a covered work with other separate and independent
+  works, which are not by their nature extensions of the covered work,
+  and which are not combined with it such as to form a larger program,
+  in or on a volume of a storage or distribution medium, is called an
+  "aggregate" if the compilation and its resulting copyright are not
+  used to limit the access or legal rights of the compilation's users
+  beyond what the individual works permit.  Inclusion of a covered work
+  in an aggregate does not cause this License to apply to the other
+  parts of the aggregate.
+
+    6. Conveying Non-Source Forms.
+
+    You may convey a covered work in object code form under the terms
+  of sections 4 and 5, provided that you also convey the
+  machine-readable Corresponding Source under the terms of this License,
+  in one of these ways:
+
+      a) Convey the object code in, or embodied in, a physical product
+      (including a physical distribution medium), accompanied by the
+      Corresponding Source fixed on a durable physical medium
+      customarily used for software interchange.
+
+      b) Convey the object code in, or embodied in, a physical product
+      (including a physical distribution medium), accompanied by a
+      written offer, valid for at least three years and valid for as
+      long as you offer spare parts or customer support for that product
+      model, to give anyone who possesses the object code either (1) a
+      copy of the Corresponding Source for all the software in the
+      product that is covered by this License, on a durable physical
+      medium customarily used for software interchange, for a price no
+      more than your reasonable cost of physically performing this
+      conveying of source, or (2) access to copy the
+      Corresponding Source from a network server at no charge.
+
+      c) Convey individual copies of the object code with a copy of the
+      written offer to provide the Corresponding Source.  This
+      alternative is allowed only occasionally and noncommercially, and
+      only if you received the object code with such an offer, in accord
+      with subsection 6b.
+
+      d) Convey the object code by offering access from a designated
+      place (gratis or for a charge), and offer equivalent access to the
+      Corresponding Source in the same way through the same place at no
+      further charge.  You need not require recipients to copy the
+      Corresponding Source along with the object code.  If the place to
+      copy the object code is a network server, the Corresponding Source
+      may be on a different server (operated by you or a third party)
+      that supports equivalent copying facilities, provided you maintain
+      clear directions next to the object code saying where to find the
+      Corresponding Source.  Regardless of what server hosts the
+      Corresponding Source, you remain obligated to ensure that it is
+      available for as long as needed to satisfy these requirements.
+
+      e) Convey the object code using peer-to-peer transmission, provided
+      you inform other peers where the object code and Corresponding
+      Source of the work are being offered to the general public at no
+      charge under subsection 6d.
+
+    A separable portion of the object code, whose source code is excluded
+  from the Corresponding Source as a System Library, need not be
+  included in conveying the object code work.
+
+    A "User Product" is either (1) a "consumer product", which means any
+  tangible personal property which is normally used for personal, family,
+  or household purposes, or (2) anything designed or sold for incorporation
+  into a dwelling.  In determining whether a product is a consumer product,
+  doubtful cases shall be resolved in favor of coverage.  For a particular
+  product received by a particular user, "normally used" refers to a
+  typical or common use of that class of product, regardless of the status
+  of the particular user or of the way in which the particular user
+  actually uses, or expects or is expected to use, the product.  A product
+  is a consumer product regardless of whether the product has substantial
+  commercial, industrial or non-consumer uses, unless such uses represent
+  the only significant mode of use of the product.
+
+    "Installation Information" for a User Product means any methods,
+  procedures, authorization keys, or other information required to install
+  and execute modified versions of a covered work in that User Product from
+  a modified version of its Corresponding Source.  The information must
+  suffice to ensure that the continued functioning of the modified object
+  code is in no case prevented or interfered with solely because
+  modification has been made.
+
+    If you convey an object code work under this section in, or with, or
+  specifically for use in, a User Product, and the conveying occurs as
+  part of a transaction in which the right of possession and use of the
+  User Product is transferred to the recipient in perpetuity or for a
+  fixed term (regardless of how the transaction is characterized), the
+  Corresponding Source conveyed under this section must be accompanied
+  by the Installation Information.  But this requirement does not apply
+  if neither you nor any third party retains the ability to install
+  modified object code on the User Product (for example, the work has
+  been installed in ROM).
+
+    The requirement to provide Installation Information does not include a
+  requirement to continue to provide support service, warranty, or updates
+  for a work that has been modified or installed by the recipient, or for
+  the User Product in which it has been modified or installed.  Access to a
+  network may be denied when the modification itself materially and
+  adversely affects the operation of the network or violates the rules and
+  protocols for communication across the network.
+
+    Corresponding Source conveyed, and Installation Information provided,
+  in accord with this section must be in a format that is publicly
+  documented (and with an implementation available to the public in
+  source code form), and must require no special password or key for
+  unpacking, reading or copying.
+
+    7. Additional Terms.
+
+    "Additional permissions" are terms that supplement the terms of this
+  License by making exceptions from one or more of its conditions.
+  Additional permissions that are applicable to the entire Program shall
+  be treated as though they were included in this License, to the extent
+  that they are valid under applicable law.  If additional permissions
+  apply only to part of the Program, that part may be used separately
+  under those permissions, but the entire Program remains governed by
+  this License without regard to the additional permissions.
+
+    When you convey a copy of a covered work, you may at your option
+  remove any additional permissions from that copy, or from any part of
+  it.  (Additional permissions may be written to require their own
+  removal in certain cases when you modify the work.)  You may place
+  additional permissions on material, added by you to a covered work,
+  for which you have or can give appropriate copyright permission.
+
+    Notwithstanding any other provision of this License, for material you
+  add to a covered work, you may (if authorized by the copyright holders of
+  that material) supplement the terms

<TRUNCATED>

[48/50] [abbrv] ignite git commit: IGNITE-10435: Remove some dead code from thin clients. This closes #5521.

Posted by sb...@apache.org.
IGNITE-10435: Remove some dead code from thin clients. This closes #5521.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/79206469
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/79206469
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/79206469

Branch: refs/heads/ignite-10044
Commit: 7920646937c877e6c7d79b398481af3689f222a5
Parents: 560240f
Author: devozerov <vo...@gridgain.com>
Authored: Thu Nov 29 12:59:43 2018 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Nov 29 12:59:43 2018 +0300

----------------------------------------------------------------------
 .../platform/client/ClientRequest.java          | 28 -----------------
 .../cache/ClientCacheClearKeyRequest.java       |  3 --
 .../cache/ClientCacheClearKeysRequest.java      |  3 --
 .../client/cache/ClientCacheClearRequest.java   |  3 --
 .../cache/ClientCacheContainsKeyRequest.java    |  3 --
 .../cache/ClientCacheContainsKeysRequest.java   |  3 --
 ...ientCacheCreateWithConfigurationRequest.java |  9 ++----
 .../cache/ClientCacheCreateWithNameRequest.java |  6 ++--
 .../client/cache/ClientCacheDestroyRequest.java |  3 --
 .../client/cache/ClientCacheGetAllRequest.java  |  5 +--
 .../ClientCacheGetAndPutIfAbsentRequest.java    |  3 --
 .../cache/ClientCacheGetAndPutRequest.java      |  3 --
 .../cache/ClientCacheGetAndRemoveRequest.java   |  3 --
 .../cache/ClientCacheGetAndReplaceRequest.java  |  3 --
 ...acheGetOrCreateWithConfigurationRequest.java |  9 ++----
 .../ClientCacheGetOrCreateWithNameRequest.java  |  3 --
 .../client/cache/ClientCacheGetRequest.java     |  3 --
 .../client/cache/ClientCacheGetSizeRequest.java |  3 --
 .../cache/ClientCacheLocalPeekRequest.java      |  3 --
 .../cache/ClientCacheNodePartitionsRequest.java |  2 --
 .../client/cache/ClientCachePutAllRequest.java  |  3 --
 .../cache/ClientCachePutIfAbsentRequest.java    |  3 --
 .../client/cache/ClientCachePutRequest.java     |  3 --
 .../cache/ClientCacheRemoveAllRequest.java      |  3 --
 .../cache/ClientCacheRemoveIfEqualsRequest.java |  3 --
 .../cache/ClientCacheRemoveKeyRequest.java      |  3 --
 .../cache/ClientCacheRemoveKeysRequest.java     |  3 --
 .../ClientCacheReplaceIfEqualsRequest.java      |  3 --
 .../client/cache/ClientCacheReplaceRequest.java |  3 --
 .../client/cache/ClientCacheRequest.java        | 32 --------------------
 .../cache/ClientCacheScanQueryRequest.java      |  3 --
 31 files changed, 9 insertions(+), 154 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientRequest.java
index 6a53517..76823b5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientRequest.java
@@ -19,8 +19,6 @@ package org.apache.ignite.internal.processors.platform.client;
 
 import org.apache.ignite.binary.BinaryRawReader;
 import org.apache.ignite.internal.processors.odbc.ClientListenerRequest;
-import org.apache.ignite.plugin.security.SecurityException;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Thin client request.
@@ -60,30 +58,4 @@ public class ClientRequest implements ClientListenerRequest {
     public ClientResponse process(ClientConnectionContext ctx) {
         return new ClientResponse(reqId);
     }
-
-    /**
-     * Run the code with converting {@link SecurityException} to {@link IgniteClientException}.
-     */
-    protected static void runWithSecurityExceptionHandler(Runnable runnable) {
-        try {
-            runnable.run();
-        }
-        catch (SecurityException ex) {
-            throw new IgniteClientException(
-                ClientStatus.SECURITY_VIOLATION,
-                "Client is not authorized to perform this operation",
-                ex
-            );
-        }
-    }
-
-    /**
-     * Authorize for specified permission.
-     */
-    protected void authorize(ClientConnectionContext ctx, SecurityPermission perm) {
-//        SecurityContext secCtx = ctx.securityContext();
-//
-//        if (secCtx != null)
-//            runWithSecurityExceptionHandler(() -> ctx.kernalContext().security().authorize(null, perm, secCtx));
-    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheClearKeyRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheClearKeyRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheClearKeyRequest.java
index 5f8e952..6bcbbe8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheClearKeyRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheClearKeyRequest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.platform.client.cache;
 import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Clear key request.
@@ -38,8 +37,6 @@ public class ClientCacheClearKeyRequest extends ClientCacheKeyRequest {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_REMOVE);
-
         cache(ctx).clear(key());
 
         return super.process(ctx);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheClearKeysRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheClearKeysRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheClearKeysRequest.java
index d803f69..04eb7f6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheClearKeysRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheClearKeysRequest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.platform.client.cache;
 import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Clear keys request.
@@ -38,8 +37,6 @@ public class ClientCacheClearKeysRequest extends ClientCacheKeysRequest {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_REMOVE);
-
         cache(ctx).clearAll(keys());
 
         return super.process(ctx);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheClearRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheClearRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheClearRequest.java
index 59d0ec5..3bf236b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheClearRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheClearRequest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.platform.client.cache;
 import org.apache.ignite.binary.BinaryRawReader;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache clear request.
@@ -37,8 +36,6 @@ public class ClientCacheClearRequest extends ClientCacheRequest {
 
     /** {@inheritDoc} */
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_REMOVE);
-
         cache(ctx).clear();
 
         return super.process(ctx);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheContainsKeyRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheContainsKeyRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheContainsKeyRequest.java
index 386f448..8470828 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheContainsKeyRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheContainsKeyRequest.java
@@ -21,7 +21,6 @@ import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientBooleanResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * ContainsKey request.
@@ -39,8 +38,6 @@ public class ClientCacheContainsKeyRequest extends ClientCacheKeyRequest {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_READ);
-
         boolean val = cache(ctx).containsKey(key());
 
         return new ClientBooleanResponse(requestId(), val);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheContainsKeysRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheContainsKeysRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheContainsKeysRequest.java
index b5184bf..41e1306 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheContainsKeysRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheContainsKeysRequest.java
@@ -21,7 +21,6 @@ import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientBooleanResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * ContainsKeys request.
@@ -39,8 +38,6 @@ public class ClientCacheContainsKeysRequest extends ClientCacheKeysRequest {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_READ);
-
         boolean val = cache(ctx).containsKeys(keys());
 
         return new ClientBooleanResponse(requestId(), val);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheCreateWithConfigurationRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheCreateWithConfigurationRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheCreateWithConfigurationRequest.java
index 9f1d63fc..93a18ed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheCreateWithConfigurationRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheCreateWithConfigurationRequest.java
@@ -26,7 +26,6 @@ import org.apache.ignite.internal.processors.platform.client.ClientRequest;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientStatus;
 import org.apache.ignite.internal.processors.platform.client.IgniteClientException;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache create with configuration request.
@@ -50,12 +49,10 @@ public class ClientCacheCreateWithConfigurationRequest extends ClientRequest {
 
     /** {@inheritDoc} */
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_CREATE);
-
         try {
-            // Use security exception handler since the code authorizes "enable on-heap cache" permission
-            runWithSecurityExceptionHandler(() -> ctx.kernalContext().grid().createCache(cacheCfg));
-        } catch (CacheExistsException e) {
+            ctx.kernalContext().grid().createCache(cacheCfg);
+        }
+        catch (CacheExistsException e) {
             throw new IgniteClientException(ClientStatus.CACHE_EXISTS, e.getMessage());
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheCreateWithNameRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheCreateWithNameRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheCreateWithNameRequest.java
index cacf099..526eb6c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheCreateWithNameRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheCreateWithNameRequest.java
@@ -24,7 +24,6 @@ import org.apache.ignite.internal.processors.platform.client.ClientRequest;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientStatus;
 import org.apache.ignite.internal.processors.platform.client.IgniteClientException;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache create with name request.
@@ -46,11 +45,10 @@ public class ClientCacheCreateWithNameRequest extends ClientRequest {
 
     /** {@inheritDoc} */
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_CREATE);
-
         try {
             ctx.kernalContext().grid().createCache(cacheName);
-        } catch (CacheExistsException e) {
+        }
+        catch (CacheExistsException e) {
             throw new IgniteClientException(ClientStatus.CACHE_EXISTS, e.getMessage());
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheDestroyRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheDestroyRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheDestroyRequest.java
index b6f85ee..6645a03 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheDestroyRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheDestroyRequest.java
@@ -21,7 +21,6 @@ import org.apache.ignite.binary.BinaryRawReader;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientRequest;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache destroy request.
@@ -43,8 +42,6 @@ public class ClientCacheDestroyRequest extends ClientRequest {
 
     /** {@inheritDoc} */
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_DESTROY);
-
         String cacheName = ClientCacheRequest.cacheDescriptor(ctx, cacheId).cacheName();
 
         ctx.kernalContext().grid().destroyCache(cacheName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAllRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAllRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAllRequest.java
index a07305c..d07da1c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAllRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAllRequest.java
@@ -22,7 +22,6 @@ import org.apache.ignite.internal.processors.platform.client.ClientConnectionCon
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
 
 import java.util.Map;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * GetAll request.
@@ -40,9 +39,7 @@ public class ClientCacheGetAllRequest extends ClientCacheKeysRequest {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_READ);
-
-        Map val = cache(ctx).getAll(keys());
+                Map val = cache(ctx).getAll(keys());
 
         return new ClientCacheGetAllResponse(requestId(), val);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndPutIfAbsentRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndPutIfAbsentRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndPutIfAbsentRequest.java
index 8713a21..8360213 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndPutIfAbsentRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndPutIfAbsentRequest.java
@@ -21,7 +21,6 @@ import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientObjectResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache get and put if absent request.
@@ -39,8 +38,6 @@ public class ClientCacheGetAndPutIfAbsentRequest extends ClientCacheKeyValueRequ
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_READ, SecurityPermission.CACHE_PUT);
-
         Object res = cache(ctx).getAndPutIfAbsent(key(), val());
 
         return new ClientObjectResponse(requestId(), res);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndPutRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndPutRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndPutRequest.java
index dde5181..7a540e8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndPutRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndPutRequest.java
@@ -21,7 +21,6 @@ import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientObjectResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache get and put request.
@@ -39,8 +38,6 @@ public class ClientCacheGetAndPutRequest extends ClientCacheKeyValueRequest {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_READ, SecurityPermission.CACHE_PUT);
-
         Object res = cache(ctx).getAndPut(key(), val());
 
         return new ClientObjectResponse(requestId(), res);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndRemoveRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndRemoveRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndRemoveRequest.java
index 3b9dd4b..e4fd735 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndRemoveRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndRemoveRequest.java
@@ -21,7 +21,6 @@ import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientObjectResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache get and remove request.
@@ -39,8 +38,6 @@ public class ClientCacheGetAndRemoveRequest extends ClientCacheKeyRequest {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_READ, SecurityPermission.CACHE_REMOVE);
-
         Object val = cache(ctx).getAndRemove(key());
 
         return new ClientObjectResponse(requestId(), val);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndReplaceRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndReplaceRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndReplaceRequest.java
index 8ba157a..dba8639 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndReplaceRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetAndReplaceRequest.java
@@ -21,7 +21,6 @@ import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientObjectResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache get and replace request.
@@ -39,8 +38,6 @@ public class ClientCacheGetAndReplaceRequest extends ClientCacheKeyValueRequest
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_READ, SecurityPermission.CACHE_PUT);
-
         Object res = cache(ctx).getAndReplace(key(), val());
 
         return new ClientObjectResponse(requestId(), res);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetOrCreateWithConfigurationRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetOrCreateWithConfigurationRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetOrCreateWithConfigurationRequest.java
index b005fb2..77368be 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetOrCreateWithConfigurationRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetOrCreateWithConfigurationRequest.java
@@ -26,7 +26,6 @@ import org.apache.ignite.internal.processors.platform.client.ClientRequest;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientStatus;
 import org.apache.ignite.internal.processors.platform.client.IgniteClientException;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache get or create with configuration request.
@@ -50,12 +49,10 @@ public class ClientCacheGetOrCreateWithConfigurationRequest extends ClientReques
 
     /** {@inheritDoc} */
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_CREATE);
-
         try {
-            // Use security exception handler since the code authorizes "enable on-heap cache" permission
-            runWithSecurityExceptionHandler(() -> ctx.kernalContext().grid().getOrCreateCache(cacheCfg));
-        } catch (CacheExistsException e) {
+            ctx.kernalContext().grid().getOrCreateCache(cacheCfg);
+        }
+        catch (CacheExistsException e) {
             throw new IgniteClientException(ClientStatus.CACHE_EXISTS, e.getMessage());
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetOrCreateWithNameRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetOrCreateWithNameRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetOrCreateWithNameRequest.java
index 3c4ce7b..94dd115 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetOrCreateWithNameRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetOrCreateWithNameRequest.java
@@ -21,7 +21,6 @@ import org.apache.ignite.binary.BinaryRawReader;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientRequest;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache create with name request.
@@ -43,8 +42,6 @@ public class ClientCacheGetOrCreateWithNameRequest extends ClientRequest {
 
     /** {@inheritDoc} */
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_CREATE);
-
         ctx.kernalContext().grid().getOrCreateCache(cacheName);
 
         return super.process(ctx);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetRequest.java
index dc17cbf..41558c2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetRequest.java
@@ -21,7 +21,6 @@ import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientObjectResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache get request.
@@ -39,8 +38,6 @@ public class ClientCacheGetRequest extends ClientCacheKeyRequest {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_READ);
-
         Object val = cache(ctx).get(key());
 
         return new ClientObjectResponse(requestId(), val);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetSizeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetSizeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetSizeRequest.java
index ea88fa3..ef9697e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetSizeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetSizeRequest.java
@@ -22,7 +22,6 @@ import org.apache.ignite.cache.CachePeekMode;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientLongResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache size request.
@@ -50,8 +49,6 @@ public class ClientCacheGetSizeRequest extends ClientCacheRequest {
 
     /** {@inheritDoc} */
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_READ);
-
         long res = cache(ctx).sizeLong(modes);
 
         return new ClientLongResponse(requestId(), res);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheLocalPeekRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheLocalPeekRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheLocalPeekRequest.java
index 068bbc9..2002664 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheLocalPeekRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheLocalPeekRequest.java
@@ -22,7 +22,6 @@ import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientObjectResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache local peek request.
@@ -41,8 +40,6 @@ public class ClientCacheLocalPeekRequest extends ClientCacheKeyRequest {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_READ);
-
         Object val = cache(ctx).localPeek(key(), CachePeekMode.ALL);
 
         return new ClientObjectResponse(requestId(), val);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheNodePartitionsRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheNodePartitionsRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheNodePartitionsRequest.java
index 5e33860..5c407de 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheNodePartitionsRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheNodePartitionsRequest.java
@@ -28,7 +28,6 @@ import org.apache.ignite.internal.processors.odbc.ClientConnectableNodePartition
 import org.apache.ignite.internal.processors.odbc.ClientListenerProcessor;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cluster node list request.
@@ -45,7 +44,6 @@ public class ClientCacheNodePartitionsRequest extends ClientCacheRequest {
 
     /** {@inheritDoc} */
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_READ);
         IgniteCache cache = cache(ctx);
 
         GridDiscoveryManager discovery = ctx.kernalContext().discovery();

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutAllRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutAllRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutAllRequest.java
index 57e3144..28a7fa5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutAllRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutAllRequest.java
@@ -23,7 +23,6 @@ import org.apache.ignite.internal.processors.platform.client.ClientResponse;
 
 import java.util.LinkedHashMap;
 import java.util.Map;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * PutAll request.
@@ -51,8 +50,6 @@ public class ClientCachePutAllRequest extends ClientCacheRequest {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_PUT);
-
         cache(ctx).putAll(map);
 
         return super.process(ctx);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutIfAbsentRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutIfAbsentRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutIfAbsentRequest.java
index ec81bc0..4dd2cde 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutIfAbsentRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutIfAbsentRequest.java
@@ -21,7 +21,6 @@ import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientBooleanResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache put if absent request.
@@ -39,8 +38,6 @@ public class ClientCachePutIfAbsentRequest extends ClientCacheKeyValueRequest {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_READ, SecurityPermission.CACHE_PUT);
-
         boolean res = cache(ctx).putIfAbsent(key(), val());
 
         return new ClientBooleanResponse(requestId(), res);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutRequest.java
index 116460e..2c396b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutRequest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.platform.client.cache;
 import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache put request.
@@ -38,8 +37,6 @@ public class ClientCachePutRequest extends ClientCacheKeyValueRequest {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_PUT);
-
         cache(ctx).put(key(), val());
 
         return super.process(ctx);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveAllRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveAllRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveAllRequest.java
index a3733a9..7d79f83 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveAllRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveAllRequest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.platform.client.cache;
 import org.apache.ignite.binary.BinaryRawReader;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache removeAll request.
@@ -37,8 +36,6 @@ public class ClientCacheRemoveAllRequest extends ClientCacheRequest {
 
     /** {@inheritDoc} */
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_REMOVE);
-
         cache(ctx).removeAll();
 
         return super.process(ctx);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveIfEqualsRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveIfEqualsRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveIfEqualsRequest.java
index 26c191f..b86f2f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveIfEqualsRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveIfEqualsRequest.java
@@ -21,7 +21,6 @@ import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientBooleanResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache remove request with value.
@@ -39,8 +38,6 @@ public class ClientCacheRemoveIfEqualsRequest extends ClientCacheKeyValueRequest
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_READ, SecurityPermission.CACHE_REMOVE);
-
         boolean res = cache(ctx).remove(key(), val());
 
         return new ClientBooleanResponse(requestId(), res);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveKeyRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveKeyRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveKeyRequest.java
index 5af9743..a68c327 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveKeyRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveKeyRequest.java
@@ -21,7 +21,6 @@ import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientBooleanResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Remove request.
@@ -39,8 +38,6 @@ public class ClientCacheRemoveKeyRequest extends ClientCacheKeyRequest {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_REMOVE);
-
         boolean val = cache(ctx).remove(key());
 
         return new ClientBooleanResponse(requestId(), val);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveKeysRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveKeysRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveKeysRequest.java
index 62dea00..043b568 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveKeysRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRemoveKeysRequest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.platform.client.cache;
 import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Remove keys request.
@@ -38,8 +37,6 @@ public class ClientCacheRemoveKeysRequest extends ClientCacheKeysRequest {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_REMOVE);
-
         cache(ctx).removeAll(keys());
 
         return super.process(ctx);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheReplaceIfEqualsRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheReplaceIfEqualsRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheReplaceIfEqualsRequest.java
index 056367d..8645fbb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheReplaceIfEqualsRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheReplaceIfEqualsRequest.java
@@ -21,7 +21,6 @@ import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientBooleanResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache replace request.
@@ -44,8 +43,6 @@ public class ClientCacheReplaceIfEqualsRequest extends ClientCacheKeyValueReques
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_READ, SecurityPermission.CACHE_PUT);
-
         boolean res = cache(ctx).replace(key(), val(), newVal);
 
         return new ClientBooleanResponse(requestId(), res);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheReplaceRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheReplaceRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheReplaceRequest.java
index ea04593..bd7a642 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheReplaceRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheReplaceRequest.java
@@ -21,7 +21,6 @@ import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.processors.platform.client.ClientBooleanResponse;
 import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache replace request.
@@ -39,8 +38,6 @@ public class ClientCacheReplaceRequest extends ClientCacheKeyValueRequest {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_READ, SecurityPermission.CACHE_PUT);
-
         boolean res = cache(ctx).replace(key(), val());
 
         return new ClientBooleanResponse(requestId(), res);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRequest.java
index 9e39b56..52b799f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRequest.java
@@ -24,8 +24,6 @@ import org.apache.ignite.internal.processors.platform.client.ClientConnectionCon
 import org.apache.ignite.internal.processors.platform.client.ClientRequest;
 import org.apache.ignite.internal.processors.platform.client.ClientStatus;
 import org.apache.ignite.internal.processors.platform.client.IgniteClientException;
-import org.apache.ignite.internal.processors.security.SecurityContext;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Cache get request.
@@ -121,34 +119,4 @@ class ClientCacheRequest extends ClientRequest {
     protected int cacheId() {
         return cacheId;
     }
-
-    /** {@inheritDoc} */
-    @Override protected void authorize(ClientConnectionContext ctx, SecurityPermission perm) {
-        SecurityContext secCtx = ctx.securityContext();
-
-        if (secCtx != null) {
-            DynamicCacheDescriptor cacheDesc = cacheDescriptor(ctx, cacheId);
-
-            runWithSecurityExceptionHandler(() -> {
-                ctx.kernalContext().security().authorize(cacheDesc.cacheName(), perm, secCtx);
-            });
-        }
-    }
-
-    /**
-     * Authorize for multiple permissions.
-     */
-    protected void authorize(ClientConnectionContext ctx, SecurityPermission... perm)
-        throws IgniteClientException {
-        SecurityContext secCtx = ctx.securityContext();
-
-        if (secCtx != null) {
-            DynamicCacheDescriptor cacheDesc = cacheDescriptor(ctx, cacheId);
-
-            runWithSecurityExceptionHandler(() -> {
-                for (SecurityPermission p : perm)
-                    ctx.kernalContext().security().authorize(cacheDesc.cacheName(), p, secCtx);
-            });
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/79206469/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheScanQueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheScanQueryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheScanQueryRequest.java
index 70b6966..26ab236 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheScanQueryRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheScanQueryRequest.java
@@ -28,7 +28,6 @@ import org.apache.ignite.internal.processors.platform.client.ClientConnectionCon
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
 import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
 import org.apache.ignite.lang.IgniteBiPredicate;
-import org.apache.ignite.plugin.security.SecurityPermission;
 
 /**
  * Scan query request.
@@ -81,8 +80,6 @@ public class ClientCacheScanQueryRequest extends ClientCacheRequest {
 
     /** {@inheritDoc} */
     @Override public ClientResponse process(ClientConnectionContext ctx) {
-        authorize(ctx, SecurityPermission.CACHE_READ);
-
         IgniteCache cache = filterPlatform == FILTER_PLATFORM_JAVA && !isKeepBinary() ? rawCache(ctx) : cache(ctx);
 
         ScanQuery qry = new ScanQuery()


[33/50] [abbrv] ignite git commit: IGNITE-10106 Optimize several Cache 5 tests by scale factor - Fixes #5252.

Posted by sb...@apache.org.
IGNITE-10106 Optimize several Cache 5 tests by scale factor - Fixes #5252.

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/9d3c7573
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9d3c7573
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9d3c7573

Branch: refs/heads/ignite-10044
Commit: 9d3c757355980fae9b558b0c2e736265adc028a0
Parents: 0b4282b
Author: Alexey Platonov <ap...@gmail.com>
Authored: Tue Nov 27 19:55:06 2018 +0300
Committer: Pavel Kovalenko <jo...@gmail.com>
Committed: Tue Nov 27 19:55:06 2018 +0300

----------------------------------------------------------------------
 .../CacheSerializableTransactionsTest.java      | 32 +++++++++-----------
 .../IgniteCacheStarvationOnRebalanceTest.java   |  5 +--
 2 files changed, 17 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9d3c7573/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 714ae6a..0afd4ba 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
@@ -71,6 +71,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.GridTestUtils.SF;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
@@ -3529,9 +3530,9 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest {
 
                     IgniteTransactions txs = ignite.transactions();
 
-                    final int KEYS = 100;
+                    final int KEYS = SF.apply(100);
 
-                    for (int i = 0; i < 1000; i++) {
+                    for (int i = 0; i < SF.apply(1000); i++) {
                         Integer key1 = rnd.nextInt(KEYS);
 
                         Integer key2;
@@ -3671,14 +3672,14 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest {
 
             final long stopTime = U.currentTimeMillis() + getTestTimeout() - 30_000;
 
-            for (int i = 0; i < 30; i++) {
+            for (int i = 0; i < SF.apply(30); i++) {
                 final AtomicInteger cntr = new AtomicInteger();
 
                 final Integer key = i;
 
                 final AtomicInteger threadIdx = new AtomicInteger();
 
-                final int THREADS = 10;
+                final int THREADS = SF.applyLB(10, 2);
 
                 final CyclicBarrier barrier = new CyclicBarrier(THREADS);
 
@@ -3696,7 +3697,7 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest {
 
                         barrier.await();
 
-                        for (int i = 0; i < 1000; i++) {
+                        for (int i = 0; i < SF.apply(1000); i++) {
                             if (i % 100 == 0 && U.currentTimeMillis() > stopTime)
                                 break;
 
@@ -3911,7 +3912,7 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest {
                     caches.add(client.<Integer, Integer>cache(cacheName));
             }
 
-            for (int i = 0; i < 100; i++) {
+            for (int i = 0; i < SF.apply(100); i++) {
                 if (U.currentTimeMillis() > stopTime)
                     break;
 
@@ -3921,7 +3922,7 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest {
 
                 final AtomicInteger threadIdx = new AtomicInteger();
 
-                final int THREADS = 10;
+                final int THREADS = SF.applyLB(10, 2);
 
                 final CyclicBarrier barrier = new CyclicBarrier(THREADS);
 
@@ -3943,7 +3944,7 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest {
 
                         barrier.await();
 
-                        for (int i = 0; i < 50; i++) {
+                        for (int i = 0; i < SF.apply(50); i++) {
                             while (true) {
                                 try {
                                     ThreadLocalRandom rnd = ThreadLocalRandom.current();
@@ -3963,10 +3964,8 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest {
                                         tx.commit();
 
                                         if (rmv) {
-                                            if (val != null) {
-                                                for (int j = 0; j < val; j++)
-                                                    cntr.decrementAndGet();
-                                            }
+                                            if (val != null)
+                                                cntr.getAndUpdate(x -> x - val);
                                         }
                                         else
                                             cntr.incrementAndGet();
@@ -4669,9 +4668,6 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest {
         final boolean restart,
         final boolean nonSer
     ) throws Exception {
-        if (FAST)
-            return;
-
         assert !updateNodes.isEmpty();
 
         final Ignite srv = ignite(1);
@@ -4680,17 +4676,17 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest {
             srv.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 1, false, false)).getName();
 
         try {
-            final int KEYS = 100;
+            final int KEYS = SF.apply(20);
 
             final AtomicBoolean finished = new AtomicBoolean();
 
             IgniteInternalFuture<?> fut = restart ? restartFuture(finished, null) : null;
 
             try {
-                for (int i = 0; i < 10; i++) {
+                for (int i = 0; i < SF.applyLB(10, 2); i++) {
                     log.info("Iteration: " + i);
 
-                    final long stopTime = U.currentTimeMillis() + 10_000;
+                    final long stopTime = U.currentTimeMillis() + SF.applyLB(10_000, 1_000);
 
                     final AtomicInteger idx = new AtomicInteger();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d3c7573/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStarvationOnRebalanceTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStarvationOnRebalanceTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStarvationOnRebalanceTest.java
index 621d10d..85d463f 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStarvationOnRebalanceTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStarvationOnRebalanceTest.java
@@ -29,6 +29,7 @@ import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.binary.BinaryMarshaller;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.GridTestUtils.SF;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -89,7 +90,7 @@ public class IgniteCacheStarvationOnRebalanceTest extends GridCacheAbstractSelfT
     public void testLoadSystemWithPutAndStartRebalancing() throws Exception {
         final IgniteCache<Integer, CacheValue> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
-        final long endTime = System.currentTimeMillis() + TEST_TIMEOUT - 60_000;
+        final long endTime = System.currentTimeMillis() + SF.applyLB((int)TEST_TIMEOUT - 60_000, 5_000);
 
         int iter = 0;
 
@@ -99,7 +100,7 @@ public class IgniteCacheStarvationOnRebalanceTest extends GridCacheAbstractSelfT
             final AtomicBoolean stop = new AtomicBoolean();
 
             IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
-                @Override public Void call() throws Exception {
+                @Override public Void call() {
                     ThreadLocalRandom rnd = ThreadLocalRandom.current();
 
                     while (!stop.get() && System.currentTimeMillis() < endTime) {


[47/50] [abbrv] ignite git commit: IGNITE-8640 Fixed dynamic cache creation failures - Fixes #4480.

Posted by sb...@apache.org.
IGNITE-8640 Fixed dynamic cache creation failures - Fixes #4480.

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/560240f1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/560240f1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/560240f1

Branch: refs/heads/ignite-10044
Commit: 560240f145fc40464a872d74f6c0bbdf950abd4a
Parents: 2fca099
Author: d.garus <ga...@gmail.com>
Authored: Thu Nov 29 11:25:59 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Nov 29 11:25:59 2018 +0300

----------------------------------------------------------------------
 .../cache/CacheAffinitySharedManager.java       |   16 +-
 ...IgniteAbstractDynamicCacheStartFailTest.java | 1959 +++++++++++-------
 .../CacheMvccConfigurationValidationTest.java   |   37 +-
 .../query/SqlIllegalSchemaSelfTest.java         |  176 +-
 .../FailureHandlerTest.cs                       |    2 +
 5 files changed, 1354 insertions(+), 836 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/560240f1/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 881f8db..ce87fa9 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
@@ -924,14 +924,18 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
 
         Map<StartCacheInfo, IgniteCheckedException> failedCaches = cctx.cache().prepareStartCachesIfPossible(startCacheInfos.keySet());
 
-        failedCaches.forEach((cacheInfo, exception) -> {
-            U.error(log, "Failed to initialize cache. Will try to rollback cache start routine. " +
-                "[cacheName=" + cacheInfo.getStartedConfiguration().getName() + ']', exception);
+        for (Map.Entry<StartCacheInfo, IgniteCheckedException> entry : failedCaches.entrySet()) {
+            if (cctx.localNode().isClient()) {
+                U.error(log, "Failed to initialize cache. Will try to rollback cache start routine. " +
+                    "[cacheName=" + entry.getKey().getStartedConfiguration().getName() + ']', entry.getValue());
 
-            cctx.cache().closeCaches(Collections.singleton(cacheInfo.getStartedConfiguration().getName()), false);
+                cctx.cache().closeCaches(Collections.singleton(entry.getKey().getStartedConfiguration().getName()), false);
 
-            cctx.cache().completeCacheStartFuture(startCacheInfos.get(cacheInfo), false, exception);
-        });
+                cctx.cache().completeCacheStartFuture(startCacheInfos.get(entry.getKey()), false, entry.getValue());
+            }
+            else
+                throw entry.getValue();
+        }
 
         Set<StartCacheInfo> failedCacheInfos = failedCaches.keySet();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/560240f1/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 db13c11..d506224 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
@@ -1,786 +1,1173 @@
-/*
- * 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.Collection;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicInteger;
-import javax.cache.CacheException;
-import javax.cache.configuration.Factory;
-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.AffinityFunctionContext;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
-import org.apache.ignite.cache.query.annotations.QuerySqlField;
-import org.apache.ignite.cache.store.CacheStore;
-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.internal.IgniteInternalFuture;
-import org.apache.ignite.lang.IgnitePredicate;
-import org.apache.ignite.resources.IgniteInstanceResource;
-import org.apache.ignite.testframework.GridTestUtils;
-
-/**
- * Tests the recovery after a dynamic cache start failure.
- */
-public abstract class IgniteAbstractDynamicCacheStartFailTest extends GridCacheAbstractSelfTest {
-    /** */
-    private static final String DYNAMIC_CACHE_NAME = "TestDynamicCache";
-
-    /** */
-    private static final String CLIENT_GRID_NAME = "client";
-
-    /** */
-    protected static final String EXISTING_CACHE_NAME = "existing-cache";;
-
-    /** */
-    private static final int PARTITION_COUNT = 16;
-
-    /** Coordinator node index. */
-    private int crdIdx = 0;
-
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 3;
-    }
-
-    /**
-     * Returns {@code true} if persistence is enabled.
-     *
-     * @return {@code true} if persistence is enabled.
-     */
-    protected boolean persistenceEnabled() {
-        return false;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testBrokenAffinityFunStartOnServerFailedOnClient() throws Exception {
-        final String clientName = CLIENT_GRID_NAME + "testBrokenAffinityFunStartOnServerFailedOnClient";
-
-        IgniteConfiguration clientCfg = getConfiguration(clientName);
-
-        clientCfg.setClientMode(true);
-
-        Ignite client = startGrid(clientName, clientCfg);
-
-        CacheConfiguration cfg = new CacheConfiguration();
-
-        cfg.setName(DYNAMIC_CACHE_NAME + "-server-1");
-
-        cfg.setAffinity(new BrokenAffinityFunction(false, clientName));
-
-        try {
-            IgniteCache cache = ignite(0).getOrCreateCache(cfg);
-        }
-        catch (CacheException e) {
-            fail("Exception should not be thrown.");
-        }
-
-        stopGrid(clientName);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testBrokenAffinityFunStartOnServerFailedOnServer() throws Exception {
-        final String clientName = CLIENT_GRID_NAME + "testBrokenAffinityFunStartOnServerFailedOnServer";
-
-        IgniteConfiguration clientCfg = getConfiguration(clientName);
-
-        clientCfg.setClientMode(true);
-
-        Ignite client = startGrid(clientName, clientCfg);
-
-        CacheConfiguration cfg = new CacheConfiguration();
-
-        cfg.setName(DYNAMIC_CACHE_NAME + "-server-2");
-
-        cfg.setAffinity(new BrokenAffinityFunction(false, getTestIgniteInstanceName(0)));
-
-        try {
-            IgniteCache cache = ignite(0).getOrCreateCache(cfg);
-
-            fail("Expected exception was not thrown.");
-        }
-        catch (CacheException e) {
-        }
-
-        stopGrid(clientName);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testBrokenAffinityFunStartOnClientFailOnServer() throws Exception {
-        final String clientName = CLIENT_GRID_NAME + "testBrokenAffinityFunStartOnClientFailOnServer";
-
-        IgniteConfiguration clientCfg = getConfiguration(clientName);
-
-        clientCfg.setClientMode(true);
-
-        Ignite client = startGrid(clientName, clientCfg);
-
-        CacheConfiguration cfg = new CacheConfiguration();
-
-        cfg.setName(DYNAMIC_CACHE_NAME + "-client-2");
-
-        cfg.setAffinity(new BrokenAffinityFunction(false, getTestIgniteInstanceName(0)));
-
-        try {
-            IgniteCache cache = client.getOrCreateCache(cfg);
-
-            fail("Expected exception was not thrown.");
-        }
-        catch (CacheException e) {
-        }
-
-        stopGrid(clientName);
-    }
-
-    /**
-     * Test cache start with broken affinity function that throws an exception on all nodes.
-     */
-    public void testBrokenAffinityFunOnAllNodes() {
-        final boolean failOnAllNodes = true;
-        final int unluckyNode = 0;
-        final int unluckyCfg = 1;
-        final int numOfCaches = 3;
-        final int initiator = 0;
-
-        testDynamicCacheStart(
-            createCacheConfigsWithBrokenAffinityFun(
-                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
-            initiator);
-    }
-
-    /**
-     * Test cache start with broken affinity function that throws an exception on initiator node.
-     */
-    public void testBrokenAffinityFunOnInitiator() {
-        final boolean failOnAllNodes = false;
-        final int unluckyNode = 1;
-        final int unluckyCfg = 1;
-        final int numOfCaches = 3;
-        final int initiator = 1;
-
-        testDynamicCacheStart(
-            createCacheConfigsWithBrokenAffinityFun(
-                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
-            initiator);
-    }
-
-    /**
-     * Test cache start with broken affinity function that throws an exception on non-initiator node.
-     */
-    public void testBrokenAffinityFunOnNonInitiator() {
-        final boolean failOnAllNodes = false;
-        final int unluckyNode = 1;
-        final int unluckyCfg = 1;
-        final int numOfCaches = 3;
-        final int initiator = 2;
-
-        testDynamicCacheStart(
-            createCacheConfigsWithBrokenAffinityFun(
-                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
-            initiator);
-    }
-
-    /**
-     * Test cache start with broken affinity function that throws an exception on coordinator node.
-     */
-    public void testBrokenAffinityFunOnCoordinatorDiffInitiator() {
-        final boolean failOnAllNodes = false;
-        final int unluckyNode = crdIdx;
-        final int unluckyCfg = 1;
-        final int numOfCaches = 3;
-        final int initiator = (crdIdx + 1) % gridCount();
-
-        testDynamicCacheStart(
-            createCacheConfigsWithBrokenAffinityFun(
-                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
-            initiator);
-    }
-
-    /**
-     * Test cache start with broken affinity function that throws an exception on initiator node.
-     */
-    public void testBrokenAffinityFunOnCoordinator() {
-        final boolean failOnAllNodes = false;
-        final int unluckyNode = crdIdx;
-        final int unluckyCfg = 1;
-        final int numOfCaches = 3;
-        final int initiator = crdIdx;
-
-        testDynamicCacheStart(
-            createCacheConfigsWithBrokenAffinityFun(
-                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
-            initiator);
-    }
-
-    /**
-     * Tests cache start with node filter and broken affinity function that throws an exception on initiator node.
-     */
-    public void testBrokenAffinityFunWithNodeFilter() {
-        final boolean failOnAllNodes = false;
-        final int unluckyNode = 0;
-        final int unluckyCfg = 0;
-        final int numOfCaches = 1;
-        final int initiator = 0;
-
-        testDynamicCacheStart(
-            createCacheConfigsWithBrokenAffinityFun(
-                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, true),
-            initiator);
-    }
-
-    /**
-     * Tests cache start with broken cache store that throws an exception on all nodes.
-     */
-    public void testBrokenCacheStoreOnAllNodes() {
-        final boolean failOnAllNodes = true;
-        final int unluckyNode = 0;
-        final int unluckyCfg = 1;
-        final int numOfCaches = 3;
-        final int initiator = 0;
-
-        testDynamicCacheStart(
-            createCacheConfigsWithBrokenCacheStore(
-                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
-            initiator);
-    }
-
-    /**
-     * Tests cache start with broken cache store that throws an exception on initiator node.
-     */
-    public void testBrokenCacheStoreOnInitiator() {
-        final boolean failOnAllNodes = false;
-        final int unluckyNode = 1;
-        final int unluckyCfg = 1;
-        final int numOfCaches = 3;
-        final int initiator = 1;
-
-        testDynamicCacheStart(
-            createCacheConfigsWithBrokenCacheStore(
-                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
-            initiator);
-    }
-
-    /**
-     * Tests cache start with broken cache store that throws an exception on non-initiator node.
-     */
-    public void testBrokenCacheStoreOnNonInitiator() {
-        final boolean failOnAllNodes = false;
-        final int unluckyNode = 1;
-        final int unluckyCfg = 1;
-        final int numOfCaches = 3;
-        final int initiator = 2;
-
-        testDynamicCacheStart(
-            createCacheConfigsWithBrokenCacheStore(
-                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
-            initiator);
-    }
-
-    /**
-     *  Tests cache start with broken cache store that throws an exception on initiator node.
-     */
-    public void testBrokenCacheStoreOnCoordinatorDiffInitiator() {
-        final boolean failOnAllNodes = false;
-        final int unluckyNode = crdIdx;
-        final int unluckyCfg = 1;
-        final int numOfCaches = 3;
-        final int initiator = (crdIdx + 1) % gridCount();
-
-        testDynamicCacheStart(
-            createCacheConfigsWithBrokenCacheStore(
-                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
-            initiator);
-    }
-
-    /**
-     *  Tests cache start with broken cache store that throws an exception on coordinator node.
-     */
-    public void testBrokenCacheStoreFunOnCoordinator() {
-        final boolean failOnAllNodes = false;
-        final int unluckyNode = crdIdx;
-        final int unluckyCfg = 1;
-        final int numOfCaches = 3;
-        final int initiator = crdIdx;
-
-        testDynamicCacheStart(
-            createCacheConfigsWithBrokenCacheStore(
-                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
-            initiator);
-    }
-
-    /**
-     *  Tests multiple creation of cache with broken affinity function.
-     */
-    public void testCreateCacheMultipleTimes() {
-        final boolean failOnAllNodes = false;
-        final int unluckyNode = 1;
-        final int unluckyCfg = 0;
-        final int numOfAttempts = 15;
-
-        CacheConfiguration cfg = createCacheConfigsWithBrokenAffinityFun(
-            failOnAllNodes, unluckyNode, unluckyCfg, 1, false).get(0);
-
-        for (int i = 0; i < numOfAttempts; ++i) {
-            try {
-                IgniteCache cache = ignite(0).getOrCreateCache(cfg);
-
-                fail("Expected exception was not thrown");
-            }
-            catch (CacheException e) {
-            }
-        }
-    }
-
-    /**
-     * Tests that a cache with the same name can be started after failure if cache configuration is corrected.
-     *
-     * @throws Exception If test failed.
-     */
-    public void testCacheStartAfterFailure() throws Exception {
-        CacheConfiguration cfg = createCacheConfigsWithBrokenAffinityFun(
-            false, 1, 0, 1, false).get(0);
-
-        GridTestUtils.assertThrows(log, new Callable<Object>() {
-            @Override public Object call() throws Exception {
-                grid(0).getOrCreateCache(cfg);
-                return null;
-            }
-        }, CacheException.class, null);
-
-        // Correct the cache configuration. Default constructor creates a good affinity function.
-        cfg.setAffinity(new BrokenAffinityFunction());
-
-        IgniteCache<Integer, Value> cache = grid(0).getOrCreateCache(createCacheConfiguration(EXISTING_CACHE_NAME));
-
-        checkCacheOperations(cache);
-    }
-
-    /**
-     * Tests that other cache (existed before the failed start) is still operable after the failure.
-     *
-     * @throws Exception If test failed.
-     */
-    public void testExistingCacheAfterFailure() throws Exception {
-        IgniteCache<Integer, Value> cache = grid(0).getOrCreateCache(createCacheConfiguration(EXISTING_CACHE_NAME));
-
-        CacheConfiguration cfg = createCacheConfigsWithBrokenAffinityFun(
-            false, 1, 0, 1, false).get(0);
-
-        GridTestUtils.assertThrows(log, new Callable<Object>() {
-            @Override public Object call() throws Exception {
-                grid(0).getOrCreateCache(cfg);
-                return null;
-            }
-        }, CacheException.class, null);
-
-        checkCacheOperations(cache);
-    }
-
-    /**
-     * Tests that other cache works as expected after the failure and further topology changes.
-     *
-     * @throws Exception If test failed.
-     */
-    public void testTopologyChangesAfterFailure() throws Exception {
-        final String clientName = "testTopologyChangesAfterFailure";
-
-        IgniteCache<Integer, Value> cache = grid(0).getOrCreateCache(createCacheConfiguration(EXISTING_CACHE_NAME));
-
-        checkCacheOperations(cache);
-
-        CacheConfiguration cfg = createCacheConfigsWithBrokenAffinityFun(
-            false, 0, 0, 1, false).get(0);
-
-        GridTestUtils.assertThrows(log, new Callable<Object>() {
-            @Override public Object call() throws Exception {
-                grid(0).getOrCreateCache(cfg);
-                return null;
-            }
-        }, CacheException.class, null);
-
-        awaitPartitionMapExchange();
-
-        checkCacheOperations(cache);
-
-        // Start a new server node and check cache operations.
-        Ignite serverNode = startGrid(gridCount() + 1);
-
-        if (persistenceEnabled()) {
-            // Start a new client node to perform baseline change.
-            // TODO: This change is workaround:
-            // Sometimes problem with caches configuration deserialization from test thread arises.
-            final String clientName1 = "baseline-changer";
-
-            IgniteConfiguration clientCfg = getConfiguration(clientName1);
-
-            clientCfg.setClientMode(true);
-
-            Ignite clientNode = startGrid(clientName1, clientCfg);
-
-            List<BaselineNode> baseline = new ArrayList<>(grid(0).cluster().currentBaselineTopology());
-
-            baseline.add(serverNode.cluster().localNode());
-
-            clientNode.cluster().setBaselineTopology(baseline);
-        }
-
-        awaitPartitionMapExchange();
-
-        checkCacheOperations(serverNode.cache(EXISTING_CACHE_NAME));
-
-        // Start a new client node and check cache operations.
-        IgniteConfiguration clientCfg = getConfiguration(clientName);
-
-        clientCfg.setClientMode(true);
-
-        Ignite clientNode = startGrid(clientName, clientCfg);
-
-        checkCacheOperations(clientNode.cache(EXISTING_CACHE_NAME));
-    }
-
-    public void testConcurrentClientNodeJoins() throws Exception {
-        final int clientCnt = 3;
-        final int numberOfAttempts = 5;
-
-        IgniteCache<Integer, Value> cache = grid(0).getOrCreateCache(createCacheConfiguration(EXISTING_CACHE_NAME));
-
-        final AtomicInteger attemptCnt = new AtomicInteger();
-        final CountDownLatch stopLatch = new CountDownLatch(clientCnt);
-
-        IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
-            @Override public Object call() throws Exception {
-                String clientName = Thread.currentThread().getName();
-
-                try {
-                    for (int i = 0; i < numberOfAttempts; ++i) {
-                        int uniqueCnt = attemptCnt.getAndIncrement();
-
-                        IgniteConfiguration clientCfg = getConfiguration(clientName + uniqueCnt);
-
-                        clientCfg.setClientMode(true);
-
-                        final Ignite clientNode = startGrid(clientName, clientCfg);
-
-                        CacheConfiguration cfg = new CacheConfiguration();
-
-                        cfg.setName(clientName + uniqueCnt);
-
-                        String instanceName = getTestIgniteInstanceName(uniqueCnt % gridCount());
-
-                        cfg.setAffinity(new BrokenAffinityFunction(false, instanceName));
-
-                        GridTestUtils.assertThrows(log, new Callable<Object>() {
-                            @Override public Object call() throws Exception {
-                                clientNode.getOrCreateCache(cfg);
-                                return null;
-                            }
-                        }, CacheException.class, null);
-
-                        stopGrid(clientName, true);
-                    }
-                }
-                catch (Exception e) {
-                    fail("Unexpected exception: " + e.getMessage());
-                }
-                finally {
-                    stopLatch.countDown();
-                }
-
-                return null;
-            }
-        }, clientCnt, "start-client-thread");
-
-        stopLatch.await();
-
-        assertEquals(numberOfAttempts * clientCnt, attemptCnt.get());
-
-        checkCacheOperations(cache);
-    }
-
-    protected void testDynamicCacheStart(final Collection<CacheConfiguration> cfgs, final int initiatorId) {
-        assert initiatorId < gridCount();
-
-        GridTestUtils.assertThrows(log, new Callable<Object>() {
-            @Override public Object call() throws Exception {
-                grid(initiatorId).getOrCreateCaches(cfgs);
-                return null;
-            }
-        }, CacheException.class, null);
-
-        for (CacheConfiguration cfg: cfgs) {
-            IgniteCache cache = grid(initiatorId).cache(cfg.getName());
-
-            assertNull(cache);
-        }
-    }
-
-    /**
-     * Creates new cache configuration with the given name.
-     *
-     * @param cacheName Cache name.
-     * @return New cache configuration.
-     */
-    protected CacheConfiguration createCacheConfiguration(String cacheName) {
-        CacheConfiguration cfg = new CacheConfiguration()
-            .setName(cacheName)
-            .setCacheMode(CacheMode.PARTITIONED)
-            .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
-            .setAffinity(new BrokenAffinityFunction());
-
-        return cfg;
-    }
-
-    /**
-     * Create list of cache configurations.
-     *
-     * @param failOnAllNodes {@code true} if affinity function should be broken on all nodes.
-     * @param unluckyNode Node, where exception is raised.
-     * @param unluckyCfg Unlucky cache configuration number.
-     * @param cacheNum Number of caches.
-     * @param useFilter {@code true} if NodeFilter should be used.
-     *
-     * @return List of cache configurations.
-     */
-    protected List<CacheConfiguration> createCacheConfigsWithBrokenAffinityFun(
-        boolean failOnAllNodes,
-        int unluckyNode,
-        final int unluckyCfg,
-        int cacheNum,
-        boolean useFilter
-    ) {
-        assert unluckyCfg >= 0 && unluckyCfg < cacheNum;
-
-        final UUID uuid = ignite(unluckyNode).cluster().localNode().id();
-
-        List<CacheConfiguration> cfgs = new ArrayList<>();
-
-        for (int i = 0; i < cacheNum; ++i) {
-            CacheConfiguration cfg = createCacheConfiguration(DYNAMIC_CACHE_NAME + "-" + i);
-
-            if (i == unluckyCfg)
-                cfg.setAffinity(new BrokenAffinityFunction(failOnAllNodes, getTestIgniteInstanceName(unluckyNode)));
-
-            if (useFilter)
-                cfg.setNodeFilter(new NodeFilter(uuid));
-
-            cfgs.add(cfg);
-        }
-
-        return cfgs;
-    }
-
-    /**
-     * Create list of cache configurations.
-     *
-     * @param failOnAllNodes {@code true} if cache store should be broken on all nodes.
-     * @param unluckyNode Node, where exception is raised.
-     * @param unluckyCfg Unlucky cache configuration number.
-     * @param cacheNum Number of caches.
-     * @param useFilter {@code true} if NodeFilter should be used.
-     *
-     * @return List of cache configurations.
-     */
-    protected List<CacheConfiguration> createCacheConfigsWithBrokenCacheStore(
-        boolean failOnAllNodes,
-        int unluckyNode,
-        int unluckyCfg,
-        int cacheNum,
-        boolean useFilter
-    ) {
-        assert unluckyCfg >= 0 && unluckyCfg < cacheNum;
-
-        final UUID uuid = ignite(unluckyNode).cluster().localNode().id();
-
-        List<CacheConfiguration> cfgs = new ArrayList<>();
-
-        for (int i = 0; i < cacheNum; ++i) {
-            CacheConfiguration cfg = new CacheConfiguration();
-
-            cfg.setName(DYNAMIC_CACHE_NAME + "-" + i);
-
-            if (i == unluckyCfg)
-                cfg.setCacheStoreFactory(new BrokenStoreFactory(failOnAllNodes, getTestIgniteInstanceName(unluckyNode)));
-
-            if (useFilter)
-                cfg.setNodeFilter(new NodeFilter(uuid));
-
-            cfgs.add(cfg);
-        }
-
-        return cfgs;
-    }
-
-    /**
-     * Test the basic cache operations.
-     *
-     * @param cache Cache.
-     * @throws Exception If test failed.
-     */
-    protected void checkCacheOperations(IgniteCache<Integer, Value> cache) throws Exception {
-        int cnt = 1000;
-
-        // Check cache operations.
-        for (int i = 0; i < cnt; ++i)
-            cache.put(i, new Value(i));
-
-        for (int i = 0; i < cnt; ++i) {
-            Value v = cache.get(i);
-
-            assertNotNull(v);
-            assertEquals(i, v.getValue());
-        }
-
-        // Check Data Streamer functionality.
-        try (IgniteDataStreamer<Integer, Value> streamer = grid(0).dataStreamer(cache.getName())) {
-            for (int i = 0; i < 10_000; ++i)
-                streamer.addData(i, new Value(i));
-        }
-    }
-
-    /**
-     *
-     */
-    public static class Value {
-        @QuerySqlField
-        private final int fieldVal;
-
-        public Value(int fieldVal) {
-            this.fieldVal = fieldVal;
-        }
-
-        public int getValue() {
-            return fieldVal;
-        }
-    }
-
-    /**
-     * Filter specifying on which node the cache should be started.
-     */
-    public static class NodeFilter implements IgnitePredicate<ClusterNode> {
-        /** Cache should be created node with certain UUID. */
-        public UUID uuid;
-
-        /**
-         * @param uuid node ID.
-         */
-        public NodeFilter(UUID uuid) {
-            this.uuid = uuid;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean apply(ClusterNode clusterNode) {
-            return clusterNode.id().equals(uuid);
-        }
-    }
-
-    /**
-     * Affinity function that throws an exception when affinity nodes are calculated on the given node.
-     */
-    public static class BrokenAffinityFunction extends RendezvousAffinityFunction {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** */
-        @IgniteInstanceResource
-        private Ignite ignite;
-
-        /** Exception should arise on all nodes. */
-        private boolean eOnAllNodes = false;
-
-        /** Exception should arise on node with certain name. */
-        private String gridName;
-
-        /**
-         * Constructs a good affinity function.
-         */
-        public BrokenAffinityFunction() {
-            super(false, PARTITION_COUNT);
-            // No-op.
-        }
-
-        /**
-         * @param eOnAllNodes {@code True} if exception should be thrown on all nodes.
-         * @param gridName Exception should arise on node with certain name.
-         */
-        public BrokenAffinityFunction(boolean eOnAllNodes, String gridName) {
-            super(false, PARTITION_COUNT);
-
-            this.eOnAllNodes = eOnAllNodes;
-            this.gridName = gridName;
-        }
-
-        /** {@inheritDoc} */
-        @Override public List<List<ClusterNode>> assignPartitions(AffinityFunctionContext affCtx) {
-            if (eOnAllNodes || ignite.name().equals(gridName))
-                throw new IllegalStateException("Simulated exception [locNodeId="
-                    + ignite.cluster().localNode().id() + "]");
-            else
-                return super.assignPartitions(affCtx);
-        }
-    }
-
-    /**
-     * Factory that throws an exception is got created.
-     */
-    public static class BrokenStoreFactory implements Factory<CacheStore<Integer, String>> {
-        /** */
-        @IgniteInstanceResource
-        private Ignite ignite;
-
-        /** Exception should arise on all nodes. */
-        boolean eOnAllNodes = true;
-
-        /** Exception should arise on node with certain name. */
-        public static String gridName;
-
-        /**
-         * @param eOnAllNodes {@code True} if exception should be thrown on all nodes.
-         * @param gridName Exception should arise on node with certain name.
-         */
-        public BrokenStoreFactory(boolean eOnAllNodes, String gridName) {
-            this.eOnAllNodes = eOnAllNodes;
-
-            this.gridName = gridName;
-        }
-
-        /** {@inheritDoc} */
-        @Override public CacheStore<Integer, String> create() {
-            if (eOnAllNodes || ignite.name().equals(gridName))
-                throw new IllegalStateException("Simulated exception [locNodeId="
-                    + ignite.cluster().localNode().id() + "]");
-            else
-                return null;
-        }
-    }
-}
+/*
+ * 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.ObjectInputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.CacheException;
+import javax.cache.configuration.Factory;
+import javax.management.Attribute;
+import javax.management.AttributeList;
+import javax.management.AttributeNotFoundException;
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.IntrospectionException;
+import javax.management.InvalidAttributeValueException;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanException;
+import javax.management.MBeanInfo;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServer;
+import javax.management.NotCompliantMBeanException;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+import javax.management.OperationsException;
+import javax.management.QueryExp;
+import javax.management.ReflectionException;
+import javax.management.loading.ClassLoaderRepository;
+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.AffinityFunctionContext;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.cache.store.CacheStore;
+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.internal.IgniteInternalFuture;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.testframework.GridTestUtils;
+
+/**
+ * Tests the recovery after a dynamic cache start failure.
+ */
+public abstract class IgniteAbstractDynamicCacheStartFailTest extends GridCacheAbstractSelfTest {
+    /** */
+    private static final String DYNAMIC_CACHE_NAME = "TestDynamicCache";
+
+    /** */
+    private static final String CLIENT_GRID_NAME = "client";
+
+    /** */
+    protected static final String EXISTING_CACHE_NAME = "existing-cache";;
+
+    /** */
+    private static final int PARTITION_COUNT = 16;
+
+    /** Failure MBean server. */
+    private static FailureMBeanServer mbSrv;
+
+    /** Coordinator node index. */
+    private int crdIdx = 0;
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 3;
+    }
+
+    /**
+     * Returns {@code true} if persistence is enabled.
+     *
+     * @return {@code true} if persistence is enabled.
+     */
+    protected boolean persistenceEnabled() {
+        return false;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBrokenAffinityFunStartOnServerFailedOnClient() throws Exception {
+        final String clientName = CLIENT_GRID_NAME + "testBrokenAffinityFunStartOnServerFailedOnClient";
+
+        IgniteConfiguration clientCfg = getConfiguration(clientName);
+
+        clientCfg.setClientMode(true);
+
+        Ignite client = startGrid(clientName, clientCfg);
+
+        CacheConfiguration cfg = new CacheConfiguration();
+
+        cfg.setName(DYNAMIC_CACHE_NAME + "-server-1");
+
+        cfg.setAffinity(new BrokenAffinityFunction(false, clientName));
+
+        try {
+            IgniteCache cache = ignite(0).getOrCreateCache(cfg);
+        }
+        catch (CacheException e) {
+            fail("Exception should not be thrown.");
+        }
+
+        stopGrid(clientName);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBrokenAffinityFunStartOnServerFailedOnServer() throws Exception {
+        final String clientName = CLIENT_GRID_NAME + "testBrokenAffinityFunStartOnServerFailedOnServer";
+
+        IgniteConfiguration clientCfg = getConfiguration(clientName);
+
+        clientCfg.setClientMode(true);
+
+        Ignite client = startGrid(clientName, clientCfg);
+
+        CacheConfiguration cfg = new CacheConfiguration();
+
+        cfg.setName(DYNAMIC_CACHE_NAME + "-server-2");
+
+        cfg.setAffinity(new BrokenAffinityFunction(false, getTestIgniteInstanceName(0)));
+
+        try {
+            IgniteCache cache = ignite(0).getOrCreateCache(cfg);
+
+            fail("Expected exception was not thrown.");
+        }
+        catch (CacheException e) {
+        }
+
+        stopGrid(clientName);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBrokenAffinityFunStartOnClientFailOnServer() throws Exception {
+        final String clientName = CLIENT_GRID_NAME + "testBrokenAffinityFunStartOnClientFailOnServer";
+
+        IgniteConfiguration clientCfg = getConfiguration(clientName);
+
+        clientCfg.setClientMode(true);
+
+        Ignite client = startGrid(clientName, clientCfg);
+
+        CacheConfiguration cfg = new CacheConfiguration();
+
+        cfg.setName(DYNAMIC_CACHE_NAME + "-client-2");
+
+        cfg.setAffinity(new BrokenAffinityFunction(false, getTestIgniteInstanceName(0)));
+
+        try {
+            IgniteCache cache = client.getOrCreateCache(cfg);
+
+            fail("Expected exception was not thrown.");
+        }
+        catch (CacheException e) {
+        }
+
+        stopGrid(clientName);
+    }
+
+    /**
+     * Test cache start with broken affinity function that throws an exception on all nodes.
+     */
+    public void testBrokenAffinityFunOnAllNodes() {
+        final boolean failOnAllNodes = true;
+        final int unluckyNode = 0;
+        final int unluckyCfg = 1;
+        final int numOfCaches = 3;
+        final int initiator = 0;
+
+        testDynamicCacheStart(
+            createCacheConfigsWithBrokenAffinityFun(
+                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
+            initiator);
+    }
+
+    /**
+     * Test cache start with broken affinity function that throws an exception on initiator node.
+     */
+    public void testBrokenAffinityFunOnInitiator() {
+        final boolean failOnAllNodes = false;
+        final int unluckyNode = 1;
+        final int unluckyCfg = 1;
+        final int numOfCaches = 3;
+        final int initiator = 1;
+
+        testDynamicCacheStart(
+            createCacheConfigsWithBrokenAffinityFun(
+                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
+            initiator);
+    }
+
+    /**
+     * Test cache start with broken affinity function that throws an exception on non-initiator node.
+     */
+    public void testBrokenAffinityFunOnNonInitiator() {
+        final boolean failOnAllNodes = false;
+        final int unluckyNode = 1;
+        final int unluckyCfg = 1;
+        final int numOfCaches = 3;
+        final int initiator = 2;
+
+        testDynamicCacheStart(
+            createCacheConfigsWithBrokenAffinityFun(
+                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
+            initiator);
+    }
+
+    /**
+     * Test cache start with broken affinity function that throws an exception on coordinator node.
+     */
+    public void testBrokenAffinityFunOnCoordinatorDiffInitiator() {
+        final boolean failOnAllNodes = false;
+        final int unluckyNode = crdIdx;
+        final int unluckyCfg = 1;
+        final int numOfCaches = 3;
+        final int initiator = (crdIdx + 1) % gridCount();
+
+        testDynamicCacheStart(
+            createCacheConfigsWithBrokenAffinityFun(
+                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
+            initiator);
+    }
+
+    /**
+     * Test cache start with broken affinity function that throws an exception on initiator node.
+     */
+    public void testBrokenAffinityFunOnCoordinator() {
+        final boolean failOnAllNodes = false;
+        final int unluckyNode = crdIdx;
+        final int unluckyCfg = 1;
+        final int numOfCaches = 3;
+        final int initiator = crdIdx;
+
+        testDynamicCacheStart(
+            createCacheConfigsWithBrokenAffinityFun(
+                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
+            initiator);
+    }
+
+    /**
+     * Tests cache start with node filter and broken affinity function that throws an exception on initiator node.
+     */
+    public void testBrokenAffinityFunWithNodeFilter() {
+        final boolean failOnAllNodes = false;
+        final int unluckyNode = 0;
+        final int unluckyCfg = 0;
+        final int numOfCaches = 1;
+        final int initiator = 0;
+
+        testDynamicCacheStart(
+            createCacheConfigsWithBrokenAffinityFun(
+                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, true),
+            initiator);
+    }
+
+    /**
+     * Tests cache start with broken cache store that throws an exception on all nodes.
+     */
+    public void testBrokenCacheStoreOnAllNodes() {
+        final boolean failOnAllNodes = true;
+        final int unluckyNode = 0;
+        final int unluckyCfg = 1;
+        final int numOfCaches = 3;
+        final int initiator = 0;
+
+        testDynamicCacheStart(
+            createCacheConfigsWithBrokenCacheStore(
+                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
+            initiator);
+    }
+
+    /**
+     * Tests cache start with broken cache store that throws an exception on initiator node.
+     */
+    public void testBrokenCacheStoreOnInitiator() {
+        final boolean failOnAllNodes = false;
+        final int unluckyNode = 1;
+        final int unluckyCfg = 1;
+        final int numOfCaches = 3;
+        final int initiator = 1;
+
+        testDynamicCacheStart(
+            createCacheConfigsWithBrokenCacheStore(
+                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
+            initiator);
+    }
+
+    /**
+     * Tests cache start that throws an Ignite checked exception on initiator node.
+     */
+    public void testThrowsIgniteCheckedExceptionOnInitiator() {
+        final int unluckyNode = 1;
+        final int unluckyCfg = 1;
+        final int numOfCaches = 3;
+        final int initiator = 1;
+
+        testDynamicCacheStart(
+            createCacheConfigsWithFailureMbServer(unluckyNode, unluckyCfg, numOfCaches),
+            initiator);
+    }
+
+    /**
+     * Tests cache start with broken cache store that throws an exception on non-initiator node.
+     */
+    public void testBrokenCacheStoreOnNonInitiator() {
+        final boolean failOnAllNodes = false;
+        final int unluckyNode = 1;
+        final int unluckyCfg = 1;
+        final int numOfCaches = 3;
+        final int initiator = 2;
+
+        testDynamicCacheStart(
+            createCacheConfigsWithBrokenCacheStore(
+                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
+            initiator);
+    }
+
+    /**
+     * Tests cache start that throws an Ignite checked exception on non-initiator node.
+     */
+    public void testThrowsIgniteCheckedExceptionOnNonInitiator() {
+        final int unluckyNode = 1;
+        final int unluckyCfg = 1;
+        final int numOfCaches = 3;
+        final int initiator = 2;
+
+        testDynamicCacheStart(
+            createCacheConfigsWithFailureMbServer(unluckyNode, unluckyCfg, numOfCaches),
+            initiator);
+    }
+
+    /**
+     *  Tests cache start with broken cache store that throws an exception on initiator node.
+     */
+    public void testBrokenCacheStoreOnCoordinatorDiffInitiator() {
+        final boolean failOnAllNodes = false;
+        final int unluckyNode = crdIdx;
+        final int unluckyCfg = 1;
+        final int numOfCaches = 3;
+        final int initiator = (crdIdx + 1) % gridCount();
+
+        testDynamicCacheStart(
+            createCacheConfigsWithBrokenCacheStore(
+                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
+            initiator);
+    }
+
+    /**
+     *  Tests cache start that throws an Ignite checked exception on coordinator node
+     *  that doesn't initiator node.
+     */
+    public void testThrowsIgniteCheckedExceptionOnCoordinatorDiffInitiator() {
+        final int unluckyNode = crdIdx;
+        final int unluckyCfg = 1;
+        final int numOfCaches = 3;
+        final int initiator = (crdIdx + 1) % gridCount();
+
+        testDynamicCacheStart(
+            createCacheConfigsWithFailureMbServer(unluckyNode, unluckyCfg, numOfCaches),
+            initiator);
+    }
+
+    /**
+     *  Tests cache start with broken cache store that throws an exception on coordinator node.
+     */
+    public void testBrokenCacheStoreFunOnCoordinator() {
+        final boolean failOnAllNodes = false;
+        final int unluckyNode = crdIdx;
+        final int unluckyCfg = 1;
+        final int numOfCaches = 3;
+        final int initiator = crdIdx;
+
+        testDynamicCacheStart(
+            createCacheConfigsWithBrokenCacheStore(
+                failOnAllNodes, unluckyNode, unluckyCfg, numOfCaches, false),
+            initiator);
+    }
+
+    /**
+     *  Tests cache start that throws an Ignite checked exception on coordinator node.
+     */
+    public void testThrowsIgniteCheckedExceptionOnCoordinator() {
+        final int unluckyNode = crdIdx;
+        final int unluckyCfg = 1;
+        final int numOfCaches = 3;
+        final int initiator = crdIdx;
+
+        testDynamicCacheStart(
+            createCacheConfigsWithFailureMbServer(unluckyNode, unluckyCfg, numOfCaches),
+            initiator);
+    }
+
+    /**
+     *  Tests multiple creation of cache with broken affinity function.
+     */
+    public void testCreateCacheMultipleTimes() {
+        final boolean failOnAllNodes = false;
+        final int unluckyNode = 1;
+        final int unluckyCfg = 0;
+        final int numOfAttempts = 15;
+
+        CacheConfiguration cfg = createCacheConfigsWithBrokenAffinityFun(
+            failOnAllNodes, unluckyNode, unluckyCfg, 1, false).get(0);
+
+        for (int i = 0; i < numOfAttempts; ++i) {
+            try {
+                IgniteCache cache = ignite(0).getOrCreateCache(cfg);
+
+                fail("Expected exception was not thrown");
+            }
+            catch (CacheException e) {
+            }
+        }
+    }
+
+    /**
+     * Tests that a cache with the same name can be started after failure if cache configuration is corrected.
+     *
+     * @throws Exception If test failed.
+     */
+    public void testCacheStartAfterFailure() throws Exception {
+        CacheConfiguration cfg = createCacheConfigsWithBrokenAffinityFun(
+            false, 1, 0, 1, false).get(0);
+
+        GridTestUtils.assertThrows(log, new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                grid(0).getOrCreateCache(cfg);
+                return null;
+            }
+        }, CacheException.class, null);
+
+        // Correct the cache configuration. Default constructor creates a good affinity function.
+        cfg.setAffinity(new BrokenAffinityFunction());
+
+        checkCacheOperations(grid(0).getOrCreateCache(cfg));
+    }
+
+    /**
+     * Tests that other cache (existed before the failed start) is still operable after the failure.
+     *
+     * @throws Exception If test failed.
+     */
+    public void testExistingCacheAfterFailure() throws Exception {
+        IgniteCache<Integer, Value> cache = grid(0).getOrCreateCache(createCacheConfiguration(EXISTING_CACHE_NAME));
+
+        CacheConfiguration cfg = createCacheConfigsWithBrokenAffinityFun(
+            false, 1, 0, 1, false).get(0);
+
+        GridTestUtils.assertThrows(log, new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                grid(0).getOrCreateCache(cfg);
+                return null;
+            }
+        }, CacheException.class, null);
+
+        checkCacheOperations(cache);
+    }
+
+    /**
+     * Tests that other cache works as expected after the failure and further topology changes.
+     *
+     * @throws Exception If test failed.
+     */
+    public void testTopologyChangesAfterFailure() throws Exception {
+        final String clientName = "testTopologyChangesAfterFailure";
+
+        IgniteCache<Integer, Value> cache = grid(0).getOrCreateCache(createCacheConfiguration(EXISTING_CACHE_NAME));
+
+        checkCacheOperations(cache);
+
+        CacheConfiguration cfg = createCacheConfigsWithBrokenAffinityFun(
+            false, 0, 0, 1, false).get(0);
+
+        GridTestUtils.assertThrows(log, new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                grid(0).getOrCreateCache(cfg);
+                return null;
+            }
+        }, CacheException.class, null);
+
+        awaitPartitionMapExchange();
+
+        checkCacheOperations(cache);
+
+        // Start a new server node and check cache operations.
+        Ignite serverNode = startGrid(gridCount() + 1);
+
+        if (persistenceEnabled()) {
+            // Start a new client node to perform baseline change.
+            // TODO: This change is workaround:
+            // Sometimes problem with caches configuration deserialization from test thread arises.
+            final String clientName1 = "baseline-changer";
+
+            IgniteConfiguration clientCfg = getConfiguration(clientName1);
+
+            clientCfg.setClientMode(true);
+
+            Ignite clientNode = startGrid(clientName1, clientCfg);
+
+            List<BaselineNode> baseline = new ArrayList<>(grid(0).cluster().currentBaselineTopology());
+
+            baseline.add(serverNode.cluster().localNode());
+
+            clientNode.cluster().setBaselineTopology(baseline);
+        }
+
+        awaitPartitionMapExchange();
+
+        checkCacheOperations(serverNode.cache(EXISTING_CACHE_NAME));
+
+        // Start a new client node and check cache operations.
+        IgniteConfiguration clientCfg = getConfiguration(clientName);
+
+        clientCfg.setClientMode(true);
+
+        Ignite clientNode = startGrid(clientName, clientCfg);
+
+        checkCacheOperations(clientNode.cache(EXISTING_CACHE_NAME));
+    }
+
+    public void testConcurrentClientNodeJoins() throws Exception {
+        final int clientCnt = 3;
+        final int numberOfAttempts = 5;
+
+        IgniteCache<Integer, Value> cache = grid(0).getOrCreateCache(createCacheConfiguration(EXISTING_CACHE_NAME));
+
+        final AtomicInteger attemptCnt = new AtomicInteger();
+        final CountDownLatch stopLatch = new CountDownLatch(clientCnt);
+
+        IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                String clientName = Thread.currentThread().getName();
+
+                try {
+                    for (int i = 0; i < numberOfAttempts; ++i) {
+                        int uniqueCnt = attemptCnt.getAndIncrement();
+
+                        IgniteConfiguration clientCfg = getConfiguration(clientName + uniqueCnt);
+
+                        clientCfg.setClientMode(true);
+
+                        final Ignite clientNode = startGrid(clientName, clientCfg);
+
+                        CacheConfiguration cfg = new CacheConfiguration();
+
+                        cfg.setName(clientName + uniqueCnt);
+
+                        String instanceName = getTestIgniteInstanceName(uniqueCnt % gridCount());
+
+                        cfg.setAffinity(new BrokenAffinityFunction(false, instanceName));
+
+                        GridTestUtils.assertThrows(log, new Callable<Object>() {
+                            @Override public Object call() throws Exception {
+                                clientNode.getOrCreateCache(cfg);
+                                return null;
+                            }
+                        }, CacheException.class, null);
+
+                        stopGrid(clientName, true);
+                    }
+                }
+                catch (Exception e) {
+                    fail("Unexpected exception: " + e.getMessage());
+                }
+                finally {
+                    stopLatch.countDown();
+                }
+
+                return null;
+            }
+        }, clientCnt, "start-client-thread");
+
+        stopLatch.await();
+
+        assertEquals(numberOfAttempts * clientCnt, attemptCnt.get());
+
+        checkCacheOperations(cache);
+    }
+
+    protected void testDynamicCacheStart(final Collection<CacheConfiguration> cfgs, final int initiatorId) {
+        assert initiatorId < gridCount();
+
+        GridTestUtils.assertThrows(log, new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                grid(initiatorId).getOrCreateCaches(cfgs);
+                return null;
+            }
+        }, CacheException.class, null);
+
+        for (CacheConfiguration cfg: cfgs) {
+            IgniteCache cache = grid(initiatorId).cache(cfg.getName());
+
+            assertNull(cache);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration res = super.getConfiguration(igniteInstanceName);
+
+        if (mbSrv == null)
+            mbSrv = new FailureMBeanServer(res.getMBeanServer());
+
+        res.setMBeanServer(mbSrv);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        mbSrv.clear();
+
+        for (String cacheName : grid(0).cacheNames()) {
+            if (!(EXISTING_CACHE_NAME.equals(cacheName) || DEFAULT_CACHE_NAME.equals(cacheName)))
+                grid(0).cache(cacheName).destroy();
+        }
+    }
+
+    /**
+     * Creates new cache configuration with the given name.
+     *
+     * @param cacheName Cache name.
+     * @return New cache configuration.
+     */
+    protected CacheConfiguration createCacheConfiguration(String cacheName) {
+        CacheConfiguration cfg = new CacheConfiguration()
+            .setName(cacheName)
+            .setCacheMode(CacheMode.PARTITIONED)
+            .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+            .setAffinity(new BrokenAffinityFunction());
+
+        return cfg;
+    }
+
+    /**
+     * Create list of cache configurations.
+     *
+     * @param failOnAllNodes {@code true} if affinity function should be broken on all nodes.
+     * @param unluckyNode Node, where exception is raised.
+     * @param unluckyCfg Unlucky cache configuration number.
+     * @param cacheNum Number of caches.
+     * @param useFilter {@code true} if NodeFilter should be used.
+     *
+     * @return List of cache configurations.
+     */
+    protected List<CacheConfiguration> createCacheConfigsWithBrokenAffinityFun(
+        boolean failOnAllNodes,
+        int unluckyNode,
+        final int unluckyCfg,
+        int cacheNum,
+        boolean useFilter
+    ) {
+        assert unluckyCfg >= 0 && unluckyCfg < cacheNum;
+
+        final UUID uuid = ignite(unluckyNode).cluster().localNode().id();
+
+        List<CacheConfiguration> cfgs = new ArrayList<>();
+
+        for (int i = 0; i < cacheNum; ++i) {
+            CacheConfiguration cfg = createCacheConfiguration(DYNAMIC_CACHE_NAME + "-" + i);
+
+            if (i == unluckyCfg)
+                cfg.setAffinity(new BrokenAffinityFunction(failOnAllNodes, getTestIgniteInstanceName(unluckyNode)));
+
+            if (useFilter)
+                cfg.setNodeFilter(new NodeFilter(uuid));
+
+            cfgs.add(cfg);
+        }
+
+        return cfgs;
+    }
+
+    /**
+     * Create list of cache configurations.
+     *
+     * @param failOnAllNodes {@code true} if cache store should be broken on all nodes.
+     * @param unluckyNode Node, where exception is raised.
+     * @param unluckyCfg Unlucky cache configuration number.
+     * @param cacheNum Number of caches.
+     * @param useFilter {@code true} if NodeFilter should be used.
+     *
+     * @return List of cache configurations.
+     */
+    protected List<CacheConfiguration> createCacheConfigsWithBrokenCacheStore(
+        boolean failOnAllNodes,
+        int unluckyNode,
+        int unluckyCfg,
+        int cacheNum,
+        boolean useFilter
+    ) {
+        assert unluckyCfg >= 0 && unluckyCfg < cacheNum;
+
+        final UUID uuid = ignite(unluckyNode).cluster().localNode().id();
+
+        List<CacheConfiguration> cfgs = new ArrayList<>();
+
+        for (int i = 0; i < cacheNum; ++i) {
+            CacheConfiguration cfg = new CacheConfiguration();
+
+            cfg.setName(DYNAMIC_CACHE_NAME + "-" + i);
+
+            if (i == unluckyCfg)
+                cfg.setCacheStoreFactory(new BrokenStoreFactory(failOnAllNodes, getTestIgniteInstanceName(unluckyNode)));
+
+            if (useFilter)
+                cfg.setNodeFilter(new NodeFilter(uuid));
+
+            cfgs.add(cfg);
+        }
+
+        return cfgs;
+    }
+
+    /**
+     * Create list of cache configurations.
+     *
+     * @param unluckyNode Node, where exception is raised.
+     * @param unluckyCfg Unlucky cache configuration number.
+     * @param cacheNum Number of caches.
+     *
+     * @return List of cache configurations.
+     */
+    private List<CacheConfiguration> createCacheConfigsWithFailureMbServer(
+        int unluckyNode,
+        int unluckyCfg,
+        int cacheNum
+    ) {
+        assert unluckyCfg >= 0 && unluckyCfg < cacheNum;
+
+        List<CacheConfiguration> cfgs = new ArrayList<>();
+
+        for (int i = 0; i < cacheNum; ++i) {
+            CacheConfiguration cfg = new CacheConfiguration();
+
+            String cacheName = DYNAMIC_CACHE_NAME + "-" + i;
+
+            cfg.setName(cacheName);
+
+            if (i == unluckyCfg)
+                mbSrv.cache(cacheName);
+
+            cfgs.add(cfg);
+        }
+
+        mbSrv.node(getTestIgniteInstanceName(unluckyNode));
+
+        return cfgs;
+    }
+
+    /**
+     * Test the basic cache operations.
+     *
+     * @param cache Cache.
+     * @throws Exception If test failed.
+     */
+    protected void checkCacheOperations(IgniteCache<Integer, Value> cache) throws Exception {
+        int cnt = 1000;
+
+        // Check cache operations.
+        for (int i = 0; i < cnt; ++i)
+            cache.put(i, new Value(i));
+
+        for (int i = 0; i < cnt; ++i) {
+            Value v = cache.get(i);
+
+            assertNotNull(v);
+            assertEquals(i, v.getValue());
+        }
+
+        // Check Data Streamer functionality.
+        try (IgniteDataStreamer<Integer, Value> streamer = grid(0).dataStreamer(cache.getName())) {
+            for (int i = 0; i < 10_000; ++i)
+                streamer.addData(i, new Value(i));
+        }
+    }
+
+    /**
+     *
+     */
+    public static class Value {
+        @QuerySqlField
+        private final int fieldVal;
+
+        public Value(int fieldVal) {
+            this.fieldVal = fieldVal;
+        }
+
+        public int getValue() {
+            return fieldVal;
+        }
+    }
+
+    /**
+     * Filter specifying on which node the cache should be started.
+     */
+    public static class NodeFilter implements IgnitePredicate<ClusterNode> {
+        /** Cache should be created node with certain UUID. */
+        public UUID uuid;
+
+        /**
+         * @param uuid node ID.
+         */
+        public NodeFilter(UUID uuid) {
+            this.uuid = uuid;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean apply(ClusterNode clusterNode) {
+            return clusterNode.id().equals(uuid);
+        }
+    }
+
+    /**
+     * Affinity function that throws an exception when affinity nodes are calculated on the given node.
+     */
+    public static class BrokenAffinityFunction extends RendezvousAffinityFunction {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** */
+        @IgniteInstanceResource
+        private Ignite ignite;
+
+        /** Exception should arise on all nodes. */
+        private boolean eOnAllNodes = false;
+
+        /** Exception should arise on node with certain name. */
+        private String gridName;
+
+        /**
+         * Constructs a good affinity function.
+         */
+        public BrokenAffinityFunction() {
+            super(false, PARTITION_COUNT);
+            // No-op.
+        }
+
+        /**
+         * @param eOnAllNodes {@code True} if exception should be thrown on all nodes.
+         * @param gridName Exception should arise on node with certain name.
+         */
+        public BrokenAffinityFunction(boolean eOnAllNodes, String gridName) {
+            super(false, PARTITION_COUNT);
+
+            this.eOnAllNodes = eOnAllNodes;
+            this.gridName = gridName;
+        }
+
+        /** {@inheritDoc} */
+        @Override public List<List<ClusterNode>> assignPartitions(AffinityFunctionContext affCtx) {
+            if (eOnAllNodes || ignite.name().equals(gridName))
+                throw new IllegalStateException("Simulated exception [locNodeId="
+                    + ignite.cluster().localNode().id() + "]");
+            else
+                return super.assignPartitions(affCtx);
+        }
+    }
+
+    /**
+     * Factory that throws an exception is got created.
+     */
+    public static class BrokenStoreFactory implements Factory<CacheStore<Integer, String>> {
+        /** */
+        @IgniteInstanceResource
+        private Ignite ignite;
+
+        /** Exception should arise on all nodes. */
+        boolean eOnAllNodes = true;
+
+        /** Exception should arise on node with certain name. */
+        public static String gridName;
+
+        /**
+         * @param eOnAllNodes {@code True} if exception should be thrown on all nodes.
+         * @param gridName Exception should arise on node with certain name.
+         */
+        public BrokenStoreFactory(boolean eOnAllNodes, String gridName) {
+            this.eOnAllNodes = eOnAllNodes;
+
+            this.gridName = gridName;
+        }
+
+        /** {@inheritDoc} */
+        @Override public CacheStore<Integer, String> create() {
+            if (eOnAllNodes || ignite.name().equals(gridName))
+                throw new IllegalStateException("Simulated exception [locNodeId="
+                    + ignite.cluster().localNode().id() + "]");
+            else
+                return null;
+        }
+    }
+
+    /** Failure MBean server. */
+    private class FailureMBeanServer implements MBeanServer {
+        /** */
+        private final MBeanServer origin;
+
+        /** Set of caches that must be failure. */
+        private final Set<String> caches = new HashSet<>();
+
+        /** Set of nodes that must be failure. */
+        private final Set<String> nodes = new HashSet<>();
+
+        /** */
+        private FailureMBeanServer(MBeanServer origin) {
+            this.origin = origin;
+        }
+
+        /** Add cache name to failure set. */
+        void cache(String cache) {
+            caches.add('\"' + cache + '\"');
+        }
+
+        /** Add node name to failure set. */
+        void node(String node) {
+            nodes.add(node);
+        }
+
+        /** Clear failure set of caches and set of nodes. */
+        void clear() {
+            caches.clear();
+            nodes.clear();
+        }
+
+        /** {@inheritDoc} */
+        @Override public ObjectInstance registerMBean(Object obj, ObjectName name)
+            throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
+            String node = name.getKeyProperty("igniteInstanceName");
+
+            if (nodes.contains(node) && caches.contains(name.getKeyProperty("group")))
+                throw new MBeanRegistrationException(new Exception("Simulate exception [node=" + node + ']'));
+
+            return origin.registerMBean(obj, name);
+        }
+
+        /** {@inheritDoc} */
+        @Override public ObjectInstance createMBean(String clsName, ObjectName name)
+            throws ReflectionException, InstanceAlreadyExistsException, MBeanException, NotCompliantMBeanException {
+            return origin.createMBean(clsName, name);
+        }
+
+        /** {@inheritDoc} */
+        @Override public ObjectInstance createMBean(String clsName, ObjectName name, ObjectName ldrName)
+            throws ReflectionException, InstanceAlreadyExistsException,
+            MBeanException, NotCompliantMBeanException, InstanceNotFoundException {
+            return origin.createMBean(clsName, name, ldrName);
+        }
+
+        /** {@inheritDoc} */
+        @Override public ObjectInstance createMBean(String clsName, ObjectName name, Object[] params,
+            String[] signature) throws ReflectionException, InstanceAlreadyExistsException,
+            MBeanException, NotCompliantMBeanException {
+            return origin.createMBean(clsName, name, params, signature);
+        }
+
+        /** {@inheritDoc} */
+        @Override public ObjectInstance createMBean(String clsName, ObjectName name, ObjectName ldrName,
+            Object[] params, String[] signature) throws ReflectionException, InstanceAlreadyExistsException,
+            MBeanException, NotCompliantMBeanException, InstanceNotFoundException {
+            return origin.createMBean(clsName, name, ldrName, params, signature);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException {
+            origin.unregisterMBean(name);
+        }
+
+        /** {@inheritDoc} */
+        @Override public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException {
+            return origin.getObjectInstance(name);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp qry) {
+            return origin.queryMBeans(name, qry);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Set<ObjectName> queryNames(ObjectName name, QueryExp qry) {
+            return origin.queryNames(name, qry);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isRegistered(ObjectName name) {
+            return origin.isRegistered(name);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Integer getMBeanCount() {
+            return origin.getMBeanCount();
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object getAttribute(ObjectName name, String attribute)
+            throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException {
+            return origin.getAttribute(name, attribute);
+        }
+
+        /** {@inheritDoc} */
+        @Override public AttributeList getAttributes(ObjectName name,
+            String[] attrs) throws InstanceNotFoundException, ReflectionException {
+            return origin.getAttributes(name, attrs);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setAttribute(ObjectName name,
+            Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException,
+            InvalidAttributeValueException, MBeanException, ReflectionException {
+            origin.setAttribute(name, attribute);
+        }
+
+        /** {@inheritDoc} */
+        @Override public AttributeList setAttributes(ObjectName name,
+            AttributeList attrs) throws InstanceNotFoundException, ReflectionException {
+            return origin.setAttributes(name, attrs);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object invoke(ObjectName name, String operationName, Object[] params,
+            String[] signature) throws InstanceNotFoundException, MBeanException, ReflectionException {
+            return origin.invoke(name, operationName, params, signature);
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getDefaultDomain() {
+            return origin.getDefaultDomain();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String[] getDomains() {
+            return origin.getDomains();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void addNotificationListener(ObjectName name, NotificationListener lsnr,
+            NotificationFilter filter, Object handback) throws InstanceNotFoundException {
+            origin.addNotificationListener(name, lsnr, filter, handback);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void addNotificationListener(ObjectName name, ObjectName lsnr,
+            NotificationFilter filter, Object handback) throws InstanceNotFoundException {
+            origin.addNotificationListener(name, lsnr, filter, handback);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void removeNotificationListener(ObjectName name,
+            ObjectName lsnr) throws InstanceNotFoundException, ListenerNotFoundException {
+            origin.removeNotificationListener(name, lsnr);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void removeNotificationListener(ObjectName name, ObjectName lsnr,
+            NotificationFilter filter, Object handback) throws InstanceNotFoundException, ListenerNotFoundException {
+            origin.removeNotificationListener(name, lsnr, filter, handback);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void removeNotificationListener(ObjectName name,
+            NotificationListener lsnr) throws InstanceNotFoundException, ListenerNotFoundException {
+            origin.removeNotificationListener(name, lsnr);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void removeNotificationListener(ObjectName name, NotificationListener lsnr,
+            NotificationFilter filter, Object handback) throws InstanceNotFoundException, ListenerNotFoundException {
+            origin.removeNotificationListener(name, lsnr, filter, handback);
+        }
+
+        /** {@inheritDoc} */
+        @Override public MBeanInfo getMBeanInfo(
+            ObjectName name) throws InstanceNotFoundException, IntrospectionException, ReflectionException {
+            return origin.getMBeanInfo(name);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isInstanceOf(ObjectName name, String clsName) throws InstanceNotFoundException {
+            return origin.isInstanceOf(name, clsName);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object instantiate(String clsName) throws ReflectionException, MBeanException {
+            return origin.instantiate(clsName);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object instantiate(String clsName,
+            ObjectName ldrName) throws ReflectionException, MBeanException, InstanceNotFoundException {
+            return origin.instantiate(clsName, ldrName);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object instantiate(String clsName, Object[] params,
+            String[] signature) throws ReflectionException, MBeanException {
+            return origin.instantiate(clsName, params, signature);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object instantiate(String clsName, ObjectName ldrName, Object[] params,
+            String[] signature) throws ReflectionException, MBeanException, InstanceNotFoundException {
+            return origin.instantiate(clsName, ldrName, params, signature);
+        }
+
+        /** {@inheritDoc} */
+        @Override @Deprecated public ObjectInputStream deserialize(ObjectName name, byte[] data)
+            throws OperationsException {
+            return origin.deserialize(name, data);
+        }
+
+        /** {@inheritDoc} */
+        @Override @Deprecated public ObjectInputStream deserialize(String clsName, byte[] data)
+            throws OperationsException, ReflectionException {
+            return origin.deserialize(clsName, data);
+        }
+
+        /** {@inheritDoc} */
+        @Override @Deprecated public ObjectInputStream deserialize(String clsName, ObjectName ldrName, byte[] data)
+            throws OperationsException, ReflectionException {
+            return origin.deserialize(clsName, ldrName, data);
+        }
+
+        /** {@inheritDoc} */
+        @Override public ClassLoader getClassLoaderFor(ObjectName mbeanName) throws InstanceNotFoundException {
+            return origin.getClassLoaderFor(mbeanName);
+        }
+
+        /** {@inheritDoc} */
+        @Override public ClassLoader getClassLoader(ObjectName ldrName) throws InstanceNotFoundException {
+            return origin.getClassLoader(ldrName);
+        }
+
+        /** {@inheritDoc} */
+        @Override public ClassLoaderRepository getClassLoaderRepository() {
+            return origin.getClassLoaderRepository();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/560240f1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java
index c677656..f8a81ed 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java
@@ -286,6 +286,41 @@ public class CacheMvccConfigurationValidationTest extends GridCommonAbstractTest
     }
 
     /**
+     * Checks if passed in {@code 'Throwable'} has given class in {@code 'cause'} hierarchy
+     * <b>including</b> that throwable itself and it contains passed message.
+     * <p>
+     * Note that this method follows includes {@link Throwable#getSuppressed()}
+     * into check.
+     *
+     * @param t Throwable to check (if {@code null}, {@code false} is returned).
+     * @param cls Cause class to check (if {@code null}, {@code false} is returned).
+     * @param msg Message to check.
+     * @return {@code True} if one of the causing exception is an instance of passed in classes
+     *      and it contains the passed message, {@code false} otherwise.
+     */
+    private boolean hasCauseWithMessage(@Nullable Throwable t, Class<?> cls, String msg) {
+        if (t == null)
+            return false;
+
+        assert cls != null;
+
+        for (Throwable th = t; th != null; th = th.getCause()) {
+            if (cls.isAssignableFrom(th.getClass()) && th.getMessage() != null && th.getMessage().contains(msg))
+                return true;
+
+            for (Throwable n : th.getSuppressed()) {
+                if (hasCauseWithMessage(n, cls, msg))
+                    return true;
+            }
+
+            if (th.getCause() == th)
+                break;
+        }
+
+        return false;
+    }
+
+    /**
      * Make sure cache cannot be started with the given configuration.
      *
      * @param ccfg Cache configuration.
@@ -305,7 +340,7 @@ public class CacheMvccConfigurationValidationTest extends GridCommonAbstractTest
             catch (Exception e) {
                 if (msg != null) {
                     assert e.getMessage() != null : "Error message is null";
-                    assert e.getMessage().contains(msg) : "Wrong error message: " + e.getMessage();
+                    assertTrue(hasCauseWithMessage(e, IgniteCheckedException.class, msg));
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/560240f1/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 e56f8a2..a91311a 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
@@ -17,16 +17,19 @@
 
 package org.apache.ignite.internal.processors.query;
 
+import java.util.concurrent.Callable;
+import java.util.function.Consumer;
+import javax.cache.CacheException;
 import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
 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.internal.util.typedef.F;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-import javax.cache.CacheException;
-import java.util.concurrent.Callable;
+import org.jetbrains.annotations.Nullable;
 
 /**
  * Tests for illegal SQL schemas in node and cache configurations.
@@ -61,17 +64,27 @@ public class SqlIllegalSchemaSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testBadCacheNameDynamic() throws Exception {
-        Ignite node = startGrid();
-
-        GridTestUtils.assertThrows(log, new Callable<Void>() {
-            @Override public Void call() throws Exception {
-                node.getOrCreateCache(new CacheConfiguration().setName(QueryUtils.SCHEMA_SYS));
-
-                return null;
+        doubleConsumerAccept(
+            (node)->{
+                try {
+                    node.getOrCreateCache(new CacheConfiguration().setName(QueryUtils.SCHEMA_SYS));
+                }
+                catch (CacheException e) {
+                    assertTrue(hasCause(e, IgniteCheckedException.class,
+                        "SQL schema name derived from cache name is reserved (please set explicit SQL " +
+                            "schema name through CacheConfiguration.setSqlSchema() or choose another cache name) [" +
+                            "cacheName=IGNITE, schemaName=null]"));
+
+                    return;
+                }
+                catch (Throwable e) {
+                    fail("Exception class is not as expected [expected=" +
+                        CacheException.class + ", actual=" + e.getClass() + ']');
+                }
+
+                fail("Exception has not been thrown.");
             }
-        }, CacheException.class, "SQL schema name derived from cache name is reserved (please set explicit SQL " +
-            "schema name through CacheConfiguration.setSqlSchema() or choose another cache name) [" +
-            "cacheName=IGNITE, schemaName=null]");
+        );
     }
 
     /**
@@ -97,17 +110,27 @@ public class SqlIllegalSchemaSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testBadSchemaLowerDynamic() throws Exception {
-        Ignite node = startGrid();
-
-        GridTestUtils.assertThrows(log, new Callable<Void>() {
-            @Override public Void call() throws Exception {
-                node.getOrCreateCache(
-                    new CacheConfiguration().setName("CACHE").setSqlSchema(QueryUtils.SCHEMA_SYS.toLowerCase())
-                );
-
-                return null;
+        doubleConsumerAccept(
+            (node) -> {
+                try {
+                    node.getOrCreateCache(
+                        new CacheConfiguration().setName("CACHE").setSqlSchema(QueryUtils.SCHEMA_SYS.toLowerCase())
+                    );
+                }
+                catch (CacheException e) {
+                    assertTrue(hasCause(e, IgniteCheckedException.class,
+                        "SQL schema name is reserved (please choose another one) [cacheName=CACHE, schemaName=ignite]"));
+
+                    return;
+                }
+                catch (Throwable e) {
+                    fail("Exception class is not as expected [expected=" +
+                        CacheException.class + ", actual=" + e.getClass() + ']');
+                }
+
+                fail("Exception has not been thrown.");
             }
-        }, CacheException.class, "SQL schema name is reserved (please choose another one) [cacheName=CACHE, schemaName=ignite]");
+        );
     }
 
     /**
@@ -133,18 +156,27 @@ public class SqlIllegalSchemaSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testBadSchemaUpperDynamic() throws Exception {
-        Ignite node = startGrid();
-
-        GridTestUtils.assertThrows(log, new Callable<Void>() {
-            @Override public Void call() throws Exception {
-                node.getOrCreateCache(
-                    new CacheConfiguration().setName("CACHE").setSqlSchema(QueryUtils.SCHEMA_SYS.toUpperCase())
-                );
-
-                return null;
+        doubleConsumerAccept(
+            (node) -> {
+                try {
+                    node.getOrCreateCache(
+                        new CacheConfiguration().setName("CACHE").setSqlSchema(QueryUtils.SCHEMA_SYS.toUpperCase())
+                    );
+                }
+                catch (CacheException e) {
+                    assertTrue(hasCause(e, IgniteCheckedException.class,
+                        "SQL schema name is reserved (please choose another one) [cacheName=CACHE, schemaName=IGNITE]"));
+
+                    return;
+                }
+                catch (Throwable e) {
+                    fail("Exception class is not as expected [expected=" +
+                        CacheException.class + ", actual=" + e.getClass() + ']');
+                }
+
+                fail("Exception has not been thrown.");
             }
-        }, CacheException.class, "SQL schema name is reserved (please choose another one) [cacheName=CACHE, " +
-            "schemaName=IGNITE]");
+        );
     }
 
     /**
@@ -170,18 +202,76 @@ public class SqlIllegalSchemaSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testBadSchemaQuotedDynamic() throws Exception {
+        doubleConsumerAccept(
+            (node) -> {
+                try {
+                    node.getOrCreateCache(
+                        new CacheConfiguration().setName("CACHE")
+                            .setSqlSchema("\"" + QueryUtils.SCHEMA_SYS.toUpperCase() + "\"")
+                    );
+                }
+                catch (CacheException e) {
+                    assertTrue(hasCause(e, IgniteCheckedException.class,
+                        "SQL schema name is reserved (please choose another one) [cacheName=CACHE, schemaName=\"IGNITE\"]"));
+
+                    return;
+                }
+                catch (Throwable e) {
+                    fail("Exception class is not as expected [expected=" +
+                        CacheException.class + ", actual=" + e.getClass() + ']');
+                }
+
+                fail("Exception has not been thrown.");
+            }
+        );
+    }
+
+    /**
+     * Executes double call of consumer's accept method with passed Ignite instance.
+     *
+     * @param cons Consumer.
+     * @throws Exception If failed.
+     */
+    private void doubleConsumerAccept(Consumer<Ignite> cons) throws Exception {
         Ignite node = startGrid();
 
-        GridTestUtils.assertThrows(log, new Callable<Void>() {
-            @Override public Void call() throws Exception {
-                node.getOrCreateCache(
-                    new CacheConfiguration().setName("CACHE")
-                        .setSqlSchema("\"" + QueryUtils.SCHEMA_SYS.toUpperCase() + "\"")
-                );
+        cons.accept(node);
 
-                return null;
+        cons.accept(node);
+    }
+
+    /**
+     * Checks if passed in {@code 'Throwable'} has given class in {@code 'cause'} hierarchy
+     * <b>including</b> that throwable itself and it contains passed message.
+     * <p>
+     * Note that this method follows includes {@link Throwable#getSuppressed()}
+     * into check.
+     *
+     * @param t Throwable to check (if {@code null}, {@code false} is returned).
+     * @param cls Cause class to check (if {@code null}, {@code false} is returned).
+     * @param msg Message to check.
+     * @return {@code True} if one of the causing exception is an instance of passed in classes
+     *      and it contains the passed message, {@code false} otherwise.
+     */
+    private boolean hasCause(@Nullable Throwable t, Class<?> cls, String msg) {
+        if (t == null)
+            return false;
+
+        assert cls != null;
+
+        for (Throwable th = t; th != null; th = th.getCause()) {
+            if (cls.isAssignableFrom(th.getClass()) && F.eq(th.getMessage(), msg))
+                return true;
+
+            for (Throwable n : th.getSuppressed()) {
+                if (hasCause(n, cls, msg))
+                    return true;
             }
-        }, CacheException.class, "SQL schema name is reserved (please choose another one) [cacheName=CACHE, " +
-            "schemaName=\"IGNITE\"]");
+
+            if (th.getCause() == th)
+                break;
+        }
+
+        return false;
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/560240f1/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FailureHandlerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FailureHandlerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FailureHandlerTest.cs
index 7c447b1..a8aff71 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FailureHandlerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FailureHandlerTest.cs
@@ -71,6 +71,7 @@ namespace Apache.Ignite.Core.Tests
         /// Tests <see cref="StopNodeFailureHandler"/>
         /// </summary>
         [Test]
+        [Ignore("IGNITE-10364")]
         public void TestStopNodeFailureHandler()
         {
            TestFailureHandler(typeof(StopNodeFailureHandler));
@@ -80,6 +81,7 @@ namespace Apache.Ignite.Core.Tests
         /// Tests <see cref="StopNodeOrHaltFailureHandler"/>
         /// </summary>
         [Test]
+        [Ignore("IGNITE-10364")]
         public void TestStopNodeOrHaltFailureHandler()
         {
             TestFailureHandler(typeof(StopNodeOrHaltFailureHandler));


[11/50] [abbrv] ignite git commit: IGNITE-10330: Disk page compression. - Fixes #5200.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/licenses/lz4-LICENSE.txt
----------------------------------------------------------------------
diff --git a/modules/compress/licenses/lz4-LICENSE.txt b/modules/compress/licenses/lz4-LICENSE.txt
new file mode 100644
index 0000000..c221aeb
--- /dev/null
+++ b/modules/compress/licenses/lz4-LICENSE.txt
@@ -0,0 +1,11 @@
+This repository uses 2 different licenses :
+- all files in the `lib` directory use a BSD 2-Clause license
+- all other files use a GPLv2 license, unless explicitly stated otherwise
+
+Relevant license is reminded at the top of each source file,
+and with presence of COPYING or LICENSE file in associated directories.
+
+This model is selected to emphasize that
+files in the `lib` directory are designed to be included into 3rd party applications,
+while all other files, in `programs`, `tests` or `examples`,
+receive more limited attention and support for such scenario.

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/licenses/lz4-java-LICENSE.txt
----------------------------------------------------------------------
diff --git a/modules/compress/licenses/lz4-java-LICENSE.txt b/modules/compress/licenses/lz4-java-LICENSE.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/compress/licenses/lz4-java-LICENSE.txt
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/pom.xml
----------------------------------------------------------------------
diff --git a/modules/compress/pom.xml b/modules/compress/pom.xml
new file mode 100644
index 0000000..876a121
--- /dev/null
+++ b/modules/compress/pom.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!--
+    POM file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.ignite</groupId>
+        <artifactId>ignite-parent</artifactId>
+        <version>1</version>
+        <relativePath>../../parent</relativePath>
+    </parent>
+
+    <artifactId>ignite-compress</artifactId>
+    <version>2.7.0-SNAPSHOT</version>
+    <url>http://ignite.apache.org</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.jnr</groupId>
+            <artifactId>jnr-posix</artifactId>
+            <version>${jnr.posix.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.luben</groupId>
+            <artifactId>zstd-jni</artifactId>
+            <version>${zstd.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.lz4</groupId>
+            <artifactId>lz4-java</artifactId>
+            <version>${lz4.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.xerial.snappy</groupId>
+            <artifactId>snappy-java</artifactId>
+            <version>${snappy.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.thoughtworks.xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>1.4.8</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/src/main/java/org/apache/ignite/internal/processors/compress/CompressionProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/compress/src/main/java/org/apache/ignite/internal/processors/compress/CompressionProcessorImpl.java b/modules/compress/src/main/java/org/apache/ignite/internal/processors/compress/CompressionProcessorImpl.java
new file mode 100644
index 0000000..2553371
--- /dev/null
+++ b/modules/compress/src/main/java/org/apache/ignite/internal/processors/compress/CompressionProcessorImpl.java
@@ -0,0 +1,403 @@
+/*
+ * 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.compress;
+
+import com.github.luben.zstd.Zstd;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.file.Path;
+import net.jpountz.lz4.LZ4Compressor;
+import net.jpountz.lz4.LZ4Factory;
+import net.jpountz.lz4.LZ4FastDecompressor;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.configuration.DiskPageCompression;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.CompactablePageIO;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.xerial.snappy.Snappy;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.MAX_PAGE_SIZE;
+import static org.apache.ignite.configuration.DiskPageCompression.SKIP_GARBAGE;
+import static org.apache.ignite.internal.util.GridUnsafe.NATIVE_BYTE_ORDER;
+
+/**
+ * Compression processor.
+ */
+public class CompressionProcessorImpl extends CompressionProcessor {
+    /** Max page size. */
+    private final ThreadLocalByteBuffer compactBuf = new ThreadLocalByteBuffer(MAX_PAGE_SIZE);
+
+    /** A bit more than max page size. */
+    private final ThreadLocalByteBuffer compressBuf = new ThreadLocalByteBuffer(MAX_PAGE_SIZE + 1024);
+
+    /**
+     * @param ctx Kernal context.
+     */
+    @SuppressWarnings("WeakerAccess")
+    public CompressionProcessorImpl(GridKernalContext ctx) {
+        super(ctx);
+    }
+
+    /**
+     * @param cap Capacity.
+     * @return Direct byte buffer.
+     */
+    static ByteBuffer allocateDirectBuffer(int cap) {
+        return ByteBuffer.allocateDirect(cap).order(NATIVE_BYTE_ORDER);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void checkPageCompressionSupported(Path storagePath, int pageSize) throws IgniteCheckedException {
+        if (!U.isLinux())
+            throw new IgniteCheckedException("Currently page compression is supported only for Linux.");
+
+        FileSystemUtils.checkSupported();
+
+        int fsBlockSize = FileSystemUtils.getFileSystemBlockSize(storagePath);
+
+        if (fsBlockSize <= 0)
+            throw new IgniteCheckedException("Failed to get file system block size: " + storagePath);
+
+        if (!U.isPow2(fsBlockSize))
+            throw new IgniteCheckedException("Storage block size must be power of 2: " + fsBlockSize);
+
+        if (pageSize < fsBlockSize * 2) {
+            throw new IgniteCheckedException("Page size (now configured to " + pageSize + " bytes) " +
+                "must be at least 2 times larger than the underlying storage block size (detected to be " + fsBlockSize +
+                " bytes at '" + storagePath + "') for page compression.");
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public ByteBuffer compressPage(
+        ByteBuffer page,
+        int pageSize,
+        int blockSize,
+        DiskPageCompression compression,
+        int compressLevel
+    ) throws IgniteCheckedException {
+        assert compression != null;
+        assert U.isPow2(pageSize): pageSize;
+        assert U.isPow2(blockSize): blockSize;
+        assert page.position() == 0 && page.limit() == pageSize;
+
+        PageIO io = PageIO.getPageIO(page);
+
+        if (!(io instanceof CompactablePageIO))
+            return page;
+
+        ByteBuffer compactPage = compactBuf.get();
+
+        // Drop the garbage from the page.
+        ((CompactablePageIO)io).compactPage(page, compactPage, pageSize);
+        page.clear();
+
+        int compactSize = compactPage.limit();
+
+        assert compactSize <= pageSize: compactSize;
+
+        // If no need to compress further or configured just to skip garbage.
+        if (compactSize < blockSize || compression == SKIP_GARBAGE)
+            return setCompactionInfo(compactPage, compactSize);
+
+        ByteBuffer compressedPage = doCompressPage(compression, compactPage, compactSize, compressLevel);
+
+        assert compressedPage.position() == 0;
+        int compressedSize = compressedPage.limit();
+
+        int freeCompactBlocks = (pageSize - compactSize) / blockSize;
+        int freeCompressedBlocks = (pageSize - compressedSize) / blockSize;
+
+        if (freeCompactBlocks >= freeCompressedBlocks) {
+            if (freeCompactBlocks == 0)
+                return page; // No blocks will be released.
+
+            return setCompactionInfo(compactPage, compactSize);
+        }
+
+        return setCompressionInfo(compressedPage, compression, compressedSize, compactSize);
+    }
+
+    /**
+     * @param page Page.
+     * @param compactSize Compacted page size.
+     * @return The given page.
+     */
+    private static ByteBuffer setCompactionInfo(ByteBuffer page, int compactSize) {
+        return setCompressionInfo(page, SKIP_GARBAGE, compactSize, compactSize);
+    }
+
+    /**
+     * @param page Page.
+     * @param compression Compression algorithm.
+     * @param compressedSize Compressed size.
+     * @param compactedSize Compact size.
+     * @return The given page.
+     */
+    private static ByteBuffer setCompressionInfo(ByteBuffer page, DiskPageCompression compression, int compressedSize, int compactedSize) {
+        assert compressedSize >= 0 && compressedSize <= Short.MAX_VALUE: compressedSize;
+        assert compactedSize >= 0 && compactedSize <= Short.MAX_VALUE: compactedSize;
+
+        PageIO.setCompressionType(page, getCompressionType(compression));
+        PageIO.setCompressedSize(page, (short)compressedSize);
+        PageIO.setCompactedSize(page, (short)compactedSize);
+
+        return page;
+    }
+
+    /**
+     * @param compression Compression algorithm.
+     * @param compactPage Compacted page.
+     * @param compactSize Compacted page size.
+     * @param compressLevel Compression level.
+     * @return Compressed page.
+     */
+    private ByteBuffer doCompressPage(DiskPageCompression compression, ByteBuffer compactPage, int compactSize, int compressLevel) {
+        switch (compression) {
+            case ZSTD:
+                return compressPageZstd(compactPage, compactSize, compressLevel);
+
+            case LZ4:
+                return compressPageLz4(compactPage, compactSize, compressLevel);
+
+            case SNAPPY:
+                return compressPageSnappy(compactPage, compactSize);
+        }
+        throw new IllegalStateException("Unsupported compression: " + compression);
+    }
+
+    /**
+     * @param compactPage Compacted page.
+     * @param compactSize Compacted page size.
+     * @param compressLevel Compression level.
+     * @return Compressed page.
+     */
+    private ByteBuffer compressPageLz4(ByteBuffer compactPage, int compactSize, int compressLevel) {
+        LZ4Compressor compressor = Lz4.getCompressor(compressLevel);
+
+        ByteBuffer compressedPage = compressBuf.get();
+
+        copyPageHeader(compactPage, compressedPage, compactSize);
+        compressor.compress(compactPage, compressedPage);
+
+        compactPage.flip();
+        compressedPage.flip();
+
+        return compressedPage;
+    }
+
+    /**
+     * @param compactPage Compacted page.
+     * @param compactSize Compacted page size.
+     * @param compressLevel Compression level.
+     * @return Compressed page.
+     */
+    private ByteBuffer compressPageZstd(ByteBuffer compactPage, int compactSize, int compressLevel) {
+        ByteBuffer compressedPage = compressBuf.get();
+
+        copyPageHeader(compactPage, compressedPage, compactSize);
+        Zstd.compress(compressedPage, compactPage, compressLevel);
+
+        compactPage.flip();
+        compressedPage.flip();
+
+        return compressedPage;
+    }
+
+    /**
+     * @param compactPage Compacted page.
+     * @param compactSize Compacted page size.
+     * @return Compressed page.
+     */
+    private ByteBuffer compressPageSnappy(ByteBuffer compactPage, int compactSize) {
+        ByteBuffer compressedPage = compressBuf.get();
+
+        copyPageHeader(compactPage, compressedPage, compactSize);
+
+        try {
+            int compressedSize = Snappy.compress(compactPage, compressedPage);
+            assert compressedPage.limit() == PageIO.COMMON_HEADER_END + compressedSize;
+        }
+        catch (IOException e) {
+            throw new IgniteException("Failed to compress page with Snappy.", e);
+        }
+
+        compactPage.position(0);
+        compressedPage.position(0);
+
+        return compressedPage;
+    }
+
+    /**
+     * @param compactPage Compacted page.
+     * @param compressedPage Compressed page.
+     * @param compactSize Compacted page size.
+     */
+    private static void copyPageHeader(ByteBuffer compactPage, ByteBuffer compressedPage, int compactSize) {
+        compactPage.limit(PageIO.COMMON_HEADER_END);
+        compressedPage.put(compactPage);
+        compactPage.limit(compactSize);
+    }
+
+    /**
+     * @param compression Compression.
+     * @return Level.
+     */
+    private static byte getCompressionType(DiskPageCompression compression) {
+        if (compression == null)
+            return UNCOMPRESSED_PAGE;
+
+        switch (compression) {
+            case ZSTD:
+                return ZSTD_COMPRESSED_PAGE;
+
+            case LZ4:
+                return LZ4_COMPRESSED_PAGE;
+
+            case SNAPPY:
+                return SNAPPY_COMPRESSED_PAGE;
+
+            case SKIP_GARBAGE:
+                return COMPACTED_PAGE;
+        }
+        throw new IllegalStateException("Unexpected compression: " + compression);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void decompressPage(ByteBuffer page, int pageSize) throws IgniteCheckedException {
+        assert page.capacity() == pageSize;
+
+        byte compressType = PageIO.getCompressionType(page);
+
+        if (compressType == UNCOMPRESSED_PAGE)
+            return; // Nothing to do.
+
+        short compressedSize = PageIO.getCompressedSize(page);
+        short compactSize = PageIO.getCompactedSize(page);
+
+        assert compactSize <= pageSize && compactSize >= compressedSize;
+
+        if (compressType == COMPACTED_PAGE) {
+            // Just setup bounds before restoring the page.
+            page.position(0).limit(compactSize);
+        }
+        else {
+            ByteBuffer dst = compressBuf.get();
+
+            // Position on a part that needs to be decompressed.
+            page.limit(compressedSize)
+                .position(PageIO.COMMON_HEADER_END);
+
+            // LZ4 needs this limit to be exact.
+            dst.limit(compactSize - PageIO.COMMON_HEADER_END);
+
+            switch (compressType) {
+                case ZSTD_COMPRESSED_PAGE:
+                    Zstd.decompress(dst, page);
+                    dst.flip();
+
+                    break;
+
+                case LZ4_COMPRESSED_PAGE:
+                    Lz4.decompress(page, dst);
+                    dst.flip();
+
+                    break;
+
+                case SNAPPY_COMPRESSED_PAGE:
+                    try {
+                        Snappy.uncompress(page, dst);
+                    }
+                    catch (IOException e) {
+                        throw new IgniteException(e);
+                    }
+                    break;
+
+                default:
+                    throw new IgniteException("Unknown compression: " + compressType);
+            }
+
+            page.position(PageIO.COMMON_HEADER_END).limit(compactSize);
+            page.put(dst).flip();
+            assert page.limit() == compactSize;
+        }
+
+        CompactablePageIO io = PageIO.getPageIO(page);
+
+        io.restorePage(page, pageSize);
+
+        setCompressionInfo(page, null, 0, 0);
+    }
+
+    /** */
+    static class Lz4 {
+        /** */
+        static final LZ4Factory factory = LZ4Factory.fastestInstance();
+
+        /** */
+        static final LZ4FastDecompressor decompressor = factory.fastDecompressor();
+
+        /** */
+        static final LZ4Compressor fastCompressor = factory.fastCompressor();
+
+        /**
+         * @param level Compression level.
+         * @return Compressor.
+         */
+        static LZ4Compressor getCompressor(int level) {
+            assert level >= 0 && level <= 17: level;
+            return level == 0 ? fastCompressor : factory.highCompressor(level);
+        }
+
+        /**
+         * @param page Page.
+         * @param dst Destination buffer.
+         */
+        static void decompress(ByteBuffer page, ByteBuffer dst) {
+            decompressor.decompress(page, dst);
+        }
+    }
+
+    /**
+     */
+    static final class ThreadLocalByteBuffer extends ThreadLocal<ByteBuffer> {
+        /** */
+        final int size;
+
+        /**
+         * @param size Size.
+         */
+        ThreadLocalByteBuffer(int size) {
+            this.size = size;
+        }
+
+        /** {@inheritDoc} */
+        @Override protected ByteBuffer initialValue() {
+            return allocateDirectBuffer(size);
+        }
+
+        /** {@inheritDoc} */
+        @Override public ByteBuffer get() {
+            ByteBuffer buf = super.get();
+            buf.clear();
+            return buf;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/src/main/java/org/apache/ignite/internal/processors/compress/NativeFileSystemLinux.java
----------------------------------------------------------------------
diff --git a/modules/compress/src/main/java/org/apache/ignite/internal/processors/compress/NativeFileSystemLinux.java b/modules/compress/src/main/java/org/apache/ignite/internal/processors/compress/NativeFileSystemLinux.java
new file mode 100644
index 0000000..22d4926
--- /dev/null
+++ b/modules/compress/src/main/java/org/apache/ignite/internal/processors/compress/NativeFileSystemLinux.java
@@ -0,0 +1,142 @@
+/*
+ * 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.compress;
+
+import jnr.ffi.LibraryLoader;
+import org.apache.ignite.IgniteException;
+
+/**
+ * Linux native file system API.
+ */
+public final class NativeFileSystemLinux extends NativeFileSystemPosix {
+    /**
+     * default is extend size
+     */
+    public static final int FALLOC_FL_KEEP_SIZE = 0x01;
+
+    /**
+     * de-allocates range
+     */
+    public static final int FALLOC_FL_PUNCH_HOLE = 0x02;
+
+    /**
+     * reserved codepoint
+     */
+    public static final int FALLOC_FL_NO_HIDE_STALE = 0x04;
+
+    /**
+     * FALLOC_FL_COLLAPSE_RANGE is used to remove a range of a file
+     * without leaving a hole in the file. The contents of the file beyond
+     * the range being removed is appended to the start offset of the range
+     * being removed (i.e. the hole that was punched is "collapsed"),
+     * resulting in a file layout that looks like the range that was
+     * removed never existed. As such collapsing a range of a file changes
+     * the size of the file, reducing it by the same length of the range
+     * that has been removed by the operation.
+     *
+     * Different filesystems may implement different limitations on the
+     * granularity of the operation. Most will limit operations to
+     * filesystem block size boundaries, but this boundary may be larger or
+     * smaller depending on the filesystem and/or the configuration of the
+     * filesystem or file.
+     *
+     * Attempting to collapse a range that crosses the end of the file is
+     * considered an illegal operation - just use ftruncate(2) if you need
+     * to collapse a range that crosses EOF.
+     */
+    public static final int FALLOC_FL_COLLAPSE_RANGE = 0x08;
+
+    /**
+     * FALLOC_FL_ZERO_RANGE is used to convert a range of file to zeros preferably
+     * without issuing data IO. Blocks should be preallocated for the regions that
+     * span holes in the file, and the entire range is preferable converted to
+     * unwritten extents - even though file system may choose to zero out the
+     * extent or do whatever which will result in reading zeros from the range
+     * while the range remains allocated for the file.
+     *
+     * This can be also used to preallocate blocks past EOF in the same way as
+     * with fallocate. Flag FALLOC_FL_KEEP_SIZE should cause the inode
+     * size to remain the same.
+     */
+    public static final int FALLOC_FL_ZERO_RANGE = 0x10;
+
+    /**
+     * FALLOC_FL_INSERT_RANGE is use to insert space within the file size without
+     * overwriting any existing data. The contents of the file beyond offset are
+     * shifted towards right by len bytes to create a hole.  As such, this
+     * operation will increase the size of the file by len bytes.
+     *
+     * Different filesystems may implement different limitations on the granularity
+     * of the operation. Most will limit operations to filesystem block size
+     * boundaries, but this boundary may be larger or smaller depending on
+     * the filesystem and/or the configuration of the filesystem or file.
+     *
+     * Attempting to insert space using this flag at OR beyond the end of
+     * the file is considered an illegal operation - just use ftruncate(2) or
+     * fallocate(2) with mode 0 for such type of operations.
+     */
+    public static final int FALLOC_FL_INSERT_RANGE = 0x20;
+
+    /**
+     * FALLOC_FL_UNSHARE_RANGE is used to unshare shared blocks within the
+     * file size without overwriting any existing data. The purpose of this
+     * call is to preemptively reallocate any blocks that are subject to
+     * copy-on-write.
+     *
+     * Different filesystems may implement different limitations on the
+     * granularity of the operation. Most will limit operations to filesystem
+     * block size boundaries, but this boundary may be larger or smaller
+     * depending on the filesystem and/or the configuration of the filesystem
+     * or file.
+     *
+     * This flag can only be used with allocate-mode fallocate, which is
+     * to say that it cannot be used with the punch, zero, collapse, or
+     * insert range modes.
+     */
+    public static final int FALLOC_FL_UNSHARE_RANGE = 0x40;
+
+    /** */
+    private static final LinuxNativeLibC libc = LibraryLoader.create(LinuxNativeLibC.class)
+        .failImmediately().load("c");
+
+    /** {@inheritDoc} */
+    @Override public void punchHole(int fd, long off, long len) {
+        int res = libc.fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, off, len);
+
+        if (res != 0)
+            throw new IgniteException("errno: " + res);
+    }
+
+    /**
+     */
+    public interface LinuxNativeLibC {
+        /**
+         * Allows the caller to directly manipulate the allocated
+         * disk space for the file referred to by fd for the byte range starting
+         * at {@code off} offset and continuing for {@code len} bytes.
+         *
+         * @param fd   file descriptor.
+         * @param mode determines the operation to be performed on the given range.
+         * @param off  required position offset.
+         * @param len  required length.
+         * @return On success, fallocate() returns zero.  On error, -1 is returned and
+         * {@code errno} is set to indicate the error.
+         */
+        int fallocate(int fd, int mode, long off, long len);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/src/main/java/org/apache/ignite/internal/processors/compress/NativeFileSystemPosix.java
----------------------------------------------------------------------
diff --git a/modules/compress/src/main/java/org/apache/ignite/internal/processors/compress/NativeFileSystemPosix.java b/modules/compress/src/main/java/org/apache/ignite/internal/processors/compress/NativeFileSystemPosix.java
new file mode 100644
index 0000000..fcf485f
--- /dev/null
+++ b/modules/compress/src/main/java/org/apache/ignite/internal/processors/compress/NativeFileSystemPosix.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.compress;
+
+import java.nio.file.Path;
+import jnr.posix.FileStat;
+import jnr.posix.POSIX;
+import jnr.posix.POSIXFactory;
+
+/**
+ * Posix file system API.
+ */
+public class NativeFileSystemPosix implements NativeFileSystem {
+    /** */
+    private static POSIX posix = POSIXFactory.getPOSIX();
+
+    /** {@inheritDoc} */
+    @Override public int getFileSystemBlockSize(Path path) {
+        FileStat stat = posix.stat(path.toString());
+        return Math.toIntExact(stat.blockSize());
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getFileSystemBlockSize(int fd) {
+        FileStat stat = posix.fstat(fd);
+        return Math.toIntExact(stat.blockSize());
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSparseFileSize(int fd) {
+        FileStat stat = posix.fstat(fd);
+        return stat.blocks() * 512;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void punchHole(int fd, long off, long len) {
+        throw new UnsupportedOperationException();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/src/test/java/org/apache/ignite/internal/processors/compress/CompressionProcessorTest.java
----------------------------------------------------------------------
diff --git a/modules/compress/src/test/java/org/apache/ignite/internal/processors/compress/CompressionProcessorTest.java b/modules/compress/src/test/java/org/apache/ignite/internal/processors/compress/CompressionProcessorTest.java
new file mode 100644
index 0000000..f660426
--- /dev/null
+++ b/modules/compress/src/test/java/org/apache/ignite/internal/processors/compress/CompressionProcessorTest.java
@@ -0,0 +1,1021 @@
+/*
+ * 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.compress;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.function.Function;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.configuration.DiskPageCompression;
+import org.apache.ignite.internal.pagemem.PageIdAllocator;
+import org.apache.ignite.internal.pagemem.PageIdUtils;
+import org.apache.ignite.internal.pagemem.PageUtils;
+import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusIO;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusInnerIO;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusLeafIO;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPagePayload;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.SimpleDataPageIO;
+import org.apache.ignite.internal.util.GridIntList;
+import org.apache.ignite.internal.util.GridUnsafe;
+import org.apache.ignite.testframework.junits.GridTestKernalContext;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.configuration.DiskPageCompression.LZ4;
+import static org.apache.ignite.configuration.DiskPageCompression.SKIP_GARBAGE;
+import static org.apache.ignite.configuration.DiskPageCompression.SNAPPY;
+import static org.apache.ignite.configuration.DiskPageCompression.ZSTD;
+import static org.apache.ignite.internal.processors.compress.CompressionProcessor.LZ4_MAX_LEVEL;
+import static org.apache.ignite.internal.processors.compress.CompressionProcessor.LZ4_MIN_LEVEL;
+import static org.apache.ignite.internal.processors.compress.CompressionProcessor.UNCOMPRESSED_PAGE;
+import static org.apache.ignite.internal.processors.compress.CompressionProcessor.ZSTD_MAX_LEVEL;
+import static org.apache.ignite.internal.processors.compress.CompressionProcessorImpl.allocateDirectBuffer;
+import static org.apache.ignite.internal.processors.compress.CompressionProcessorTest.TestInnerIO.INNER_IO;
+import static org.apache.ignite.internal.processors.compress.CompressionProcessorTest.TestLeafIO.LEAF_IO;
+import static org.apache.ignite.internal.util.GridUnsafe.bufferAddress;
+
+/**
+ */
+public class CompressionProcessorTest extends GridCommonAbstractTest {
+    /** */
+    private static final int ITEM_SIZE = 6; // To fill the whole page.
+
+    /** */
+    private int blockSize = 16;
+
+    /** */
+    private int pageSize = 4 * 1024;
+
+    /** */
+    private DiskPageCompression compression;
+
+    /** */
+    private int compressLevel;
+
+    /** */
+    private CompressionProcessor p;
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        PageIO.registerTest(INNER_IO, LEAF_IO);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() {
+        p = new CompressionProcessorImpl(new GridTestKernalContext(log));
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageCompact16() throws IgniteCheckedException {
+        blockSize = 16;
+        compression = SKIP_GARBAGE;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageCompact128() throws IgniteCheckedException {
+        blockSize = 128;
+        compression = SKIP_GARBAGE;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageCompact1k() throws IgniteCheckedException {
+        blockSize = 1024;
+        compression = SKIP_GARBAGE;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageCompact2k() throws IgniteCheckedException {
+        blockSize = 2 * 1024;
+        compression = SKIP_GARBAGE;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageZstd16() throws IgniteCheckedException {
+        blockSize = 16;
+        compression = ZSTD;
+        compressLevel = ZSTD_MAX_LEVEL;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageZstd128() throws IgniteCheckedException {
+        blockSize = 128;
+        compression = ZSTD;
+        compressLevel = ZSTD_MAX_LEVEL;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageZstd1k() throws IgniteCheckedException {
+        blockSize = 1024;
+        compression = ZSTD;
+        compressLevel = ZSTD_MAX_LEVEL;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageZstd2k() throws IgniteCheckedException {
+        blockSize = 2 * 1024;
+        compression = ZSTD;
+        compressLevel = ZSTD_MAX_LEVEL;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageSnappy16() throws IgniteCheckedException {
+        blockSize = 16;
+        compression = SNAPPY;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageSnappy128() throws IgniteCheckedException {
+        blockSize = 128;
+        compression = SNAPPY;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageSnappy1k() throws IgniteCheckedException {
+        blockSize = 1024;
+        compression = SNAPPY;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageSnappy2k() throws IgniteCheckedException {
+        blockSize = 2 * 1024;
+        compression = SNAPPY;
+
+        doTestDataPage();
+    }
+
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageLz4Fast16() throws IgniteCheckedException {
+        blockSize = 16;
+        compression = LZ4;
+        compressLevel = LZ4_MIN_LEVEL;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageLz4Fast128() throws IgniteCheckedException {
+        blockSize = 128;
+        compression = LZ4;
+        compressLevel = LZ4_MIN_LEVEL;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageLz4Fast1k() throws IgniteCheckedException {
+        blockSize = 1024;
+        compression = LZ4;
+        compressLevel = LZ4_MIN_LEVEL;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageLz4Fast2k() throws IgniteCheckedException {
+        blockSize = 2 * 1024;
+        compression = LZ4;
+        compressLevel = LZ4_MIN_LEVEL;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageLz4Slow16() throws IgniteCheckedException {
+        blockSize = 16;
+        compression = LZ4;
+        compressLevel = LZ4_MAX_LEVEL;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageLz4Slow128() throws IgniteCheckedException {
+        blockSize = 128;
+        compression = LZ4;
+        compressLevel = LZ4_MAX_LEVEL;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageLz4Slow1k() throws IgniteCheckedException {
+        blockSize = 1024;
+        compression = LZ4;
+        compressLevel = LZ4_MAX_LEVEL;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testDataPageLz4Slow2k() throws IgniteCheckedException {
+        blockSize = 2 * 1024;
+        compression = LZ4;
+        compressLevel = LZ4_MAX_LEVEL;
+
+        doTestDataPage();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageCompact16() throws IgniteCheckedException {
+        blockSize = 16;
+        compression = SKIP_GARBAGE;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageCompact16() throws IgniteCheckedException {
+        blockSize = 16;
+        compression = SKIP_GARBAGE;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageZstd16() throws IgniteCheckedException {
+        blockSize = 16;
+        compression = ZSTD;
+        compressLevel = ZSTD_MAX_LEVEL;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageZstd16() throws IgniteCheckedException {
+        blockSize = 16;
+        compression = ZSTD;
+        compressLevel = ZSTD_MAX_LEVEL;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageLz4Fast16() throws IgniteCheckedException {
+        blockSize = 16;
+        compression = LZ4;
+        compressLevel = LZ4_MIN_LEVEL;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageLz4Fast16() throws IgniteCheckedException {
+        blockSize = 16;
+        compression = LZ4;
+        compressLevel = LZ4_MIN_LEVEL;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageLz4Slow16() throws IgniteCheckedException {
+        blockSize = 16;
+        compression = LZ4;
+        compressLevel = LZ4_MAX_LEVEL;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageLz4Slow16() throws IgniteCheckedException {
+        blockSize = 16;
+        compression = LZ4;
+        compressLevel = LZ4_MAX_LEVEL;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageSnappy16() throws IgniteCheckedException {
+        blockSize = 16;
+        compression = SNAPPY;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageSnappy16() throws IgniteCheckedException {
+        blockSize = 16;
+        compression = SNAPPY;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageCompact128() throws IgniteCheckedException {
+        blockSize = 128;
+        compression = SKIP_GARBAGE;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageCompact128() throws IgniteCheckedException {
+        blockSize = 128;
+        compression = SKIP_GARBAGE;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageZstd128() throws IgniteCheckedException {
+        blockSize = 128;
+        compression = ZSTD;
+        compressLevel = ZSTD_MAX_LEVEL;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageZstd128() throws IgniteCheckedException {
+        blockSize = 128;
+        compression = ZSTD;
+        compressLevel = ZSTD_MAX_LEVEL;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageLz4Fast128() throws IgniteCheckedException {
+        blockSize = 128;
+        compression = LZ4;
+        compressLevel = LZ4_MIN_LEVEL;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageLz4Fast128() throws IgniteCheckedException {
+        blockSize = 128;
+        compression = LZ4;
+        compressLevel = LZ4_MIN_LEVEL;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageLz4Slow128() throws IgniteCheckedException {
+        blockSize = 128;
+        compression = LZ4;
+        compressLevel = LZ4_MAX_LEVEL;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageLz4Slow128() throws IgniteCheckedException {
+        blockSize = 128;
+        compression = LZ4;
+        compressLevel = LZ4_MAX_LEVEL;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageSnappy128() throws IgniteCheckedException {
+        blockSize = 128;
+        compression = SNAPPY;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageSnappy128() throws IgniteCheckedException {
+        blockSize = 128;
+        compression = SNAPPY;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageCompact1k() throws IgniteCheckedException {
+        blockSize = 1024;
+        compression = SKIP_GARBAGE;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageCompact1k() throws IgniteCheckedException {
+        blockSize = 1024;
+        compression = SKIP_GARBAGE;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageZstd1k() throws IgniteCheckedException {
+        blockSize = 1024;
+        compression = ZSTD;
+        compressLevel = ZSTD_MAX_LEVEL;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageZstd1k() throws IgniteCheckedException {
+        blockSize = 1024;
+        compression = ZSTD;
+        compressLevel = ZSTD_MAX_LEVEL;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageLz4Fast1k() throws IgniteCheckedException {
+        blockSize = 1024;
+        compression = LZ4;
+        compressLevel = LZ4_MIN_LEVEL;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageLz4Fast1k() throws IgniteCheckedException {
+        blockSize = 1024;
+        compression = LZ4;
+        compressLevel = LZ4_MIN_LEVEL;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageLz4Slow1k() throws IgniteCheckedException {
+        blockSize = 1024;
+        compression = LZ4;
+        compressLevel = LZ4_MAX_LEVEL;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageLz4Slow1k() throws IgniteCheckedException {
+        blockSize = 1024;
+        compression = LZ4;
+        compressLevel = LZ4_MAX_LEVEL;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageSnappy1k() throws IgniteCheckedException {
+        blockSize = 1024;
+        compression = SNAPPY;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageSnappy1k() throws IgniteCheckedException {
+        blockSize = 1024;
+        compression = SNAPPY;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageCompact2k() throws IgniteCheckedException {
+        blockSize = 2 * 1024;
+        compression = SKIP_GARBAGE;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageCompact2k() throws IgniteCheckedException {
+        blockSize = 2 * 1024;
+        compression = SKIP_GARBAGE;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageZstd2k() throws IgniteCheckedException {
+        blockSize = 2 * 1024;
+        compression = ZSTD;
+        compressLevel = ZSTD_MAX_LEVEL;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageZstd2k() throws IgniteCheckedException {
+        blockSize = 2 * 1024;
+        compression = ZSTD;
+        compressLevel = ZSTD_MAX_LEVEL;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageLz4Fast2k() throws IgniteCheckedException {
+        blockSize = 2 * 1024;
+        compression = LZ4;
+        compressLevel = LZ4_MIN_LEVEL;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageLz4Fast2k() throws IgniteCheckedException {
+        blockSize = 2 * 1024;
+        compression = LZ4;
+        compressLevel = LZ4_MIN_LEVEL;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageLz4Slow2k() throws IgniteCheckedException {
+        blockSize = 2 * 1024;
+        compression = LZ4;
+        compressLevel = LZ4_MAX_LEVEL;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageLz4Slow2k() throws IgniteCheckedException {
+        blockSize = 2 * 1024;
+        compression = LZ4;
+        compressLevel = LZ4_MAX_LEVEL;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testInnerPageSnappy2k() throws IgniteCheckedException {
+        blockSize = 2 * 1024;
+        compression = SNAPPY;
+
+        doTestBTreePage(INNER_IO);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    public void testLeafPageSnappy2k() throws IgniteCheckedException {
+        blockSize = 2 * 1024;
+        compression = SNAPPY;
+
+        doTestBTreePage(LEAF_IO);
+    }
+
+    /**
+     * @param io Page IO.
+     * @throws IgniteCheckedException If failed.
+     */
+    private void doTestBTreePage(BPlusIO<byte[]> io) throws IgniteCheckedException {
+        Random rnd = ThreadLocalRandom.current();
+
+        final byte[][] rows = new byte[3][io.getItemSize()];
+
+        for (int i = 0; i < rows.length; i++)
+            rnd.nextBytes(rows[i]);
+
+        ByteBuffer page = allocateDirectBuffer(pageSize);
+        long pageAddr = bufferAddress(page);
+
+        long pageId = PageIdUtils.pageId(PageIdAllocator.INDEX_PARTITION, PageIdAllocator.FLAG_IDX, 171717);
+
+        io.initNewPage(pageAddr, pageId, pageSize);
+
+        checkIo(io, page);
+
+        Function<ByteBuffer, List<?>> getContents = (buf) -> {
+            long addr = bufferAddress(buf);
+
+            int cnt = io.getCount(addr);
+
+            List<Object> list = new ArrayList<>(cnt);
+
+            for (int i = 0; i < cnt; i++) {
+                if (!io.isLeaf())
+                    list.add(((BPlusInnerIO)io).getLeft(addr, i));
+
+                try {
+                    list.add(new Bytes(io.getLookupRow(null, addr, i)));
+                }
+                catch (IgniteCheckedException e) {
+                    throw new IllegalStateException(e);
+                }
+
+                if (!io.isLeaf())
+                    list.add(((BPlusInnerIO)io).getRight(addr, i));
+            }
+
+            return list;
+        };
+
+        // Empty page.
+        checkCompressDecompress(page, getContents, false);
+
+        int cnt = io.getMaxCount(pageAddr, pageSize);
+
+        for (int i = 0; i < cnt; i++) {
+            byte[] row = rows[rnd.nextInt(rows.length)];
+            io.insert(pageAddr, i, row, row, 777_000 + i, false);
+        }
+
+        if (io.isLeaf())
+            assertEquals(pageSize, io.getItemsEnd(pageAddr)); // Page must be full.
+
+        // Full page.
+        checkCompressDecompress(page, getContents, io.isLeaf());
+
+        io.setCount(pageAddr, cnt / 2);
+
+        // Half page.
+        checkCompressDecompress(page, getContents, false);
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    private void doTestDataPage() throws IgniteCheckedException {
+        Random rnd = ThreadLocalRandom.current();
+
+        final byte[][] rows = new byte[][]{
+            new byte[17], new byte[37], new byte[71]
+        };
+
+        for (int i = 0; i < rows.length; i++)
+            rnd.nextBytes(rows[i]);
+
+        ByteBuffer page = allocateDirectBuffer(pageSize);
+        long pageAddr = bufferAddress(page);
+
+        SimpleDataPageIO io = SimpleDataPageIO.VERSIONS.latest();
+
+        long pageId = PageIdUtils.pageId(PageIdAllocator.MAX_PARTITION_ID, PageIdAllocator.FLAG_DATA, 171717);
+
+        io.initNewPage(pageAddr, pageId, pageSize);
+
+        checkIo(io, page);
+
+        Function<ByteBuffer,List<Bytes>> getContents = (buf) -> {
+            try {
+                long addr = bufferAddress(buf);
+
+                return io.forAllItems(addr, (link) -> {
+                    DataPagePayload payload = io.readPayload(addr, PageIdUtils.itemId(link), pageSize);
+
+                    return new Bytes(payload.getBytes(addr));
+                });
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException(e);
+            }
+        };
+
+        // Empty data page.
+        checkCompressDecompress(page, getContents, false);
+
+        GridIntList itemIds = new GridIntList();
+
+        for (;;) {
+            byte[] row = rows[rnd.nextInt(rows.length)];
+
+            if (io.getFreeSpace(pageAddr) < row.length)
+                break;
+
+            itemIds.add(io.addRow(pageAddr, row, pageSize));
+        }
+
+        int freeSpace = io.getFreeSpace(pageAddr);
+
+        if (freeSpace != 0) {
+            byte[] lastRow = new byte[freeSpace];
+            rnd.nextBytes(lastRow);
+
+            io.addRowFragment(pageId, pageAddr, lastRow, 777L, pageSize);
+
+            assertEquals(0, io.getRealFreeSpace(pageAddr));
+        }
+
+        // Full data page.
+        checkCompressDecompress(page, getContents, io.getRealFreeSpace(pageAddr) == 0);
+
+        for (int i = 0; i < itemIds.size(); i += 2)
+            io.removeRow(pageAddr, itemIds.get(i), pageSize);
+
+        // Half-filled data page.
+        checkCompressDecompress(page, getContents, false);
+    }
+
+    private void checkIo(PageIO io, ByteBuffer page) throws IgniteCheckedException {
+        assertSame(io, PageIO.getPageIO(bufferAddress(page)));
+        assertSame(io, PageIO.getPageIO(page));
+    }
+
+    private void checkCompressDecompress(ByteBuffer page, Function<ByteBuffer, ?> getPageContents, boolean fullPage)
+        throws IgniteCheckedException {
+        PageIO.setCrc(page, 0xABCDEF13);
+
+        long pageId = PageIO.getPageId(page);
+        PageIO io = PageIO.getPageIO(page);
+
+        ByteBuffer compressed = p.compressPage(page, pageSize, blockSize, compression, compressLevel);
+
+        int compressedSize = PageIO.getCompressedSize(compressed);
+
+        assertNotSame(page, compressed); // This is generally possible but not interesting in this test.
+
+        assertTrue(compressedSize > 0);
+        assertTrue(compressedSize <= pageSize);
+        assertEquals(compressedSize, compressed.limit());
+
+        if (!fullPage || compression != SKIP_GARBAGE)
+            assertTrue(pageSize > compressedSize);
+
+        assertEquals(0, compressed.position());
+
+        checkIo(io, compressed);
+        assertEquals(0, page.position());
+        assertEquals(pageSize, page.limit());
+
+        info(io.getClass().getSimpleName() + " " + compression + " " + compressLevel + ": " + compressedSize + "/" + pageSize);
+
+        if (!fullPage || compression != SKIP_GARBAGE)
+            assertTrue(compressedSize < pageSize);
+
+        assertEquals(pageId, PageIO.getPageId(compressed));
+
+        ByteBuffer decompress = allocateDirectBuffer(pageSize);
+        decompress.put(compressed).clear();
+
+        p.decompressPage(decompress, pageSize);
+
+        assertEquals(0, decompress.position());
+        assertEquals(pageSize, decompress.limit());
+
+        checkIo(io, decompress);
+        assertEquals(UNCOMPRESSED_PAGE, PageIO.getCompressionType(page));
+        assertEquals(0, PageIO.getCompressedSize(page));
+        assertEquals(0, PageIO.getCompactedSize(page));
+
+        assertTrue(Arrays.equals(getPageCommonHeader(page), getPageCommonHeader(decompress)));
+        assertEquals(getPageContents.apply(page), getPageContents.apply(decompress));
+    }
+
+    /**
+     * @param page Page.
+     * @return Page header.
+     */
+    private static byte[] getPageCommonHeader(ByteBuffer page) {
+        return PageUtils.getBytes(GridUnsafe.bufferAddress(page), 0, PageIO.COMMON_HEADER_END);
+    }
+
+    /**
+     */
+    private static class Bytes {
+        /** */
+        private final byte[] bytes;
+
+        /**
+         * @param bytes Bytes.
+         */
+        private Bytes(byte[] bytes) {
+            assert bytes != null;
+            this.bytes = bytes;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            Bytes bytes1 = (Bytes)o;
+
+            return Arrays.equals(bytes, bytes1.bytes);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return Arrays.hashCode(bytes);
+        }
+    }
+
+    /**
+     */
+    static class TestLeafIO extends BPlusLeafIO<byte[]> {
+        /** */
+        static final TestLeafIO LEAF_IO = new TestLeafIO();
+
+        /**
+         */
+        TestLeafIO() {
+            super(29_501, 1, ITEM_SIZE);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void storeByOffset(long pageAddr, int off, byte[] row) {
+            PageUtils.putBytes(pageAddr, off, row);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void store(long dstPageAddr, int dstIdx, BPlusIO<byte[]> srcIo, long srcPageAddr,
+            int srcIdx) throws IgniteCheckedException {
+            storeByOffset(dstPageAddr, offset(dstIdx), srcIo.getLookupRow(null, srcPageAddr, srcIdx));
+        }
+
+        /** {@inheritDoc} */
+        @Override public byte[] getLookupRow(BPlusTree<byte[],?> tree, long pageAddr, int idx) {
+            return PageUtils.getBytes(pageAddr, offset(idx), itemSize);
+        }
+    }
+
+    /**
+     */
+    static class TestInnerIO extends BPlusInnerIO<byte[]> {
+        /** */
+        static TestInnerIO INNER_IO = new TestInnerIO();
+
+        /**
+         */
+        TestInnerIO() {
+            super(29_502, 1, true, ITEM_SIZE);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void storeByOffset(long pageAddr, int off, byte[] row) {
+            PageUtils.putBytes(pageAddr, off, row);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void store(long dstPageAddr, int dstIdx, BPlusIO<byte[]> srcIo, long srcPageAddr,
+            int srcIdx) throws IgniteCheckedException {
+            storeByOffset(dstPageAddr, offset(dstIdx), srcIo.getLookupRow(null, srcPageAddr, srcIdx));
+        }
+
+        /** {@inheritDoc} */
+        @Override public byte[] getLookupRow(BPlusTree<byte[],?> tree, long pageAddr, int idx) {
+            return PageUtils.getBytes(pageAddr, offset(idx), itemSize);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/src/test/java/org/apache/ignite/internal/processors/compress/DiskPageCompressionIntegrationAsyncTest.java
----------------------------------------------------------------------
diff --git a/modules/compress/src/test/java/org/apache/ignite/internal/processors/compress/DiskPageCompressionIntegrationAsyncTest.java b/modules/compress/src/test/java/org/apache/ignite/internal/processors/compress/DiskPageCompressionIntegrationAsyncTest.java
new file mode 100644
index 0000000..658a5d2
--- /dev/null
+++ b/modules/compress/src/test/java/org/apache/ignite/internal/processors/compress/DiskPageCompressionIntegrationAsyncTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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.compress;
+
+import org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIOFactory;
+import org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory;
+
+/**
+ */
+public class DiskPageCompressionIntegrationAsyncTest extends DiskPageCompressionIntegrationTest {
+    /** {@inheritDoc} */
+    @Override protected FileIOFactory getFileIOFactory() {
+        return new AsyncFileIOFactory();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/src/test/java/org/apache/ignite/internal/processors/compress/DiskPageCompressionIntegrationTest.java
----------------------------------------------------------------------
diff --git a/modules/compress/src/test/java/org/apache/ignite/internal/processors/compress/DiskPageCompressionIntegrationTest.java b/modules/compress/src/test/java/org/apache/ignite/internal/processors/compress/DiskPageCompressionIntegrationTest.java
new file mode 100644
index 0000000..ca7f4ea
--- /dev/null
+++ b/modules/compress/src/test/java/org/apache/ignite/internal/processors/compress/DiskPageCompressionIntegrationTest.java
@@ -0,0 +1,468 @@
+/*
+ * 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.compress;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.nio.file.OpenOption;
+import java.util.Objects;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DiskPageCompression;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.pagemem.store.PageStore;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
+import org.apache.ignite.internal.processors.cache.persistence.file.FileIO;
+import org.apache.ignite.internal.processors.cache.persistence.file.FileIODecorator;
+import org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory;
+import org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager;
+import org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.mxbean.CacheGroupMetricsMXBean;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.configuration.DataStorageConfiguration.MAX_PAGE_SIZE;
+import static org.apache.ignite.configuration.DiskPageCompression.LZ4;
+import static org.apache.ignite.configuration.DiskPageCompression.SKIP_GARBAGE;
+import static org.apache.ignite.configuration.DiskPageCompression.SNAPPY;
+import static org.apache.ignite.configuration.DiskPageCompression.ZSTD;
+import static org.apache.ignite.internal.processors.compress.CompressionProcessor.LZ4_DEFAULT_LEVEL;
+import static org.apache.ignite.internal.processors.compress.CompressionProcessor.LZ4_MAX_LEVEL;
+import static org.apache.ignite.internal.processors.compress.CompressionProcessor.LZ4_MIN_LEVEL;
+import static org.apache.ignite.internal.processors.compress.CompressionProcessor.ZSTD_MAX_LEVEL;
+import static org.apache.ignite.internal.processors.compress.CompressionProcessor.ZSTD_MIN_LEVEL;
+
+/**
+ *
+ */
+public class DiskPageCompressionIntegrationTest extends GridCommonAbstractTest {
+    /** */
+    private DiskPageCompression compression;
+
+    /** */
+    private Integer compressionLevel;
+
+    /** */
+    private FileIOFactory factory;
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        compression = null;
+        compressionLevel = null;
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteName) throws Exception {
+        DataRegionConfiguration drCfg = new DataRegionConfiguration()
+            .setPersistenceEnabled(true);
+
+        factory = getFileIOFactory();
+
+        DataStorageConfiguration dsCfg = new DataStorageConfiguration()
+            .setMetricsEnabled(true)
+            .setPageSize(MAX_PAGE_SIZE)
+            .setDefaultDataRegionConfiguration(drCfg)
+            .setFileIOFactory(U.isLinux() ? factory : new PunchFileIOFactory(factory));
+
+        return super.getConfiguration(igniteName).setDataStorageConfiguration(dsCfg);
+    }
+
+    /**
+     * @return File IO factory.
+     */
+    protected FileIOFactory getFileIOFactory() {
+        return new RandomAccessFileIOFactory();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPageCompression_Zstd_Max() throws Exception {
+        compression = ZSTD;
+        compressionLevel = ZSTD_MAX_LEVEL;
+
+        doTestPageCompression();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPageCompression_Zstd_Default() throws Exception {
+        compression = ZSTD;
+        compressionLevel = null;
+
+        doTestPageCompression();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPageCompression_Zstd_Min() throws Exception {
+        compression = ZSTD;
+        compressionLevel = ZSTD_MIN_LEVEL;
+
+        doTestPageCompression();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPageCompression_Lz4_Max() throws Exception {
+        compression = LZ4;
+        compressionLevel = LZ4_MAX_LEVEL;
+
+        doTestPageCompression();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPageCompression_Lz4_Default() throws Exception {
+        compression = LZ4;
+        compressionLevel = null;
+
+        doTestPageCompression();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPageCompression_Lz4_Min() throws Exception {
+        assertEquals(LZ4_MIN_LEVEL, LZ4_DEFAULT_LEVEL);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPageCompression_SkipGarbage() throws Exception {
+        compression = SKIP_GARBAGE;
+
+        doTestPageCompression();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPageCompression_Snappy() throws Exception {
+        compression = SNAPPY;
+
+        doTestPageCompression();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void doTestPageCompression() throws Exception {
+        IgniteEx ignite = startGrid(0);
+
+        ignite.cluster().active(true);
+
+        String cacheName = "test";
+
+        CacheConfiguration<Integer,TestVal> ccfg = new CacheConfiguration<Integer,TestVal>()
+            .setName(cacheName)
+            .setBackups(0)
+            .setAtomicityMode(ATOMIC)
+            .setIndexedTypes(Integer.class, TestVal.class)
+            .setDiskPageCompression(compression)
+            .setDiskPageCompressionLevel(compressionLevel);
+
+        IgniteCache<Integer,TestVal> cache = ignite.getOrCreateCache(ccfg);
+
+        int cnt = 2_000;
+
+        for (int i = 0; i < cnt; i++)
+            assertTrue(cache.putIfAbsent(i, new TestVal(i)));
+
+        for (int i = 0; i < cnt; i += 2)
+            assertEquals(new TestVal(i), cache.getAndRemove(i));
+
+        GridCacheDatabaseSharedManager dbMgr = ((GridCacheDatabaseSharedManager)ignite.context()
+            .cache().context().database());
+
+        dbMgr.forceCheckpoint("test compression").finishFuture().get();
+
+        FilePageStoreManager storeMgr = dbMgr.getFileStoreManager();
+
+        checkFileIOFactory(storeMgr.getPageStoreFileIoFactory());
+
+        Thread.sleep(100); // Wait for metrics update.
+
+        long storeSize = ignite.dataStorageMetrics().getStorageSize();
+        long sparseStoreSize = ignite.dataStorageMetrics().getSparseStorageSize();
+
+        assertTrue("storeSize: " + storeSize, storeSize > 0);
+
+        if (U.isLinux()) {
+            assertTrue("sparseSize: " + sparseStoreSize, sparseStoreSize > 0);
+            assertTrue(storeSize + " > " + sparseStoreSize, storeSize > sparseStoreSize);
+        }
+        else
+            assertTrue(sparseStoreSize < 0);
+
+        GridCacheContext<?,?> cctx = ignite.cachex(cacheName).context();
+
+        int cacheId = cctx.cacheId();
+        int groupId = cctx.groupId();
+
+        assertEquals(cacheId, groupId);
+
+        CacheGroupMetricsMXBean mx = cctx.group().mxBean();
+
+        storeSize = mx.getStorageSize();
+        sparseStoreSize = mx.getSparseStorageSize();
+
+        assertTrue("storeSize: " + storeSize, storeSize > 0);
+
+        if (U.isLinux()) {
+            assertTrue("sparseSize: " + sparseStoreSize, sparseStoreSize > 0);
+            assertTrue(storeSize + " > " + sparseStoreSize, storeSize > sparseStoreSize);
+        }
+        else
+            assertTrue(sparseStoreSize < 0);
+
+        int parts = cctx.affinity().partitions();
+
+        for (int i = 0; i < parts; i++) {
+            PageStore store = storeMgr.getStore(cacheId, i);
+
+            long realSize = store.size();
+            long virtualSize = store.getPageSize() * store.pages();
+            long sparseSize = store.getSparseSize();
+
+            assertTrue(virtualSize > 0);
+
+            error("virt: " + virtualSize + ",  real: " + realSize + ",  sparse: " + sparseSize);
+
+            if (!store.exists())
+                continue;
+
+            if (virtualSize > sparseSize)
+                return;
+        }
+
+        fail("No files were compacted.");
+    }
+
+    /**
+     */
+    public void _testCompressionRatio() throws Exception {
+        IgniteEx ignite = startGrid(0);
+
+        ignite.cluster().active(true);
+
+        String cacheName = "test";
+
+        CacheConfiguration<Integer,TestVal> ccfg = new CacheConfiguration<Integer,TestVal>()
+            .setName(cacheName)
+            .setBackups(0)
+            .setAtomicityMode(ATOMIC)
+            .setIndexedTypes(Integer.class, TestVal.class)
+            .setAffinity(new RendezvousAffinityFunction().setPartitions(10))
+            .setDiskPageCompression(ZSTD);
+//            .setDiskPageCompressionLevel(compressionLevel);
+
+        ignite.getOrCreateCache(ccfg);
+
+        IgniteInternalCache<Integer,TestVal> cache = ignite.cachex(cacheName);
+
+        CacheGroupMetricsMXBean mx = cache.context().group().mxBean();
+
+        GridCacheDatabaseSharedManager dbMgr = ((GridCacheDatabaseSharedManager)ignite.context()
+            .cache().context().database());
+
+        int cnt = 20_000_000;
+
+        for (int i = 0; i < cnt; i++) {
+            assertTrue(cache.putIfAbsent(i, new TestVal(i)));
+
+            if (i % 50_000 == 0) {
+                dbMgr.forceCheckpoint("test").finishFuture().get();
+
+                long sparse = mx.getSparseStorageSize();
+                long size = mx.getStorageSize();
+
+                System.out.println(i + " >> " + sparse + " / " + size + " = " + ((double)sparse / size));
+            }
+        }
+    }
+
+    /**
+     * @param f Factory.
+     */
+    protected void checkFileIOFactory(FileIOFactory f) {
+        if (!U.isLinux())
+            f = ((PunchFileIOFactory)f).delegate;
+
+        assertSame(factory, f);
+    }
+
+    /**
+     */
+    static class TestVal implements Serializable {
+        /** */
+        static final long serialVersionUID = 1L;
+
+        /** */
+        @QuerySqlField
+        String str;
+
+        /** */
+        int i;
+
+        /** */
+        @QuerySqlField
+        long x;
+
+        /** */
+        @QuerySqlField
+        UUID id;
+
+        TestVal(int i) {
+            this.str =  i + "bla bla bla!";
+            this.i = -i;
+            this.x = 0xffaabbccdd773311L + i;
+            this.id = new UUID(i,-i);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            TestVal testVal = (TestVal)o;
+
+            if (i != testVal.i) return false;
+            if (x != testVal.x) return false;
+            if (str != null ? !str.equals(testVal.str) : testVal.str != null) return false;
+            return id != null ? id.equals(testVal.id) : testVal.id == null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            int result = str != null ? str.hashCode() : 0;
+            result = 31 * result + i;
+            result = 31 * result + (int)(x ^ (x >>> 32));
+            result = 31 * result + (id != null ? id.hashCode() : 0);
+            return result;
+        }
+    }
+
+    /**
+     */
+    static class PunchFileIO extends FileIODecorator {
+        /** */
+        private ConcurrentMap<Long, Integer> holes = new ConcurrentHashMap<>();
+
+        /**
+         * @param delegate File I/O delegate
+         */
+        public PunchFileIO(FileIO delegate) {
+            super(Objects.requireNonNull(delegate));
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getFileSystemBlockSize() {
+            assertFalse(U.isLinux());
+
+            return 4 * 1024;
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getSparseSize() {
+            assertFalse(U.isLinux());
+
+            long holesSize = holes.values().stream().mapToLong(x -> x).sum();
+
+            try {
+                return size() - holesSize;
+            }
+            catch (IOException e) {
+                throw new IgniteException(e);
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override public int writeFully(ByteBuffer srcBuf, long position) throws IOException {
+            assertFalse(U.isLinux());
+
+            holes.remove(position);
+            return super.writeFully(srcBuf, position);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int punchHole(long pos, int len) {
+            assertFalse(U.isLinux());
+
+            assertTrue(len > 0);
+
+            int blockSize = getFileSystemBlockSize();
+
+            len = len / blockSize * blockSize;
+
+            if (len > 0)
+                holes.put(pos, len);
+
+            return len;
+        }
+    }
+
+    /**
+     */
+    static class PunchFileIOFactory implements FileIOFactory {
+        /** */
+        final FileIOFactory delegate;
+
+        /**
+         * @param delegate Delegate.
+         */
+        PunchFileIOFactory(FileIOFactory delegate) {
+            this.delegate = Objects.requireNonNull(delegate);
+        }
+
+        /** {@inheritDoc} */
+        @Override public FileIO create(File file) throws IOException {
+            return new PunchFileIO(delegate.create(file));
+        }
+
+        /** {@inheritDoc} */
+        @Override public FileIO create(File file, OpenOption... modes) throws IOException {
+            return new PunchFileIO(delegate.create(file, modes));
+        }
+    }
+}


[03/50] [abbrv] ignite git commit: IGNITE-10339 Skip index partition file integrity check for in-memory caches - Fixes #5475.

Posted by sb...@apache.org.
IGNITE-10339 Skip index partition file integrity check for in-memory caches - Fixes #5475.

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/5b656e2f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5b656e2f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5b656e2f

Branch: refs/heads/ignite-10044
Commit: 5b656e2f3b2157200d650923e5aca800c4d61635
Parents: 97d2422
Author: Ivan Daschinskiy <iv...@gmail.com>
Authored: Fri Nov 23 19:36:00 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Nov 23 19:36:00 2018 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/commandline/CommandHandler.java   | 6 ++++--
 .../ignite/internal/visor/verify/ValidateIndexesClosure.java | 8 +++++---
 2 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5b656e2f/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 56fbfae..e9a4281 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
@@ -820,7 +820,11 @@ public class CommandHandler {
         VisorValidateIndexesTaskResult taskRes = executeTaskByNameOnNode(
             client, VALIDATE_INDEXES_TASK, taskArg, null);
 
+        boolean errors = false;
+
         if (!F.isEmpty(taskRes.exceptions())) {
+            errors = true;
+
             log("Index validation failed on nodes:");
 
             for (Map.Entry<UUID, Exception> e : taskRes.exceptions().entrySet()) {
@@ -832,8 +836,6 @@ public class CommandHandler {
             }
         }
 
-        boolean errors = false;
-
         for (Map.Entry<UUID, VisorValidateIndexesJobResult> nodeEntry : taskRes.results().entrySet()) {
             if (!nodeEntry.getValue().hasIssues())
                 continue;

http://git-wip-us.apache.org/repos/asf/ignite/blob/5b656e2f/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 ec02c25..b6909e3 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
@@ -260,7 +260,8 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
 
                 Map<PartitionKey, ValidateIndexesPartitionResult> partRes = fut.get();
 
-                partResults.putAll(partRes);
+                if (!partRes.isEmpty() && partRes.entrySet().stream().anyMatch(e -> !e.getValue().issues().isEmpty()))
+                    partResults.putAll(partRes);
             }
 
             for (; curIdx < procIdxFutures.size(); curIdx++) {
@@ -268,7 +269,8 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
 
                 Map<String, ValidateIndexesPartitionResult> idxRes = fut.get();
 
-                idxResults.putAll(idxRes);
+                if (!idxRes.isEmpty() && idxRes.entrySet().stream().anyMatch(e -> !e.getValue().issues().isEmpty()))
+                    idxResults.putAll(idxRes);
             }
 
             log.warning("ValidateIndexesClosure finished: processed " + totalPartitions + " partitions and "
@@ -296,7 +298,7 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
         for (Integer grpId: grpIds) {
             final CacheGroupContext grpCtx = ignite.context().cache().cacheGroup(grpId);
 
-            if (grpCtx == null) {
+            if (grpCtx == null || !grpCtx.persistenceEnabled()) {
                 integrityCheckedIndexes.incrementAndGet();
 
                 continue;


[39/50] [abbrv] ignite git commit: IGNITE-9700: Remove configurable values from mesos pom.xml. - Fixes #4838.

Posted by sb...@apache.org.
IGNITE-9700: Remove configurable values from mesos pom.xml. - Fixes #4838.

Signed-off-by: shroman <rs...@yahoo.com>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8e170d69
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8e170d69
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8e170d69

Branch: refs/heads/ignite-10044
Commit: 8e170d699ac081952c09bdba753e3a529916365c
Parents: c3fd4a9
Author: Roman Shtykh <rs...@yahoo.com>
Authored: Wed Nov 28 16:46:38 2018 +0900
Committer: shroman <rs...@yahoo.com>
Committed: Wed Nov 28 16:46:38 2018 +0900

----------------------------------------------------------------------
 modules/mesos/pom.xml                           | 48 --------------------
 .../ignite/mesos/resource/IgniteProvider.java   |  1 -
 2 files changed, 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8e170d69/modules/mesos/pom.xml
----------------------------------------------------------------------
diff --git a/modules/mesos/pom.xml b/modules/mesos/pom.xml
index 1841650..6234c81 100644
--- a/modules/mesos/pom.xml
+++ b/modules/mesos/pom.xml
@@ -36,9 +36,6 @@
 
     <properties>
         <mesos.version>1.5.0</mesos.version>
-        <ignite.version.url>https://ignite.apache.org/latest</ignite.version.url>
-        <ignite.path>/ignite/%s/apache-ignite-%s-bin.zip</ignite.path>
-        <apache.mirror.url>https://www.apache.org/dyn/closer.cgi?as_json=1</apache.mirror.url>
     </properties>
 
     <dependencies>
@@ -71,51 +68,6 @@
     <build>
         <plugins>
             <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-antrun-plugin</artifactId>
-                <version>1.7</version>
-                <executions>
-                    <execution>
-                        <id>update-versions</id>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
-                        <phase>generate-sources</phase>
-                        <configuration>
-                            <target>
-                                <echo message="Update download url in mesos module."/>
-                                <echo message="Latest version ${ignite.version.url}."/>
-
-                                <replaceregexp byline="true" encoding="UTF-8">
-                                    <regexp pattern="(.*IGNITE_LATEST_VERSION_URL = &quot;)(.*)(&quot;.*)"/>
-                                    <substitution expression="\1${ignite.version.url}\3"/>
-                                    <fileset dir="${basedir}/">
-                                        <include name="**/IgniteProvider.java"/>
-                                    </fileset>
-                                </replaceregexp>
-
-                                <replaceregexp byline="true" encoding="UTF-8">
-                                    <regexp pattern="(.*APACHE_MIRROR_URL = &quot;)(.*)(&quot;.*)"/>
-                                    <substitution expression="\1${apache.mirror.url}\3"/>
-                                    <fileset dir="${basedir}/">
-                                        <include name="**/IgniteProvider.java"/>
-                                    </fileset>
-                                </replaceregexp>
-
-                                <replaceregexp byline="true" encoding="UTF-8">
-                                    <regexp pattern="(.*IGNITE_PATH = &quot;)(.*)(&quot;.*)"/>
-                                    <substitution expression="\1${ignite.path}\3"/>
-                                    <fileset dir="${basedir}/">
-                                        <include name="**/IgniteProvider.java"/>
-                                    </fileset>
-                                </replaceregexp>
-                            </target>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-
-            <plugin>
                 <artifactId>maven-assembly-plugin</artifactId>
                 <version>2.4.1</version>
                 <configuration>

http://git-wip-us.apache.org/repos/asf/ignite/blob/8e170d69/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/IgniteProvider.java
----------------------------------------------------------------------
diff --git a/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/IgniteProvider.java b/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/IgniteProvider.java
index 892a592..438f40d 100644
--- a/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/IgniteProvider.java
+++ b/modules/mesos/src/main/java/org/apache/ignite/mesos/resource/IgniteProvider.java
@@ -47,7 +47,6 @@ public class IgniteProvider {
     /** Logger. */
     private static final Logger log = Logger.getLogger(IgniteProvider.class.getSimpleName());
 
-    // This constants are set by maven-ant-plugin.
     /** */
     private static final String DOWNLOAD_URL_PATTERN = "https://archive.apache.org/dist/ignite/%s/apache-ignite-%s-bin.zip";
 


[10/50] [abbrv] ignite git commit: IGNITE-10330: Disk page compression. - Fixes #5200.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/src/test/java/org/apache/ignite/internal/processors/compress/FileSystemUtilsTest.java
----------------------------------------------------------------------
diff --git a/modules/compress/src/test/java/org/apache/ignite/internal/processors/compress/FileSystemUtilsTest.java b/modules/compress/src/test/java/org/apache/ignite/internal/processors/compress/FileSystemUtilsTest.java
new file mode 100644
index 0000000..70dda0b
--- /dev/null
+++ b/modules/compress/src/test/java/org/apache/ignite/internal/processors/compress/FileSystemUtilsTest.java
@@ -0,0 +1,193 @@
+/*
+ * 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.compress;
+
+import java.io.FileDescriptor;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import junit.framework.TestCase;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+import static java.nio.file.StandardOpenOption.READ;
+import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
+import static java.nio.file.StandardOpenOption.WRITE;
+import static org.apache.ignite.internal.processors.compress.CompressionProcessorImpl.allocateDirectBuffer;
+import static org.apache.ignite.internal.processors.compress.FileSystemUtils.getFileSystemBlockSize;
+import static org.apache.ignite.internal.processors.compress.FileSystemUtils.getSparseFileSize;
+import static org.apache.ignite.internal.processors.compress.FileSystemUtils.punchHole;
+
+/**
+ */
+public class FileSystemUtilsTest extends TestCase {
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSparseFiles() throws Exception {
+        if (!U.isLinux())
+            return;
+
+        Path file = Files.createTempFile("test_sparse_file_", ".bin");
+
+        try {
+            doTestSparseFiles(file, false); // Ext4 expected as default FS.
+        }
+        finally {
+            Files.delete(file);
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void _testFileSystems() throws Exception {
+        doTestSparseFiles(Paths.get("/ext4/test_file"), false);
+        doTestSparseFiles(Paths.get("/btrfs/test_file"), false);
+        doTestSparseFiles(Paths.get("/xfs/test_file"), true);
+    }
+
+    private static int getFD(FileChannel ch) throws IgniteCheckedException {
+        return U.<Integer>field(U.<FileDescriptor>field(ch, "fd"), "fd");
+    }
+
+    /**
+     * @param file File path.
+     * @param reopen Reopen file after each hole punch. XFS needs it.
+     * @throws Exception If failed.
+     */
+    private void doTestSparseFiles(Path file, boolean reopen) throws Exception {
+        System.out.println(file);
+
+        FileChannel ch = FileChannel.open(file,
+            READ, WRITE, TRUNCATE_EXISTING);
+
+        try {
+            int fd = getFD(ch);
+
+            int fsBlockSize = getFileSystemBlockSize(fd);
+
+            System.out.println("fsBlockSize: " + fsBlockSize);
+
+            assertTrue(fsBlockSize > 0);
+
+            int pageSize = fsBlockSize * 4;
+
+            ByteBuffer page = allocateDirectBuffer(pageSize);
+
+            while (page.remaining() > 0)
+                page.putLong(0xABCDEF7654321EADL);
+            page.flip();
+
+            int pages = 5;
+            int blocks = pages * pageSize / fsBlockSize;
+            int fileSize = pages * pageSize;
+            int sparseSize = fileSize;
+
+            for (int i = 0; i < pages; i++) {
+                ch.write(page, i * pageSize);
+                assertEquals(0, page.remaining());
+                page.flip();
+            }
+
+            if (reopen) {
+                ch.force(true);
+                ch.close();
+                ch = FileChannel.open(file, READ, WRITE);
+                fd = getFD(ch);
+            }
+
+            assertEquals(fileSize, ch.size());
+            assertEquals(fileSize, getSparseFileSize(fd));
+
+            int off = fsBlockSize * 3 - (fsBlockSize >>> 2);
+            int len = fsBlockSize;
+            assertEquals(0, punchHole(fd, off, len, fsBlockSize));
+            if (reopen) {
+                ch.force(true);
+                ch.close();
+                ch = FileChannel.open(file, READ, WRITE);
+                fd = getFD(ch);
+            }
+            assertEquals(fileSize, getSparseFileSize(fd));
+
+            off = 2 * fsBlockSize - 3;
+            len = 2 * fsBlockSize + 3;
+            assertEquals(2 * fsBlockSize, punchHole(fd, off, len, fsBlockSize));
+            if (reopen) {
+                ch.force(true);
+                ch.close();
+                ch = FileChannel.open(file, READ, WRITE);
+                fd = getFD(ch);
+            }
+            assertEquals(sparseSize -= 2 * fsBlockSize, getSparseFileSize(fd));
+
+            off = 10 * fsBlockSize;
+            len = 3 * fsBlockSize + 5;
+            assertEquals(3 * fsBlockSize, punchHole(fd, off, len, fsBlockSize));
+            if (reopen) {
+                ch.force(true);
+                ch.close();
+                ch = FileChannel.open(file, READ, WRITE);
+                fd = getFD(ch);
+            }
+            assertEquals(sparseSize -= 3 * fsBlockSize, getSparseFileSize(fd));
+
+            off = 15 * fsBlockSize + 1;
+            len = fsBlockSize;
+            assertEquals(0, punchHole(fd, off, len, fsBlockSize));
+
+            off = 15 * fsBlockSize - 1;
+            len = fsBlockSize;
+            assertEquals(0, punchHole(fd, off, len, fsBlockSize));
+
+            off = 15 * fsBlockSize;
+            len = fsBlockSize - 1;
+            assertEquals(0, punchHole(fd, off, len, fsBlockSize));
+
+            off = 15 * fsBlockSize;
+            len = fsBlockSize;
+            assertEquals(fsBlockSize, punchHole(fd, off, len, fsBlockSize));
+            if (reopen) {
+                ch.force(true);
+                ch.close();
+                ch = FileChannel.open(file, READ, WRITE);
+                fd = getFD(ch);
+            }
+            assertEquals(sparseSize -= fsBlockSize, getSparseFileSize(fd));
+
+            for (int i = 0; i < blocks - 1; i++)
+                punchHole(fd, fsBlockSize * i, fsBlockSize, fsBlockSize);
+
+            if (reopen) {
+                ch.force(true);
+                ch.close();
+                ch = FileChannel.open(file, READ, WRITE);
+                fd = getFD(ch);
+            }
+
+            assertEquals(fsBlockSize, getSparseFileSize(fd));
+        }
+        finally {
+            ch.close();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/src/test/java/org/apache/ignite/testsuites/IgnitePdsCompressionTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/compress/src/test/java/org/apache/ignite/testsuites/IgnitePdsCompressionTestSuite.java b/modules/compress/src/test/java/org/apache/ignite/testsuites/IgnitePdsCompressionTestSuite.java
new file mode 100644
index 0000000..a977700
--- /dev/null
+++ b/modules/compress/src/test/java/org/apache/ignite/testsuites/IgnitePdsCompressionTestSuite.java
@@ -0,0 +1,56 @@
+/*
+ * 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 junit.framework.TestSuite;
+import org.apache.ignite.internal.processors.compress.CompressionProcessorTest;
+import org.apache.ignite.internal.processors.compress.DiskPageCompressionIntegrationAsyncTest;
+import org.apache.ignite.internal.processors.compress.DiskPageCompressionIntegrationTest;
+import org.apache.ignite.internal.processors.compress.FileSystemUtilsTest;
+
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_DEFAULT_DATA_STORAGE_PAGE_SIZE;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_DEFAULT_DISK_PAGE_COMPRESSION;
+import static org.apache.ignite.configuration.DiskPageCompression.ZSTD;
+
+/**
+ */
+public class IgnitePdsCompressionTestSuite {
+    /**
+     * @return Suite.
+     */
+    public static TestSuite suite() {
+        TestSuite suite = new TestSuite("Ignite Persistent Store Test Suite (with page compression).");
+
+        suite.addTestSuite(CompressionProcessorTest.class);
+        suite.addTestSuite(FileSystemUtilsTest.class);
+        suite.addTestSuite(DiskPageCompressionIntegrationTest.class);
+        suite.addTestSuite(DiskPageCompressionIntegrationAsyncTest.class);
+
+        enableCompressionByDefault();
+        IgnitePdsTestSuite.addRealPageStoreTests(suite);
+
+        return suite;
+    }
+
+    /**
+     */
+    static void enableCompressionByDefault() {
+        System.setProperty(IGNITE_DEFAULT_DISK_PAGE_COMPRESSION, ZSTD.name());
+        System.setProperty(IGNITE_DEFAULT_DATA_STORAGE_PAGE_SIZE, String.valueOf(8 * 1024));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/compress/src/test/java/org/apache/ignite/testsuites/IgnitePdsCompressionTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/compress/src/test/java/org/apache/ignite/testsuites/IgnitePdsCompressionTestSuite2.java b/modules/compress/src/test/java/org/apache/ignite/testsuites/IgnitePdsCompressionTestSuite2.java
new file mode 100644
index 0000000..3fb8ac2
--- /dev/null
+++ b/modules/compress/src/test/java/org/apache/ignite/testsuites/IgnitePdsCompressionTestSuite2.java
@@ -0,0 +1,38 @@
+/*
+ * 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 junit.framework.TestSuite;
+
+import static org.apache.ignite.testsuites.IgnitePdsCompressionTestSuite.enableCompressionByDefault;
+
+/**
+ */
+public class IgnitePdsCompressionTestSuite2 {
+    /**
+     * @return Suite.
+     */
+    public static TestSuite suite() {
+        TestSuite suite = new TestSuite("Ignite Persistent Store Test Suite 2 (with page compression).");
+
+        enableCompressionByDefault();
+        IgnitePdsTestSuite2.addRealPageStoreTests(suite);
+
+        return suite;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java b/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java
index cdde0ac..e23d188 100644
--- a/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/DataStorageMetrics.java
@@ -212,4 +212,22 @@ public interface DataStorageMetrics {
      * @return Checkpoint buffer size in bytes.
      */
     public long getCheckpointBufferSize();
+
+    /**
+     * Storage space allocated in bytes.
+     *
+     * @return Storage space allocated in bytes.
+     */
+    public long getStorageSize();
+
+    /**
+     * Storage space allocated adjusted for possible sparsity in bytes.
+     *
+     * May produce unstable or even incorrect result on some file systems (e.g. XFS).
+     * Known to work correctly on Ext4 and Btrfs.
+     *
+     * @return Storage space allocated adjusted for possible sparsity in bytes
+     *         or negative value is not supported.
+     */
+    public long getSparseStorageSize();
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/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 ccf7ebf..2d27840 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -1047,6 +1047,16 @@ public final class IgniteSystemProperties {
     public static final String IGNITE_RECOVERY_VERBOSE_LOGGING = "IGNITE_RECOVERY_VERBOSE_LOGGING";
 
     /**
+     * Sets default {@link CacheConfiguration#setDiskPageCompression disk page compression}.
+     */
+    public static final String IGNITE_DEFAULT_DISK_PAGE_COMPRESSION = "IGNITE_DEFAULT_DISK_PAGE_COMPRESSION";
+
+    /**
+     * Sets default {@link DataStorageConfiguration#setPageSize storage page size}.
+     */
+    public static final String IGNITE_DEFAULT_DATA_STORAGE_PAGE_SIZE = "IGNITE_DEFAULT_DATA_STORAGE_PAGE_SIZE";
+
+    /**
      * Enforces singleton.
      */
     private IgniteSystemProperties() {
@@ -1054,6 +1064,40 @@ public final class IgniteSystemProperties {
     }
 
     /**
+     * @param enumCls Enum type.
+     * @param name Name of the system property or environment variable.
+     * @return Enum value or {@code null} if the property is not set.
+     */
+    public static <E extends Enum<E>> E getEnum(Class<E> enumCls, String name) {
+        return getEnum(enumCls, name, null);
+    }
+
+    /**
+     * @param name Name of the system property or environment variable.
+     * @return Enum value or the given default.
+     */
+    public static <E extends Enum<E>> E getEnum(String name, E dflt) {
+        return getEnum(dflt.getDeclaringClass(), name, dflt);
+    }
+
+    /**
+     * @param enumCls Enum type.
+     * @param name Name of the system property or environment variable.
+     * @param dflt Default value.
+     * @return Enum value or the given default.
+     */
+    private static <E extends Enum<E>> E getEnum(Class<E> enumCls, String name, E dflt) {
+        assert enumCls != null;
+
+        String val = getString(name);
+
+        if (val == null)
+            return dflt;
+
+        return Enum.valueOf(enumCls, val);
+    }
+
+    /**
      * Gets either system property or environment variable with given name.
      *
      * @param name Name of the system property or environment variable.

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 5c91dc0..e27961d 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -33,6 +33,7 @@ import javax.cache.integration.CacheLoader;
 import javax.cache.integration.CacheWriter;
 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.CacheEntryProcessor;
 import org.apache.ignite.cache.CacheInterceptor;
@@ -62,6 +63,8 @@ import org.apache.ignite.spi.encryption.EncryptionSpi;
 import org.apache.ignite.spi.encryption.keystore.KeystoreEncryptionSpi;
 import org.jetbrains.annotations.Nullable;
 
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_DEFAULT_DISK_PAGE_COMPRESSION;
+
 /**
  * This class defines grid cache configuration. This configuration is passed to
  * grid via {@link IgniteConfiguration#getCacheConfiguration()} method. It defines all configuration
@@ -383,6 +386,13 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
      */
     private boolean encryptionEnabled;
 
+    /** */
+    private DiskPageCompression diskPageCompression = IgniteSystemProperties.getEnum(
+        DiskPageCompression.class, IGNITE_DEFAULT_DISK_PAGE_COMPRESSION);
+
+    /** */
+    private Integer diskPageCompressionLevel;
+
     /** Empty constructor (all values are initialized to their defaults). */
     public CacheConfiguration() {
         /* No-op. */
@@ -443,6 +453,8 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
         nearCfg = cc.getNearConfiguration();
         nodeFilter = cc.getNodeFilter();
         onheapCache = cc.isOnheapCacheEnabled();
+        diskPageCompression = cc.getDiskPageCompression();
+        diskPageCompressionLevel = cc.getDiskPageCompressionLevel();
         partLossPlc = cc.getPartitionLossPolicy();
         pluginCfgs = cc.getPluginConfigurations();
         qryDetailMetricsSz = cc.getQueryDetailMetricsSize();
@@ -2297,6 +2309,54 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
         return this;
     }
 
+    /**
+     * Gets disk page compression algorithm.
+     * Makes sense only with enabled {@link DataRegionConfiguration#setPersistenceEnabled persistence}.
+     *
+     * @return Disk page compression algorithm.
+     * @see #getDiskPageCompressionLevel
+     */
+    public DiskPageCompression getDiskPageCompression() {
+        return diskPageCompression;
+    }
+
+    /**
+     * Sets disk page compression algorithm.
+     * Makes sense only with enabled {@link DataRegionConfiguration#setPersistenceEnabled persistence}.
+     *
+     * @param diskPageCompression Disk page compression algorithm.
+     * @return {@code this} for chaining.
+     * @see #setDiskPageCompressionLevel
+     */
+    public CacheConfiguration<K,V> setDiskPageCompression(DiskPageCompression diskPageCompression) {
+        this.diskPageCompression = diskPageCompression;
+
+        return this;
+    }
+
+    /**
+     * Gets {@link #getDiskPageCompression algorithm} specific disk page compression level.
+     *
+     * @return Disk page compression level or {@code null} for default.
+     */
+    public Integer getDiskPageCompressionLevel() {
+        return diskPageCompressionLevel;
+    }
+
+    /**
+     * Sets {@link #setDiskPageCompression algorithm} specific disk page compression level.
+     *
+     * @param diskPageCompressionLevel Disk page compression level or {@code null} to use default.
+     *                             {@link DiskPageCompression#ZSTD Zstd}: from {@code -131072} to {@code 22} (default {@code 3}).
+     *                             {@link DiskPageCompression#LZ4 LZ4}: from {@code 0} to {@code 17} (default {@code 0}).
+     * @return {@code this} for chaining.
+     */
+    public CacheConfiguration<K,V> setDiskPageCompressionLevel(Integer diskPageCompressionLevel) {
+        this.diskPageCompressionLevel = diskPageCompressionLevel;
+
+        return this;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(CacheConfiguration.class, this);

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java
index 20b314f..4aca0b1 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java
@@ -28,6 +28,8 @@ import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_DEFAULT_DATA_STORAGE_PAGE_SIZE;
+
 /**
  * A durable memory configuration for an Apache Ignite node. The durable memory is a manageable off-heap based memory
  * architecture that divides all expandable data regions into pages of fixed size
@@ -87,6 +89,12 @@ public class DataStorageConfiguration implements Serializable {
     /** Default memory page size. */
     public static final int DFLT_PAGE_SIZE = 4 * 1024;
 
+    /** Max memory page size. */
+    public static final int MAX_PAGE_SIZE = 16 * 1024;
+
+    /** Min memory page size. */
+    public static final int MIN_PAGE_SIZE = 1024;
+
     /** This name is assigned to default Dataregion if no user-defined default MemPlc is specified */
     public static final String DFLT_DATA_REG_DEFAULT_NAME = "default";
 
@@ -166,7 +174,8 @@ public class DataStorageConfiguration implements Serializable {
     private long sysRegionMaxSize = DFLT_SYS_REG_MAX_SIZE;
 
     /** Memory page size. */
-    private int pageSize;
+    private int pageSize = IgniteSystemProperties.getInteger(
+        IGNITE_DEFAULT_DATA_STORAGE_PAGE_SIZE, 0);
 
     /** Concurrency level. */
     private int concLvl;
@@ -346,10 +355,13 @@ public class DataStorageConfiguration implements Serializable {
      * Changes the page size.
      *
      * @param pageSize Page size in bytes. If value is not set (or zero), {@link #DFLT_PAGE_SIZE} will be used.
+     * @see #MIN_PAGE_SIZE
+     * @see #MAX_PAGE_SIZE
      */
     public DataStorageConfiguration setPageSize(int pageSize) {
         if (pageSize != 0) {
-            A.ensure(pageSize >= 1024 && pageSize <= 16 * 1024, "Page size must be between 1kB and 16kB.");
+            A.ensure(pageSize >= MIN_PAGE_SIZE && pageSize <= MAX_PAGE_SIZE,
+                "Page size must be between 1kB and 16kB.");
             A.ensure(U.isPow2(pageSize), "Page size must be a power of 2.");
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/configuration/DiskPageCompression.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/DiskPageCompression.java b/modules/core/src/main/java/org/apache/ignite/configuration/DiskPageCompression.java
new file mode 100644
index 0000000..d628c6a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/DiskPageCompression.java
@@ -0,0 +1,38 @@
+/*
+ * 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.configuration;
+
+/**
+ * Disk page compression options.
+ *
+ * @see CacheConfiguration#setDiskPageCompression
+ * @see CacheConfiguration#setDiskPageCompressionLevel
+ */
+public enum DiskPageCompression {
+    /** Retain only useful data from half-filled pages, but do not apply any compression. */
+    SKIP_GARBAGE,
+
+    /** Zstd compression. */
+    ZSTD,
+
+    /** LZ4 compression. */
+    LZ4,
+
+    /** Snappy compression. */
+    SNAPPY
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
index a43312c..e19450e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
@@ -34,6 +34,7 @@ import org.apache.ignite.internal.managers.failover.GridFailoverManager;
 import org.apache.ignite.internal.managers.indexing.GridIndexingManager;
 import org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerManager;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccProcessor;
+import org.apache.ignite.internal.processors.compress.CompressionProcessor;
 import org.apache.ignite.internal.worker.WorkersRegistry;
 import org.apache.ignite.internal.processors.affinity.GridAffinityProcessor;
 import org.apache.ignite.internal.processors.authentication.IgniteAuthenticationProcessor;
@@ -700,6 +701,11 @@ public interface GridKernalContext extends Iterable<GridComponent> {
     public Thread.UncaughtExceptionHandler uncaughtExceptionHandler();
 
     /**
+     * @return Compression processor.
+     */
+    public CompressionProcessor compress();
+
+    /**
      * @return {@code True} if node is in recovery mode (before join to topology).
      */
     public boolean recoveryMode();

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index 8a42664..ef69167 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@ -49,6 +49,7 @@ import org.apache.ignite.internal.managers.failover.GridFailoverManager;
 import org.apache.ignite.internal.managers.indexing.GridIndexingManager;
 import org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerManager;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccProcessor;
+import org.apache.ignite.internal.processors.compress.CompressionProcessor;
 import org.apache.ignite.internal.worker.WorkersRegistry;
 import org.apache.ignite.internal.processors.affinity.GridAffinityProcessor;
 import org.apache.ignite.internal.processors.authentication.IgniteAuthenticationProcessor;
@@ -294,6 +295,10 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
 
     /** */
     @GridToStringExclude
+    private CompressionProcessor compressProc;
+
+    /** */
+    @GridToStringExclude
     private DataStructuresProcessor dataStructuresProc;
 
     /** Cache mvcc coordinators. */
@@ -639,6 +644,8 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
             internalSubscriptionProc = (GridInternalSubscriptionProcessor)comp;
         else if (comp instanceof IgniteAuthenticationProcessor)
             authProc = (IgniteAuthenticationProcessor)comp;
+        else if (comp instanceof CompressionProcessor)
+            compressProc = (CompressionProcessor)comp;
         else if (!(comp instanceof DiscoveryNodeValidationProcessor
             || comp instanceof PlatformPluginProcessor))
             assert (comp instanceof GridPluginComponent) : "Unknown manager class: " + comp.getClass();
@@ -1184,6 +1191,11 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
     }
 
     /** {@inheritDoc} */
+    @Override public CompressionProcessor compress() {
+        return compressProc;
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean recoveryMode() {
         return recoveryMode;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/IgniteComponentType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteComponentType.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteComponentType.java
index 0cd2fc1..65cbb90 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteComponentType.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteComponentType.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal;
 
 import java.lang.reflect.Constructor;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.compress.CompressionProcessor;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.plugin.extensions.communication.MessageFactory;
 import org.jetbrains.annotations.Nullable;
@@ -89,6 +90,12 @@ public enum IgniteComponentType {
         "org.apache.ignite.internal.processors.schedule.IgniteNoopScheduleProcessor",
         "org.apache.ignite.internal.processors.schedule.IgniteScheduleProcessor",
         "ignite-schedule"
+    ),
+
+    COMPRESSION(
+        CompressionProcessor.class.getName(),
+        "org.apache.ignite.internal.processors.compress.CompressionProcessorImpl",
+        "ignite-compress"
     );
 
     /** No-op class name. */

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/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 710fd09..284a4cb 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
@@ -236,6 +236,7 @@ import static org.apache.ignite.internal.GridKernalState.STARTED;
 import static org.apache.ignite.internal.GridKernalState.STARTING;
 import static org.apache.ignite.internal.GridKernalState.STOPPED;
 import static org.apache.ignite.internal.GridKernalState.STOPPING;
+import static org.apache.ignite.internal.IgniteComponentType.COMPRESSION;
 import static org.apache.ignite.internal.IgniteComponentType.HADOOP_HELPER;
 import static org.apache.ignite.internal.IgniteComponentType.IGFS;
 import static org.apache.ignite.internal.IgniteComponentType.IGFS_HELPER;
@@ -1002,6 +1003,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
             // Start processors before discovery manager, so they will
             // be able to start receiving messages once discovery completes.
             try {
+                startProcessor(COMPRESSION.createOptional(ctx));
                 startProcessor(new PdsConsistentIdProcessor(ctx));
                 startProcessor(new MvccProcessorImpl(ctx));
                 startProcessor(createComponent(DiscoveryNodeValidationProcessor.class, ctx));

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/pagemem/store/PageStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/store/PageStore.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/store/PageStore.java
index 7a7f964..7c1e15d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/store/PageStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/store/PageStore.java
@@ -17,9 +17,8 @@
 
 package org.apache.ignite.internal.pagemem.store;
 
-import org.apache.ignite.IgniteCheckedException;
-
 import java.nio.ByteBuffer;
+import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.processors.cache.persistence.StorageException;
 
 /**
@@ -128,4 +127,35 @@ public interface PageStore {
      * @throws StorageException If failed.
      */
     public void truncate(int tag) throws StorageException;
+
+    /**
+     * @return Page size in bytes.
+     */
+    public int getPageSize();
+
+    /**
+     * @return Storage block size or negative value if unknown or not supported.
+     */
+    public int getBlockSize();
+
+    /**
+     * @return Size of the storage in bytes. May differ from {@link #pages()} * {@link #getPageSize()}
+     *         due to delayed writes or due to other implementation specific details.
+     */
+    public long size();
+
+    /**
+     * @return Size of the storage adjusted for sparsity in bytes or negative
+     *         value if not supported. Should be less than or equal to {@link #size()}.
+     * @see #punchHole
+     */
+    public long getSparseSize();
+
+    /**
+     * Should free all the extra storage space after the given number of useful bytes in the given page.
+     *
+     * @param pageId Page id.
+     * @param usefulBytes Number of meaningful bytes from the beginning of the page.
+     */
+    void punchHole(long pageId, int usefulBytes);
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheCompressionManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheCompressionManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheCompressionManager.java
new file mode 100644
index 0000000..d9e977a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheCompressionManager.java
@@ -0,0 +1,95 @@
+/*
+ * 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.File;
+import java.nio.ByteBuffer;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DiskPageCompression;
+import org.apache.ignite.internal.pagemem.store.PageStore;
+import org.apache.ignite.internal.processors.compress.CompressionProcessor;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+import static org.apache.ignite.internal.processors.compress.CompressionProcessor.checkCompressionLevelBounds;
+import static org.apache.ignite.internal.processors.compress.CompressionProcessor.getDefaultCompressionLevel;
+
+/**
+ * Cache compression manager.
+ */
+public class CacheCompressionManager extends GridCacheManagerAdapter {
+    /** */
+    private DiskPageCompression diskPageCompression;
+
+    /** */
+    private int diskPageCompressLevel;
+
+    /** */
+    private CompressionProcessor compressProc;
+
+    /** {@inheritDoc} */
+    @Override protected void start0() throws IgniteCheckedException {
+        compressProc = cctx.kernalContext().compress();
+
+        CacheConfiguration cfg = cctx.config();
+
+        diskPageCompression = cfg.getDiskPageCompression();
+
+        if (diskPageCompression != null) {
+            if (!cctx.dataRegion().config().isPersistenceEnabled())
+                throw new IgniteCheckedException("Disk page compression makes sense only with enabled persistence.");
+
+            Integer lvl = cfg.getDiskPageCompressionLevel();
+            diskPageCompressLevel = lvl != null ?
+                checkCompressionLevelBounds(lvl, diskPageCompression) :
+                getDefaultCompressionLevel(diskPageCompression);
+
+            DataStorageConfiguration dsCfg = cctx.kernalContext().config().getDataStorageConfiguration();
+
+            File dbPath = cctx.kernalContext().pdsFolderResolver().resolveFolders().persistentStoreRootPath();
+
+            assert dbPath != null;
+
+            compressProc.checkPageCompressionSupported(dbPath.toPath(), dsCfg.getPageSize());
+
+            if (log.isInfoEnabled()) {
+                log.info("Disk page compression is enabled [cache=" + cctx.name() +
+                    ", compression=" + diskPageCompression + ", level=" + diskPageCompressLevel + "]");
+            }
+        }
+    }
+
+    /**
+     * @param page Page buffer.
+     * @param store Page store.
+     * @return Compressed or the same buffer.
+     * @throws IgniteCheckedException If failed.
+     */
+    public ByteBuffer compressPage(ByteBuffer page, PageStore store) throws IgniteCheckedException {
+        if (diskPageCompression == null)
+            return page;
+
+        int blockSize = store.getBlockSize();
+
+        if (blockSize <= 0)
+            throw new IgniteCheckedException("Failed to detect storage block size on " + U.osString());
+
+        return compressProc.compressPage(page, store.getPageSize(), blockSize, diskPageCompression, diskPageCompressLevel);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsMXBeanImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsMXBeanImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsMXBeanImpl.java
index 5ece77f..59894e3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsMXBeanImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsMXBeanImpl.java
@@ -28,15 +28,17 @@ import java.util.UUID;
 import java.util.concurrent.atomic.LongAdder;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.pagemem.store.PageStore;
 import org.apache.ignite.internal.processors.affinity.AffinityAssignment;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-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.distributed.dht.preloader.GridDhtPartitionFullMap;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
+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.AllocatedPageTracker;
 import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
 import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl;
+import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
 import org.apache.ignite.mxbean.CacheGroupMetricsMXBean;
 
 /**
@@ -359,4 +361,21 @@ public class CacheGroupMetricsMXBeanImpl implements CacheGroupMetricsMXBean {
     @Override public long getTotalAllocatedSize() {
         return getTotalAllocatedPages() * ctx.dataRegion().pageMemory().pageSize();
     }
+
+    /** {@inheritDoc} */
+    @Override public long getStorageSize() {
+        return database().forGroupPageStores(ctx, PageStore::size);
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSparseStorageSize() {
+        return database().forGroupPageStores(ctx, PageStore::getSparseSize);
+    }
+
+    /**
+     * @return Database.
+     */
+    private GridCacheDatabaseSharedManager database() {
+        return (GridCacheDatabaseSharedManager)ctx.shared().database();
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 30cf969..1a8cf88 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -177,6 +177,9 @@ public class GridCacheContext<K, V> implements Externalizable {
     /** Store manager. */
     private CacheStoreManager storeMgr;
 
+    /** Compression manager. */
+    private CacheCompressionManager compressMgr;
+
     /** Replication manager. */
     private GridCacheDrManager drMgr;
 
@@ -321,6 +324,7 @@ public class GridCacheContext<K, V> implements Externalizable {
          * ===========================
          */
 
+        CacheCompressionManager compressMgr,
         GridCacheEventManager evtMgr,
         CacheStoreManager storeMgr,
         CacheEvictionManager evictMgr,
@@ -338,6 +342,7 @@ public class GridCacheContext<K, V> implements Externalizable {
         assert cacheCfg != null;
         assert locStartTopVer != null : cacheCfg.getName();
 
+        assert compressMgr != null;
         assert grp != null;
         assert evtMgr != null;
         assert storeMgr != null;
@@ -364,6 +369,7 @@ public class GridCacheContext<K, V> implements Externalizable {
          * Managers in starting order!
          * ===========================
          */
+        this.compressMgr = add(compressMgr);
         this.evtMgr = add(evtMgr);
         this.storeMgr = add(storeMgr);
         this.evictMgr = add(evictMgr);
@@ -1230,6 +1236,13 @@ public class GridCacheContext<K, V> implements Externalizable {
     }
 
     /**
+     * @return Compression manager.
+     */
+    public CacheCompressionManager compress() {
+        return compressMgr;
+    }
+
+    /**
      * Sets cache object context.
      *
      * @param cacheObjCtx Cache object context.

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/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 ce81468..8a54852 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
@@ -1524,6 +1524,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         boolean nearEnabled = GridCacheUtils.isNearEnabled(cfg);
 
+        CacheCompressionManager compressMgr = new CacheCompressionManager();
         GridCacheAffinityManager affMgr = new GridCacheAffinityManager();
         GridCacheEventManager evtMgr = new GridCacheEventManager();
         CacheEvictionManager evictMgr = (nearEnabled || cfg.isOnheapCacheEnabled()) ? new GridCacheEvictionManager() : new CacheOffheapEvictionManager();
@@ -1558,6 +1559,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
              * Managers in starting order!
              * ===========================
              */
+            compressMgr,
             evtMgr,
             storeMgr,
             evictMgr,
@@ -1694,6 +1696,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                  * Managers in starting order!
                  * ===========================
                  */
+                compressMgr,
                 evtMgr,
                 storeMgr,
                 evictMgr,

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
index 03955a4..4565b58 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsImpl.java
@@ -93,6 +93,12 @@ public class DataStorageMetricsImpl implements DataStorageMetricsMXBean {
     /** */
     private volatile Collection<DataRegionMetrics> regionMetrics;
 
+    /** */
+    private volatile long storageSize;
+
+    /** */
+    private volatile long sparseStorageSize;
+
     /**
      * @param metricsEnabled Metrics enabled flag.
      * @param rateTimeInterval Rate time interval.
@@ -485,6 +491,16 @@ public class DataStorageMetricsImpl implements DataStorageMetricsMXBean {
         return metricsEnabled;
     }
 
+    /** {@inheritDoc} */
+    @Override public long getStorageSize() {
+        return storageSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSparseStorageSize() {
+        return sparseStorageSize;
+    }
+
     /**
      * @param lockWaitDuration Lock wait duration.
      * @param markDuration Mark duration.
@@ -503,7 +519,9 @@ public class DataStorageMetricsImpl implements DataStorageMetricsMXBean {
         long duration,
         long totalPages,
         long dataPages,
-        long cowPages
+        long cowPages,
+        long storageSize,
+        long sparseStorageSize
     ) {
         if (metricsEnabled) {
             lastCpLockWaitDuration = lockWaitDuration;
@@ -514,6 +532,8 @@ public class DataStorageMetricsImpl implements DataStorageMetricsMXBean {
             lastCpTotalPages = totalPages;
             lastCpDataPages = dataPages;
             lastCpCowPages = cowPages;
+            this.storageSize = storageSize;
+            this.sparseStorageSize = sparseStorageSize;
 
             totalCheckpointTime.addAndGet(duration);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java
index c3bcd5b..78b08bc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataStorageMetricsSnapshot.java
@@ -101,6 +101,12 @@ public class DataStorageMetricsSnapshot implements DataStorageMetrics {
     /** */
     private long totalAllocatedSize;
 
+    /** */
+    private long storageSize;
+
+    /** */
+    private long sparseStorageSize;
+
     /**
      * @param metrics Metrics.
      */
@@ -131,6 +137,8 @@ public class DataStorageMetricsSnapshot implements DataStorageMetrics {
         offHeapSize = metrics.getOffHeapSize();
         offHeadUsedSize = metrics.getOffheapUsedSize();
         totalAllocatedSize = metrics.getTotalAllocatedSize();
+        storageSize = metrics.getStorageSize();
+        sparseStorageSize = metrics.getSparseStorageSize();
     }
 
     /** {@inheritDoc} */
@@ -264,6 +272,16 @@ public class DataStorageMetricsSnapshot implements DataStorageMetrics {
     }
 
     /** {@inheritDoc} */
+    @Override public long getStorageSize() {
+        return storageSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSparseStorageSize() {
+        return sparseStorageSize;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(DataStorageMetricsSnapshot.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/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 ed54f65..9a083f8 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
@@ -54,6 +54,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.LongAdder;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 import java.util.function.Predicate;
+import java.util.function.ToLongFunction;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
@@ -398,6 +399,13 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                     : ctx.config().getFailureDetectionTimeout()));
     }
 
+    /**
+     * @return File store manager.
+     */
+    public FilePageStoreManager getFileStoreManager() {
+        return storeMgr;
+    }
+
     /** */
     private void notifyMetastorageReadyForRead() throws IgniteCheckedException {
         for (MetastorageLifecycleListener lsnr : metastorageLifecycleLsnrs)
@@ -1935,6 +1943,44 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     }
 
     /**
+     * @param f Consumer.
+     * @return Accumulated result for all page stores.
+     */
+    public long forAllPageStores(ToLongFunction<PageStore> f) {
+        long res = 0;
+
+        for (CacheGroupContext gctx : cctx.cache().cacheGroups())
+            res += forGroupPageStores(gctx, f);
+
+        return res;
+    }
+
+    /**
+     * @param gctx Group context.
+     * @param f Consumer.
+     * @return Accumulated result for all page stores.
+     */
+    public long forGroupPageStores(CacheGroupContext gctx, ToLongFunction<PageStore> f) {
+        int groupId = gctx.groupId();
+
+        long res = 0;
+
+        try {
+            Collection<PageStore> stores = storeMgr.getStores(groupId);
+
+            if (stores != null) {
+                for (PageStore store : stores)
+                    res += f.applyAsLong(store);
+            }
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+
+        return res;
+    }
+
+    /**
      * Calculates tail pointer for WAL at the end of logical recovery.
      *
      * @param from Start replay WAL from.
@@ -3263,28 +3309,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                                 tracker.totalDuration()));
                         }
                     }
-
-                    persStoreMetrics.onCheckpoint(
-                        tracker.lockWaitDuration(),
-                        tracker.markDuration(),
-                        tracker.pagesWriteDuration(),
-                        tracker.fsyncDuration(),
-                        tracker.totalDuration(),
-                        chp.pagesSize,
-                        tracker.dataPagesWritten(),
-                        tracker.cowPagesWritten());
-                }
-                else {
-                    persStoreMetrics.onCheckpoint(
-                        tracker.lockWaitDuration(),
-                        tracker.markDuration(),
-                        tracker.pagesWriteDuration(),
-                        tracker.fsyncDuration(),
-                        tracker.totalDuration(),
-                        chp.pagesSize,
-                        tracker.dataPagesWritten(),
-                        tracker.cowPagesWritten());
                 }
+
+                updateMetrics(chp, tracker);
             }
             catch (IgniteCheckedException e) {
                 if (chp != null)
@@ -3294,6 +3321,26 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
             }
         }
 
+        /**
+         * @param chp Checkpoint.
+         * @param tracker Tracker.
+         */
+        private void updateMetrics(Checkpoint chp, CheckpointMetricsTracker tracker) {
+            if (persStoreMetrics.metricsEnabled()) {
+                persStoreMetrics.onCheckpoint(
+                    tracker.lockWaitDuration(),
+                    tracker.markDuration(),
+                    tracker.pagesWriteDuration(),
+                    tracker.fsyncDuration(),
+                    tracker.totalDuration(),
+                    chp.pagesSize,
+                    tracker.dataPagesWritten(),
+                    tracker.cowPagesWritten(),
+                    forAllPageStores(PageStore::size),
+                    forAllPageStores(PageStore::getSparseSize));
+            }
+        }
+
         /** */
         private String prepareWalSegsCoveredMsg(IgniteBiTuple<Long, Long> walRange) {
             String res;

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AbstractFileIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AbstractFileIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AbstractFileIO.java
index d0211f4..d0aaef7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AbstractFileIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AbstractFileIO.java
@@ -56,7 +56,7 @@ public abstract class AbstractFileIO implements FileIO {
                     i += n;
                     time = 0;
                 }
-                else if (n == 0) {
+                else if (n == 0 || i > 0) {
                     if (!write && available(num - i, position + i) == 0)
                         return i;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AsyncFileIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AsyncFileIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AsyncFileIO.java
index fd00e25..7c6ece8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AsyncFileIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AsyncFileIO.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.cache.persistence.file;
 
 import java.io.File;
+import java.io.FileDescriptor;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.MappedByteBuffer;
@@ -25,8 +26,10 @@ import java.nio.channels.AsynchronousFileChannel;
 import java.nio.channels.CompletionHandler;
 import java.nio.file.OpenOption;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.compress.FileSystemUtils;
 import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.internal.U;
 
 /**
  * File I/O implementation based on {@link AsynchronousFileChannel}.
@@ -37,6 +40,12 @@ public class AsyncFileIO extends AbstractFileIO {
      */
     private final AsynchronousFileChannel ch;
 
+    /** Native file descriptor. */
+    private final int fd;
+
+    /** */
+    private final int fsBlockSize;
+
     /**
      * Channel's position.
      */
@@ -54,11 +63,36 @@ public class AsyncFileIO extends AbstractFileIO {
      * @param modes Open modes.
      */
     public AsyncFileIO(File file, ThreadLocal<ChannelOpFuture> holder, OpenOption... modes) throws IOException {
-        this.ch = AsynchronousFileChannel.open(file.toPath(), modes);
-
+        ch = AsynchronousFileChannel.open(file.toPath(), modes);
+        fd = getFileDescriptor(ch);
+        fsBlockSize = FileSystemUtils.getFileSystemBlockSize(fd);
         this.holder = holder;
     }
 
+    /**
+     * @param ch File channel.
+     * @return Native file descriptor.
+     */
+    private static int getFileDescriptor(AsynchronousFileChannel ch) {
+         FileDescriptor fd = U.field(ch, "fdObj");
+         return U.field(fd, "fd");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getFileSystemBlockSize() {
+        return fsBlockSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSparseSize() {
+        return FileSystemUtils.getSparseFileSize(fd);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int punchHole(long position, int len) {
+        return (int)FileSystemUtils.punchHole(fd, position, len, fsBlockSize);
+    }
+
     /** {@inheritDoc} */
     @Override public long position() throws IOException {
         return position;

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/EncryptedFileIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/EncryptedFileIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/EncryptedFileIO.java
index 86d9bbc..f21b8ee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/EncryptedFileIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/EncryptedFileIO.java
@@ -21,7 +21,6 @@ import java.io.IOException;
 import java.io.Serializable;
 import java.nio.ByteBuffer;
 import java.nio.MappedByteBuffer;
-
 import org.apache.ignite.internal.processors.cache.persistence.wal.crc.FastCrc;
 import org.apache.ignite.spi.encryption.EncryptionSpi;
 import org.apache.ignite.internal.managers.encryption.GridEncryptionManager;
@@ -100,6 +99,21 @@ public class EncryptedFileIO implements FileIO {
     }
 
     /** {@inheritDoc} */
+    @Override public int getFileSystemBlockSize() {
+        return -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSparseSize() {
+        return -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int punchHole(long position, int len) {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
     @Override public long position() throws IOException {
         return plainFileIO.position();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileIO.java
index 6f32d01..546d1a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileIO.java
@@ -253,4 +253,23 @@ public interface FileIO extends AutoCloseable {
      * @throws IOException If some I/O error occurs.
      */
     @Override public void close() throws IOException;
+
+    /**
+     * @return File system block size or negative value if unknown.
+     */
+    public int getFileSystemBlockSize();
+
+    /**
+     * @param position Starting file position.
+     * @param len Number of bytes to free.
+     * @return The actual freed size or negative value if not supported.
+     */
+    int punchHole(long position, int len);
+
+    /**
+     * @return Approximate system dependent size of the storage or negative
+     *          value if not supported.
+     * @see #punchHole
+     */
+    long getSparseSize();
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileIODecorator.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileIODecorator.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileIODecorator.java
index 8e79b54..c615a34 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileIODecorator.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileIODecorator.java
@@ -26,7 +26,7 @@ import java.nio.MappedByteBuffer;
  */
 public class FileIODecorator extends AbstractFileIO {
     /** File I/O delegate */
-    private final FileIO delegate;
+    protected final FileIO delegate;
 
     /**
      *
@@ -37,6 +37,21 @@ public class FileIODecorator extends AbstractFileIO {
     }
 
     /** {@inheritDoc} */
+    @Override public int getFileSystemBlockSize() {
+        return delegate.getFileSystemBlockSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSparseSize() {
+        return delegate.getSparseSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int punchHole(long pos, int len) {
+        return delegate.punchHole(pos, len);
+    }
+
+    /** {@inheritDoc} */
     @Override public long position() throws IOException {
         return delegate.position();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStore.java
index 16d74c3..a8fae08 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStore.java
@@ -27,8 +27,8 @@ import java.nio.file.Files;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
-
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteSystemProperties;
 import org.apache.ignite.configuration.DataStorageConfiguration;
 import org.apache.ignite.internal.pagemem.PageIdUtils;
@@ -71,7 +71,7 @@ public class FilePageStore implements PageStore {
     private final FileIOFactory ioFactory;
 
     /** I/O interface for read/write operations with file */
-    private volatile FileIO fileIO;
+    protected volatile FileIO fileIO;
 
     /** */
     private final AtomicLong allocated;
@@ -80,7 +80,7 @@ public class FilePageStore implements PageStore {
     private final AllocatedPageTracker allocatedTracker;
 
     /** */
-    private final int pageSize;
+    protected final int pageSize;
 
     /** */
     private volatile boolean inited;
@@ -105,7 +105,8 @@ public class FilePageStore implements PageStore {
         File file,
         FileIOFactory factory,
         DataStorageConfiguration cfg,
-        AllocatedPageTracker allocatedTracker) {
+        AllocatedPageTracker allocatedTracker
+    ) {
         this.type = type;
         this.cfgFile = file;
         this.dbCfg = cfg;
@@ -116,6 +117,38 @@ public class FilePageStore implements PageStore {
     }
 
     /** {@inheritDoc} */
+    @Override public int getPageSize() {
+        return pageSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getBlockSize() {
+        return -1; // Header is unaligned in this version.
+    }
+
+    /** {@inheritDoc} */
+    @Override public long size() {
+        try {
+            FileIO io = fileIO;
+
+            return io == null ? 0 : io.size();
+        }
+        catch (IOException e) {
+            throw new IgniteException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSparseSize() {
+        return -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void punchHole(long pageId, int usefulBytes) {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean exists() {
         return cfgFile.exists() && cfgFile.length() > headerSize();
     }
@@ -228,10 +261,8 @@ public class FilePageStore implements PageStore {
         if (fileSize == headerSize()) // Every file has a special meta page.
             fileSize = pageSize + headerSize();
 
-        if ((fileSize - headerSize()) % pageSize != 0)
-            throw new IOException(prefix + "(invalid file size)" +
-                " [fileSize=" + U.hexLong(fileSize) +
-                ", pageSize=" + U.hexLong(pageSize) + ']');
+        if (fileSize % pageSize != 0) // In the case of compressed pages we can miss the tail of the page.
+            fileSize = (fileSize / pageSize + 1) * pageSize;
 
         return fileSize;
     }
@@ -333,6 +364,26 @@ public class FilePageStore implements PageStore {
         }
     }
 
+    /**
+     * @param pageId Page ID.
+     * @param pageBuf Page buffer.
+     * @return Number of bytes to calculate CRC on.
+     */
+    private int getCrcSize(long pageId, ByteBuffer pageBuf) throws IOException {
+        int compressedSize = PageIO.getCompressedSize(pageBuf);
+
+        if (compressedSize == 0)
+            return pageSize; // Page is not compressed.
+
+        if (compressedSize < 0 || compressedSize > pageSize) {
+            throw new IgniteDataIntegrityViolationException("Failed to read page (CRC validation failed) " +
+                "[id=" + U.hexLong(pageId) + ", file=" + cfgFile.getAbsolutePath() + ", fileSize=" + fileIO.size() +
+                ", page=" + U.toHexString(pageBuf) + "]");
+        }
+
+        return compressedSize;
+    }
+
     /** {@inheritDoc} */
     @Override public void read(long pageId, ByteBuffer pageBuf, boolean keepCrc) throws IgniteCheckedException {
         init();
@@ -363,7 +414,7 @@ public class FilePageStore implements PageStore {
             pageBuf.position(0);
 
             if (!skipCrc) {
-                int curCrc32 = FastCrc.calcCrc(pageBuf, pageSize);
+                int curCrc32 = FastCrc.calcCrc(pageBuf, getCrcSize(pageId, pageBuf));
 
                 if ((savedCrc32 ^ curCrc32) != 0)
                     throw new IgniteDataIntegrityViolationException("Failed to read page (CRC validation failed) " +
@@ -549,7 +600,6 @@ public class FilePageStore implements PageStore {
                         "off=" + U.hexLong(off) + ", allocated=" + U.hexLong(allocated.get()) +
                             ", pageId=" + U.hexLong(pageId) + ", file=" + cfgFile.getPath();
 
-                    assert pageBuf.capacity() == pageSize;
                     assert pageBuf.position() == 0;
                     assert pageBuf.order() == ByteOrder.nativeOrder() : "Page buffer order " + pageBuf.order()
                         + " should be same with " + ByteOrder.nativeOrder();
@@ -559,7 +609,7 @@ public class FilePageStore implements PageStore {
                     if (calculateCrc && !skipCrc) {
                         assert PageIO.getCrc(pageBuf) == 0 : U.hexLong(pageId);
 
-                        PageIO.setCrc(pageBuf, calcCrc32(pageBuf, pageSize));
+                        PageIO.setCrc(pageBuf, calcCrc32(pageBuf, getCrcSize(pageId, pageBuf)));
                     }
 
                     // Check whether crc was calculated somewhere above the stack if it is forcibly skipped.

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
index 4a14c6b..86560ba 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
@@ -30,6 +30,7 @@ import java.nio.file.DirectoryStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.StandardCopyOption;
+import java.util.AbstractList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -54,6 +55,7 @@ import org.apache.ignite.internal.pagemem.store.IgnitePageStoreManager;
 import org.apache.ignite.internal.pagemem.store.PageStore;
 import org.apache.ignite.internal.processors.cache.CacheGroupContext;
 import org.apache.ignite.internal.processors.cache.CacheGroupDescriptor;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter;
 import org.apache.ignite.internal.processors.cache.StoredCacheData;
 import org.apache.ignite.internal.processors.cache.persistence.AllocatedPageTracker;
@@ -62,6 +64,7 @@ import org.apache.ignite.internal.processors.cache.persistence.StorageException;
 import org.apache.ignite.internal.processors.cache.persistence.filename.PdsFolderSettings;
 import org.apache.ignite.internal.processors.cache.persistence.metastorage.MetaStorage;
 import org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteCacheSnapshotManager;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
 import org.apache.ignite.internal.util.IgniteUtils;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.CU;
@@ -73,6 +76,7 @@ import org.jetbrains.annotations.Nullable;
 
 import static java.nio.file.Files.delete;
 import static java.nio.file.Files.newDirectoryStream;
+import static java.util.Objects.requireNonNull;
 
 /**
  * File page store manager.
@@ -461,6 +465,10 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
 
         try {
             store.read(pageId, pageBuf, keepCrc);
+
+            assert keepCrc || PageIO.getCrc(pageBuf) == 0: store.size() - store.pageOffset(pageId);
+
+            cctx.kernalContext().compress().decompressPage(pageBuf, store.getPageSize());
         }
         catch (StorageException e) {
             cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));
@@ -511,13 +519,40 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
      * @return PageStore to which the page has been written.
      * @throws IgniteCheckedException If IO error occurred.
      */
-    public PageStore writeInternal(int cacheId, long pageId, ByteBuffer pageBuf, int tag, boolean calculateCrc) throws IgniteCheckedException {
+    public PageStore writeInternal(int cacheId, long pageId, ByteBuffer pageBuf, int tag, boolean calculateCrc)
+        throws IgniteCheckedException {
         int partId = PageIdUtils.partId(pageId);
 
         PageStore store = getStore(cacheId, partId);
 
         try {
+            int pageSize = store.getPageSize();
+            int compressedPageSize = pageSize;
+
+            GridCacheContext cctx0 = cctx.cacheContext(cacheId);
+
+            if (cctx0 != null) {
+                assert pageBuf.position() == 0 && pageBuf.limit() == pageSize: pageBuf;
+
+                ByteBuffer compressedPageBuf = cctx0.compress().compressPage(pageBuf, store);
+
+                if (compressedPageBuf != pageBuf) {
+                    compressedPageSize = PageIO.getCompressedSize(compressedPageBuf);
+
+                    if (!calculateCrc) {
+                        calculateCrc = true;
+                        PageIO.setCrc(compressedPageBuf, 0); // It will be recalculated over compressed data further.
+                    }
+
+                    PageIO.setCrc(pageBuf, 0); // It is expected to be reset to 0 after each write.
+                    pageBuf = compressedPageBuf;
+                }
+            }
+
             store.write(pageId, pageBuf, tag, calculateCrc);
+
+            if (pageSize > compressedPageSize)
+                store.punchHole(pageId, compressedPageSize); // TODO maybe add async punch mode?
         }
         catch (StorageException e) {
             cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));
@@ -1048,6 +1083,15 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
 
     /**
      * @param grpId Cache group ID.
+     * @return Collection of related page stores.
+     * @throws IgniteCheckedException If failed.
+     */
+    public Collection<PageStore> getStores(int grpId) throws IgniteCheckedException {
+        return getHolder(grpId);
+    }
+
+    /**
+     * @param grpId Cache group ID.
      * @param partId Partition ID.
      * @return Page store for the corresponding parameters.
      * @throws IgniteCheckedException If cache or partition with the given ID was not created.
@@ -1125,7 +1169,7 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
     /**
      *
      */
-    private static class CacheStoreHolder {
+    private static class CacheStoreHolder extends AbstractList<PageStore> {
         /** Index store. */
         private final PageStore idxStore;
 
@@ -1133,11 +1177,20 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
         private final PageStore[] partStores;
 
         /**
-         *
          */
-        public CacheStoreHolder(PageStore idxStore, PageStore[] partStores) {
-            this.idxStore = idxStore;
-            this.partStores = partStores;
+        CacheStoreHolder(PageStore idxStore, PageStore[] partStores) {
+            this.idxStore = requireNonNull(idxStore);
+            this.partStores = requireNonNull(partStores);
+        }
+
+        /** {@inheritDoc} */
+        @Override public PageStore get(int idx) {
+            return requireNonNull(idx == partStores.length ? idxStore : partStores[idx]);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int size() {
+            return partStores.length + 1;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreV2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreV2.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreV2.java
index d8c800d..de078eb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreV2.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreV2.java
@@ -57,4 +57,25 @@ public class FilePageStoreV2 extends FilePageStore {
     @Override public int version() {
         return VERSION;
     }
+
+    /** {@inheritDoc} */
+    @Override public int getBlockSize() {
+        return fileIO.getFileSystemBlockSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSparseSize() {
+        FileIO io = fileIO;
+
+        return io == null ? 0 : fileIO.getSparseSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void punchHole(long pageId, int usefulBytes) {
+        assert usefulBytes >= 0 && usefulBytes < pageSize: usefulBytes;
+
+        long off = pageOffset(pageId);
+
+        fileIO.punchHole(off + usefulBytes, pageSize - usefulBytes);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/RandomAccessFileIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/RandomAccessFileIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/RandomAccessFileIO.java
index ef4a3df..c6922bc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/RandomAccessFileIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/RandomAccessFileIO.java
@@ -18,11 +18,14 @@
 package org.apache.ignite.internal.processors.cache.persistence.file;
 
 import java.io.File;
+import java.io.FileDescriptor;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.MappedByteBuffer;
 import java.nio.channels.FileChannel;
 import java.nio.file.OpenOption;
+import org.apache.ignite.internal.processors.compress.FileSystemUtils;
+import org.apache.ignite.internal.util.typedef.internal.U;
 
 /**
  * File I/O implementation based on {@link FileChannel}.
@@ -33,6 +36,12 @@ public class RandomAccessFileIO extends AbstractFileIO {
      */
     private final FileChannel ch;
 
+    /** Native file descriptor. */
+    private final int fd;
+
+    /** */
+    private final int fsBlockSize;
+
     /**
      * Creates I/O implementation for specified {@code file}
      *
@@ -41,6 +50,32 @@ public class RandomAccessFileIO extends AbstractFileIO {
      */
     public RandomAccessFileIO(File file, OpenOption... modes) throws IOException {
         ch = FileChannel.open(file.toPath(), modes);
+        fd = getNativeFileDescriptor(ch);
+        fsBlockSize = FileSystemUtils.getFileSystemBlockSize(fd);
+    }
+
+    /**
+     * @param ch File channel.
+     * @return Native file descriptor.
+     */
+    private static int getNativeFileDescriptor(FileChannel ch) {
+        FileDescriptor fd = U.field(ch, "fd");
+        return U.field(fd, "fd");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getFileSystemBlockSize() {
+        return fsBlockSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSparseSize() {
+        return FileSystemUtils.getSparseFileSize(fd);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int punchHole(long position, int len) {
+        return (int)FileSystemUtils.punchHole(fd, position, len, fsBlockSize);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/UnzipFileIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/UnzipFileIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/UnzipFileIO.java
index 6345b1f..5300d83 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/UnzipFileIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/UnzipFileIO.java
@@ -54,6 +54,21 @@ public class UnzipFileIO extends AbstractFileIO {
     }
 
     /** {@inheritDoc} */
+    @Override public int getFileSystemBlockSize() {
+        return -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSparseSize() {
+        return -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int punchHole(long position, int len) {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
     @Override public long position() throws IOException {
         return totalBytesRead;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
index b64b294..03f66c0 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
@@ -530,7 +530,7 @@ public class PageMemoryImpl implements PageMemoryEx {
             PageHeader.writeTimestamp(absPtr, U.currentTimeMillis());
             rwLock.init(absPtr + PAGE_LOCK_OFFSET, PageIdUtils.tag(pageId));
 
-            assert GridUnsafe.getInt(absPtr + PAGE_OVERHEAD + 4) == 0; //TODO GG-11480
+            assert PageIO.getCrc(absPtr + PAGE_OVERHEAD) == 0; //TODO GG-11480
 
             assert !PageHeader.isAcquired(absPtr) :
                 "Pin counter must be 0 for a new page [relPtr=" + U.hexLong(relPtr) +
@@ -808,9 +808,9 @@ public class PageMemoryImpl implements PageMemoryEx {
 
                     memMetrics.onPageRead();
                 }
-                catch (IgniteDataIntegrityViolationException ignore) {
+                catch (IgniteDataIntegrityViolationException e) {
                     U.warn(log, "Failed to read page (data integrity violation encountered, will try to " +
-                        "restore using existing WAL) [fullPageId=" + fullId + ']');
+                        "restore using existing WAL) [fullPageId=" + fullId + ']', e);
 
                     buf.rewind();
 
@@ -1252,8 +1252,8 @@ public class PageMemoryImpl implements PageMemoryEx {
 
             GridUnsafe.copyMemory(absPtr + PAGE_OVERHEAD, tmpPtr, pageSize());
 
-            assert GridUnsafe.getInt(absPtr + PAGE_OVERHEAD + 4) == 0; //TODO GG-11480
-            assert GridUnsafe.getInt(tmpPtr + 4) == 0; //TODO GG-11480
+            assert PageIO.getCrc(absPtr + PAGE_OVERHEAD) == 0; //TODO GG-11480
+            assert PageIO.getCrc(tmpPtr) == 0; //TODO GG-11480
         }
         else {
             byte[] arr = buf.array();
@@ -1402,7 +1402,7 @@ public class PageMemoryImpl implements PageMemoryEx {
         if (touch)
             PageHeader.writeTimestamp(absPtr, U.currentTimeMillis());
 
-        assert GridUnsafe.getInt(absPtr + PAGE_OVERHEAD + 4) == 0; //TODO GG-11480
+        assert PageIO.getCrc(absPtr + PAGE_OVERHEAD) == 0; //TODO GG-11480
 
         return absPtr + PAGE_OVERHEAD;
     }
@@ -1490,11 +1490,11 @@ public class PageMemoryImpl implements PageMemoryEx {
             PageHeader.dirty(absPtr, false);
             PageHeader.tempBufferPointer(absPtr, tmpRelPtr);
 
-            assert GridUnsafe.getInt(absPtr + PAGE_OVERHEAD + 4) == 0; //TODO GG-11480
-            assert GridUnsafe.getInt(tmpAbsPtr + PAGE_OVERHEAD + 4) == 0; //TODO GG-11480
+            assert PageIO.getCrc(absPtr + PAGE_OVERHEAD) == 0; //TODO GG-11480
+            assert PageIO.getCrc(tmpAbsPtr + PAGE_OVERHEAD) == 0; //TODO GG-11480
         }
 
-        assert GridUnsafe.getInt(absPtr + PAGE_OVERHEAD + 4) == 0; //TODO GG-11480
+        assert PageIO.getCrc(absPtr + PAGE_OVERHEAD) == 0; //TODO GG-11480
 
         return absPtr + PAGE_OVERHEAD;
     }
@@ -1522,7 +1522,7 @@ public class PageMemoryImpl implements PageMemoryEx {
 
         boolean pageWalRec = markDirty && walPlc != FALSE && (walPlc == TRUE || !wasDirty);
 
-        assert GridUnsafe.getInt(page + PAGE_OVERHEAD + 4) == 0; //TODO GG-11480
+        assert PageIO.getCrc(page + PAGE_OVERHEAD) == 0; //TODO GG-11480
 
         if (markDirty)
             setDirty(fullId, page, markDirty, false);


[23/50] [abbrv] ignite git commit: IGNITE-10002: MVCC: Create "Cache 2" test suite for MVCC mode. This closes #5198.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/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 ce8749c..dd6e36e 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
@@ -86,6 +86,7 @@ import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode;
 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.TransactionConcurrency;
@@ -140,6 +141,13 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
     }
 
     /** {@inheritDoc} */
+    @Override public void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
         super.afterTest();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheTxIteratorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheTxIteratorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheTxIteratorSelfTest.java
index c211590..e5bb583 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheTxIteratorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheTxIteratorSelfTest.java
@@ -27,8 +27,9 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.apache.ignite.configuration.TransactionConfiguration;
-import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
 import org.apache.ignite.internal.util.typedef.internal.S;
+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;
@@ -105,14 +106,14 @@ public class IgniteCacheTxIteratorSelfTest extends GridCommonAbstractTest {
         try {
             for (CacheMode mode : CacheMode.values()) {
                 for (CacheAtomicityMode atomMode : CacheAtomicityMode.values()) {
-                    if (mode == CacheMode.PARTITIONED && atomMode != CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) {
+                    if (mode == CacheMode.PARTITIONED) {
                         // Near cache makes sense only for partitioned cache.
                         checkTxCache(CacheMode.PARTITIONED, atomMode, true, false);
                     }
 
-                    checkTxCache(CacheMode.PARTITIONED, atomMode, false, true);
+                    checkTxCache(mode, atomMode, false, true);
 
-                    checkTxCache(CacheMode.PARTITIONED, atomMode, false, false);
+                    checkTxCache(mode, atomMode, false, false);
                 }
             }
         }
@@ -130,6 +131,13 @@ public class IgniteCacheTxIteratorSelfTest extends GridCommonAbstractTest {
         boolean nearEnabled,
         boolean useEvicPlc
     ) throws Exception {
+        if (atomMode == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) {
+            if (!MvccFeatureChecker.isSupported(mode) ||
+                (nearEnabled && !MvccFeatureChecker.isSupported(Feature.NEAR_CACHE)) ||
+                (useEvicPlc && !MvccFeatureChecker.isSupported(Feature.EVICTION)))
+                return; // Nothing to do. Mode is not supported.
+        }
+
         final Ignite ignite = grid(0);
 
         final CacheConfiguration<String, TestClass> ccfg = cacheConfiguration(
@@ -154,14 +162,11 @@ public class IgniteCacheTxIteratorSelfTest extends GridCommonAbstractTest {
 
                 for (TransactionIsolation iso : TransactionIsolation.values()) {
                     for (TransactionConcurrency con : TransactionConcurrency.values()) {
-                        try (Transaction transaction = ignite.transactions().txStart(con, iso)) {
-                            //TODO: IGNITE-7187: Fix when ticket will be implemented. (Near cache)
-                            //TODO: IGNITE-7956: Fix when ticket will be implemented. (Eviction)
-                            if (((IgniteCacheProxy)cache).context().mvccEnabled() &&
-                                ((iso != TransactionIsolation.REPEATABLE_READ && con != TransactionConcurrency.PESSIMISTIC)
-                                    || nearEnabled || useEvicPlc))
-                                return; // Nothing to do. Mode is not supported.
+                        if (atomMode == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT &&
+                            !MvccFeatureChecker.isSupported(con, iso))
+                            continue; // Mode not supported.
 
+                        try (Transaction transaction = ignite.transactions().txStart(con, iso)) {
                             assertEquals(val, cache.get(key));
 
                             transaction.commit();

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteMvccTxTimeoutAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteMvccTxTimeoutAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteMvccTxTimeoutAbstractTest.java
new file mode 100644
index 0000000..15d23f4
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteMvccTxTimeoutAbstractTest.java
@@ -0,0 +1,146 @@
+/*
+ * 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;
+
+import java.util.Random;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.TransactionConfiguration;
+import org.apache.ignite.internal.util.typedef.X;
+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.transactions.TransactionTimeoutException;
+
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
+
+/**
+ * Simple cache test.
+ */
+public class IgniteMvccTxTimeoutAbstractTest extends GridCommonAbstractTest {
+    /** Random number generator. */
+    private static final Random RAND = new Random();
+
+    /** Grid count. */
+    private static final int GRID_COUNT = 2;
+
+    /** Transaction timeout. */
+    private static final long TIMEOUT = 50;
+
+    /** */
+    private TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Override protected void beforeTestsStarted() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-7388");
+
+        startGridsMultiThreaded(GRID_COUNT, true);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
+
+        TransactionConfiguration txCfg = c.getTransactionConfiguration();
+
+        txCfg.setDefaultTxTimeout(TIMEOUT);
+
+        TcpDiscoverySpi spi = new TcpDiscoverySpi();
+
+        spi.setIpFinder(ipFinder);
+
+        c.setDiscoverySpi(spi);
+
+        return c;
+    }
+
+    /**
+     * @param i Grid index.
+     * @return Cache.
+     */
+    @Override protected <K, V> IgniteCache<K, V> jcache(int i) {
+        return grid(i).cache(DEFAULT_CACHE_NAME);
+    }
+
+    /**
+     * @throws IgniteCheckedException If test failed.
+     */
+    public void testPessimisticRepeatableRead() throws Exception {
+        checkTransactionTimeout(PESSIMISTIC, REPEATABLE_READ);
+    }
+
+    /**
+     * @param concurrency Concurrency.
+     * @param isolation Isolation.
+     * @throws IgniteCheckedException If test failed.
+     */
+    private void checkTransactionTimeout(TransactionConcurrency concurrency,
+        TransactionIsolation isolation) throws Exception {
+        int idx = RAND.nextInt(GRID_COUNT);
+
+        IgniteCache<Integer, String> cache = jcache(idx);
+
+        Transaction tx = ignite(idx).transactions().txStart(concurrency, isolation, TIMEOUT, 0);
+
+        try {
+            info("Storing value in cache [key=1, val=1]");
+
+            cache.put(1, "1");
+
+            long sleep = TIMEOUT * 2;
+
+            info("Going to sleep for (ms): " + sleep);
+
+            Thread.sleep(sleep);
+
+            info("Storing value in cache [key=1, val=2]");
+
+            cache.put(1, "2");
+
+            info("Committing transaction: " + tx);
+
+            tx.commit();
+
+            assert false : "Timeout never happened for transaction: " + tx;
+        }
+        catch (Exception e) {
+            if (!(X.hasCause(e, TransactionTimeoutException.class)))
+                throw e;
+
+            info("Received expected timeout exception [msg=" + e.getMessage() + ", tx=" + tx + ']');
+        }
+        finally {
+            tx.close();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java
index a0ec70a..4cd64e3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java
@@ -17,13 +17,15 @@
 
 package org.apache.ignite.internal.processors.cache.distributed;
 
-import java.util.ArrayList;
-import java.util.List;
 import java.util.Random;
-import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.TransactionConfiguration;
 import org.apache.ignite.internal.util.typedef.X;
+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;
@@ -46,25 +48,41 @@ public class IgniteTxTimeoutAbstractTest extends GridCommonAbstractTest {
     /** Grid count. */
     private static final int GRID_COUNT = 2;
 
-    /** Grid instances. */
-    private static final List<Ignite> IGNITEs = new ArrayList<>();
-
     /** Transaction timeout. */
     private static final long TIMEOUT = 50;
 
+    /** */
+    private TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
     /**
      * @throws Exception If failed.
      */
     @Override protected void beforeTestsStarted() throws Exception {
-        for (int i = 0; i < GRID_COUNT; i++)
-            IGNITEs.add(startGrid(i));
+        startGridsMultiThreaded(GRID_COUNT);
     }
 
     /**
      * @throws Exception If failed.
      */
     @Override protected void afterTestsStopped() throws Exception {
-        IGNITEs.clear();
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
+
+        TransactionConfiguration txCfg = c.getTransactionConfiguration();
+
+        txCfg.setDefaultTxTimeout(TIMEOUT);
+
+        TcpDiscoverySpi spi = new TcpDiscoverySpi();
+
+        spi.setIpFinder(ipFinder);
+
+        c.setDiscoverySpi(spi);
+
+        return c;
     }
 
     /**
@@ -72,7 +90,7 @@ public class IgniteTxTimeoutAbstractTest extends GridCommonAbstractTest {
      * @return Cache.
      */
     @Override protected <K, V> IgniteCache<K, V> jcache(int i) {
-        return IGNITEs.get(i).cache(DEFAULT_CACHE_NAME);
+        return grid(i).cache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -124,7 +142,6 @@ public class IgniteTxTimeoutAbstractTest extends GridCommonAbstractTest {
      */
     private void checkTransactionTimeout(TransactionConcurrency concurrency,
         TransactionIsolation isolation) throws Exception {
-
         int idx = RAND.nextInt(GRID_COUNT);
 
         IgniteCache<Integer, String> cache = jcache(idx);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedMvccTxSingleThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedMvccTxSingleThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedMvccTxSingleThreadedSelfTest.java
new file mode 100644
index 0000000..717d771
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedMvccTxSingleThreadedSelfTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.CacheWriteSynchronizationMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.processors.cache.IgniteMvccTxSingleThreadedAbstractTest;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheRebalanceMode.NONE;
+
+/**
+ * Test Mvcc txs in single-threaded mode for colocated cache.
+ */
+public class GridCacheColocatedMvccTxSingleThreadedSelfTest extends IgniteMvccTxSingleThreadedAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        CacheConfiguration<?, ?> ccfg = defaultCacheConfiguration();
+
+        ccfg.setCacheMode(PARTITIONED);
+        ccfg.setBackups(1);
+        ccfg.setNearConfiguration(null);
+        ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
+
+        ccfg.setEvictionPolicy(null);
+
+        ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_ASYNC);
+
+        ccfg.setRebalanceMode(NONE);
+
+        cfg.setCacheConfiguration(ccfg);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 4;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int keyCount() {
+        return 3;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int maxKeyValue() {
+        return 3;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int iterations() {
+        return 3000;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean isTestDebug() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean printMemoryStats() {
+        return true;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
index 5aa6510..853763e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
@@ -37,6 +37,7 @@ import org.apache.ignite.lang.IgniteBiTuple;
 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;
 
@@ -78,6 +79,10 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest {
 
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+        super.beforeTestsStarted();
+
         startGridsMultiThreaded(GRID_CNT);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java
index bd0af34..5456e4c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java
@@ -27,6 +27,7 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCach
 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;
@@ -44,6 +45,13 @@ public class GridCacheDhtMappingSelfTest extends GridCommonAbstractTest {
     private TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java
index 66efc18..d8bc44a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java
@@ -40,6 +40,7 @@ import org.apache.ignite.lang.IgnitePredicate;
 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;
@@ -73,6 +74,13 @@ public class GridCacheDhtPreloadDisabledSelfTest extends GridCommonAbstractTest
     /** IP finder. */
     private TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+        super.beforeTestsStarted();
+    }
+
     /**
      *
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMultiThreadedSelfTest.java
index 6c32a67..5f7be7a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMultiThreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMultiThreadedSelfTest.java
@@ -33,6 +33,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.jetbrains.annotations.Nullable;
 
@@ -137,6 +138,8 @@ public class GridCacheDhtPreloadMultiThreadedSelfTest extends GridCommonAbstract
      * @throws Exception If failed.
      */
     public void testConcurrentNodesStartStop() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
         try {
             multithreadedAsync(
                 new Callable<Object>() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java
index 71911e8..a62984a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java
@@ -33,6 +33,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.jetbrains.annotations.Nullable;
 
@@ -163,6 +164,9 @@ public class GridCacheDhtPreloadPutGetSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testPutGetNone1() throws Exception {
+        if (MvccFeatureChecker.forcedMvcc())
+            fail("https://issues.apache.org/jira/browse/IGNITE-10261");
+
         preloadMode = NONE;
         backups = 1;
 
@@ -173,6 +177,9 @@ public class GridCacheDhtPreloadPutGetSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testPutGetNone2() throws Exception {
+        if (MvccFeatureChecker.forcedMvcc())
+            fail("https://issues.apache.org/jira/browse/IGNITE-10261");
+
         preloadMode = NONE;
         backups = 2;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
index e47d775..76b1424 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
@@ -212,7 +212,6 @@ public class GridCacheDhtPreloadSelfTest extends GridCommonAbstractTest {
      */
     private void checkActivePartitionTransfer(int keyCnt, int nodeCnt, boolean sameCoord, boolean shuffle)
         throws Exception {
-
         try {
             Ignite ignite1 = startGrid(0);
 
@@ -456,7 +455,6 @@ public class GridCacheDhtPreloadSelfTest extends GridCommonAbstractTest {
      */
     private void checkNodes(int keyCnt, int nodeCnt, boolean sameCoord, boolean shuffle)
         throws Exception {
-
         try {
             Ignite ignite1 = startGrid(0);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheClearDuringRebalanceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheClearDuringRebalanceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheClearDuringRebalanceTest.java
index 8561c5c..5194020 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheClearDuringRebalanceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheClearDuringRebalanceTest.java
@@ -28,6 +28,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.PARTITIONED;
@@ -43,6 +44,14 @@ public class IgniteCacheClearDuringRebalanceTest extends GridCommonAbstractTest
     private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        if(MvccFeatureChecker.forcedMvcc())
+            fail("https://issues.apache.org/jira/browse/IGNITE-7952");
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
         super.afterTest();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePartitionedBackupNodeFailureRecoveryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePartitionedBackupNodeFailureRecoveryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePartitionedBackupNodeFailureRecoveryTest.java
index 98520ab..6cecce1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePartitionedBackupNodeFailureRecoveryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePartitionedBackupNodeFailureRecoveryTest.java
@@ -44,7 +44,7 @@ import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
 /**
  */
 public class IgniteCachePartitionedBackupNodeFailureRecoveryTest extends IgniteCacheAbstractTest {
-    /** {@inheritDoc}*/
+  /** {@inheritDoc}*/
     @Override protected int gridCount() {
         return 3;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearClientHitTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearClientHitTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearClientHitTest.java
index fd378b7..6663a67 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearClientHitTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearClientHitTest.java
@@ -71,14 +71,11 @@ public class GridCacheNearClientHitTest extends GridCommonAbstractTest {
         CacheConfiguration<Object, Object> cfg = new CacheConfiguration<>();
 
         cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
-
         cfg.setCacheMode(CacheMode.PARTITIONED);
-
         cfg.setBackups(1);
-
         cfg.setCopyOnRead(false);
-
         cfg.setName(CACHE_NAME);
+        cfg.setNearConfiguration(new NearCacheConfiguration<>());
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java
index 3e13ccd..4633161 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java
@@ -20,12 +20,13 @@ package org.apache.ignite.internal.processors.cache.distributed.near;
 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.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.cache.affinity.Affinity;
 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.internal.processors.cache.GridCacheProcessor;
 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;
@@ -35,9 +36,9 @@ import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
 import org.apache.ignite.transactions.TransactionOptimisticException;
-import org.apache.log4j.Level;
 
 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.CacheRebalanceMode.NONE;
 import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
@@ -50,9 +51,6 @@ import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
  * Test getting the same value twice within the same transaction.
  */
 public class GridCacheNearMultiGetSelfTest extends GridCommonAbstractTest {
-    /** Cache debug flag. */
-    private static final boolean CACHE_DEBUG = false;
-
     /** Number of gets. */
     private static final int GET_CNT = 5;
 
@@ -62,40 +60,47 @@ public class GridCacheNearMultiGetSelfTest extends GridCommonAbstractTest {
     /** */
     private TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 
+    /** */
+    private CacheAtomicityMode atomicityMode;
+
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
 
-        c.getTransactionConfiguration().setTxSerializableEnabled(true);
-
-        CacheConfiguration cc = defaultCacheConfiguration();
-
-        cc.setCacheMode(PARTITIONED);
-        cc.setBackups(1);
-        cc.setAtomicityMode(TRANSACTIONAL);
-
-        cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
-
-        cc.setRebalanceMode(NONE);
-
         TcpDiscoverySpi spi = new TcpDiscoverySpi();
 
         spi.setIpFinder(ipFinder);
 
         c.setDiscoverySpi(spi);
 
-        c.setCacheConfiguration(cc);
+        return c;
+    }
 
-        if (CACHE_DEBUG)
-            resetLog4j(Level.DEBUG, false, GridCacheProcessor.class.getPackage().getName());
+    /**
+     * @return Cache configuration.
+     */
+    private CacheConfiguration cacheConfiguration() {
+        CacheConfiguration cc = defaultCacheConfiguration();
 
-        return c;
+        cc.setCacheMode(PARTITIONED);
+        cc.setBackups(1);
+        cc.setAtomicityMode(atomicityMode);
+        cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+        cc.setRebalanceMode(NONE);
+        cc.setNearConfiguration(new NearCacheConfiguration());
+
+        return cc;
     }
 
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
-        for (int i = 0; i < GRID_CNT; i++)
-            startGrid(i);
+        startGridsMultiThreaded(GRID_CNT);
+    }
+
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        atomicityMode = TRANSACTIONAL;
     }
 
     /** {@inheritDoc} */
@@ -110,6 +115,8 @@ public class GridCacheNearMultiGetSelfTest extends GridCommonAbstractTest {
             assertEquals("Cache size mismatch for grid [igniteInstanceName=" + g.name() +
                     ", entrySet=" + entrySet(c) + ']', 0, c.size());
         }
+
+        grid(0).destroyCache(DEFAULT_CACHE_NAME);
     }
 
     /** @return {@code True} if debug enabled. */
@@ -213,6 +220,24 @@ public class GridCacheNearMultiGetSelfTest extends GridCommonAbstractTest {
         checkDoubleGet(PESSIMISTIC, SERIALIZABLE, true);
     }
 
+    /** @throws Exception If failed. */
+    public void testMvccPessimisticRepeatableReadNoPut() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-7187");
+
+        atomicityMode = TRANSACTIONAL_SNAPSHOT;
+
+        checkDoubleGet(PESSIMISTIC, REPEATABLE_READ, false);
+    }
+
+    /** @throws Exception If failed. */
+    public void testMvccPessimisticRepeatableReadWithPut() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-7187");
+
+        atomicityMode = TRANSACTIONAL_SNAPSHOT;
+
+        checkDoubleGet(PESSIMISTIC, REPEATABLE_READ, true);
+    }
+
     /**
      * @param concurrency Concurrency.
      * @param isolation Isolation.
@@ -222,7 +247,7 @@ public class GridCacheNearMultiGetSelfTest extends GridCommonAbstractTest {
     private void checkDoubleGet(TransactionConcurrency concurrency, TransactionIsolation isolation, boolean put)
         throws Exception {
         IgniteEx ignite = grid(0);
-        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
+        IgniteCache<Integer, String> cache = ignite.getOrCreateCache(cacheConfiguration());
 
         Integer key = 1;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
index e83b14a..875284d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
@@ -56,6 +56,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 org.apache.ignite.transactions.Transaction;
 import org.jetbrains.annotations.Nullable;
@@ -79,6 +80,15 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
     /** Cache store. */
     private static TestStore store = new TestStore();
 
+    /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
+        super.setUp();
+    }
+
     /** */
     private TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
index 1595350..2b4b60c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
@@ -26,10 +26,12 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 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.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 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;
 
@@ -46,6 +48,13 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
     /** Cache store. */
     private static TestStore store = new TestStore();
 
+    /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+        super.setUp();
+    }
+
     /**
      *
      */
@@ -80,8 +89,8 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
         cacheCfg.setCacheMode(PARTITIONED);
         cacheCfg.setBackups(1);
         cacheCfg.setAtomicityMode(TRANSACTIONAL);
-
         cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+        cacheCfg.setNearConfiguration(new NearCacheConfiguration());
 
         cacheCfg.setCacheStoreFactory(singletonFactory(store));
         cacheCfg.setReadThrough(true);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearPartitionedClearSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearPartitionedClearSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearPartitionedClearSelfTest.java
index cbdc855..90a7406 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearPartitionedClearSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearPartitionedClearSelfTest.java
@@ -29,6 +29,7 @@ import org.apache.ignite.internal.util.typedef.G;
 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;
@@ -57,6 +58,13 @@ public class GridCacheNearPartitionedClearSelfTest extends GridCommonAbstractTes
     private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
         startGrids(GRID_CNT);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReaderPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReaderPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReaderPreloadSelfTest.java
index e143260..316cc6e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReaderPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReaderPreloadSelfTest.java
@@ -30,6 +30,7 @@ import org.apache.ignite.internal.util.typedef.G;
 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;
@@ -62,6 +63,13 @@ public class GridCacheNearReaderPreloadSelfTest extends GridCommonAbstractTest {
     private IgniteCache<Integer, Integer> cache3;
 
     /** {@inheritDoc} */
+    @Override public void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
         cache1 = null;
         cache2 = null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
index e30106c..88a757d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
@@ -48,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.CacheAtomicityMode.ATOMIC;
@@ -67,12 +68,19 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
     private TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 
     /** Grid counter. */
-    private static AtomicInteger cntr = new AtomicInteger(0);
+    private AtomicInteger cntr = new AtomicInteger(0);
 
     /** Test cache affinity. */
     private GridCacheModuloAffinityFunction aff = new GridCacheModuloAffinityFunction();
 
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedBasicStoreMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedBasicStoreMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedBasicStoreMultiNodeSelfTest.java
index 91c9b22..73d5b5f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedBasicStoreMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedBasicStoreMultiNodeSelfTest.java
@@ -33,6 +33,7 @@ import org.apache.ignite.internal.util.typedef.F;
 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;
 
@@ -72,6 +73,11 @@ public class GridCachePartitionedBasicStoreMultiNodeSelfTest extends GridCommonA
 
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+        if (nearCacheConfiguration() != null)
+            MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
         super.beforeTestsStarted();
 
         stores = Collections.synchronizedList(new ArrayList<GridCacheTestStore>());

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/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/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java
index 96fb8f6..28afce1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java
@@ -33,6 +33,7 @@ import org.apache.ignite.lang.IgniteFuture;
 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;
@@ -51,6 +52,13 @@ public class GridCachePartitionedExplicitLockNodeFailureSelfTest extends GridCom
     public static final int GRID_CNT = 4;
 
     /** {@inheritDoc} */
+    @Override public void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java
index 9474950..2ad8b50 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java
@@ -29,6 +29,7 @@ import org.apache.ignite.lang.IgniteBiInClosure;
 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.jetbrains.annotations.Nullable;
 
@@ -49,6 +50,13 @@ public class GridCachePartitionedLoadCacheSelfTest extends GridCommonAbstractTes
     private static final int PUT_CNT = 100;
 
     /** {@inheritDoc} */
+    @Override public void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxMultiThreadedSelfTest.java
new file mode 100644
index 0000000..184132e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxMultiThreadedSelfTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.near;
+
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.processors.cache.IgniteMvccTxMultiThreadedAbstractTest;
+import org.apache.ignite.testframework.MvccFeatureChecker;
+
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Tests for partitioned cache transactions.
+ */
+public class GridCachePartitionedMvccTxMultiThreadedSelfTest extends IgniteMvccTxMultiThreadedAbstractTest {
+    @Override protected void beforeTestsStarted() throws Exception {
+        if (nearEnabled())
+            MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        CacheConfiguration<?, ?> ccfg = defaultCacheConfiguration();
+
+        ccfg.setCacheMode(PARTITIONED);
+        ccfg.setBackups(1);
+
+        ccfg.setEvictionPolicy(null);
+
+        ccfg.setWriteSynchronizationMode(FULL_SYNC);
+
+        ccfg.setNearConfiguration(nearEnabled() ? new NearCacheConfiguration() : null);
+
+        cfg.setCacheConfiguration(ccfg);
+
+        return cfg;
+    }
+
+    /**
+     * @return {@code True} if near cache is enabled.
+     */
+    protected boolean nearEnabled() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 3;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int keyCount() {
+        return 3;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int maxKeyValue() {
+        return 3;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int threadCount() {
+        return 5;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int iterations() {
+        return 1000;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean isTestDebug() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean printMemoryStats() {
+        return true;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxSingleThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxSingleThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxSingleThreadedSelfTest.java
new file mode 100644
index 0000000..1404839
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxSingleThreadedSelfTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.near;
+
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.processors.cache.IgniteMvccTxSingleThreadedAbstractTest;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheRebalanceMode.NONE;
+
+/**
+ * Tests for partitioned cache transactions.
+ */
+public class GridCachePartitionedMvccTxSingleThreadedSelfTest extends IgniteMvccTxSingleThreadedAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        CacheConfiguration<?, ?> ccfg = defaultCacheConfiguration();
+
+        ccfg.setCacheMode(PARTITIONED);
+        ccfg.setBackups(1);
+        ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
+
+        ccfg.setNearConfiguration(null);
+        ccfg.setEvictionPolicy(null);
+
+        ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_ASYNC);
+
+        ccfg.setRebalanceMode(NONE);
+
+        cfg.setCacheConfiguration(ccfg);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 4;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int keyCount() {
+        return 3;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int maxKeyValue() {
+        return 3;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int iterations() {
+        return 3000;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean isTestDebug() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean printMemoryStats() {
+        return true;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxTimeoutSelfTest.java
new file mode 100644
index 0000000..aad95aa
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxTimeoutSelfTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.near;
+
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteMvccTxTimeoutAbstractTest;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+
+/**
+ * Simple cache test.
+ */
+public class GridCachePartitionedMvccTxTimeoutSelfTest extends IgniteMvccTxTimeoutAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
+
+        CacheConfiguration cc = defaultCacheConfiguration();
+
+        cc.setCacheMode(PARTITIONED);
+        cc.setBackups(1);
+        cc.setAtomicityMode(TRANSACTIONAL);
+
+        //cacheCfg.setPreloadMode(NONE);
+
+        c.setCacheConfiguration(cc);
+
+        return c;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
index da802e3..7f25cba 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
@@ -56,7 +56,6 @@ public class GridCachePartitionedPreloadLifecycleSelfTest extends GridCachePrelo
         cc1.setRebalanceMode(preloadMode);
         cc1.setEvictionPolicy(null);
         cc1.setCacheStoreFactory(null);
-        cc1.setEvictionPolicy(null);
 
         // Identical configuration.
         CacheConfiguration cc2 = new CacheConfiguration(cc1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxTimeoutSelfTest.java
index 202476e..1a88ae0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxTimeoutSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxTimeoutSelfTest.java
@@ -19,11 +19,7 @@ package org.apache.ignite.internal.processors.cache.distributed.near;
 
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.TransactionConfiguration;
 import org.apache.ignite.internal.processors.cache.distributed.IgniteTxTimeoutAbstractTest;
-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 static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -32,27 +28,10 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
  * Simple cache test.
  */
 public class GridCachePartitionedTxTimeoutSelfTest extends IgniteTxTimeoutAbstractTest {
-    /** Transaction timeout. */
-    private static final long TIMEOUT = 50;
-
-    /** */
-    private TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
 
-        TransactionConfiguration txCfg = c.getTransactionConfiguration();
-
-        txCfg.setTxSerializableEnabled(true);
-        txCfg.setDefaultTxTimeout(TIMEOUT);
-
-        TcpDiscoverySpi spi = new TcpDiscoverySpi();
-
-        spi.setIpFinder(ipFinder);
-
-        c.setDiscoverySpi(spi);
-
         CacheConfiguration cc = defaultCacheConfiguration();
 
         cc.setCacheMode(PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheStoreUpdateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheStoreUpdateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheStoreUpdateTest.java
index bf8ad78..02a9223 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheStoreUpdateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheStoreUpdateTest.java
@@ -39,6 +39,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.apache.ignite.internal.IgniteInternalFuture;
 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.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
@@ -60,6 +61,14 @@ public class GridNearCacheStoreUpdateTest extends GridCommonAbstractTest {
     private IgniteCache<String, String> cache;
 
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE);
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception {
         final IgniteConfiguration cfg = super.getConfiguration(gridName);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java
index d253013..e1ca01f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java
@@ -34,6 +34,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.CacheWriteSynchronizationMode.FULL_SYNC;
 
@@ -60,6 +61,13 @@ public class NearCacheSyncUpdateTest extends GridCommonAbstractTest {
         startGridsMultiThreaded(3);
     }
 
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+
+        super.afterTestsStopped();
+    }
+
     /**
      * @throws Exception If failed.
      */
@@ -75,6 +83,15 @@ public class NearCacheSyncUpdateTest extends GridCommonAbstractTest {
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testNearCacheSyncUpdateMvccTx() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-7187");
+
+        nearCacheSyncUpdateTx(TRANSACTIONAL_SNAPSHOT);
+    }
+
+    /**
      * @param atomicityMode Atomicity mode.
      * @throws Exception If failed.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java
index c1123cb..109dbff 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java
@@ -45,9 +45,18 @@ public class NoneRebalanceModeSelfTest extends GridCommonAbstractTest {
 
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
         startGrid(0);
     }
 
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+
+        super.afterTestsStopped();
+    }
+
     /**
      * @throws Exception If failed.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxTimeoutSelfTest.java
index a63a302..9a748ba 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxTimeoutSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxTimeoutSelfTest.java
@@ -20,9 +20,6 @@ package org.apache.ignite.internal.processors.cache.distributed.replicated;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.processors.cache.distributed.IgniteTxTimeoutAbstractTest;
-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 static org.apache.ignite.cache.CacheMode.REPLICATED;
 
@@ -30,31 +27,16 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED;
  * Simple cache test.
  */
 public class GridCacheReplicatedTxTimeoutSelfTest extends IgniteTxTimeoutAbstractTest {
-    /** Transaction timeout. */
-    private static final long TIMEOUT = 50;
-
-    /** */
-    private TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
 
-        c.getTransactionConfiguration().setDefaultTxTimeout(TIMEOUT);
-        c.getTransactionConfiguration().setTxSerializableEnabled(true);
-
         CacheConfiguration cc = defaultCacheConfiguration();
 
         cc.setCacheMode(REPLICATED);
 
         c.setCacheConfiguration(cc);
 
-        TcpDiscoverySpi spi = new TcpDiscoverySpi();
-
-        spi.setIpFinder(ipFinder);
-
-        c.setDiscoverySpi(spi);
-
         return c;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalBasicApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalBasicApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalBasicApiSelfTest.java
index d35590f..91df599 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalBasicApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalBasicApiSelfTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.local;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.processors.cache.GridCacheBasicApiAbstractTest;
+import org.apache.ignite.testframework.MvccFeatureChecker;
 
 import static org.apache.ignite.cache.CacheMode.LOCAL;
 
@@ -28,6 +29,13 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
  */
 public class GridCacheLocalBasicApiSelfTest extends GridCacheBasicApiAbstractTest {
     /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+        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/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalBasicStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalBasicStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalBasicStoreSelfTest.java
index 183b456..5d6492b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalBasicStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalBasicStoreSelfTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache.local;
 
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.internal.processors.cache.GridCacheBasicStoreAbstractTest;
+import org.apache.ignite.testframework.MvccFeatureChecker;
 
 import static org.apache.ignite.cache.CacheMode.LOCAL;
 
@@ -27,6 +28,13 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
  */
 public class GridCacheLocalBasicStoreSelfTest extends GridCacheBasicStoreAbstractTest {
     /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+        super.setUp();
+    }
+
+    /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return LOCAL;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalEventSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalEventSelfTest.java
index 0bf01c2..c0b6071 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalEventSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalEventSelfTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache.local;
 
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.internal.processors.cache.distributed.GridCacheEventAbstractTest;
+import org.apache.ignite.testframework.MvccFeatureChecker;
 
 import static org.apache.ignite.cache.CacheMode.LOCAL;
 
@@ -27,6 +28,14 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
  */
 public class GridCacheLocalEventSelfTest extends GridCacheEventAbstractTest {
     /** {@inheritDoc} */
+    @Override public void beforeTestsStarted() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return LOCAL;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalEvictionEventSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalEvictionEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalEvictionEventSelfTest.java
index b2d98c6..7406689 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalEvictionEventSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalEvictionEventSelfTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.local;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.internal.processors.cache.GridCacheEvictionEventAbstractTest;
+import org.apache.ignite.testframework.MvccFeatureChecker;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 
@@ -28,6 +29,13 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
  */
 public class GridCacheLocalEvictionEventSelfTest extends GridCacheEvictionEventAbstractTest {
     /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+        super.setUp();
+    }
+
+    /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return CacheMode.LOCAL;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7577c877/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalGetAndTransformStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalGetAndTransformStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalGetAndTransformStoreSelfTest.java
index 19b4b61..9752b7e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalGetAndTransformStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalGetAndTransformStoreSelfTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache.local;
 
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.internal.processors.cache.GridCacheGetAndTransformStoreAbstractTest;
+import org.apache.ignite.testframework.MvccFeatureChecker;
 
 import static org.apache.ignite.cache.CacheMode.LOCAL;
 
@@ -27,6 +28,13 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
  */
 public class GridCacheLocalGetAndTransformStoreSelfTest extends GridCacheGetAndTransformStoreAbstractTest {
     /** {@inheritDoc} */
+    @Override public void setUp() throws Exception {
+        MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE);
+
+        super.setUp();
+    }
+
+    /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return LOCAL;
     }


[25/50] [abbrv] ignite git commit: IGNITE-10343 Stop grid in IgniteCacheGetRestartTest.testGetRestartReplicated test - Fixes #5447.

Posted by sb...@apache.org.
IGNITE-10343 Stop grid in IgniteCacheGetRestartTest.testGetRestartReplicated test - Fixes #5447.

Signed-off-by: Aleksey Plekhanov <pl...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/46a84fdd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/46a84fdd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/46a84fdd

Branch: refs/heads/ignite-10044
Commit: 46a84fddb701f8e26741ddaa1ee3ab3ffa2234c2
Parents: 7577c87
Author: Fedotov <va...@gmail.com>
Authored: Tue Nov 27 13:24:50 2018 +0300
Committer: Aleksey Plekhanov <pl...@gmail.com>
Committed: Tue Nov 27 13:24:50 2018 +0300

----------------------------------------------------------------------
 .../distributed/IgniteCacheGetRestartTest.java  | 29 +++++++++++---------
 1 file changed, 16 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/46a84fdd/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 e194e28..ba22048 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
@@ -209,25 +209,28 @@ public class IgniteCacheGetRestartTest extends GridCommonAbstractTest {
 
                         log.info("Restart node [node=" + nodeIdx + ", client=" + clientMode + ']');
 
-                        Ignite ignite = startGrid(nodeIdx);
+                        try {
+                            Ignite ignite = startGrid(nodeIdx);
 
-                        IgniteCache<Object, Object> cache;
+                            IgniteCache<Object, Object> cache;
 
-                        if (clientMode && ccfg.getNearConfiguration() != null)
-                            cache = ignite.createNearCache(ccfg.getName(), new NearCacheConfiguration<>());
-                        else
-                            cache = ignite.cache(ccfg.getName());
+                            if (clientMode && ccfg.getNearConfiguration() != null)
+                                cache = ignite.createNearCache(ccfg.getName(), new NearCacheConfiguration<>());
+                            else
+                                cache = ignite.cache(ccfg.getName());
 
-                        checkGet(cache);
-
-                        IgniteInternalFuture<?> syncFut = ((IgniteCacheProxy)cache).context().preloader().syncFuture();
-
-                        while (!syncFut.isDone() && U.currentTimeMillis() < stopTime)
                             checkGet(cache);
 
-                        checkGet(cache);
+                            IgniteInternalFuture<?> syncFut = ((IgniteCacheProxy)cache).context().preloader().syncFuture();
+
+                            while (!syncFut.isDone() && U.currentTimeMillis() < stopTime)
+                                checkGet(cache);
 
-                        stopGrid(nodeIdx);
+                            checkGet(cache);
+                        }
+                        finally {
+                            stopGrid(nodeIdx);
+                        }
                     }
 
                     return null;


[42/50] [abbrv] ignite git commit: IGNITE-10002 Fixed inspections

Posted by sb...@apache.org.
IGNITE-10002 Fixed inspections


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2418d876
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2418d876
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2418d876

Branch: refs/heads/ignite-10044
Commit: 2418d876339f8b79666b361848e6378a3d83b7fd
Parents: d21f86f
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Wed Nov 28 11:10:18 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Nov 28 11:12:09 2018 +0300

----------------------------------------------------------------------
 .../internal/processors/cache/CacheEnumOperationsAbstractTest.java | 2 --
 .../communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java | 1 -
 2 files changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2418d876/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
index 480d959..0cffeb6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
@@ -32,7 +32,6 @@ import org.apache.ignite.marshaller.Marshaller;
 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.ATOMIC;
@@ -40,7 +39,6 @@ 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.CacheWriteSynchronizationMode.FULL_SYNC;
-import static org.junit.Assert.fail;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/ignite/blob/2418d876/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
index 12cf4d9..27f7fa3 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
@@ -105,7 +105,6 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
     }
 
     /** */
-    @SuppressWarnings({"deprecation"})
     private class TestListener implements CommunicationListener<Message> {
         /** */
         private boolean block;


[09/50] [abbrv] ignite git commit: IGNITE-10330: Disk page compression. - Fixes #5200.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/AbstractDataPageIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/AbstractDataPageIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/AbstractDataPageIO.java
index 4a12045..6176eeb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/AbstractDataPageIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/AbstractDataPageIO.java
@@ -33,10 +33,12 @@ import org.apache.ignite.internal.util.GridStringBuilder;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.jetbrains.annotations.Nullable;
 
+import static org.apache.ignite.internal.util.GridUnsafe.bufferAddress;
+
 /**
  * Data pages IO.
  */
-public abstract class AbstractDataPageIO<T extends Storable> extends PageIO {
+public abstract class AbstractDataPageIO<T extends Storable> extends PageIO implements CompactablePageIO {
 
     /** */
     private static final int SHOW_ITEM = 0b0001;
@@ -228,7 +230,7 @@ public abstract class AbstractDataPageIO<T extends Storable> extends PageIO {
      * @param pageAddr Page address.
      * @return Free space.
      */
-    private int getRealFreeSpace(long pageAddr) {
+    public int getRealFreeSpace(long pageAddr) {
         return PageUtils.getShort(pageAddr, FREE_SPACE_OFF);
     }
 
@@ -822,9 +824,10 @@ public abstract class AbstractDataPageIO<T extends Storable> extends PageIO {
      * @param pageAddr Page address.
      * @param payload Payload.
      * @param pageSize Page size.
+     * @return Item ID.
      * @throws IgniteCheckedException If failed.
      */
-    public void addRow(
+    public int addRow(
         long pageAddr,
         byte[] payload,
         int pageSize
@@ -840,7 +843,7 @@ public abstract class AbstractDataPageIO<T extends Storable> extends PageIO {
 
         writeRowData(pageAddr, dataOff, payload);
 
-        addItem(pageAddr, fullEntrySize, directCnt, indirectCnt, dataOff, pageSize);
+        return addItem(pageAddr, fullEntrySize, directCnt, indirectCnt, dataOff, pageSize);
     }
 
     /**
@@ -1106,6 +1109,62 @@ public abstract class AbstractDataPageIO<T extends Storable> extends PageIO {
         return directCnt; // Previous directCnt will be our itemId.
     }
 
+    /** {@inheritDoc} */
+    @Override public void compactPage(ByteBuffer page, ByteBuffer out, int pageSize) {
+        // TODO May we compactDataEntries in-place and then copy compacted data to out?
+        copyPage(page, out, pageSize);
+
+        long pageAddr = bufferAddress(out);
+
+        int freeSpace = getRealFreeSpace(pageAddr);
+
+        if (freeSpace == 0)
+            return; // No garbage: nothing to compact here.
+
+        int directCnt = getDirectCount(pageAddr);
+
+        if (directCnt != 0) {
+            int firstOff = getFirstEntryOffset(pageAddr);
+
+            if (firstOff - freeSpace != getHeaderSizeWithItems(pageAddr, directCnt)) {
+                firstOff = compactDataEntries(pageAddr, directCnt, pageSize);
+                setFirstEntryOffset(pageAddr, firstOff, pageSize);
+            }
+
+            // Move all the data entries from page end to the page header to close the gap.
+            moveBytes(pageAddr, firstOff, pageSize - firstOff, -freeSpace, pageSize);
+        }
+
+        out.limit(pageSize - freeSpace); // Here we have only meaningful data of this page.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void restorePage(ByteBuffer page, int pageSize) {
+        assert page.isDirect();
+        assert page.position() == 0;
+        assert page.limit() <= pageSize;
+
+        long pageAddr = bufferAddress(page);
+
+        int freeSpace = getRealFreeSpace(pageAddr);
+
+        if (freeSpace != 0) {
+            int firstOff = getFirstEntryOffset(pageAddr);
+            int cnt = pageSize - firstOff;
+
+            if (cnt != 0) {
+                int off = page.limit() - cnt;
+
+                assert off > PageIO.COMMON_HEADER_END: off;
+                assert cnt > 0 : cnt;
+
+                moveBytes(pageAddr, off, cnt, freeSpace, pageSize);
+            }
+        }
+
+        page.limit(pageSize);
+    }
+
     /**
      * @param pageAddr Page address.
      * @param directCnt Direct items count.
@@ -1203,7 +1262,16 @@ public abstract class AbstractDataPageIO<T extends Storable> extends PageIO {
             entriesSize += entrySize;
         }
 
-        return pageSize - ITEMS_OFF - entriesSize - (directCnt + getIndirectCount(pageAddr)) * ITEM_SIZE;
+        return pageSize - entriesSize - getHeaderSizeWithItems(pageAddr, directCnt);
+    }
+
+    /**
+     * @param pageAddr Page address.
+     * @param directCnt Direct items count.
+     * @return Size of the page header including all items.
+     */
+    private int getHeaderSizeWithItems(long pageAddr, int directCnt) {
+        return ITEMS_OFF + (directCnt + getIndirectCount(pageAddr)) * ITEM_SIZE;
     }
 
     /**
@@ -1214,6 +1282,7 @@ public abstract class AbstractDataPageIO<T extends Storable> extends PageIO {
      * @param pageSize Page size.
      */
     private void moveBytes(long addr, int off, int cnt, int step, int pageSize) {
+        assert cnt >= 0: cnt;
         assert step != 0 : step;
         assert off + step >= 0;
         assert off + step + cnt <= pageSize : "[off=" + off + ", step=" + step + ", cnt=" + cnt +

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/BPlusIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/BPlusIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/BPlusIO.java
index 349e877..4c656eb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/BPlusIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/BPlusIO.java
@@ -17,16 +17,18 @@
 
 package org.apache.ignite.internal.processors.cache.persistence.tree.io;
 
+import java.nio.ByteBuffer;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.pagemem.PageUtils;
 import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
 import org.apache.ignite.internal.util.GridStringBuilder;
+import org.apache.ignite.internal.util.GridUnsafe;
 import org.apache.ignite.lang.IgniteInClosure;
 
 /**
  * Abstract IO routines for B+Tree pages.
  */
-public abstract class BPlusIO<L> extends PageIO {
+public abstract class BPlusIO<L> extends PageIO implements CompactablePageIO {
     /** */
     private static final int CNT_OFF = COMMON_HEADER_END;
 
@@ -412,4 +414,32 @@ public abstract class BPlusIO<L> extends PageIO {
             .a(",\n\tremoveId=").appendHex(getRemoveId(addr))
             .a("\n]");
     }
+
+    /**
+     * @param pageAddr Page address.
+     * @return Offset after the last item.
+     */
+    public int getItemsEnd(long pageAddr) {
+        int cnt = getCount(pageAddr);
+        return offset(cnt);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void compactPage(ByteBuffer page, ByteBuffer out, int pageSize) {
+        copyPage(page, out, pageSize);
+
+        long pageAddr = GridUnsafe.bufferAddress(out);
+
+        // Just drop all the extra garbage at the end.
+        out.limit(getItemsEnd(pageAddr));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void restorePage(ByteBuffer compactPage, int pageSize) {
+        assert compactPage.isDirect();
+        assert compactPage.position() == 0;
+        assert compactPage.limit() <= pageSize;
+
+        compactPage.limit(pageSize); // Just add garbage to the end.
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/CompactablePageIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/CompactablePageIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/CompactablePageIO.java
new file mode 100644
index 0000000..775a1f8
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/CompactablePageIO.java
@@ -0,0 +1,43 @@
+/*
+ * 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.tree.io;
+
+import java.nio.ByteBuffer;
+
+/**
+ * Page IO that supports compaction.
+ */
+public interface CompactablePageIO {
+    /**
+     * Compacts page contents to the output buffer.
+     * Implementation must not change contents, position and limit of the original page buffer.
+     *
+     * @param page Page buffer.
+     * @param out Output buffer.
+     * @param pageSize Page size.
+     */
+    void compactPage(ByteBuffer page, ByteBuffer out, int pageSize);
+
+    /**
+     * Restores the original page in place.
+     *
+     * @param compactPage Compact page.
+     * @param pageSize Page size.
+     */
+    void restorePage(ByteBuffer compactPage, int pageSize);
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/DataPagePayload.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/DataPagePayload.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/DataPagePayload.java
index 49eed88..e58aad9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/DataPagePayload.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/DataPagePayload.java
@@ -17,6 +17,9 @@
 
 package org.apache.ignite.internal.processors.cache.persistence.tree.io;
 
+import org.apache.ignite.internal.pagemem.PageUtils;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
 /**
  *
  */
@@ -61,4 +64,17 @@ public class DataPagePayload {
     public long nextLink() {
         return nextLink;
     }
+
+    /**
+     * @param pageAddr Page address.
+     * @return Payload bytes.
+     */
+    public byte[] getBytes(long pageAddr) {
+        return PageUtils.getBytes(pageAddr, off, payloadSize);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(DataPagePayload.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/PageIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/PageIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/PageIO.java
index ee61e25..85a1e8c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/PageIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/PageIO.java
@@ -83,6 +83,9 @@ import org.apache.ignite.internal.util.GridStringBuilder;
  */
 public abstract class PageIO {
     /** */
+    private static PageIO testIO;
+
+    /** */
     private static BPlusInnerIO<?> innerTestIO;
 
     /** */
@@ -131,16 +134,19 @@ public abstract class PageIO {
     public static final int ROTATED_ID_PART_OFF = PAGE_ID_OFF + 8;
 
     /** */
-    private static final int RESERVED_BYTE_OFF = ROTATED_ID_PART_OFF + 1;
+    private static final int COMPRESSION_TYPE_OFF = ROTATED_ID_PART_OFF + 1;
+
+    /** */
+    private static final int COMPRESSED_SIZE_OFF = COMPRESSION_TYPE_OFF + 1;
 
     /** */
-    private static final int RESERVED_SHORT_OFF = RESERVED_BYTE_OFF + 1;
+    private static final int COMPACTED_SIZE_OFF = COMPRESSED_SIZE_OFF + 2;
 
     /** */
-    private static final int RESERVED_INT_OFF = RESERVED_SHORT_OFF + 2;
+    private static final int RESERVED_SHORT_OFF = COMPACTED_SIZE_OFF + 2;
 
     /** */
-    private static final int RESERVED_2_OFF = RESERVED_INT_OFF + 4;
+    private static final int RESERVED_2_OFF = RESERVED_SHORT_OFF + 2;
 
     /** */
     private static final int RESERVED_3_OFF = RESERVED_2_OFF + 8;
@@ -382,6 +388,54 @@ public abstract class PageIO {
     }
 
     /**
+     * @param page Page buffer.
+     * @param compressType Compression type.
+     */
+    public static void setCompressionType(ByteBuffer page, byte compressType) {
+        page.put(COMPRESSION_TYPE_OFF, compressType);
+    }
+
+    /**
+     * @param page Page buffer.
+     * @return Compression type.
+     */
+    public static byte getCompressionType(ByteBuffer page) {
+        return page.get(COMPRESSION_TYPE_OFF);
+    }
+
+    /**
+     * @param page Page buffer.
+     * @param compressedSize Compressed size.
+     */
+    public static void setCompressedSize(ByteBuffer page, short compressedSize) {
+        page.putShort(COMPRESSED_SIZE_OFF, compressedSize);
+    }
+
+    /**
+     * @param page Page buffer.
+     * @return Compressed size.
+     */
+    public static short getCompressedSize(ByteBuffer page) {
+        return page.getShort(COMPRESSED_SIZE_OFF);
+    }
+
+    /**
+     * @param page Page buffer.
+     * @param compactedSize Compacted size.
+     */
+    public static void setCompactedSize(ByteBuffer page, short compactedSize) {
+        page.putShort(COMPACTED_SIZE_OFF, compactedSize);
+    }
+
+    /**
+     * @param page Page buffer.
+     * @return Compacted size.
+     */
+    public static short getCompactedSize(ByteBuffer page) {
+        return page.getShort(COMPACTED_SIZE_OFF);
+    }
+
+    /**
      * @param pageAddr Page address.
      * @return Checksum.
      */
@@ -487,6 +541,15 @@ public abstract class PageIO {
     }
 
     /**
+     * Registers IO for testing.
+     *
+     * @param io Page IO.
+     */
+    public static void registerTest(PageIO io) {
+        testIO = io;
+    }
+
+    /**
      * @return Type.
      */
     public final int getType() {
@@ -513,7 +576,8 @@ public abstract class PageIO {
         setPageId(pageAddr, pageId);
         setCrc(pageAddr, 0);
 
-        PageUtils.putLong(pageAddr, ROTATED_ID_PART_OFF, 0L); // 1 + reserved(1+2+4)
+        // rotated(1) + compress_type(1) + compressed_size(2) + compacted_size(2) + reserved(2)
+        PageUtils.putLong(pageAddr, ROTATED_ID_PART_OFF, 0L);
         PageUtils.putLong(pageAddr, RESERVED_2_OFF, 0L);
         PageUtils.putLong(pageAddr, RESERVED_3_OFF, 0L);
     }
@@ -536,6 +600,15 @@ public abstract class PageIO {
     }
 
     /**
+     * @param page Page.
+     * @return Page IO.
+     * @throws IgniteCheckedException If failed.
+     */
+    public static <Q extends PageIO> Q getPageIO(ByteBuffer page) throws IgniteCheckedException {
+        return getPageIO(getType(page), getVersion(page));
+    }
+
+    /**
      * @param type IO Type.
      * @param ver IO Version.
      * @return Page IO.
@@ -572,6 +645,11 @@ public abstract class PageIO {
                 return (Q)SimpleDataPageIO.VERSIONS.forVersion(ver);
 
             default:
+                if (testIO != null) {
+                    if (testIO.type == type && testIO.ver == ver)
+                        return (Q)testIO;
+                }
+
                 return (Q)getBPlusIO(type, ver);
         }
     }
@@ -715,6 +793,21 @@ public abstract class PageIO {
     protected abstract void printPage(long addr, int pageSize, GridStringBuilder sb) throws IgniteCheckedException;
 
     /**
+     * @param page Page.
+     * @param out Output buffer.
+     * @param pageSize Page size.
+     */
+    protected final void copyPage(ByteBuffer page, ByteBuffer out, int pageSize) {
+        assert out.position() == 0;
+        assert pageSize <= out.remaining();
+        assert pageSize == page.remaining();
+
+        page.mark();
+        out.put(page).flip();
+        page.reset();
+    }
+
+    /**
      * @param addr Address.
      */
     public static String printPage(long addr, int pageSize) throws IgniteCheckedException {

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java
index e70a027..03bac2b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java
@@ -57,6 +57,7 @@ import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProces
 import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
 import org.apache.ignite.internal.processors.cluster.ClusterProcessor;
 import org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor;
+import org.apache.ignite.internal.processors.compress.CompressionProcessor;
 import org.apache.ignite.internal.processors.continuous.GridContinuousProcessor;
 import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor;
 import org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor;
@@ -671,4 +672,9 @@ public class StandaloneGridKernalContext implements GridKernalContext {
     @NotNull @Override public Iterator<GridComponent> iterator() {
         return null;
     }
+
+    /** {@inheritDoc} */
+    @Override public CompressionProcessor compress() {
+        return null;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/compress/CompressionProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/compress/CompressionProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/compress/CompressionProcessor.java
new file mode 100644
index 0000000..8b917b3
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/compress/CompressionProcessor.java
@@ -0,0 +1,173 @@
+/*
+ * 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.compress;
+
+import java.nio.ByteBuffer;
+import java.nio.file.Path;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.configuration.DiskPageCompression;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteComponentType;
+import org.apache.ignite.internal.processors.GridProcessorAdapter;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
+
+/**
+ * Compression processor.
+ *
+ * @see IgniteComponentType#COMPRESSION
+ */
+public class CompressionProcessor extends GridProcessorAdapter {
+    /** */
+    public static final int LZ4_MIN_LEVEL = 0;
+
+    /** */
+    public static final int LZ4_MAX_LEVEL = 17;
+
+    /** */
+    public static final int LZ4_DEFAULT_LEVEL = 0;
+
+    /** */
+    public static final int ZSTD_MIN_LEVEL = -131072;
+
+    /** */
+    public static final int ZSTD_MAX_LEVEL = 22;
+
+    /** */
+    public static final int ZSTD_DEFAULT_LEVEL = 3;
+
+    /** */
+    protected static final byte UNCOMPRESSED_PAGE = 0;
+
+    /** */
+    protected static final byte COMPACTED_PAGE = 1;
+
+    /** */
+    protected static final byte ZSTD_COMPRESSED_PAGE = 2;
+
+    /** */
+    protected static final byte LZ4_COMPRESSED_PAGE = 3;
+
+    /** */
+    protected static final byte SNAPPY_COMPRESSED_PAGE = 4;
+
+    /**
+     * @param ctx Kernal context.
+     */
+    public CompressionProcessor(GridKernalContext ctx) {
+        super(ctx);
+    }
+
+    /**
+     * @param compression Compression algorithm.
+     * @return Default compression level.
+     */
+    public static int getDefaultCompressionLevel(DiskPageCompression compression) {
+        switch (compression) {
+            case ZSTD:
+                return ZSTD_DEFAULT_LEVEL;
+
+            case LZ4:
+                return LZ4_DEFAULT_LEVEL;
+
+            case SNAPPY:
+            case SKIP_GARBAGE:
+                return 0;
+        }
+
+        throw new IllegalArgumentException("Compression: " + compression);
+    }
+
+    /**
+     * @param compressLevel Compression level.
+     * @param compression Compression algorithm.
+     * @return Compression level.
+     */
+    public static int checkCompressionLevelBounds(int compressLevel, DiskPageCompression compression) {
+        switch (compression) {
+            case ZSTD:
+                checkCompressionLevelBounds(compressLevel, ZSTD_MIN_LEVEL, ZSTD_MAX_LEVEL);
+                break;
+
+            case LZ4:
+                checkCompressionLevelBounds(compressLevel, LZ4_MIN_LEVEL, LZ4_MAX_LEVEL);
+                break;
+
+            default:
+                throw new IllegalArgumentException("Compression level for " + compression + " is not supported.");
+        }
+
+        return compressLevel;
+    }
+
+    /**
+     * @param compressLevel Compression level.
+     * @param min Min level.
+     * @param max Max level.
+     */
+    private static void checkCompressionLevelBounds(int compressLevel, int min, int max) {
+        if (compressLevel < min  || compressLevel > max) {
+            throw new IllegalArgumentException("Compression level for LZ4 must be between " + min +
+                " and " + max + ".");
+        }
+    }
+
+    /**
+     * @throws IgniteCheckedException Always.
+     */
+    private static <T> T fail() throws IgniteCheckedException {
+        throw new IgniteCheckedException("Make sure that ignite-compress module is in classpath.");
+    }
+
+    /**
+     * @param storagePath Storage path.
+     * @param pageSize Page size.
+     * @throws IgniteCheckedException If compression is not supported.
+     */
+    public void checkPageCompressionSupported(Path storagePath, int pageSize) throws IgniteCheckedException {
+        fail();
+    }
+
+    /**
+     * @param page Page buffer.
+     * @param pageSize Page size.
+     * @param storeBlockSize Store block size.
+     * @param compression Compression algorithm.
+     * @param compressLevel Compression level.
+     * @return Possibly compressed buffer.
+     * @throws IgniteCheckedException If failed.
+     */
+    public ByteBuffer compressPage(
+        ByteBuffer page,
+        int pageSize,
+        int storeBlockSize,
+        DiskPageCompression compression,
+        int compressLevel
+    ) throws IgniteCheckedException {
+        return fail();
+    }
+
+    /**
+     * @param page Possibly compressed page buffer.
+     * @param pageSize Page size.
+     * @throws IgniteCheckedException If failed.
+     */
+    public void decompressPage(ByteBuffer page, int pageSize) throws IgniteCheckedException {
+        if (PageIO.getCompressionType(page) != UNCOMPRESSED_PAGE)
+            fail();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/compress/FileSystemUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/compress/FileSystemUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/compress/FileSystemUtils.java
new file mode 100644
index 0000000..1877640
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/compress/FileSystemUtils.java
@@ -0,0 +1,129 @@
+/*
+ * 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.compress;
+
+import java.nio.file.Path;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.IgniteComponentType;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * Native file system API.
+ */
+public final class FileSystemUtils {
+    /** */
+    private static final String NATIVE_FS_LINUX_CLASS =
+        "org.apache.ignite.internal.processors.compress.NativeFileSystemLinux";
+
+    /** */
+    private static final NativeFileSystem fs;
+
+    /** */
+    private static volatile Throwable err;
+
+    /** */
+    static {
+        NativeFileSystem x = null;
+
+        try {
+            if (IgniteComponentType.COMPRESSION.inClassPath()) {
+                if (U.isLinux())
+                    x = U.newInstance(NATIVE_FS_LINUX_CLASS);
+            }
+        }
+        catch (Throwable e) {
+            err = e;
+        }
+
+        fs = x;
+    }
+
+    /**
+     */
+    public static void checkSupported() {
+        Throwable e = err;
+
+        if (e != null || fs == null)
+            throw new IgniteException("Native file system API is not supported on " + U.osString(), e);
+    }
+
+    /**
+     * @param path File system path.
+     * @return File system block size or negative value if not supported.
+     */
+    public static int getFileSystemBlockSize(Path path) {
+        return fs == null ? -1 : fs.getFileSystemBlockSize(path);
+    }
+
+    /**
+     * @param fd Native file descriptor.
+     * @return File system block size or negative value if not supported.
+     */
+    public static int getFileSystemBlockSize(int fd) {
+        return fs == null ? -1 : fs.getFileSystemBlockSize(fd);
+    }
+
+    /**
+     * !!! Use with caution. May produce unexpected results.
+     *
+     * Known to work correctly on Linux EXT4 and Btrfs,
+     * while on XSF it returns meaningful result only after
+     * file reopening.
+     *
+     * @param fd Native file descriptor.
+     * @return Approximate system dependent size of the sparse file or negative
+     *          value if not supported.
+     */
+    public static long getSparseFileSize(int fd) {
+        return fs == null ? -1 : fs.getSparseFileSize(fd);
+    }
+
+    /**
+     * @param fd Native file descriptor.
+     * @param off Offset of the hole.
+     * @param len Length of the hole.
+     * @param fsBlockSize File system block size.
+     * @return Actual punched hole size.
+     */
+    public static long punchHole(int fd, long off, long len, int fsBlockSize) {
+        assert off >= 0;
+        assert len > 0;
+
+        checkSupported();
+
+        if (len < fsBlockSize)
+            return 0;
+
+        // TODO maybe optimize for power of 2
+        if (off % fsBlockSize != 0) {
+            long end = off + len;
+            off = (off / fsBlockSize + 1) * fsBlockSize;
+            len = end - off;
+
+            if (len <= 0)
+                return 0;
+        }
+
+        len = len / fsBlockSize * fsBlockSize;
+
+        if (len > 0)
+            fs.punchHole(fd, off, len);
+
+        return len;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/processors/compress/NativeFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/compress/NativeFileSystem.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/compress/NativeFileSystem.java
new file mode 100644
index 0000000..673d1bc
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/compress/NativeFileSystem.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.internal.processors.compress;
+
+import java.nio.file.Path;
+
+/**
+ * Native file system API.
+ */
+public interface NativeFileSystem {
+    /**
+     * @param path Path.
+     * @return File system block size in bytes.
+     */
+    int getFileSystemBlockSize(Path path);
+
+    /**
+     * @param fd Native file descriptor.
+     * @return File system block size in bytes.
+     */
+    int getFileSystemBlockSize(int fd);
+
+    /**
+     * @param fd Native file descriptor.
+     * @param off Offset of the hole.
+     * @param len Length of the hole.
+     */
+    void punchHole(int fd, long off, long len);
+
+    /**
+     * @param fd Native file descriptor.
+     * @return Approximate system dependent size of the sparse file.
+     */
+    long getSparseFileSize(int fd);
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java
index 2cc0ae3..6b8e2b3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java
@@ -1339,6 +1339,7 @@ public abstract class GridUnsafe {
      * @return Buffer memory address.
      */
     public static long bufferAddress(ByteBuffer buf) {
+        assert buf.isDirect();
         return UNSAFE.getLong(buf, DIRECT_BUF_ADDR_OFF);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/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 2d6b584..946378d 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
@@ -3933,15 +3933,23 @@ public abstract class IgniteUtils {
      * @return Hex string.
      */
     public static String byteArray2HexString(byte[] arr) {
-        SB sb = new SB(arr.length << 1);
+        StringBuilder sb = new StringBuilder(arr.length << 1);
 
         for (byte b : arr)
-            sb.a(Integer.toHexString(MASK & b >>> 4)).a(Integer.toHexString(MASK & b));
+            addByteAsHex(sb, b);
 
         return sb.toString().toUpperCase();
     }
 
     /**
+     * @param sb String builder.
+     * @param b Byte to add in hexadecimal format.
+     */
+    private static void addByteAsHex(StringBuilder sb, byte b) {
+        sb.append(Integer.toHexString(MASK & b >>> 4)).append(Integer.toHexString(MASK & b));
+    }
+
+    /**
      * Checks for containment of the value in the array.
      * Both array cells and value may be {@code null}. Two {@code null}s are considered equal.
      *
@@ -10552,12 +10560,10 @@ public abstract class IgniteUtils {
      * @return hex representation of memory region
      */
     public static String toHexString(long addr, int len) {
-        assert (len & 0b111) == 0 && len > 0;
-
         StringBuilder sb = new StringBuilder(len * 2);
 
-        for (int i = 0; i < len; i += 8)
-            sb.append(U.hexLong(GridUnsafe.getLong(addr + i)));
+        for (int i = 0; i < len; i++) // Can not use getLong because on little-endian it produces bs.
+            addByteAsHex(sb, GridUnsafe.getByte(addr + i));
 
         return sb.toString();
     }
@@ -10568,12 +10574,10 @@ public abstract class IgniteUtils {
      * @return hex representation of memory region
      */
     public static String toHexString(ByteBuffer buf) {
-        assert (buf.capacity() & 0b111) == 0;
-
         StringBuilder sb = new StringBuilder(buf.capacity() * 2);
 
-        for (int i = 0; i < buf.capacity(); i += 8)
-            sb.append(U.hexLong(buf.getLong(i)));
+        for (int i = 0; i < buf.capacity(); i++)
+            addByteAsHex(sb, buf.get(i)); // Can not use getLong because on little-endian it produces bs.
 
         return sb.toString();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/mxbean/CacheGroupMetricsMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/CacheGroupMetricsMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/CacheGroupMetricsMXBean.java
index 2612a41..cf8aa76 100644
--- a/modules/core/src/main/java/org/apache/ignite/mxbean/CacheGroupMetricsMXBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/CacheGroupMetricsMXBean.java
@@ -179,4 +179,16 @@ public interface CacheGroupMetricsMXBean {
      */
     @MXBeanDescription("Total size of memory allocated for group, in bytes.")
     public long getTotalAllocatedSize();
+
+    /**
+     * Storage space allocated for group, in bytes.
+     */
+    @MXBeanDescription("Storage space allocated for group, in bytes.")
+    public long getStorageSize();
+
+    /**
+     * Storage space allocated for group adjusted for possible sparsity, in bytes.
+     */
+    @MXBeanDescription("Storage space allocated for group adjusted for possible sparsity, in bytes.")
+    public long getSparseStorageSize();
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java
index 2069099..4689f15 100644
--- a/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/DataStorageMetricsMXBean.java
@@ -174,4 +174,12 @@ public interface DataStorageMetricsMXBean extends DataStorageMetrics {
         "Number of subintervals to set."
     )
     public void subIntervals(int subInts);
+
+    /** {@inheritDoc} */
+    @MXBeanDescription("Storage space allocated, in bytes.")
+    @Override long getStorageSize();
+
+    /** {@inheritDoc} */
+    @MXBeanDescription("Storage space allocated adjusted for possible sparsity, in bytes.")
+    @Override long getSparseStorageSize();
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/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 36d8b41..ed6eb86 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
@@ -120,7 +120,6 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
         }
 
         DataStorageConfiguration memCfg = new DataStorageConfiguration();
-        memCfg.setPageSize(4 * 1024);
         memCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
             .setMaxSize(150L * 1024 * 1024)
             .setPersistenceEnabled(persistenceEnabled()));
@@ -1330,6 +1329,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
         ccfgs[4] = cacheConfiguration(CACHE_NAME_PREFIX + 4, TRANSACTIONAL);
 
         ccfgs[4].setDataRegionName(NO_PERSISTENCE_REGION);
+        ccfgs[4].setDiskPageCompression(null);
 
         return ccfgs;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/DummyPageIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/DummyPageIO.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/DummyPageIO.java
index 1b36ac1..c402ad7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/DummyPageIO.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/DummyPageIO.java
@@ -17,25 +17,40 @@
 
 package org.apache.ignite.internal.processors.cache.persistence;
 
+import java.nio.ByteBuffer;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.CompactablePageIO;
 import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
 import org.apache.ignite.internal.util.GridStringBuilder;
 
 /**
  * Dummy PageIO implementation. For test purposes only.
  */
-public class DummyPageIO extends PageIO {
+public class DummyPageIO extends PageIO implements CompactablePageIO {
     /** */
     public DummyPageIO() {
         super(2 * Short.MAX_VALUE, 1);
+
+        PageIO.registerTest(this);
     }
 
     /** {@inheritDoc} */
-    @Override
-    protected void printPage(long addr, int pageSize, GridStringBuilder sb) throws IgniteCheckedException {
+    @Override protected void printPage(long addr, int pageSize, GridStringBuilder sb) throws IgniteCheckedException {
         sb.a("DummyPageIO [\n");
         sb.a("addr=").a(addr).a(", ");
         sb.a("pageSize=").a(addr);
         sb.a("\n]");
     }
+
+    /** {@inheritDoc} */
+    @Override public void compactPage(ByteBuffer page, ByteBuffer out, int pageSize) {
+        copyPage(page, out, pageSize);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void restorePage(ByteBuffer p, int pageSize) {
+        assert p.isDirect();
+        assert p.position() == 0;
+        assert p.limit() == pageSize;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteDataStorageMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteDataStorageMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteDataStorageMetricsSelfTest.java
index 4db1de9..0f5aef9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteDataStorageMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteDataStorageMetricsSelfTest.java
@@ -55,6 +55,9 @@ public class IgniteDataStorageMetricsSelfTest extends GridCommonAbstractTest {
     /** */
     private static final String GROUP1 = "grp1";
 
+    /** */
+    private static final String NO_PERSISTENCE = "no-persistence";
+
     /** {@inheritDoc} */
     @Override protected void afterTestsStopped() throws Exception {
         cleanPersistenceDir();
@@ -73,19 +76,20 @@ public class IgniteDataStorageMetricsSelfTest extends GridCommonAbstractTest {
 
         cfg.setConsistentId(gridName);
 
+        long maxRegionSize = 20L * 1024 * 1024;
+
         DataStorageConfiguration memCfg = new DataStorageConfiguration()
             .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
-                .setMaxSize(10L * 1024 * 1024)
+                .setMaxSize(maxRegionSize)
                 .setPersistenceEnabled(true)
                 .setMetricsEnabled(true)
                 .setName("dflt-plc"))
             .setDataRegionConfigurations(new DataRegionConfiguration()
-                .setMaxSize(10L * 1024 * 1024)
+                .setMaxSize(maxRegionSize)
                 .setPersistenceEnabled(false)
                 .setMetricsEnabled(true)
-                .setName("no-persistence"))
+                .setName(NO_PERSISTENCE))
             .setWalMode(WALMode.LOG_ONLY)
-            .setPageSize(4 * 1024)
             .setMetricsEnabled(true);
 
         cfg.setDataStorageConfiguration(memCfg);
@@ -95,7 +99,7 @@ public class IgniteDataStorageMetricsSelfTest extends GridCommonAbstractTest {
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
 
         cfg.setCacheConfiguration(cacheConfiguration(GROUP1, "cache", PARTITIONED, ATOMIC, 1, null),
-            cacheConfiguration(null, "cache-np", PARTITIONED, ATOMIC, 1, "no-persistence"));
+            cacheConfiguration(null, "cache-np", PARTITIONED, ATOMIC, 1, NO_PERSISTENCE));
 
         return cfg;
     }
@@ -135,6 +139,9 @@ public class IgniteDataStorageMetricsSelfTest extends GridCommonAbstractTest {
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
         ccfg.setDataRegionName(dataRegName);
 
+        if (NO_PERSISTENCE.equals(dataRegName))
+            ccfg.setDiskPageCompression(null);
+
         return ccfg;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java
index 713d4cc..be3ed0b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java
@@ -45,8 +45,7 @@ public class IgnitePdsDynamicCacheTest extends IgniteDbDynamicCacheSelfTest {
         DataStorageConfiguration memCfg = new DataStorageConfiguration()
             .setDefaultDataRegionConfiguration(
                 new DataRegionConfiguration().setMaxSize(200L * 1024 * 1024).setPersistenceEnabled(true))
-            .setWalMode(WALMode.LOG_ONLY)
-            .setPageSize(4 * 1024);
+            .setWalMode(WALMode.LOG_ONLY);
 
         cfg.setDataStorageConfiguration(memCfg);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java
index ecc6e02..d6d5c4f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsExchangeDuringCheckpointTest.java
@@ -105,6 +105,7 @@ public class IgnitePdsExchangeDuringCheckpointTest extends GridCommonAbstractTes
 
         CacheConfiguration ccfgNp = new CacheConfiguration("nonPersistentCache");
         ccfgNp.setDataRegionName(NO_PERSISTENCE_REGION);
+        ccfgNp.setDiskPageCompression(null);
 
         ccfg.setAffinity(new RendezvousAffinityFunction(false, 4096));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPageSizesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPageSizesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPageSizesTest.java
index 353bc50..d907239 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPageSizesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPageSizesTest.java
@@ -21,16 +21,20 @@ import java.util.Random;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ThreadLocalRandom;
 import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteSystemProperties;
 import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.DataRegionConfiguration;
 import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DiskPageCompression;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.WALMode;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_DEFAULT_DISK_PAGE_COMPRESSION;
+
 /**
  *
  */
@@ -112,6 +116,10 @@ public class IgnitePdsPageSizesTest extends GridCommonAbstractTest {
      * @throws Exception if failed.
      */
     private void checkPageSize(int pageSize) throws Exception {
+        if (pageSize <= 4 * 1024 &&
+            IgniteSystemProperties.getEnum(DiskPageCompression.class, IGNITE_DEFAULT_DISK_PAGE_COMPRESSION) != null)
+            return; // Small pages do not work with compression.
+
         this.pageSize = pageSize;
 
         IgniteEx ignite = startGrid(0);

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/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 48b60d4..56426f3 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
@@ -566,6 +566,21 @@ public class LocalWalModeChangeDuringRebalancingSelfTest extends GridCommonAbstr
         }
 
         /** {@inheritDoc} */
+        @Override public int getFileSystemBlockSize() {
+            return delegate.getFileSystemBlockSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getSparseSize() {
+            return delegate.getSparseSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int punchHole(long position, int len) {
+            return delegate.punchHole(position, len);
+        }
+
+        /** {@inheritDoc} */
         @Override public long position() throws IOException {
             return delegate.position();
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheRestoreTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheRestoreTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheRestoreTest.java
index b8cb047..4787143 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheRestoreTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsCacheRestoreTest.java
@@ -57,14 +57,15 @@ public class IgnitePdsCacheRestoreTest extends GridCommonAbstractTest {
             ccfgs = null;
         }
 
+        long regionMaxSize = 20L * 1024 * 1024;
+
         DataStorageConfiguration memCfg = new DataStorageConfiguration()
             .setDefaultDataRegionConfiguration(
-                new DataRegionConfiguration().setMaxSize(10L * 1024 * 1024).setPersistenceEnabled(true))
-            .setPageSize(4 * 1024)
+                new DataRegionConfiguration().setMaxSize(regionMaxSize).setPersistenceEnabled(true))
             .setWalMode(WALMode.LOG_ONLY);
 
         memCfg.setDataRegionConfigurations(new DataRegionConfiguration()
-            .setMaxSize(10L * 1024 * 1024)
+            .setMaxSize(regionMaxSize)
             .setName(NO_PERSISTENCE_REGION)
             .setPersistenceEnabled(false));
 
@@ -210,6 +211,7 @@ public class IgnitePdsCacheRestoreTest extends GridCommonAbstractTest {
         ccfgs[2] = cacheConfiguration("c3");
 
         ccfgs[2].setDataRegionName(NO_PERSISTENCE_REGION);
+        ccfgs[2].setDiskPageCompression(null);
 
         return ccfgs;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsDataRegionMetricsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsDataRegionMetricsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsDataRegionMetricsTest.java
index c05f65c..0154c14 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsDataRegionMetricsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsDataRegionMetricsTest.java
@@ -60,7 +60,7 @@ public class IgnitePdsDataRegionMetricsTest extends GridCommonAbstractTest {
     private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
     /** */
-    private static final long INIT_REGION_SIZE = 10 << 20;
+    private static final long INIT_REGION_SIZE = 20 << 20;
 
     /** */
     private static final long MAX_REGION_SIZE = INIT_REGION_SIZE * 10;
@@ -312,7 +312,13 @@ public class IgnitePdsDataRegionMetricsTest extends GridCommonAbstractTest {
 
                 FilePageStore store = (FilePageStore)pageStoreMgr.getStore(CU.cacheId(cacheName), partId(file));
 
-                totalPersistenceSize += path.toFile().length() - store.headerSize();
+                int pageSize = store.getPageSize();
+                long storeSize = path.toFile().length() - store.headerSize();
+
+                if (storeSize % pageSize != 0)
+                    storeSize = (storeSize / pageSize + 1) * pageSize; // Adjust for possible page compression.
+
+                totalPersistenceSize += storeSize;
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsReserveWalSegmentsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsReserveWalSegmentsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsReserveWalSegmentsTest.java
index 5593e44..cfbb8d8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsReserveWalSegmentsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsReserveWalSegmentsTest.java
@@ -61,8 +61,6 @@ public class IgnitePdsReserveWalSegmentsTest extends GridCommonAbstractTest {
 
         DataStorageConfiguration dbCfg = new DataStorageConfiguration();
 
-        dbCfg.setPageSize(4 * 1024);
-
         cfg.setDataStorageConfiguration(dbCfg);
 
         dbCfg.setWalSegmentSize(1024 * 1024)

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteCheckpointDirtyPagesForLowLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteCheckpointDirtyPagesForLowLoadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteCheckpointDirtyPagesForLowLoadTest.java
index 8baa1c3..c9174ba 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteCheckpointDirtyPagesForLowLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteCheckpointDirtyPagesForLowLoadTest.java
@@ -68,7 +68,6 @@ public class IgniteCheckpointDirtyPagesForLowLoadTest extends GridCommonAbstract
         cfg.setCacheConfiguration(ccfgs.toArray(new CacheConfiguration[ccfgs.size()]));
 
         DataStorageConfiguration dsCfg = new DataStorageConfiguration();
-        dsCfg.setPageSize(1024); //smaller page to reduce overhead to short values
         dsCfg.setDefaultDataRegionConfiguration(
             new DataRegionConfiguration()
                 .setPersistenceEnabled(true)

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java
index 29e113c..70d003d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java
@@ -38,7 +38,7 @@ public class DefaultPageSizeBackwardsCompatibilityTest extends GridCommonAbstrac
     private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
     /** Client mode. */
-    private boolean set2kPageSize = true;
+    private boolean set16kPageSize = true;
 
     /** Entries count. */
     public static final int ENTRIES_COUNT = 300;
@@ -55,8 +55,10 @@ public class DefaultPageSizeBackwardsCompatibilityTest extends GridCommonAbstrac
 
         DataStorageConfiguration memCfg = new DataStorageConfiguration();
 
-        if (set2kPageSize)
-            memCfg.setPageSize(2048);
+        if (set16kPageSize)
+            memCfg.setPageSize(16 * 1024);
+        else
+            memCfg.setPageSize(0); // Enforce default.
 
         DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();
         memPlcCfg.setMaxSize(100L * 1000 * 1000);
@@ -64,7 +66,7 @@ public class DefaultPageSizeBackwardsCompatibilityTest extends GridCommonAbstrac
         memPlcCfg.setPersistenceEnabled(true);
 
         memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
-        memCfg.setCheckpointFrequency(3_000);
+        memCfg.setCheckpointFrequency(500);
 
         cfg.setDataStorageConfiguration(memCfg);
 
@@ -75,6 +77,9 @@ public class DefaultPageSizeBackwardsCompatibilityTest extends GridCommonAbstrac
         ccfg1.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
         ccfg1.setAffinity(new RendezvousAffinityFunction(false, 32));
 
+        if (!set16kPageSize)
+            ccfg1.setDiskPageCompression(null);
+
         cfg.setCacheConfiguration(ccfg1);
 
         cfg.setConsistentId(gridName);
@@ -99,7 +104,7 @@ public class DefaultPageSizeBackwardsCompatibilityTest extends GridCommonAbstrac
     /**
      * @throws Exception If failed.
      */
-    public void testStartFrom2kDefaultStore() throws Exception {
+    public void testStartFrom16kDefaultStore() throws Exception {
         startGrids(2);
 
         Ignite ig = ignite(0);
@@ -113,11 +118,11 @@ public class DefaultPageSizeBackwardsCompatibilityTest extends GridCommonAbstrac
         for (int i = 0; i < ENTRIES_COUNT; i++)
             cache.put(i, i);
 
-        Thread.sleep(5_000); // Await for checkpoint to happen.
+        Thread.sleep(1500); // Await for checkpoint to happen.
 
         stopAllGrids();
 
-        set2kPageSize = false;
+        set16kPageSize = false;
 
         startGrids(2);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/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 5bf7e7f..14525f0 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
@@ -42,8 +42,6 @@ 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 static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_PAGE_SIZE;
-
 /**
  *
  */
@@ -83,7 +81,7 @@ public class WalCompactionTest extends GridCommonAbstractTest {
 
         CacheConfiguration ccfg = new CacheConfiguration();
 
-        ccfg.setName("cache");
+        ccfg.setName(CACHE_NAME);
         ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
         ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
         ccfg.setAffinity(new RendezvousAffinityFunction(false, 16));
@@ -139,7 +137,9 @@ public class WalCompactionTest extends GridCommonAbstractTest {
         IgniteEx ig = (IgniteEx)startGrids(3);
         ig.cluster().active(true);
 
-        IgniteCache<Integer, byte[]> cache = ig.cache("cache");
+        IgniteCache<Integer, byte[]> cache = ig.cache(CACHE_NAME);
+
+        final int pageSize = ig.cachex(CACHE_NAME).context().dataRegion().pageMemory().pageSize();
 
         for (int i = 0; i < ENTRIES; i++) { // At least 20MB of raw data in total.
             final byte[] val = new byte[20000];
@@ -150,9 +150,9 @@ public class WalCompactionTest extends GridCommonAbstractTest {
         }
 
         // Spam WAL to move all data records to compressible WAL zone.
-        for (int i = 0; i < WAL_SEGMENT_SIZE / DFLT_PAGE_SIZE * 2; i++) {
-            ig.context().cache().context().wal().log(new PageSnapshot(new FullPageId(-1, -1), new byte[DFLT_PAGE_SIZE],
-                DFLT_PAGE_SIZE));
+        for (int i = 0; i < WAL_SEGMENT_SIZE / pageSize * 2; i++) {
+            ig.context().cache().context().wal().log(new PageSnapshot(new FullPageId(-1, -1), new byte[pageSize],
+                pageSize));
         }
 
         // WAL archive segment is allowed to be compressed when it's at least one checkpoint away from current WAL head.
@@ -262,7 +262,7 @@ public class WalCompactionTest extends GridCommonAbstractTest {
         IgniteEx ig = startGrid(0);
         ig.cluster().active(true);
 
-        IgniteCache<Integer, byte[]> cache = ig.cache("cache");
+        IgniteCache<Integer, byte[]> cache = ig.cache(CACHE_NAME);
 
         for (int i = 0; i < 2500; i++) { // At least 50MB of raw data in total.
             final byte[] val = new byte[20000];
@@ -325,7 +325,9 @@ public class WalCompactionTest extends GridCommonAbstractTest {
         IgniteEx ig = (IgniteEx)startGrids(3);
         ig.cluster().active(true);
 
-        IgniteCache<Integer, byte[]> cache = ig.cache("cache");
+        IgniteCache<Integer, byte[]> cache = ig.cache(CACHE_NAME);
+
+        final int pageSize = ig.cachex(CACHE_NAME).context().dataRegion().pageMemory().pageSize();
 
         for (int i = 0; i < 100; i++) {
             final byte[] val = new byte[20000];
@@ -364,9 +366,9 @@ public class WalCompactionTest extends GridCommonAbstractTest {
         }
 
         // Spam WAL to move all data records to compressible WAL zone.
-        for (int i = 0; i < WAL_SEGMENT_SIZE / DFLT_PAGE_SIZE * 2; i++) {
-            ig.context().cache().context().wal().log(new PageSnapshot(new FullPageId(-1, -1), new byte[DFLT_PAGE_SIZE],
-                DFLT_PAGE_SIZE));
+        for (int i = 0; i < WAL_SEGMENT_SIZE / pageSize * 2; i++) {
+            ig.context().cache().context().wal().log(new PageSnapshot(new FullPageId(-1, -1), new byte[pageSize],
+                pageSize));
         }
 
         // WAL archive segment is allowed to be compressed when it's at least one checkpoint away from current WAL head.

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalDeletionArchiveAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalDeletionArchiveAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalDeletionArchiveAbstractTest.java
index 300b752..3a99236 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalDeletionArchiveAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalDeletionArchiveAbstractTest.java
@@ -55,7 +55,6 @@ public abstract class WalDeletionArchiveAbstractTest extends GridCommonAbstractT
         dbCfg.setWalMode(walMode());
         dbCfg.setWalSegmentSize(512 * 1024);
         dbCfg.setCheckpointFrequency(60 * 1000);//too high value for turn off frequency checkpoint.
-        dbCfg.setPageSize(4 * 1024);
         dbCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
             .setMaxSize(100 * 1024 * 1024)
             .setPersistenceEnabled(true));

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java
index 9a23502..14013b1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java
@@ -73,8 +73,6 @@ public abstract class IgniteDbAbstractTest extends GridCommonAbstractTest {
 
         if (isLargePage())
             dbCfg.setPageSize(16 * 1024);
-        else
-            dbCfg.setPageSize(4 * 1024);
 
         dbCfg.setWalMode(WALMode.LOG_ONLY);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
index 8ac72f7..02857ae 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
@@ -22,6 +22,7 @@ import org.apache.ignite.cache.store.CacheStore;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager;
+import org.apache.ignite.internal.processors.cache.CacheCompressionManager;
 import org.apache.ignite.internal.processors.cache.CacheOsConflictResolutionManager;
 import org.apache.ignite.internal.processors.cache.CacheType;
 import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
@@ -90,6 +91,7 @@ public class GridCacheTestContext<K, V> extends GridCacheContext<K, V> {
             true,
             true,
             false,
+            new CacheCompressionManager(),
             new GridCacheEventManager(),
             new CacheOsStoreManager(null, new CacheConfiguration()),
             new GridCacheEvictionManager(),

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/direct-io/pom.xml
----------------------------------------------------------------------
diff --git a/modules/direct-io/pom.xml b/modules/direct-io/pom.xml
index e460e67..a5e2841 100644
--- a/modules/direct-io/pom.xml
+++ b/modules/direct-io/pom.xml
@@ -59,6 +59,21 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-compress</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-compress</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-beans</artifactId>
             <version>${spring.version}</version>
@@ -75,7 +90,7 @@
         <dependency>
             <groupId>net.java.dev.jna</groupId>
             <artifactId>jna</artifactId>
-            <version>4.5.0</version>
+            <version>${jna.version}</version>
         </dependency>
 
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIO.java
----------------------------------------------------------------------
diff --git a/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIO.java b/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIO.java
index 98fd99b..a37dcdb 100644
--- a/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIO.java
+++ b/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIO.java
@@ -33,6 +33,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicReferenceArray;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.internal.processors.compress.FileSystemUtils;
 import org.apache.ignite.internal.util.GridUnsafe;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.jetbrains.annotations.NotNull;
@@ -46,19 +47,22 @@ public class AlignedBuffersDirectFileIO extends AbstractFileIO {
     /** Negative value for file offset: read/write starting from current file position */
     private static final int FILE_POS_USE_CURRENT = -1;
 
-    /** File system & linux block size. Minimal amount of data can be written using DirectIO. */
-    private final int fsBlockSize;
+    /** Minimal amount of data can be written using DirectIO. */
+    private final int ioBlockSize;
 
-    /** Durable memory Page size. Can have greater value than {@link #fsBlockSize}. */
+    /** Durable memory Page size. Can have greater value than {@link #ioBlockSize}. */
     private final int pageSize;
 
+    /** File system block size. */
+    private final int fsBlockSize;
+
     /** File. */
     private final File file;
 
     /** Logger. */
     private final IgniteLogger log;
 
-    /** Thread local with buffers with capacity = one page {@link #pageSize} and aligned using {@link #fsBlockSize}. */
+    /** Thread local with buffers with capacity = one page {@link #pageSize} and aligned using {@link #ioBlockSize}. */
     private ThreadLocal<ByteBuffer> tlbOnePageAligned;
 
     /** Managed aligned buffers. Used to check if buffer is applicable for direct IO our data should be copied. */
@@ -79,18 +83,18 @@ public class AlignedBuffersDirectFileIO extends AbstractFileIO {
     /**
      * Creates Direct File IO.
      *
-     * @param fsBlockSize FS/OS block size.
+     * @param ioBlockSize FS/OS block size.
      * @param pageSize Durable memory Page size.
      * @param file File to open.
      * @param modes Open options (flags).
      * @param tlbOnePageAligned Thread local with buffers with capacity = one page {@code pageSize} and aligned using
-     * {@code fsBlockSize}.
+     * {@code ioBlockSize}.
      * @param managedAlignedBuffers Managed aligned buffers map, used to check if buffer is known.
      * @param log Logger.
      * @throws IOException if file open failed.
      */
     AlignedBuffersDirectFileIO(
-        int fsBlockSize,
+        int ioBlockSize,
         int pageSize,
         File file,
         OpenOption[] modes,
@@ -99,7 +103,7 @@ public class AlignedBuffersDirectFileIO extends AbstractFileIO {
         IgniteLogger log)
         throws IOException {
         this.log = log;
-        this.fsBlockSize = fsBlockSize;
+        this.ioBlockSize = ioBlockSize;
         this.pageSize = pageSize;
         this.file = file;
         this.tlbOnePageAligned = tlbOnePageAligned;
@@ -126,6 +130,7 @@ public class AlignedBuffersDirectFileIO extends AbstractFileIO {
                         "(probably incompatible file system selected, for example, tmpfs): " + msg);
 
                     this.fd = fd;
+                    fsBlockSize = FileSystemUtils.getFileSystemBlockSize(fd);
 
                     return;
                 }
@@ -135,6 +140,7 @@ public class AlignedBuffersDirectFileIO extends AbstractFileIO {
         }
 
         this.fd = fd;
+        fsBlockSize = FileSystemUtils.getFileSystemBlockSize(fd);
     }
 
     /**
@@ -174,6 +180,21 @@ public class AlignedBuffersDirectFileIO extends AbstractFileIO {
     }
 
     /** {@inheritDoc} */
+    @Override public int getFileSystemBlockSize() {
+        return fsBlockSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSparseSize() {
+        return FileSystemUtils.getSparseFileSize(fd);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int punchHole(long position, int len) {
+        return (int)FileSystemUtils.punchHole(fd, position, len, fsBlockSize);
+    }
+
+    /** {@inheritDoc} */
     @Override public long position() throws IOException {
         long position = IgniteNativeIoLib.lseek(fdCheckOpened(), 0, IgniteNativeIoLib.SEEK_CUR);
 
@@ -202,11 +223,22 @@ public class AlignedBuffersDirectFileIO extends AbstractFileIO {
     @Override public int read(ByteBuffer destBuf, long filePosition) throws IOException {
         int size = checkSizeIsPadded(destBuf.remaining());
 
-        if (isKnownAligned(destBuf))
-            return readIntoAlignedBuffer(destBuf, filePosition);
+        return isKnownAligned(destBuf) ?
+            readIntoAlignedBuffer(destBuf, filePosition) :
+            readIntoUnalignedBuffer(destBuf, filePosition, size);
+    }
 
+    /**
+     * @param destBuf Destination aligned byte buffer.
+     * @param filePosition File position.
+     * @param size Buffer size to write, should be divisible by {@link #ioBlockSize}.
+     * @return Number of read bytes, possibly zero, or <tt>-1</tt> if the
+     *         given position is greater than or equal to the file's current size.
+     * @throws IOException If failed.
+     */
+    private int readIntoUnalignedBuffer(ByteBuffer destBuf, long filePosition, int size) throws IOException {
         boolean useTlb = size == pageSize;
-        ByteBuffer alignedBuf = useTlb ? tlbOnePageAligned.get() : AlignedBuffers.allocate(fsBlockSize, size);
+        ByteBuffer alignedBuf = useTlb ? tlbOnePageAligned.get() : AlignedBuffers.allocate(ioBlockSize, size);
 
         try {
             assert alignedBuf.position() == 0: "Temporary aligned buffer is in incorrect state: position is set incorrectly";
@@ -241,29 +273,46 @@ public class AlignedBuffersDirectFileIO extends AbstractFileIO {
 
     /** {@inheritDoc} */
     @Override public int write(ByteBuffer srcBuf, long filePosition) throws IOException {
-        int size = checkSizeIsPadded(srcBuf.remaining());
+        return isKnownAligned(srcBuf) ?
+            writeFromAlignedBuffer(srcBuf, filePosition) :
+            writeFromUnalignedBuffer(srcBuf, filePosition);
+    }
 
-        if (isKnownAligned(srcBuf))
-            return writeFromAlignedBuffer(srcBuf, filePosition);
+    /**
+     * @param srcBuf buffer to check if it is known buffer.
+     * @param filePosition File position.
+     * @return Number of written bytes.
+     * @throws IOException If failed.
+     */
+    private int writeFromUnalignedBuffer(ByteBuffer srcBuf, long filePosition) throws IOException {
+        int size = srcBuf.remaining();
 
-        boolean useTlb = size == pageSize;
-        ByteBuffer alignedBuf = useTlb ? tlbOnePageAligned.get() : AlignedBuffers.allocate(fsBlockSize, size);
+        boolean useTlb = size <= pageSize;
+        ByteBuffer alignedBuf = useTlb ? tlbOnePageAligned.get() : AlignedBuffers.allocate(ioBlockSize, size);
 
         try {
             assert alignedBuf.position() == 0 : "Temporary aligned buffer is in incorrect state: position is set incorrectly";
-            assert alignedBuf.limit() == size : "Temporary aligned buffer is in incorrect state: limit is set incorrectly";
+            assert alignedBuf.limit() >= size : "Temporary aligned buffer is in incorrect state: limit is set incorrectly";
 
             int initPos = srcBuf.position();
 
             alignedBuf.put(srcBuf);
             alignedBuf.flip();
 
-            srcBuf.position(initPos); // will update later from write results
+            int len = alignedBuf.remaining();
+
+            // Compressed buffer of wrong size can be passed here.
+            if (len % ioBlockSize != 0)
+                alignBufferLimit(alignedBuf);
 
             int written = writeFromAlignedBuffer(alignedBuf, filePosition);
 
-            if (written > 0)
-                srcBuf.position(initPos + written);
+            // Actual written length can be greater than the original buffer,
+            // since we artificially expanded it to have correctly aligned size.
+            if (written > len)
+                written = len;
+
+            srcBuf.position(initPos + written);
 
             return written;
         }
@@ -276,6 +325,17 @@ public class AlignedBuffersDirectFileIO extends AbstractFileIO {
     }
 
     /**
+     * @param buf Byte buffer to align.
+     */
+    private void alignBufferLimit(ByteBuffer buf) {
+        int len = buf.remaining();
+
+        int alignedLen = (len / ioBlockSize + 1) * ioBlockSize;
+
+        buf.limit(buf.limit() + alignedLen - len);
+    }
+
+    /**
      * Checks if we can run fast path: we got well known buffer is already aligned.
      *
      * @param srcBuf buffer to check if it is known buffer.
@@ -290,16 +350,16 @@ public class AlignedBuffersDirectFileIO extends AbstractFileIO {
     /**
      * Check if size is appropriate for aligned/direct IO.
      *
-     * @param size buffer size to write, should be divisible by {@link #fsBlockSize}.
+     * @param size buffer size to write, should be divisible by {@link #ioBlockSize}.
      * @return size from parameter.
      * @throws IOException if provided size can't be written using direct IO.
      */
     private int checkSizeIsPadded(int size) throws IOException {
-        if (size % fsBlockSize != 0) {
+        if (size % ioBlockSize != 0) {
             throw new IOException(
-                String.format("Unable to apply DirectIO for read/write buffer [%d] bytes on file system " +
+                String.format("Unable to apply DirectIO for read/write buffer [%d] bytes on " +
                     "block size [%d]. Consider setting %s.setPageSize(%d) or disable Direct IO.",
-                    size, fsBlockSize, DataStorageConfiguration.class.getSimpleName(), fsBlockSize));
+                    size, ioBlockSize, DataStorageConfiguration.class.getSimpleName(), ioBlockSize));
         }
 
         return size;
@@ -446,9 +506,9 @@ public class AlignedBuffersDirectFileIO extends AbstractFileIO {
         if (pos > buf.capacity())
             throw new BufferOverflowException();
 
-        if ((alignedPointer + pos) % fsBlockSize != 0) {
+        if ((alignedPointer + pos) % ioBlockSize != 0) {
             U.warn(log, String.format("IO Buffer Pointer [%d] and/or offset [%d] seems to be not aligned " +
-                "for FS block size [%d]. Direct IO may fail.", alignedPointer, buf.position(), fsBlockSize));
+                "for IO block size [%d]. Direct IO may fail.", alignedPointer, buf.position(), ioBlockSize));
         }
 
         return new Pointer(alignedPointer + pos);

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIOFactory.java
----------------------------------------------------------------------
diff --git a/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIOFactory.java b/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIOFactory.java
index 85a3a02..5d919fe 100644
--- a/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIOFactory.java
+++ b/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIOFactory.java
@@ -49,7 +49,7 @@ public class AlignedBuffersDirectFileIOFactory implements FileIOFactory {
     private final FileIOFactory backupFactory;
 
     /** File system/os block size, negative value if library init was failed. */
-    private final int fsBlockSize;
+    private final int ioBlockSize;
 
     /** Use backup factory, {@code true} if direct IO setup failed. */
     private boolean useBackupFactory;
@@ -81,22 +81,22 @@ public class AlignedBuffersDirectFileIOFactory implements FileIOFactory {
         this.backupFactory = backupFactory;
 
         useBackupFactory = true;
-        fsBlockSize = IgniteNativeIoLib.getFsBlockSize(storePath.getAbsolutePath(), log);
+        ioBlockSize = IgniteNativeIoLib.getDirectIOBlockSize(storePath.getAbsolutePath(), log);
 
         if(!IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_DIRECT_IO_ENABLED, true)) {
             if (log.isInfoEnabled())
-                log.info("Direct IO is explicitly disabled by system property");
+                log.info("Direct IO is explicitly disabled by system property.");
 
             return;
         }
 
-        if (fsBlockSize > 0) {
-            int blkSize = fsBlockSize;
+        if (ioBlockSize > 0) {
+            int blkSize = ioBlockSize;
 
             if (pageSize % blkSize != 0) {
                 U.warn(log, String.format("Unable to setup Direct IO for Ignite [pageSize=%d bytes;" +
                         " file system block size=%d]. For speeding up Ignite consider setting %s.setPageSize(%d)." +
-                        " Direct IO is disabled",
+                        " Direct IO is disabled.",
                     pageSize, blkSize, DataStorageConfiguration.class.getSimpleName(), blkSize));
             }
             else {
@@ -133,7 +133,7 @@ public class AlignedBuffersDirectFileIOFactory implements FileIOFactory {
         assert !useBackupFactory : "Direct IO is disabled, aligned managed buffer creation is disabled now";
         assert managedAlignedBuffers != null : "Direct buffers not available";
 
-        ByteBuffer allocate = AlignedBuffers.allocate(fsBlockSize, size).order(ByteOrder.nativeOrder());
+        ByteBuffer allocate = AlignedBuffers.allocate(ioBlockSize, size).order(ByteOrder.nativeOrder());
 
         managedAlignedBuffers.put(GridUnsafe.bufferAddress(allocate), Thread.currentThread());
 
@@ -145,7 +145,7 @@ public class AlignedBuffersDirectFileIOFactory implements FileIOFactory {
         if (useBackupFactory)
             return backupFactory.create(file, modes);
 
-        return new AlignedBuffersDirectFileIO(fsBlockSize, pageSize, file, modes, tlbOnePageAligned, managedAlignedBuffers, log);
+        return new AlignedBuffersDirectFileIO(ioBlockSize, pageSize, file, modes, tlbOnePageAligned, managedAlignedBuffers, log);
 
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/IgniteNativeIoLib.java
----------------------------------------------------------------------
diff --git a/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/IgniteNativeIoLib.java b/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/IgniteNativeIoLib.java
index 65ef8d7..2ab4325 100644
--- a/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/IgniteNativeIoLib.java
+++ b/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/IgniteNativeIoLib.java
@@ -190,7 +190,7 @@ public class IgniteNativeIoLib {
      * <li>and <tt>-1</tt> if failed to determine block size.</li>
      * <li>and <tt>-1</tt> if JNA is not available or init failed.</li> </ul>
      */
-    public static int getFsBlockSize(final String storageDir, final IgniteLogger log) {
+    public static int getDirectIOBlockSize(final String storageDir, final IgniteLogger log) {
         if (ex != null) {
             U.warn(log, "Failed to initialize O_DIRECT support at current OS: " + ex.getMessage(), ex);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e8eeea37/modules/direct-io/src/test/java/org/apache/ignite/internal/processors/cache/persistence/DiskPageCompressionIntegrationDirectIOTest.java
----------------------------------------------------------------------
diff --git a/modules/direct-io/src/test/java/org/apache/ignite/internal/processors/cache/persistence/DiskPageCompressionIntegrationDirectIOTest.java b/modules/direct-io/src/test/java/org/apache/ignite/internal/processors/cache/persistence/DiskPageCompressionIntegrationDirectIOTest.java
new file mode 100644
index 0000000..89b963a
--- /dev/null
+++ b/modules/direct-io/src/test/java/org/apache/ignite/internal/processors/cache/persistence/DiskPageCompressionIntegrationDirectIOTest.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.persistence;
+
+import org.apache.ignite.internal.processors.cache.persistence.file.AlignedBuffersDirectFileIOFactory;
+import org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory;
+import org.apache.ignite.internal.processors.compress.DiskPageCompressionIntegrationTest;
+
+/**
+ */
+public class DiskPageCompressionIntegrationDirectIOTest extends DiskPageCompressionIntegrationTest {
+    /** {@inheritDoc} */
+    @Override protected void checkFileIOFactory(FileIOFactory f) {
+        assertTrue(f instanceof AlignedBuffersDirectFileIOFactory);
+    }
+}


[49/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/c969d6a7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c969d6a7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c969d6a7

Branch: refs/heads/ignite-10044
Commit: c969d6a7db65f44d0f27a648c191c1cd186bf4d7
Parents: 5f94fca 7920646
Author: sboikov <sb...@apache.org>
Authored: Thu Nov 29 13:37:01 2018 +0300
Committer: sboikov <sb...@apache.org>
Committed: Thu Nov 29 13:37:01 2018 +0300

----------------------------------------------------------------------
 examples/sql/world.sql                          |   28 +-
 .../JettyRestProcessorAbstractSelfTest.java     |   90 +-
 ...RestProcessorAuthenticationAbstractTest.java |    6 +-
 .../apache/ignite/IgniteSystemProperties.java   |   15 -
 .../ignite/internal/IgniteNodeAttributes.java   |    3 -
 .../discovery/GridDiscoveryManager.java         |   17 -
 .../cache/CacheAffinitySharedManager.java       |   16 +-
 .../cache/CacheEntryPredicateContainsValue.java |    4 +
 .../preloader/latch/ExchangeLatchManager.java   |    2 +-
 .../GridCacheDatabaseSharedManager.java         |   20 +-
 .../persistence/GridCacheOffheapManager.java    |    4 +-
 .../cache/persistence/tree/BPlusTree.java       |   23 +-
 .../platform/client/ClientRequest.java          |   28 -
 .../cache/ClientCacheClearKeyRequest.java       |    3 -
 .../cache/ClientCacheClearKeysRequest.java      |    3 -
 .../client/cache/ClientCacheClearRequest.java   |    3 -
 .../cache/ClientCacheContainsKeyRequest.java    |    3 -
 .../cache/ClientCacheContainsKeysRequest.java   |    3 -
 ...ientCacheCreateWithConfigurationRequest.java |    9 +-
 .../cache/ClientCacheCreateWithNameRequest.java |    6 +-
 .../client/cache/ClientCacheDestroyRequest.java |    3 -
 .../client/cache/ClientCacheGetAllRequest.java  |    5 +-
 .../ClientCacheGetAndPutIfAbsentRequest.java    |    3 -
 .../cache/ClientCacheGetAndPutRequest.java      |    3 -
 .../cache/ClientCacheGetAndRemoveRequest.java   |    3 -
 .../cache/ClientCacheGetAndReplaceRequest.java  |    3 -
 ...acheGetOrCreateWithConfigurationRequest.java |    9 +-
 .../ClientCacheGetOrCreateWithNameRequest.java  |    3 -
 .../client/cache/ClientCacheGetRequest.java     |    3 -
 .../client/cache/ClientCacheGetSizeRequest.java |    3 -
 .../cache/ClientCacheLocalPeekRequest.java      |    3 -
 .../cache/ClientCacheNodePartitionsRequest.java |    2 -
 .../client/cache/ClientCachePutAllRequest.java  |    3 -
 .../cache/ClientCachePutIfAbsentRequest.java    |    3 -
 .../client/cache/ClientCachePutRequest.java     |    3 -
 .../cache/ClientCacheRemoveAllRequest.java      |    3 -
 .../cache/ClientCacheRemoveIfEqualsRequest.java |    3 -
 .../cache/ClientCacheRemoveKeyRequest.java      |    3 -
 .../cache/ClientCacheRemoveKeysRequest.java     |    3 -
 .../ClientCacheReplaceIfEqualsRequest.java      |    3 -
 .../client/cache/ClientCacheReplaceRequest.java |    3 -
 .../client/cache/ClientCacheRequest.java        |   32 -
 .../cache/ClientCacheScanQueryRequest.java      |    3 -
 .../service/GridServiceProcessor.java           |   12 -
 .../util/tostring/GridToStringBuilder.java      |  101 +-
 .../internal/util/tostring/SBLimitedLength.java |    1 -
 .../ignite/spi/discovery/tcp/ServerImpl.java    |   41 -
 .../GridDiscoveryManagerAttributesSelfTest.java |   37 -
 .../cache/CacheEnumOperationsAbstractTest.java  |    2 -
 .../CacheSerializableTransactionsTest.java      |   32 +-
 ...IgniteAbstractDynamicCacheStartFailTest.java | 1959 +++++++++++-------
 .../GridCacheBinaryObjectsAbstractSelfTest.java |   58 +
 ...IgnitePartitionedCountDownLatchSelfTest.java |    5 -
 .../distributed/CacheExchangeMergeTest.java     |    4 +-
 ...ptimisticTxSuspendResumeMultiServerTest.java |   30 -
 .../IgniteOptimisticTxSuspendResumeTest.java    |  228 +-
 .../CacheMvccConfigurationValidationTest.java   |   37 +-
 ...eBaselineAffinityTopologyActivationTest.java |   59 -
 ...PdsCacheStartStopWithFreqCheckpointTest.java |  177 ++
 ...OptimisticPrepareOnUnstableTopologyTest.java |  164 +-
 .../transactions/TxRollbackOnTimeoutTest.java   |    3 +-
 .../processors/database/BPlusTreeSelfTest.java  |   23 +
 .../tostring/GridToStringBuilderSelfTest.java   |   82 +
 ...GridTcpCommunicationSpiRecoverySelfTest.java |    1 -
 .../ignite/testframework/GridTestUtils.java     |    6 +-
 .../testsuites/IgniteCacheTestSuite6.java       |    2 -
 .../ignite/testsuites/IgnitePdsTestSuite2.java  |    3 +
 .../cache/IgniteCacheAbstractQuerySelfTest.java |   54 +-
 .../IgniteCacheQueryMultiThreadedSelfTest.java  |    6 +-
 .../IgniteCacheStarvationOnRebalanceTest.java   |    5 +-
 .../query/SqlIllegalSchemaSelfTest.java         |  176 +-
 modules/mesos/pom.xml                           |   48 -
 .../ignite/mesos/resource/IgniteProvider.java   |    1 -
 .../ignite/ml/multiclass/MultiClassModel.java   |  115 +
 .../ignite/ml/multiclass/OneVsRestTrainer.java  |  147 ++
 .../org/apache/ignite/ml/IgniteMLTestSuite.java |    4 +-
 .../inference/util/DirectorySerializerTest.java |   18 +-
 .../ml/multiclass/MultiClassTestSuite.java      |   32 +
 .../ml/multiclass/OneVsRestTrainerTest.java     |  126 ++
 .../include/ignite/binary/binary_object.h       |    1 +
 .../include/ignite/binary/binary_raw_reader.h   |   20 +
 .../include/ignite/binary/binary_raw_writer.h   |   38 +-
 .../include/ignite/binary/binary_reader.h       |   26 +-
 .../include/ignite/binary/binary_writer.h       |   42 +-
 .../FailureHandlerTest.cs                       |    2 +
 .../components/modal-import-models/service.js   |   24 +-
 parent/pom.xml                                  |    1 +
 87 files changed, 2721 insertions(+), 1623 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c969d6a7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------


[07/50] [abbrv] ignite git commit: IGNITE-9145:[ML] Add different strategies to index labels in StringEncoderTrainer

Posted by sb...@apache.org.
IGNITE-9145:[ML] Add different strategies to index labels in
StringEncoderTrainer

this closes #5481


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9137af73
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9137af73
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9137af73

Branch: refs/heads/ignite-10044
Commit: 9137af73ef20228ee98e4bc95a8ccb15dadd0010
Parents: cdaeda1
Author: zaleslaw <za...@gmail.com>
Authored: Mon Nov 26 14:10:51 2018 +0300
Committer: Yury Babak <yb...@gridgain.com>
Committed: Mon Nov 26 14:10:51 2018 +0300

----------------------------------------------------------------------
 .../encoding/EncoderSortingStrategy.java        | 31 ++++++++++++++++++++
 .../preprocessing/encoding/EncoderTrainer.java  | 25 +++++++++++++++-
 .../encoding/EncoderTrainerTest.java            | 27 +++++++++++++++++
 3 files changed, 82 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9137af73/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/encoding/EncoderSortingStrategy.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/encoding/EncoderSortingStrategy.java b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/encoding/EncoderSortingStrategy.java
new file mode 100644
index 0000000..22cca53
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/preprocessing/encoding/EncoderSortingStrategy.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.ml.preprocessing.encoding;
+
+/**
+ * Describes Encoder sorting strategy to define mapping of integer values to values of categorical feature .
+ *
+ * @see EncoderTrainer
+ */
+public enum EncoderSortingStrategy {
+    /** Descending order by label frequency (most frequent label assigned 0). */
+    FREQUENCY_DESC,
+
+    /** Ascending order by label frequency (least frequent label assigned 0). */
+    FREQUENCY_ASC
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9137af73/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 9a97a6d..d5668e4 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
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.ml.preprocessing.encoding;
 
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
@@ -47,6 +49,9 @@ public class EncoderTrainer<K, V> implements PreprocessingTrainer<K, V, Object[]
     /** Encoder preprocessor type. */
     private EncoderType encoderType = EncoderType.ONE_HOT_ENCODER;
 
+    /** Encoder sorting strategy. */
+    private EncoderSortingStrategy encoderSortingStgy = EncoderSortingStrategy.FREQUENCY_DESC;
+
     /** {@inheritDoc} */
     @Override public EncoderPreprocessor<K, V> fit(DatasetBuilder<K, V> datasetBuilder,
                                                    IgniteBiFunction<K, V, Object[]> basePreprocessor) {
@@ -129,9 +134,16 @@ public class EncoderTrainer<K, V> implements PreprocessingTrainer<K, V, Object[]
      * @return Encoding values.
      */
     private Map<String, Integer> transformFrequenciesToEncodingValues(Map<String, Integer> frequencies) {
+        Comparator<Map.Entry<String, Integer>> comp;
+
+        if (encoderSortingStgy.equals(EncoderSortingStrategy.FREQUENCY_DESC))
+            comp = Map.Entry.comparingByValue();
+        else
+            comp = Collections.reverseOrder(Map.Entry.comparingByValue());
+
         final HashMap<String, Integer> resMap = frequencies.entrySet()
             .stream()
-            .sorted(Map.Entry.comparingByValue())
+            .sorted(comp)
             .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
                 (oldValue, newValue) -> oldValue, LinkedHashMap::new));
 
@@ -211,6 +223,17 @@ public class EncoderTrainer<K, V> implements PreprocessingTrainer<K, V, Object[]
     }
 
     /**
+     * Sets the encoder indexing strategy.
+     *
+     * @param encoderSortingStgy The encoder indexing strategy.
+     * @return The changed trainer.
+     */
+    public EncoderTrainer<K, V> withEncoderIndexingStrategy(EncoderSortingStrategy encoderSortingStgy) {
+        this.encoderSortingStgy = encoderSortingStgy;
+        return this;
+    }
+
+    /**
      * Sets the encoder preprocessor type.
      *
      * @param type The encoder preprocessor type.

http://git-wip-us.apache.org/repos/asf/ignite/blob/9137af73/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 23afd30..7c7eabe 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
@@ -115,4 +115,31 @@ public class EncoderTrainerTest extends TrainerTest {
         }
         fail("UnknownCategorialFeatureValue");
     }
+
+    /** Tests {@code fit()} method. */
+    @Test
+    public void testFitOnStringCategorialFeaturesWithReversedOrder() {
+        Map<Integer, String[]> data = new HashMap<>();
+        data.put(1, new String[] {"Monday", "September"});
+        data.put(2, new String[] {"Monday", "August"});
+        data.put(3, new String[] {"Monday", "August"});
+        data.put(4, new String[] {"Friday", "June"});
+        data.put(5, new String[] {"Friday", "June"});
+        data.put(6, new String[] {"Sunday", "August"});
+
+        DatasetBuilder<Integer, String[]> datasetBuilder = new LocalDatasetBuilder<>(data, parts);
+
+        EncoderTrainer<Integer, String[]> strEncoderTrainer = new EncoderTrainer<Integer, String[]>()
+            .withEncoderType(EncoderType.STRING_ENCODER)
+            .withEncoderIndexingStrategy(EncoderSortingStrategy.FREQUENCY_ASC)
+            .withEncodedFeature(0)
+            .withEncodedFeature(1);
+
+        EncoderPreprocessor<Integer, String[]> preprocessor = strEncoderTrainer.fit(
+            datasetBuilder,
+            (k, v) -> v
+        );
+
+        assertArrayEquals(new double[] {2.0, 0.0}, preprocessor.apply(7, new String[] {"Monday", "September"}).asArray(), 1e-8);
+    }
 }