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/10/30 06:08:52 UTC

[01/28] ignite git commit: IGNITE-10016 Web Console: ClusterLoginService should return "Credentials" modal as singleton.

Repository: ignite
Updated Branches:
  refs/heads/ignite-627 7aa249870 -> 0ed37afb3


IGNITE-10016 Web Console: ClusterLoginService should return "Credentials" modal as singleton.


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

Branch: refs/heads/ignite-627
Commit: 51d8c9f72a0553397d4f471f81f926e498f21114
Parents: 797e7af
Author: Alexander Kalinin <ve...@yandex.ru>
Authored: Fri Oct 26 16:42:39 2018 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Oct 26 16:42:39 2018 +0700

----------------------------------------------------------------------
 .../agent/components/cluster-login/service.js   | 21 +++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/51d8c9f7/modules/web-console/frontend/app/modules/agent/components/cluster-login/service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/agent/components/cluster-login/service.js b/modules/web-console/frontend/app/modules/agent/components/cluster-login/service.js
index 128f3cc..955d0a3 100644
--- a/modules/web-console/frontend/app/modules/agent/components/cluster-login/service.js
+++ b/modules/web-console/frontend/app/modules/agent/components/cluster-login/service.js
@@ -22,6 +22,8 @@ import {CancellationError} from 'app/errors/CancellationError';
 export default class ClusterLoginService {
     static $inject = ['$modal', '$q'];
 
+    deferred;
+
     /**
      * @param {mgcrea.ngStrap.modal.IModalService} $modal
      * @param {ng.IQService} $q
@@ -36,7 +38,12 @@ export default class ClusterLoginService {
      * @returns {ng.IPromise<import('../../types/ClusterSecrets').ClusterSecrets>}
      */
     askCredentials(baseSecrets) {
-        const deferred = this.$q.defer();
+        if (this.deferred)
+            return this.deferred.promise;
+
+        this.deferred = this.$q.defer();
+
+        const self = this;
 
         const modal = this.$modal({
             template: `
@@ -50,11 +57,11 @@ export default class ClusterLoginService {
                 this.secrets = _.clone(baseSecrets);
 
                 this.onLogin = () => {
-                    deferred.resolve(this.secrets);
+                    self.deferred.resolve(this.secrets);
                 };
 
                 this.onHide = () => {
-                    deferred.reject(new CancellationError());
+                    self.deferred.reject(new CancellationError());
                 };
             }],
             controllerAs: '$ctrl',
@@ -63,7 +70,11 @@ export default class ClusterLoginService {
         });
 
         return modal.$promise
-            .then(() => deferred.promise)
-            .finally(modal.hide);
+            .then(() => this.deferred.promise)
+            .finally(() => {
+                this.deferred = null;
+
+                modal.hide();
+            });
     }
 }


[03/28] ignite git commit: IGNITE-7196 Restore binary state before node join to topology - Fixes #4520.

Posted by sb...@apache.org.
IGNITE-7196 Restore binary state before node join to topology - Fixes #4520.

Signed-off-by: Dmitriy Govorukhin <dm...@gmail.com>


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

Branch: refs/heads/ignite-627
Commit: c7449f6c6a318debce84883aba69e6c028af5e48
Parents: 28e3dec
Author: Maxim Muzafarov <ma...@gmail.com>
Authored: Fri Oct 26 15:16:40 2018 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Fri Oct 26 15:16:40 2018 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    |   2 +
 .../pagemem/store/IgnitePageStoreManager.java   |  12 +-
 .../pagemem/wal/IgniteWriteAheadLogManager.java |   7 +-
 .../wal/record/MemoryRecoveryRecord.java        |   7 +-
 .../processors/cache/GridCacheProcessor.java    |   2 +-
 .../GridDhtPartitionsExchangeFuture.java        |  76 ++----
 .../cache/mvcc/MvccProcessorImpl.java           |  18 +-
 .../persistence/DatabaseLifecycleListener.java  |  13 +-
 .../GridCacheDatabaseSharedManager.java         | 256 +++++++++++++------
 .../IgniteCacheDatabaseSharedManager.java       |  87 +++++--
 .../persistence/file/FilePageStoreManager.java  |  37 ++-
 .../persistence/metastorage/MetaStorage.java    |   5 -
 .../wal/FileWriteAheadLogManager.java           |  27 +-
 .../wal/FsyncModeFileWriteAheadLogManager.java  |  27 +-
 .../file/IgnitePdsDiskErrorsRecoveringTest.java |  12 +-
 .../persistence/db/wal/WalCompactionTest.java   |  15 ++
 .../pagemem/NoOpPageStoreManager.java           |   6 +
 .../persistence/pagemem/NoOpWALManager.java     |   5 -
 .../db/wal/IgniteWalRecoveryTest.java           | 123 +++++++++
 19 files changed, 502 insertions(+), 235 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/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 1f9a5e8..250fbd7 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
@@ -1046,6 +1046,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
                 fillNodeAttributes(clusterProc.updateNotifierEnabled());
 
                 ctx.cache().context().database().notifyMetaStorageSubscribersOnReadyForRead();
+
+                ctx.cache().context().database().startMemoryRestore(ctx);
             }
             catch (Throwable e) {
                 U.error(

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/modules/core/src/main/java/org/apache/ignite/internal/pagemem/store/IgnitePageStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/store/IgnitePageStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/store/IgnitePageStoreManager.java
index d7c61e9..1408383 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/store/IgnitePageStoreManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/store/IgnitePageStoreManager.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.pagemem.store;
 
 import java.nio.ByteBuffer;
 import java.util.Map;
+import java.util.function.Predicate;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.pagemem.PageMemory;
@@ -243,11 +244,20 @@ public interface IgnitePageStoreManager extends GridCacheSharedManager, IgniteCh
     public void cleanupPersistentSpace(CacheConfiguration cacheConfiguration) throws IgniteCheckedException;
 
     /**
-     * Cleanup persistent space for all caches.
+     * Cleanup persistent space for all caches except metastore.
      */
     public void cleanupPersistentSpace() throws IgniteCheckedException;
 
     /**
+     * Cleanup cache store whether it matches the provided predicate and if matched
+     * store was previously initizlized.
+     *
+     * @param cacheGrpPred Predicate to match by id cache group stores to clean.
+     * @param cleanFiles {@code True} to delete all persisted files related to particular store.
+     */
+    public void cleanupPageStoreIfMatch(Predicate<Integer> cacheGrpPred, boolean cleanFiles);
+
+    /**
      * Creates and initializes cache work directory retrieved from {@code cacheCfg}.
      *
      * @param cacheCfg Cache configuration.

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/IgniteWriteAheadLogManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/IgniteWriteAheadLogManager.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/IgniteWriteAheadLogManager.java
index 68428d0..679eec9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/IgniteWriteAheadLogManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/IgniteWriteAheadLogManager.java
@@ -47,6 +47,8 @@ public interface IgniteWriteAheadLogManager extends GridCacheSharedManager, Igni
     /**
      * Resumes logging after start. When WAL manager is started, it will skip logging any updates until this
      * method is called to avoid logging changes induced by the state restore procedure.
+     *
+     * @throws IgniteCheckedException If fails.
      */
     public void resumeLogging(WALPointer lastWrittenPtr) throws IgniteCheckedException;
 
@@ -178,9 +180,4 @@ public interface IgniteWriteAheadLogManager extends GridCacheSharedManager, Igni
      * @param grpId Group id.
      */
     public boolean disabled(int grpId);
-
-    /**
-     * Cleanup all directories relating to WAL (e.g. work WAL dir, archive WAL dir).
-     */
-    public void cleanupWalDirectories() throws IgniteCheckedException;
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MemoryRecoveryRecord.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MemoryRecoveryRecord.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MemoryRecoveryRecord.java
index 8843eee..92658cc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MemoryRecoveryRecord.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MemoryRecoveryRecord.java
@@ -20,8 +20,13 @@ package org.apache.ignite.internal.pagemem.wal.record;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
- * Marker that we start memory recovering
+ * Marker that we start memory recovering.
+ *
+ * @deprecated Previously, used to track node started\stopped states. But in fact only
+ * mark files created by method GridCacheDatabaseSharedManager#nodeStart(WALPointer)
+ * used. Should be removed in 3.0 release.
  */
+@Deprecated
 public class MemoryRecoveryRecord extends WALRecord {
     /** Create timestamp, millis */
     private long time;

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/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 2394ad1..d33e929 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
@@ -2264,7 +2264,7 @@ public class GridCacheProcessor extends GridProcessorAdapter implements Metastor
      * @param affNode {@code true} if it is affinity node for cache.
      * @throws IgniteCheckedException if failed.
      */
-    private void preparePageStore(DynamicCacheDescriptor desc, boolean affNode) throws IgniteCheckedException {
+    public void preparePageStore(DynamicCacheDescriptor desc, boolean affNode) throws IgniteCheckedException {
         if (sharedCtx.pageStore() != null && affNode)
             initializationProtector.protect(
                 desc.groupDescriptor().groupId(),

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/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 d54b1ab..23e47e5 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
@@ -50,7 +50,6 @@ import org.apache.ignite.cache.CacheRebalanceMode;
 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.events.DiscoveryEvent;
 import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
 import org.apache.ignite.internal.IgniteDiagnosticAware;
@@ -83,7 +82,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate;
 import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.GridCacheUtils;
-import org.apache.ignite.internal.processors.cache.LocalJoinCachesContext;
 import org.apache.ignite.internal.processors.cache.StateChangeRequest;
 import org.apache.ignite.internal.processors.cache.WalStateAbstractMessage;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFutureAdapter;
@@ -870,13 +868,22 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
      * @throws IgniteCheckedException If failed.
      */
     private IgniteInternalFuture<?> initCachesOnLocalJoin() throws IgniteCheckedException {
-        boolean baselineNode = isLocalNodeInBaseline();
-
-        if (!baselineNode) {
+        if (!isLocalNodeInBaseline()) {
             cctx.exchange().exchangerBlockingSectionBegin();
 
             try {
-                cctx.cache().cleanupCachesDirectories();
+                cctx.database().cleanupRestoredCaches();
+
+                for (DynamicCacheDescriptor desc : cctx.cache().cacheDescriptors().values()) {
+                    if (CU.isPersistentCache(desc.cacheConfiguration(),
+                        cctx.gridConfig().getDataStorageConfiguration())) {
+                        // Perform cache init from scratch.
+                        cctx.cache().preparePageStore(desc, true);
+                    }
+                }
+
+                // Set initial node started marker.
+                cctx.database().nodeStart(null);
             }
             finally {
                 cctx.exchange().exchangerBlockingSectionEnd();
@@ -892,34 +899,11 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
             cctx.exchange().exchangerBlockingSectionEnd();
         }
 
-        LocalJoinCachesContext locJoinCtx = exchActions == null ? null : exchActions.localJoinContext();
-
-        List<T2<DynamicCacheDescriptor, NearCacheConfiguration>> caches = locJoinCtx == null ? null :
-            locJoinCtx.caches();
-
-        if (!cctx.kernalContext().clientNode()) {
-            List<DynamicCacheDescriptor> startDescs = new ArrayList<>();
-
-            if (caches != null) {
-                for (T2<DynamicCacheDescriptor, NearCacheConfiguration> c : caches) {
-                    DynamicCacheDescriptor startDesc = c.get1();
-
-                    if (CU.isPersistentCache(startDesc.cacheConfiguration(), cctx.gridConfig().getDataStorageConfiguration()))
-                        startDescs.add(startDesc);
-                }
-            }
-
-            cctx.exchange().exchangerBlockingSectionBegin();
-
-            try {
-                cctx.database().readCheckpointAndRestoreMemory(startDescs, !baselineNode);
-            }
-            finally {
-                cctx.exchange().exchangerBlockingSectionEnd();
-            }
-        }
+        if (!cctx.kernalContext().clientNode())
+            cctx.database().onDoneRestoreBinaryMemory();
 
-        IgniteInternalFuture<?> cachesRegistrationFut = cctx.cache().startCachesOnLocalJoin(initialVersion(), locJoinCtx);
+        IgniteInternalFuture<?> cachesRegistrationFut = cctx.cache().startCachesOnLocalJoin(initialVersion(),
+            exchActions == null ? null : exchActions.localJoinContext());
 
         ensureClientCachesStarted();
 
@@ -1080,26 +1064,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
                         cctx.exchange().exchangerBlockingSectionEnd();
                     }
 
-                    if (!cctx.kernalContext().clientNode()) {
-                        List<DynamicCacheDescriptor> startDescs = new ArrayList<>();
-
-                        for (ExchangeActions.CacheActionData startReq : exchActions.cacheStartRequests()) {
-                            DynamicCacheDescriptor desc = startReq.descriptor();
-
-                            if (CU.isPersistentCache(desc.cacheConfiguration(),
-                                cctx.gridConfig().getDataStorageConfiguration()))
-                                startDescs.add(desc);
-                        }
-
-                        cctx.exchange().exchangerBlockingSectionBegin();
-
-                        try {
-                            cctx.database().readCheckpointAndRestoreMemory(startDescs, false);
-                        }
-                        finally {
-                            cctx.exchange().exchangerBlockingSectionEnd();
-                        }
-                    }
+                    if (!cctx.kernalContext().clientNode())
+                        cctx.database().onDoneRestoreBinaryMemory();
 
                     assert registerCachesFuture == null : "No caches registration should be scheduled before new caches have started.";
 
@@ -2148,9 +2114,9 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
 
         cctx.database().releaseHistoryForExchange();
 
-        cctx.database().rebuildIndexesIfNeeded(this);
-
         if (err == null) {
+            cctx.database().rebuildIndexesIfNeeded(this);
+
             for (CacheGroupContext grp : cctx.cache().cacheGroups()) {
                 if (!grp.isLocal())
                     grp.topology().onExchangeDone(this, grp.affinity().readyAffinity(res), false);

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/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 a304bef..bf51103 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
@@ -324,10 +324,22 @@ public class MvccProcessorImpl extends GridProcessorAdapter implements MvccProce
     }
 
     /** {@inheritDoc} */
-    @SuppressWarnings("ConstantConditions")
-    @Override public void beforeMemoryRestore(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException {
+    @Override public void beforeBinaryMemoryRestore(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException {
+        txLogPageStoreInit(mgr);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void beforeResumeWalLogging(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException {
+        // In case of blt changed we should re-init TX_LOG cache.
+        txLogPageStoreInit(mgr);
+    }
+
+    /**
+     * @param mgr Database shared manager.
+     * @throws IgniteCheckedException If failed.
+     */
+    private void txLogPageStoreInit(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException {
         assert CU.isPersistenceEnabled(ctx.config());
-        assert txLog == null;
 
         ctx.cache().context().pageStore().initialize(TX_LOG_CACHE_ID, 1,
             TX_LOG_CACHE_NAME, mgr.dataRegion(TX_LOG_CACHE_NAME).memoryMetrics());

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DatabaseLifecycleListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DatabaseLifecycleListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DatabaseLifecycleListener.java
index f96cdd9..ae65c77 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DatabaseLifecycleListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DatabaseLifecycleListener.java
@@ -23,7 +23,6 @@ import org.apache.ignite.IgniteCheckedException;
  *
  */
 public interface DatabaseLifecycleListener {
-
     /**
      * @param mgr Database shared manager.
      *
@@ -31,10 +30,16 @@ public interface DatabaseLifecycleListener {
     void onInitDataRegions(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException;
 
     /**
-     * @param mgr Page store manager.
-     *
+     * @param mgr Database shared manager.
+     * @throws IgniteCheckedException If failed.
+     */
+    public void beforeBinaryMemoryRestore(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException;
+
+    /**
+     * @param mgr Database shared manager.
+     * @throws IgniteCheckedException If failed.
      */
-    void beforeMemoryRestore(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException;
+    public void beforeResumeWalLogging(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException;
 
     /**
      * @param mgr Database shared manager.

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/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 3e2e6a1..4af1d8e 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
@@ -53,6 +53,7 @@ import java.util.concurrent.TimeUnit;
 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.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
@@ -96,7 +97,6 @@ import org.apache.ignite.internal.pagemem.wal.record.CacheState;
 import org.apache.ignite.internal.pagemem.wal.record.CheckpointRecord;
 import org.apache.ignite.internal.pagemem.wal.record.DataEntry;
 import org.apache.ignite.internal.pagemem.wal.record.DataRecord;
-import org.apache.ignite.internal.pagemem.wal.record.MemoryRecoveryRecord;
 import org.apache.ignite.internal.pagemem.wal.record.MetastoreDataRecord;
 import org.apache.ignite.internal.pagemem.wal.record.PageSnapshot;
 import org.apache.ignite.internal.pagemem.wal.record.WALRecord;
@@ -159,8 +159,8 @@ import org.apache.ignite.lang.IgniteOutClosure;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.mxbean.DataStorageMetricsMXBean;
 import org.apache.ignite.thread.IgniteThread;
-import org.jetbrains.annotations.NotNull;
 import org.apache.ignite.thread.IgniteThreadPoolExecutor;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentLinkedHashMap;
 
@@ -168,6 +168,7 @@ import static java.nio.file.StandardOpenOption.READ;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_CHECKPOINT_READ_LOCK_TIMEOUT;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_PDS_SKIP_CRC;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_PDS_WAL_REBALANCE_THRESHOLD;
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_DATA_REG_DEFAULT_NAME;
 import static org.apache.ignite.failure.FailureType.CRITICAL_ERROR;
 import static org.apache.ignite.failure.FailureType.SYSTEM_WORKER_TERMINATION;
 import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType.CHECKPOINT_RECORD;
@@ -282,6 +283,14 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     /** */
     private boolean stopping;
 
+    /**
+     * The position of last seen WAL pointer. Used for resumming logging from this pointer.
+     *
+     * If binary memory recovery pefrormed on node start, the checkpoint END pointer will store
+     * not the last WAL pointer and can't be used for resumming logging.
+     */
+    private volatile WALPointer walTail;
+
     /** Checkpoint runner thread pool. If null tasks are to be run in single thread */
     @Nullable private IgniteThreadPoolExecutor asyncRunner;
 
@@ -330,7 +339,10 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     /** Number of pages in current checkpoint at the beginning of checkpoint. */
     private volatile int currCheckpointPagesCnt;
 
-    /** */
+    /**
+     * MetaStorage instance. Value {@code null} means storage not initialized yet.
+     * Guarded by {@link GridCacheDatabaseSharedManager#checkpointReadLock()}
+     */
     private MetaStorage metaStorage;
 
     /** */
@@ -434,6 +446,8 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     }
 
     /**
+     * Create metastorage data region configuration with enabled persistence by default.
+     *
      * @param storageCfg Data storage configuration.
      * @return Data region configuration.
      */
@@ -520,10 +534,43 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
         }
     }
 
-    /**
-     * Cleanup checkpoint directory.
-     */
+    /** {@inheritDoc} */
+    @Override public void cleanupRestoredCaches() {
+        if (dataRegionMap == null)
+            return;
+
+        for (CacheGroupDescriptor grpDesc : cctx.cache().cacheGroupDescriptors().values()) {
+            String regionName = grpDesc.config().getDataRegionName();
+
+            DataRegion region = dataRegionMap.get(regionName == null ? DFLT_DATA_REG_DEFAULT_NAME : regionName);
+
+            if (region == null)
+                continue;
+
+            int partitions = grpDesc.config().getAffinity().partitions();
+
+            if (region.pageMemory() instanceof PageMemoryEx) {
+                PageMemoryEx memEx = (PageMemoryEx)region.pageMemory();
+
+                for (int partId = 0; partId < partitions; partId++)
+                    memEx.invalidate(grpDesc.groupId(), partId);
+            }
+        }
+
+        storeMgr.cleanupPageStoreIfMatch(
+            new Predicate<Integer>() {
+                @Override public boolean test(Integer grpId) {
+                    return MetaStorage.METASTORAGE_CACHE_ID != grpId;
+                }
+            },
+            true);
+    }
+
+    /** {@inheritDoc} */
     @Override public void cleanupCheckpointDirectory() throws IgniteCheckedException {
+        if (cpHistory != null)
+            cpHistory = new CheckpointHistory(cctx.kernalContext());
+
         try {
             try (DirectoryStream<Path> files = Files.newDirectoryStream(cpDir.toPath())) {
                 for (Path path : files)
@@ -645,7 +692,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
             checkpointReadLock();
 
             try {
-                restoreMemory(status, true, storePageMem, false);
+                restoreMemory(status, true, storePageMem, Collections.emptySet());
 
                 metaStorage = new MetaStorage(cctx, regCfg, memMetrics, true);
 
@@ -658,12 +705,18 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                 notifyMetastorageReadyForRead();
             }
             finally {
-                checkpointReadUnlock();
-            }
+                metaStorage = null;
+
+                storePageMem.stop(true);
 
-            metaStorage = null;
+                cctx.pageStore().cleanupPageStoreIfMatch(new Predicate<Integer>() {
+                    @Override public boolean test(Integer grpId) {
+                        return MetaStorage.METASTORAGE_CACHE_ID == grpId;
+                    }
+                }, false);
 
-            storePageMem.stop(true);
+                checkpointReadUnlock();
+            }
         }
         catch (StorageException e) {
             cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));
@@ -680,7 +733,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
 
         snapshotMgr = cctx.snapshot();
 
-        if (!cctx.localNode().isClient()) {
+        if (!cctx.kernalContext().clientNode()) {
             initDataBase();
 
             registrateMetricsMBean();
@@ -789,11 +842,8 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     }
 
     /** {@inheritDoc} */
-    @Override public void readCheckpointAndRestoreMemory(
-            List<DynamicCacheDescriptor> cachesToStart,
-            boolean restoreMetastorageOnly
-    ) throws IgniteCheckedException {
-        assert !cctx.localNode().isClient();
+    @Override public void onDoneRestoreBinaryMemory() throws IgniteCheckedException {
+        assert !cctx.kernalContext().clientNode();
 
         long time = System.currentTimeMillis();
 
@@ -801,50 +851,88 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
 
         try {
             for (DatabaseLifecycleListener lsnr : getDatabaseListeners(cctx.kernalContext()))
-                lsnr.beforeMemoryRestore(this);
+                lsnr.beforeResumeWalLogging(this);
 
-            if (!F.isEmpty(cachesToStart)) {
-                for (DynamicCacheDescriptor desc : cachesToStart) {
-                    if (CU.affinityNode(cctx.localNode(), desc.cacheConfiguration().getNodeFilter()))
-                        storeMgr.initializeForCache(desc.groupDescriptor(), new StoredCacheData(desc.cacheConfiguration()));
-                }
-            }
+            cctx.pageStore().initializeForMetastorage();
 
             CheckpointStatus status = readCheckpointStatus();
 
-            cctx.pageStore().initializeForMetastorage();
+            // Binary memory should be recovered at startup.
+            assert !status.needRestoreMemory() : status;
+
+            WALPointer statusEndPtr = CheckpointStatus.NULL_PTR.equals(status.endPtr) ? null : status.endPtr;
+
+            // If binary memory recovery occurs resume from the last walTail in the other case from END checkpoint.
+            WALPointer walPtr = walTail == null ? statusEndPtr : walTail;
+
+            cctx.wal().resumeLogging(walPtr);
+
+            walTail = null;
 
             metaStorage = new MetaStorage(
                 cctx,
                 dataRegionMap.get(METASTORE_DATA_REGION_NAME),
-                (DataRegionMetricsImpl)memMetricsMap.get(METASTORE_DATA_REGION_NAME)
+                (DataRegionMetricsImpl)memMetricsMap.get(METASTORE_DATA_REGION_NAME),
+                false
             );
 
-            WALPointer restore = restoreMemory(status, restoreMetastorageOnly, (PageMemoryEx) metaStorage.pageMemory(), true);
+            // Init metastore only after WAL logging resumed. Can't do it earlier because
+            // MetaStorage first initialization also touches WAL, look at #isWalDeltaRecordNeeded.
+            metaStorage.init(this);
 
-            if (restore == null && !status.endPtr.equals(CheckpointStatus.NULL_PTR)) {
-                throw new StorageException("Restore wal pointer = " + restore + ", while status.endPtr = " +
-                    status.endPtr + ". Can't restore memory - critical part of WAL archive is missing.");
-            }
+            notifyMetastorageReadyForReadWrite();
 
-            // First, bring memory to the last consistent checkpoint state if needed.
-            // This method should return a pointer to the last valid record in the WAL.
-            cctx.wal().resumeLogging(restore);
+            for (DatabaseLifecycleListener lsnr : getDatabaseListeners(cctx.kernalContext()))
+                lsnr.afterMemoryRestore(this);
+        }
+        catch (IgniteCheckedException e) {
+            if (X.hasCause(e, StorageException.class, IOException.class))
+                cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));
 
-            WALPointer ptr = cctx.wal().log(new MemoryRecoveryRecord(U.currentTimeMillis()));
+            throw e;
+        }
+        finally {
+            checkpointReadUnlock();
 
-            if (ptr != null) {
-                cctx.wal().flush(ptr, true);
+            U.log(log, "Resume logging performed in " + (System.currentTimeMillis() - time) + " ms.");
+        }
+    }
 
-                nodeStart(ptr);
-            }
+    /**
+     * @param cacheGrps Cache groups to restore.
+     * @return Last seen WAL pointer during binary memory recovery.
+     * @throws IgniteCheckedException If failed.
+     */
+    protected WALPointer restoreBinaryMemory(Set<Integer> cacheGrps) throws IgniteCheckedException {
+        assert !cctx.kernalContext().clientNode();
 
-            metaStorage.init(this);
+        long time = System.currentTimeMillis();
 
-            notifyMetastorageReadyForReadWrite();
+        checkpointReadLock();
 
+        try {
             for (DatabaseLifecycleListener lsnr : getDatabaseListeners(cctx.kernalContext()))
-                lsnr.afterMemoryRestore(this);
+                lsnr.beforeBinaryMemoryRestore(this);
+
+            cctx.pageStore().initializeForMetastorage();
+
+            CheckpointStatus status = readCheckpointStatus();
+
+            // First, bring memory to the last consistent checkpoint state if needed.
+            // This method should return a pointer to the last valid record in the WAL.
+            WALPointer tailWalPtr = restoreMemory(status,
+                false,
+                (PageMemoryEx)dataRegionMap.get(METASTORE_DATA_REGION_NAME).pageMemory(),
+                cacheGrps);
+
+            if (tailWalPtr == null && !status.endPtr.equals(CheckpointStatus.NULL_PTR)) {
+                throw new StorageException("Restore wal pointer = " + tailWalPtr + ", while status.endPtr = " +
+                    status.endPtr + ". Can't restore memory - critical part of WAL archive is missing.");
+            }
+
+            nodeStart(tailWalPtr);
+
+            return tailWalPtr;
         }
         catch (IgniteCheckedException e) {
             if (X.hasCause(e, StorageException.class, IOException.class))
@@ -860,14 +948,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
         }
     }
 
-    /**
-     * Creates file with current timestamp and specific "node-started.bin" suffix
-     * and writes into memory recovery pointer.
-     *
-     * @param ptr Memory recovery wal pointer.
-     */
-    private void nodeStart(WALPointer ptr) throws IgniteCheckedException {
-        FileWALPointer p = (FileWALPointer)ptr;
+    /** {@inheritDoc} */
+    @Override public void nodeStart(@Nullable WALPointer ptr) throws IgniteCheckedException {
+        FileWALPointer p = (FileWALPointer)(ptr == null ? CheckpointStatus.NULL_PTR : ptr);
 
         String fileName = U.currentTimeMillis() + NODE_STARTED_FILE_NAME_SUFFIX;
         String tmpFileName = fileName + FilePageStoreManager.TMP_SUFFIX;
@@ -1957,11 +2040,33 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
         }
     }
 
+    /** {@inheritDoc} */
+    @Override public void startMemoryRestore(GridKernalContext kctx) throws IgniteCheckedException {
+        if (kctx.clientNode())
+            return;
+
+        // Preform early regions startup before restoring state.
+        initAndStartRegions(kctx.config().getDataStorageConfiguration());
+
+        // Only presistence caches to start.
+        for (DynamicCacheDescriptor desc : cctx.cache().cacheDescriptors().values()) {
+            if (CU.isPersistentCache(desc.cacheConfiguration(), cctx.gridConfig().getDataStorageConfiguration()))
+                storeMgr.initializeForCache(desc.groupDescriptor(), new StoredCacheData(desc.cacheConfiguration()));
+        }
+
+        final WALPointer restoredPtr = restoreBinaryMemory(cctx.cache().cacheGroupDescriptors().keySet());
+
+        walTail = restoredPtr;
+
+        if (restoredPtr != null)
+            U.log(log, "Binary memory state restored at node startup [restoredPtr=" + restoredPtr + ']');
+    }
+
     /**
      * @param status Checkpoint status.
      * @param metastoreOnly If {@code True} restores Metastorage only.
      * @param storePageMem Metastore page memory.
-     * @param finalizeCp If {@code True}, finalizes checkpoint on recovery.
+     * @param cacheGrps Cache groups to restore.
      * @throws IgniteCheckedException If failed.
      * @throws StorageException In case I/O error occurred during operations with storage.
      */
@@ -1969,7 +2074,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
         CheckpointStatus status,
         boolean metastoreOnly,
         PageMemoryEx storePageMem,
-        boolean finalizeCp
+        Set<Integer> cacheGrps
     ) throws IgniteCheckedException {
         assert !metastoreOnly || storePageMem != null;
 
@@ -1994,8 +2099,14 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
 
         RestoreBinaryState restoreBinaryState = new RestoreBinaryState(status, lastArchivedSegment, log);
 
-        Collection<Integer> ignoreGrps = metastoreOnly ? Collections.emptySet() :
-            F.concat(false, initiallyGlobalWalDisabledGrps, initiallyLocalWalDisabledGrps);
+        // Always perform recovery at least meta storage cache.
+        Set<Integer> restoreGrps = new HashSet<>(Collections.singletonList(METASTORAGE_CACHE_ID));
+
+        if (!metastoreOnly && !F.isEmpty(cacheGrps)) {
+            restoreGrps.addAll(cacheGrps.stream()
+                .filter(g -> !initiallyGlobalWalDisabledGrps.contains(g) && !initiallyLocalWalDisabledGrps.contains(g))
+                .collect(Collectors.toSet()));
+        }
 
         int applied = 0;
 
@@ -2015,10 +2126,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                             // several repetitive restarts and the same pages may have changed several times.
                             int grpId = pageRec.fullPageId().groupId();
 
-                            if (metastoreOnly && grpId != METASTORAGE_CACHE_ID)
-                                continue;
-
-                            if (!ignoreGrps.contains(grpId)) {
+                            if (restoreGrps.contains(grpId)) {
                                 long pageId = pageRec.fullPageId().pageId();
 
                                 PageMemoryEx pageMem = grpId == METASTORAGE_CACHE_ID ? storePageMem : getPageMemoryForCacheGroup(grpId);
@@ -2051,10 +2159,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                         {
                             int grpId = metaStateRecord.groupId();
 
-                            if (metastoreOnly && grpId != METASTORAGE_CACHE_ID)
-                                continue;
-
-                            if (ignoreGrps.contains(grpId))
+                            if (!restoreGrps.contains(grpId))
                                 continue;
 
                             int partId = metaStateRecord.partitionId();
@@ -2075,10 +2180,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                         {
                             int grpId = destroyRecord.groupId();
 
-                            if (metastoreOnly && grpId != METASTORAGE_CACHE_ID)
-                                continue;
-
-                            if (ignoreGrps.contains(grpId))
+                            if (!restoreGrps.contains(grpId))
                                 continue;
 
                             PageMemoryEx pageMem = grpId == METASTORAGE_CACHE_ID ? storePageMem : getPageMemoryForCacheGroup(grpId);
@@ -2096,10 +2198,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
 
                             int grpId = r.groupId();
 
-                            if (metastoreOnly && grpId != METASTORAGE_CACHE_ID)
-                                continue;
-
-                            if (!ignoreGrps.contains(grpId)) {
+                            if (restoreGrps.contains(grpId)) {
                                 long pageId = r.pageId();
 
                                 PageMemoryEx pageMem = grpId == METASTORAGE_CACHE_ID ? storePageMem : getPageMemoryForCacheGroup(grpId);
@@ -2129,7 +2228,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
             }
         }
 
-        if (!finalizeCp)
+        if (metastoreOnly)
             return null;
 
         WALPointer lastReadPtr = restoreBinaryState.lastReadRecordPointer();
@@ -2259,6 +2358,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
 
     /**
      * @param status Last registered checkpoint status.
+     * @param metastoreOnly If {@code True} only records related to metastorage will be processed.
      * @throws IgniteCheckedException If failed to apply updates.
      * @throws StorageException If IO exception occurred while reading write-ahead log.
      */
@@ -2299,9 +2399,13 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                         for (DataEntry dataEntry : dataRec.writeEntries()) {
                             int cacheId = dataEntry.cacheId();
 
-                            int grpId = cctx.cache().cacheDescriptor(cacheId).groupId();
+                            DynamicCacheDescriptor cacheDesc = cctx.cache().cacheDescriptor(cacheId);
 
-                            if (!ignoreGrps.contains(grpId)) {
+                            // Can empty in case recovery node on blt changed.
+                            if (cacheDesc == null)
+                                continue;
+
+                            if (!ignoreGrps.contains(cacheDesc.groupId())) {
                                 GridCacheContext cacheCtx = cctx.cacheContext(cacheId);
 
                                 applyUpdate(cacheCtx, dataEntry);
@@ -2799,8 +2903,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     /**
      * @param cp Checkpoint entry.
      * @param type Checkpoint type.
+     * @return Checkpoint file name.
      */
-    private static String checkpointFileName(CheckpointEntry cp, CheckpointEntryType type) {
+    public static String checkpointFileName(CheckpointEntry cp, CheckpointEntryType type) {
         return checkpointFileName(cp.timestamp(), cp.checkpointId(), type);
     }
 
@@ -4228,7 +4333,8 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
         }
 
         /**
-         * @return {@code True} if need to apply page log to restore tree structure.
+         * @return {@code True} if need perform binary memory recovery. Only records {@link PageDeltaRecord}
+         * and {@link PageSnapshot} needs to be applyed from {@link #cpStartId}.
          */
         public boolean needRestoreMemory() {
             return !F.eq(cpStartId, cpEndId) && !F.eq(NULL_UUID, cpStartId);

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
index db6b987..589b495 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
@@ -37,6 +37,7 @@ import org.apache.ignite.configuration.DataStorageConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
 import org.apache.ignite.internal.mem.DirectMemoryProvider;
 import org.apache.ignite.internal.mem.DirectMemoryRegion;
 import org.apache.ignite.internal.mem.file.MappedFileMemoryProvider;
@@ -45,7 +46,6 @@ import org.apache.ignite.internal.pagemem.PageMemory;
 import org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl;
 import org.apache.ignite.internal.pagemem.wal.WALPointer;
 import org.apache.ignite.internal.processors.cache.CacheGroupContext;
-import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
 import org.apache.ignite.internal.processors.cache.GridCacheMapEntry;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
@@ -100,6 +100,9 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
     private volatile boolean dataRegionsInitialized;
 
     /** */
+    private volatile boolean dataRegionsStarted;
+
+    /** */
     protected Map<String, DataRegionMetrics> memMetricsMap;
 
     /** */
@@ -238,6 +241,8 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
         initDataRegions0(memCfg);
 
         dataRegionsInitialized = true;
+
+        U.log(log, "Configured data regions initialized successfully [total=" + dataRegionMap.size() + ']');
     }
 
     /**
@@ -648,14 +653,19 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
     }
 
     /**
-     * @param cachesToStart Started caches.
-     * @param restoreMetastorageOnly Apply updates only for metastorage.
-     * @throws IgniteCheckedException If failed.
+     * @throws IgniteCheckedException If fails.
      */
-    public void readCheckpointAndRestoreMemory(
-            List<DynamicCacheDescriptor> cachesToStart,
-            boolean restoreMetastorageOnly
-    ) throws IgniteCheckedException {
+    public void onDoneRestoreBinaryMemory() throws IgniteCheckedException {
+        // No-op.
+    }
+
+    /**
+     * Creates file with current timestamp and specific "node-started.bin" suffix
+     * and writes into memory recovery pointer.
+     *
+     * @param ptr Memory recovery wal pointer.
+     */
+    public void nodeStart(@Nullable WALPointer ptr) throws IgniteCheckedException {
         // No-op.
     }
 
@@ -781,7 +791,15 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
     }
 
     /**
-     * No-op for non-persistent storage.
+     * Method will perform cleanup cache page memory and each cache partition store.
+     */
+    public void cleanupRestoredCaches() {
+        // No-op.
+    }
+
+    /**
+     * Clean checkpoint directory {@link GridCacheDatabaseSharedManager#cpDir}. The operation
+     * is necessary when local node joined to baseline topology with different consistentId.
      */
     public void cleanupCheckpointDirectory() throws IgniteCheckedException {
         // No-op.
@@ -836,6 +854,16 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
     }
 
     /**
+     * Perform memory restore before {@link GridDiscoveryManager} start.
+     *
+     * @param kctx Current kernal context.
+     * @throws IgniteCheckedException If fails.
+     */
+    public void startMemoryRestore(GridKernalContext kctx) throws IgniteCheckedException {
+        // No-op.
+    }
+
+    /**
      * Called when all partitions have been fully restored and pre-created on node start.
      *
      * @throws IgniteCheckedException If failed.
@@ -1138,23 +1166,46 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
 
     /** {@inheritDoc} */
     @Override public void onActivate(GridKernalContext kctx) throws IgniteCheckedException {
-        if (cctx.kernalContext().clientNode() && cctx.kernalContext().config().getDataStorageConfiguration() == null)
+        if (kctx.clientNode() && kctx.config().getDataStorageConfiguration() == null)
             return;
 
-        DataStorageConfiguration memCfg = cctx.kernalContext().config().getDataStorageConfiguration();
+        initAndStartRegions(kctx.config().getDataStorageConfiguration());
 
-        assert memCfg != null;
+        for (DatabaseLifecycleListener lsnr : getDatabaseListeners(kctx))
+            lsnr.afterInitialise(this);
+    }
 
-        initDataRegions(memCfg);
+    /**
+     * @param cfg Current data storage configuration.
+     * @throws IgniteCheckedException If fails.
+     */
+    protected void initAndStartRegions(DataStorageConfiguration cfg) throws IgniteCheckedException {
+        assert cfg != null;
+
+        initDataRegions(cfg);
+
+        startDataRegions(cfg);
+    }
+
+    /**
+     * @param cfg Regions configuration.
+     * @throws IgniteCheckedException If fails.
+     */
+    private void startDataRegions(DataStorageConfiguration cfg) throws IgniteCheckedException {
+        if (dataRegionsStarted)
+            return;
+
+        assert cfg != null;
 
         registerMetricsMBeans();
 
         startMemoryPolicies();
 
-        initPageMemoryDataStructures(memCfg);
+        initPageMemoryDataStructures(cfg);
 
-        for (DatabaseLifecycleListener lsnr : getDatabaseListeners(kctx))
-            lsnr.afterInitialise(this);
+        dataRegionsStarted = true;
+
+        U.log(log, "Configured data regions started successfully [total=" + dataRegionMap.size() + ']');
     }
 
     /** {@inheritDoc} */
@@ -1163,7 +1214,7 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
     }
 
     /**
-     * @param shutdown Shutdown.
+     * @param shutdown {@code True} to force memory regions shutdown.
      */
     private void onDeActivate(boolean shutdown) {
         for (DatabaseLifecycleListener lsnr : getDatabaseListeners(cctx.kernalContext()))
@@ -1189,6 +1240,8 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
             }
 
             dataRegionsInitialized = false;
+
+            dataRegionsStarted = false;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/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 c6cd9e5..e05cb71 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
@@ -32,11 +32,14 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.StandardCopyOption;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.DataStorageConfiguration;
@@ -227,14 +230,28 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
     }
 
     /** {@inheritDoc} */
+    @Override public void cleanupPageStoreIfMatch(Predicate<Integer> cacheGrpPred, boolean cleanFiles) {
+        Map<Integer, CacheStoreHolder> filteredStores = idxCacheStores.entrySet().stream()
+            .filter(e -> cacheGrpPred.test(e.getKey()))
+            .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+
+        IgniteCheckedException ex = shutdown(filteredStores.values(), cleanFiles);
+
+        if (ex != null)
+            U.error(log, "Failed to gracefully stop page store managers", ex);
+
+        idxCacheStores.entrySet().removeIf(e -> cacheGrpPred.test(e.getKey()));
+
+        U.log(log, "Cleanup cache stores [total=" + filteredStores.keySet().size() +
+            ", left=" + idxCacheStores.size() + ", cleanFiles=" + cleanFiles + ']');
+    }
+
+    /** {@inheritDoc} */
     @Override public void stop0(boolean cancel) {
         if (log.isDebugEnabled())
             log.debug("Stopping page store manager.");
 
-        IgniteCheckedException ex = shutdown(false);
-
-        if (ex != null)
-            U.error(log, "Failed to gracefully stop page store manager", ex);
+        cleanupPageStoreIfMatch(p -> true, false);
     }
 
     /** {@inheritDoc} */
@@ -253,8 +270,6 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
                 " topVer=" + cctx.discovery().topologyVersionEx() + " ]");
 
         stop0(true);
-
-        idxCacheStores.clear();
     }
 
     /** {@inheritDoc} */
@@ -287,6 +302,8 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
     /** {@inheritDoc} */
     @Override public void initialize(int cacheId, int partitions, String workingDir, AllocatedPageTracker tracker)
         throws IgniteCheckedException {
+        assert storeWorkDir != null;
+
         if (!idxCacheStores.containsKey(cacheId)) {
             CacheStoreHolder holder = initDir(
                 new File(storeWorkDir, workingDir),
@@ -304,6 +321,8 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
 
     /** {@inheritDoc} */
     @Override public void initializeForCache(CacheGroupDescriptor grpDesc, StoredCacheData cacheData) throws IgniteCheckedException {
+        assert storeWorkDir != null;
+
         int grpId = grpDesc.groupId();
 
         if (!idxCacheStores.containsKey(grpId)) {
@@ -317,6 +336,8 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
 
     /** {@inheritDoc} */
     @Override public void initializeForMetastorage() throws IgniteCheckedException {
+        assert storeWorkDir != null;
+
         int grpId = MetaStorage.METASTORAGE_CACHE_ID;
 
         if (!idxCacheStores.containsKey(grpId)) {
@@ -898,10 +919,10 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
     /**
      * @param cleanFiles {@code True} if the stores should delete it's files upon close.
      */
-    private IgniteCheckedException shutdown(boolean cleanFiles) {
+    private IgniteCheckedException shutdown(Collection<CacheStoreHolder> holders, boolean cleanFiles) {
         IgniteCheckedException ex = null;
 
-        for (CacheStoreHolder holder : idxCacheStores.values())
+        for (CacheStoreHolder holder : holders)
             ex = shutdown(holder, cleanFiles, ex);
 
         return ex;

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/metastorage/MetaStorage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/metastorage/MetaStorage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/metastorage/MetaStorage.java
index 3981d4d..4a243aa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/metastorage/MetaStorage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/metastorage/MetaStorage.java
@@ -136,11 +136,6 @@ public class MetaStorage implements DbCheckpointListener, ReadOnlyMetastorage, R
     }
 
     /** */
-    public MetaStorage(GridCacheSharedContext cctx, DataRegion memPlc, DataRegionMetricsImpl memMetrics) {
-        this(cctx, memPlc, memMetrics, false);
-    }
-
-    /** */
     public void init(IgniteCacheDatabaseSharedManager db) throws IgniteCheckedException {
         getOrAllocateMetas();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
index 0b03128..61b1f65 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
@@ -33,10 +33,8 @@ import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.nio.MappedByteBuffer;
 import java.nio.channels.ClosedByInterruptException;
-import java.nio.file.DirectoryStream;
 import java.nio.file.FileAlreadyExistsException;
 import java.nio.file.Files;
-import java.nio.file.Path;
 import java.sql.Time;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -688,6 +686,8 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
     @Override public void resumeLogging(WALPointer lastPtr) throws IgniteCheckedException {
         assert currHnd == null;
         assert lastPtr == null || lastPtr instanceof FileWALPointer;
+        assert (isArchiverEnabled() && archiver != null) || (!isArchiverEnabled() && archiver == null) :
+            "Trying to restore FileWriteHandle on deactivated write ahead log manager";
 
         FileWALPointer filePtr = (FileWALPointer)lastPtr;
 
@@ -1485,29 +1485,6 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
             checkFiles(0, false, null, null);
     }
 
-    /** {@inheritDoc} */
-    @Override public void cleanupWalDirectories() throws IgniteCheckedException {
-        try {
-            try (DirectoryStream<Path> files = Files.newDirectoryStream(walWorkDir.toPath())) {
-                for (Path path : files)
-                    Files.delete(path);
-            }
-        }
-        catch (IOException e) {
-            throw new IgniteCheckedException("Failed to cleanup wal work directory: " + walWorkDir, e);
-        }
-
-        try {
-            try (DirectoryStream<Path> files = Files.newDirectoryStream(walArchiveDir.toPath())) {
-                for (Path path : files)
-                    Files.delete(path);
-            }
-        }
-        catch (IOException e) {
-            throw new IgniteCheckedException("Failed to cleanup wal archive directory: " + walArchiveDir, e);
-        }
-    }
-
     /**
      * Clears whole the file, fills with zeros for Default mode.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FsyncModeFileWriteAheadLogManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FsyncModeFileWriteAheadLogManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FsyncModeFileWriteAheadLogManager.java
index d1e0ebc..def9bf2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FsyncModeFileWriteAheadLogManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FsyncModeFileWriteAheadLogManager.java
@@ -28,10 +28,8 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
-import java.nio.file.DirectoryStream;
 import java.nio.file.FileAlreadyExistsException;
 import java.nio.file.Files;
-import java.nio.file.Path;
 import java.sql.Time;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -539,6 +537,8 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda
     @Override public void resumeLogging(WALPointer lastPtr) throws IgniteCheckedException {
         assert currentHnd == null;
         assert lastPtr == null || lastPtr instanceof FileWALPointer;
+        assert (isArchiverEnabled() && archiver != null) || (!isArchiverEnabled() && archiver == null) :
+            "Trying to restore FileWriteHandle on deactivated write ahead log manager";
 
         FileWALPointer filePtr = (FileWALPointer)lastPtr;
 
@@ -1022,29 +1022,6 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda
         return cctx.walState().isDisabled(grpId);
     }
 
-    /** {@inheritDoc} */
-    @Override public void cleanupWalDirectories() throws IgniteCheckedException {
-        try {
-            try (DirectoryStream<Path> files = Files.newDirectoryStream(walWorkDir.toPath())) {
-                for (Path path : files)
-                    Files.delete(path);
-            }
-        }
-        catch (IOException e) {
-            throw new IgniteCheckedException("Failed to cleanup wal work directory: " + walWorkDir, e);
-        }
-
-        try {
-            try (DirectoryStream<Path> files = Files.newDirectoryStream(walArchiveDir.toPath())) {
-                for (Path path : files)
-                    Files.delete(path);
-            }
-        }
-        catch (IOException e) {
-            throw new IgniteCheckedException("Failed to cleanup wal archive directory: " + walArchiveDir, e);
-        }
-    }
-
     /**
      * Lists files in archive directory and returns the index of last archived file.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsDiskErrorsRecoveringTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsDiskErrorsRecoveringTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsDiskErrorsRecoveringTest.java
index 23bc3fb..2f4e4a3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsDiskErrorsRecoveringTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsDiskErrorsRecoveringTest.java
@@ -25,7 +25,6 @@ import java.nio.file.OpenOption;
 import java.util.Arrays;
 import java.util.concurrent.atomic.AtomicLong;
 import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteException;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheRebalanceMode;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
@@ -176,15 +175,18 @@ public class IgnitePdsDiskErrorsRecoveringTest extends GridCommonAbstractTest {
         boolean activationFailed = false;
         try {
             grid = startGrid(0);
-            grid.cluster().active(true);
         }
-        catch (IgniteException e) {
-            log.warning("Activation test exception", e);
+        catch (IgniteCheckedException e) {
+            boolean interrupted = Thread.interrupted();
+
+            if (interrupted)
+                log.warning("Ignore interrupted excpetion [" +
+                    "thread=" + Thread.currentThread().getName() + ']', e);
 
             activationFailed = true;
         }
 
-        Assert.assertTrue("Activation must be failed", activationFailed);
+        Assert.assertTrue("Ignite instance startup must be failed", activationFailed);
 
         // Grid should be automatically stopped after checkpoint fail.
         awaitStop(grid);

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/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 dcc2280..3374860 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
@@ -21,6 +21,7 @@ import java.io.FilenameFilter;
 import java.io.RandomAccessFile;
 import java.util.Arrays;
 import java.util.Comparator;
+import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
@@ -221,6 +222,20 @@ public class WalCompactionTest extends GridCommonAbstractTest {
         }
 
         assertFalse(fail);
+
+        // Check compation successfully reset on blt changed.
+        stopAllGrids();
+
+        Ignite ignite = startGrids(2);
+
+        ignite.cluster().active(true);
+
+        resetBaselineTopology();
+
+        // This node will join to different blt.
+        startGrid(2);
+
+        awaitPartitionMapExchange();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpPageStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpPageStoreManager.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpPageStoreManager.java
index 39c7dc9..44071ea 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpPageStoreManager.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpPageStoreManager.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Predicate;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.GridKernalContext;
@@ -235,6 +236,11 @@ public class NoOpPageStoreManager implements IgnitePageStoreManager {
     }
 
     /** {@inheritDoc} */
+    @Override public void cleanupPageStoreIfMatch(Predicate<Integer> cacheGrpPred, boolean cleanFiles) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean checkAndInitCacheWorkDir(CacheConfiguration cacheCfg) throws IgniteCheckedException {
         return false;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpWALManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpWALManager.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpWALManager.java
index 0beeed7..ea3ed2f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpWALManager.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpWALManager.java
@@ -108,11 +108,6 @@ public class NoOpWALManager implements IgniteWriteAheadLogManager {
     }
 
     /** {@inheritDoc} */
-    @Override public void cleanupWalDirectories() throws IgniteCheckedException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
     @Override public void start(GridCacheSharedContext cctx) throws IgniteCheckedException {
         // No-op.
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c7449f6c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
index d80b5e2..388fb19 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
@@ -18,8 +18,12 @@
 package org.apache.ignite.internal.processors.cache.persistence.db.wal;
 
 import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -38,6 +42,7 @@ import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteCompute;
 import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.IgniteSystemProperties;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
@@ -53,9 +58,11 @@ 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.DiscoverySpiTestListener;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi;
 import org.apache.ignite.internal.pagemem.FullPageId;
 import org.apache.ignite.internal.pagemem.PageUtils;
 import org.apache.ignite.internal.pagemem.wal.WALIterator;
@@ -67,14 +74,21 @@ import org.apache.ignite.internal.pagemem.wal.record.PageSnapshot;
 import org.apache.ignite.internal.pagemem.wal.record.TxRecord;
 import org.apache.ignite.internal.pagemem.wal.record.WALRecord;
 import org.apache.ignite.internal.pagemem.wal.record.delta.PageDeltaRecord;
+import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+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.checkpoint.CheckpointEntry;
+import org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointEntryType;
+import org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager;
 import org.apache.ignite.internal.processors.cache.persistence.filename.PdsConsistentIdProcessor;
 import org.apache.ignite.internal.processors.cache.persistence.metastorage.MetaStorage;
 import org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryEx;
 import org.apache.ignite.internal.processors.cache.persistence.tree.io.TrackingPageIO;
+import org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.GridUnsafe;
+import org.apache.ignite.internal.util.lang.IgniteInClosureX;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.PA;
 import org.apache.ignite.internal.util.typedef.PAX;
@@ -94,6 +108,8 @@ import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
 import org.junit.Assert;
 
+import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_IGNITE_INSTANCE_NAME;
+import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.CACHE_DATA_FILENAME;
 import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR;
 
 /**
@@ -116,6 +132,9 @@ public class IgniteWalRecoveryTest extends GridCommonAbstractTest {
     private static final String RENAMED_CACHE_NAME = "partitioned0";
 
     /** */
+    private static final String CACHE_TO_DESTROY_NAME = "destroyCache";
+
+    /** */
     private static final String LOC_CACHE_NAME = "local";
 
     /** */
@@ -466,6 +485,110 @@ public class IgniteWalRecoveryTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Check binary recover completes successfully when node stopped at the middle of checkpoint.
+     * Destroy cache_data.bin file for particular cache to emulate missing {@link DynamicCacheDescriptor}
+     * file (binary recovery should complete successfully in this case).
+     *
+     * @throws Exception if failed.
+     */
+    public void testBinaryRecoverBeforePMEWhenMiddleCheckpoint() throws Exception {
+        startGrids(3);
+
+        IgniteEx ig2 = grid(2);
+
+        ig2.cluster().active(true);
+
+        IgniteCache<Object, Object> cache = ig2.cache(CACHE_NAME);
+
+        for (int i = 1; i <= 4_000; i++)
+            cache.put(i, new BigObject(i));
+
+        BigObject objToCheck;
+
+        ig2.getOrCreateCache(CACHE_TO_DESTROY_NAME).put(1, objToCheck = new BigObject(1));
+
+        GridCacheDatabaseSharedManager dbMgr = (GridCacheDatabaseSharedManager)ig2
+            .context().cache().context().database();
+
+        IgniteInternalFuture<?> cpFinishFut = dbMgr.forceCheckpoint("force checkpoint").finishFuture();
+
+        // Delete checkpoint END file to emulate node stopped at the middle of checkpoint.
+        cpFinishFut.listen(new IgniteInClosureX<IgniteInternalFuture>() {
+            @Override public void applyx(IgniteInternalFuture fut0) throws IgniteCheckedException {
+                try {
+                    CheckpointEntry cpEntry = dbMgr.checkpointHistory().lastCheckpoint();
+
+                    String cpEndFileName = GridCacheDatabaseSharedManager.checkpointFileName(cpEntry,
+                        CheckpointEntryType.END);
+
+                    Files.delete(Paths.get(dbMgr.checkpointDirectory().getAbsolutePath(), cpEndFileName));
+
+                    log.info("Checkpoint marker removed [cpEndFileName=" + cpEndFileName + ']');
+                }
+                catch (IOException e) {
+                    throw new IgniteCheckedException(e);
+                }
+            }
+        });
+
+        // Resolve cache directory. Emulating cache destroy in the middle of checkpoint.
+        IgniteInternalCache<Object, Object> destoryCache = ig2.cachex(CACHE_TO_DESTROY_NAME);
+
+        FilePageStoreManager pageStoreMgr = (FilePageStoreManager)destoryCache.context().shared().pageStore();
+
+        File destroyCacheWorkDir = pageStoreMgr.cacheWorkDir(destoryCache.configuration());
+
+        // Stop the whole cluster
+        stopAllGrids();
+
+        // Delete cache_data.bin file for this cache. Binary recovery should complete successfully after it.
+        final File[] files = destroyCacheWorkDir.listFiles(new FilenameFilter() {
+            @Override public boolean accept(final File dir, final String name) {
+                return name.endsWith(CACHE_DATA_FILENAME);
+            }
+        });
+
+        assertTrue(files.length > 0);
+
+        for (final File file : files)
+            assertTrue("Can't remove " + file.getAbsolutePath(), file.delete());
+
+        startGrids(2);
+
+        // Preprare Ignite instance configuration with additional Discovery checks.
+        final String ig2Name = getTestIgniteInstanceName(2);
+
+        final IgniteConfiguration onJoinCfg = optimize(getConfiguration(ig2Name));
+
+        // Check restore beeing called before PME and joining node to cluster.
+        ((IgniteDiscoverySpi)onJoinCfg.getDiscoverySpi())
+            .setInternalListener(new DiscoverySpiTestListener() {
+                @Override public void beforeJoin(ClusterNode locNode, IgniteLogger log) {
+                    String nodeName = locNode.attribute(ATTR_IGNITE_INSTANCE_NAME);
+
+                    GridCacheSharedContext sharedCtx = ((IgniteEx)ignite(getTestIgniteInstanceIndex(nodeName)))
+                        .context()
+                        .cache()
+                        .context();
+
+                    if (nodeName.equals(ig2Name)) {
+                        // Checkpoint history initialized on node start.
+                        assertFalse(((GridCacheDatabaseSharedManager)sharedCtx.database())
+                            .checkpointHistory().checkpoints().isEmpty());
+                    }
+
+                    super.beforeJoin(locNode, log);
+                }
+            });
+
+        Ignite restoredIg2 = startGrid(ig2Name, onJoinCfg);
+
+        awaitPartitionMapExchange();
+
+        assertEquals(restoredIg2.cache(CACHE_TO_DESTROY_NAME).get(1), objToCheck);
+    }
+
+    /**
      * @throws Exception if failed.
      */
     public void testWalRolloverMultithreadedDefault() throws Exception {


[22/28] ignite git commit: IGNITE-9342: SQL: fixed execution of multu-statement non-colocated queries. This closes #4709.

Posted by sb...@apache.org.
IGNITE-9342: SQL: fixed execution of multu-statement non-colocated queries. This closes #4709.


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

Branch: refs/heads/ignite-627
Commit: 92af53895a0f617858b7149e6ccc4396e2e04675
Parents: ac093b9
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Mon Oct 29 16:49:46 2018 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Oct 29 16:49:46 2018 +0300

----------------------------------------------------------------------
 .../processors/query/h2/IgniteH2Indexing.java   |  3 +-
 .../MultipleStatementsSqlQuerySelfTest.java     | 40 ++++++++++++++++----
 2 files changed, 34 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/92af5389/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 866ae99..5bd6f7b 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -2192,8 +2192,9 @@ public class IgniteH2Indexing implements GridQueryIndexing {
                 res.addAll(doRunPrepared(schemaName, prepared, newQry, twoStepQry, meta, keepBinary, startTx, tracker,
                     cancel));
 
+                // We cannot cache two-step query for multiple statements query except the last statement
                 if (parseRes.twoStepQuery() != null && parseRes.twoStepQueryKey() != null &&
-                    !parseRes.twoStepQuery().explain())
+                    !parseRes.twoStepQuery().explain() && remainingSql == null)
                     twoStepCache.putIfAbsent(parseRes.twoStepQueryKey(), new H2TwoStepCachedQuery(meta,
                         twoStepQry.copy()));
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/92af5389/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/MultipleStatementsSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/MultipleStatementsSqlQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/MultipleStatementsSqlQuerySelfTest.java
index becd586..65b9795 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/MultipleStatementsSqlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/MultipleStatementsSqlQuerySelfTest.java
@@ -47,10 +47,8 @@ public class MultipleStatementsSqlQuerySelfTest extends GridCommonAbstractTest {
 
     /**
      * Test query without caches.
-     *
-     * @throws Exception If failed.
      */
-    public void testQuery() throws Exception {
+    public void testQuery() {
         GridQueryProcessor qryProc = node.context().query();
 
         SqlFieldsQuery qry = new SqlFieldsQuery(
@@ -92,10 +90,8 @@ public class MultipleStatementsSqlQuerySelfTest extends GridCommonAbstractTest {
 
     /**
      * Test query without caches.
-     *
-     * @throws Exception If failed.
      */
-    public void testQueryWithParameters() throws Exception {
+    public void testQueryWithParameters() {
         GridQueryProcessor qryProc = node.context().query();
 
         SqlFieldsQuery qry = new SqlFieldsQuery(
@@ -137,9 +133,8 @@ public class MultipleStatementsSqlQuerySelfTest extends GridCommonAbstractTest {
     }
 
     /**
-     * @throws Exception If failed.
      */
-    public void testQueryMultipleStatementsFailed() throws Exception {
+    public void testQueryMultipleStatementsFailed() {
         final SqlFieldsQuery qry = new SqlFieldsQuery("select 1; select 1;").setSchema("PUBLIC");
 
         GridTestUtils.assertThrows(log,
@@ -151,4 +146,33 @@ public class MultipleStatementsSqlQuerySelfTest extends GridCommonAbstractTest {
                 }
             }, IgniteSQLException.class, "Multiple statements queries are not supported");
     }
+
+    /**
+     * Check cached two-steps query.
+     */
+    public void testCachedTwoSteps() {
+        List<FieldsQueryCursor<List<?>>> curs = sql("SELECT 1; SELECT 2");
+
+        assertEquals(2, curs.size());
+        assertEquals(1, curs.get(0).getAll().get(0).get(0));
+        assertEquals(2, curs.get(1).getAll().get(0).get(0));
+
+        curs = sql("SELECT 1; SELECT 2");
+
+        assertEquals(2, curs.size());
+        assertEquals(1, curs.get(0).getAll().get(0).get(0));
+        assertEquals(2, curs.get(1).getAll().get(0).get(0));
+    }
+
+    /**
+     * @param sql SQL query.
+     * @return Results.
+     */
+    private List<FieldsQueryCursor<List<?>>> sql(String sql) {
+        GridQueryProcessor qryProc = node.context().query();
+
+        SqlFieldsQuery qry = new SqlFieldsQuery(sql).setSchema("PUBLIC");
+
+        return qryProc.querySqlFields(qry, true, false);
+    }
 }


[28/28] ignite git commit: Merge remote-tracking branch 'remotes/origin/master' into ignite-627

Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-627


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

Branch: refs/heads/ignite-627
Commit: 0ed37afb36160f9f032a8ade2d8a7bc4b2a7c8d4
Parents: 7aa2498 bdb2239
Author: sboikov <sb...@apache.org>
Authored: Tue Oct 30 09:08:06 2018 +0300
Committer: sboikov <sb...@apache.org>
Committed: Tue Oct 30 09:08:06 2018 +0300

----------------------------------------------------------------------
 .../clustering/KMeansClusterizationExample.java | 150 +----
 .../ml/knn/ANNClassificationExample.java        |   2 +-
 .../ml/knn/KNNClassificationExample.java        | 183 +------
 .../examples/ml/knn/KNNRegressionExample.java   | 221 +-------
 .../GaussianNaiveBayesTrainerExample.java       |   5 +-
 .../examples/ml/nn/MLPTrainerExample.java       |   2 +-
 .../LinearRegressionLSQRTrainerExample.java     |  86 +--
 ...ssionLSQRTrainerWithMinMaxScalerExample.java |  85 +--
 .../LinearRegressionSGDTrainerExample.java      |  86 +--
 .../LogisticRegressionSGDTrainerExample.java    | 132 +----
 ...gressionMultiClassClassificationExample.java | 158 +-----
 .../ml/selection/cv/CrossValidationExample.java |   2 +-
 .../split/TrainTestDatasetSplitterExample.java  |  90 +--
 .../binary/SVMBinaryClassificationExample.java  | 132 +----
 .../SVMMultiClassClassificationExample.java     | 189 ++-----
 ...ecisionTreeClassificationTrainerExample.java |   2 +-
 .../DecisionTreeRegressionTrainerExample.java   |   2 +-
 .../GDBOnTreesClassificationTrainerExample.java |   2 +-
 .../RandomForestClassificationExample.java      | 216 +-------
 .../RandomForestRegressionExample.java          | 543 +------------------
 .../examples/ml/util/MLSandboxDatasets.java     |  87 +++
 .../ignite/examples/ml/util/SandboxMLCache.java | 144 +++++
 .../ignite/examples/ml/util/TestCache.java      |  77 ---
 .../datasets/boston_housing_dataset.txt         | 505 +++++++++++++++++
 .../resources/datasets/cleared_machines.csv     | 209 +++++++
 .../resources/datasets/cleared_machines.txt     | 209 -------
 .../resources/datasets/glass_identification.csv | 116 ++++
 .../main/resources/datasets/mortalitydata.csv   |  53 ++
 .../resources/datasets/two_classed_iris.csv     | 100 ++++
 examples/src/main/resources/datasets/wine.txt   | 178 ++++++
 .../JettyRestProcessorAbstractSelfTest.java     |  41 ++
 .../suite/IgniteJdbcDriverMvccTestSuite.java    |  20 +-
 .../jdbc/thin/JdbcThinConnectionSelfTest.java   | 138 ++---
 .../jdbc/thin/JdbcThinTransactionsSelfTest.java |  28 +
 .../java/org/apache/ignite/IgniteCache.java     |  49 +-
 .../apache/ignite/internal/IgniteKernal.java    |   2 +
 .../internal/commandline/CommandHandler.java    |  34 +-
 .../CacheDistributionTaskResult.java            |   4 +-
 .../pagemem/store/IgnitePageStoreManager.java   |  12 +-
 .../pagemem/wal/IgniteWriteAheadLogManager.java |   7 +-
 .../wal/record/MemoryRecoveryRecord.java        |   7 +-
 .../cache/GatewayProtectedCacheProxy.java       |  36 ++
 .../processors/cache/GridCacheAdapter.java      | 132 +++++
 .../processors/cache/GridCacheProcessor.java    |   2 +-
 .../processors/cache/GridCacheProxyImpl.java    |  36 ++
 .../cache/GridCacheSharedContext.java           |   1 -
 .../cache/IgniteCacheOffheapManager.java        |  20 +-
 .../cache/IgniteCacheOffheapManagerImpl.java    |  10 +
 .../processors/cache/IgniteCacheProxyImpl.java  |  30 +
 .../processors/cache/IgniteInternalCache.java   |  23 +
 .../distributed/dht/GridDhtTxPrepareFuture.java | 140 +++--
 .../GridDhtPartitionsExchangeFuture.java        | 172 +++---
 .../preloader/GridDhtPartitionsFullMessage.java |  16 +-
 .../topology/GridDhtPartitionsReservation.java  |   2 +-
 .../near/GridNearTxAbstractEnlistFuture.java    |   4 +-
 .../processors/cache/local/GridLocalCache.java  |  23 +
 .../cache/mvcc/MvccProcessorImpl.java           |  18 +-
 .../persistence/DatabaseLifecycleListener.java  |  13 +-
 .../GridCacheDatabaseSharedManager.java         | 385 +++++++------
 .../persistence/GridCacheOffheapManager.java    |  49 ++
 .../IgniteCacheDatabaseSharedManager.java       | 237 +++++---
 .../persistence/file/FilePageStoreManager.java  |  37 +-
 .../persistence/metastorage/MetaStorage.java    |   5 -
 .../wal/FileWriteAheadLogManager.java           |  27 +-
 .../wal/FsyncModeFileWriteAheadLogManager.java  |  27 +-
 .../cache/transactions/IgniteTxHandler.java     |   1 +
 .../cache/transactions/IgniteTxManager.java     |   3 +-
 .../top/GridTopologyCommandHandler.java         |  28 +-
 .../rest/request/GridRestTopologyRequest.java   |  19 +-
 .../timeout/GridTimeoutProcessor.java           |   6 +-
 .../visor/verify/IndexIntegrityCheckIssue.java  |  74 +++
 .../verify/VisorValidateIndexesJobResult.java   |  30 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |   2 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   2 +
 .../resources/META-INF/classnames.properties    |   1 +
 .../internal/TestRecordingCommunicationSpi.java |  20 +
 .../cache/GridCacheAbstractFullApiSelfTest.java |  14 +-
 ...ridCacheStoreManagerDeserializationTest.java |   4 +-
 .../IgniteCacheConfigVariationsFullApiTest.java |   4 +-
 ...rtitionsExchangeCoordinatorFailoverTest.java |  64 +++
 .../distributed/CacheBlockOnGetAllTest.java     |  48 ++
 .../CacheBlockOnReadAbstractTest.java           | 286 ++++++++--
 .../cache/distributed/CacheBlockOnScanTest.java |  48 ++
 .../distributed/CacheBlockOnSingleGetTest.java  |  48 ++
 .../cache/mvcc/CacheMvccTransactionsTest.java   |   6 +-
 .../db/IgnitePdsPartitionPreloadTest.java       | 512 +++++++++++++++++
 .../file/IgnitePdsDiskErrorsRecoveringTest.java |  12 +-
 .../persistence/db/wal/WalCompactionTest.java   |  15 +
 .../pagemem/NoOpPageStoreManager.java           |   6 +
 .../persistence/pagemem/NoOpWALManager.java     |   5 -
 .../pagemem/PageIdDistributionTest.java         |   4 +-
 .../IgniteNoParrallelClusterIsAllowedTest.java  |   2 +-
 .../TxRollbackOnTimeoutOnePhaseCommitTest.java  | 215 ++++++++
 .../continuous/GridEventConsumeSelfTest.java    |   2 +-
 .../processors/database/BPlusTreeSelfTest.java  |  34 --
 ...GridServiceProcessorBatchDeploySelfTest.java |  22 +-
 .../internal/util/IgniteUtilsSelfTest.java      |   2 +-
 ...gniteClientReconnectMassiveShutdownTest.java |   4 +-
 .../tcp/TcpDiscoveryMultiThreadedTest.java      |   4 +-
 .../multijvm/IgniteCacheProcessProxy.java       |  15 +
 .../testsuites/IgniteCacheTestSuite6.java       |   2 +
 .../ignite/testsuites/IgnitePdsTestSuite4.java  |   3 +
 .../cache/hibernate/HibernateCacheProxy.java    |  15 +
 .../processors/query/h2/IgniteH2Indexing.java   |  18 +-
 .../visor/verify/ValidateIndexesClosure.java    | 205 ++++++-
 .../distributed/CacheBlockOnSqlQueryTest.java   |  24 +
 ...sactionCommandsWithMvccDisabledSelfTest.java |  74 +++
 .../index/SqlTransactionsComandsSelfTest.java   |  83 ---
 ...sactionsComandsWithMvccDisabledSelfTest.java |  83 ---
 .../mvcc/CacheMvccSqlTxQueriesAbstractTest.java |  48 ++
 .../db/wal/IgniteWalRecoveryTest.java           | 123 +++++
 .../MultipleStatementsSqlQuerySelfTest.java     |  40 +-
 .../IgniteCacheQuerySelfTestSuite.java          |   4 +-
 .../util/GridCommandHandlerIndexingTest.java    | 152 ++++--
 .../ml/knn/regression/KNNRegressionModel.java   |   2 +
 .../math/primitives/vector/AbstractVector.java  |   9 +
 .../ml/math/primitives/vector/Vector.java       |   9 +
 .../vector/impl/DelegatingVector.java           |   5 +
 .../ApiParity/CacheParityTest.cs                |   5 +-
 modules/platforms/nodejs/lib/EnumItem.js        |  17 +-
 modules/platforms/nodejs/lib/Errors.js          |  12 +
 .../nodejs/lib/internal/BinaryUtils.js          |   4 +
 modules/platforms/nodejs/spec/TestingHelper.js  |   7 +
 .../spec/cache/CachePutGetDiffTypes.spec.js     |  39 ++
 .../Internal/Binary/BinaryCommunicator.php      |  27 +-
 .../Ignite/Internal/Binary/BinaryUtils.php      |  12 +
 modules/platforms/php/tests/CachePutGetTest.php | 119 ++++
 .../http/jetty/GridJettyRestHandler.java        |   3 +
 modules/web-console/DEVNOTES.txt                |  17 +
 modules/web-console/assembly/README.txt         |   1 +
 modules/web-console/backend/app/settings.js     |   4 +-
 .../backend/config/settings.json.sample         |   5 +-
 modules/web-console/backend/routes/public.js    |  22 +-
 modules/web-console/backend/services/mails.js   |  24 +-
 modules/web-console/backend/services/users.js   |  12 +-
 modules/web-console/frontend/app/app.js         |   6 +-
 .../dialog-admin-create-user/component.ts       |  27 +
 .../dialog-admin-create-user/controller.ts      |  78 +++
 .../dialog-admin-create-user/index.ts           |  23 +
 .../dialog-admin-create-user/state.ts           |  29 +
 .../dialog-admin-create-user/template.pug       |  37 ++
 .../app/components/form-signup/component.ts     |  32 ++
 .../app/components/form-signup/controller.ts    |  46 ++
 .../app/components/form-signup/index.ts         |  41 ++
 .../app/components/form-signup/style.scss       |  31 ++
 .../app/components/form-signup/template.pug     | 105 ++++
 .../input-dialog/input-dialog.service.ts        |  12 +-
 .../input-dialog/input-dialog.tpl.pug           |  14 +
 .../list-of-registered-users/column-defs.js     |  23 -
 .../list-of-registered-users/controller.js      | 214 ++++----
 .../list-of-registered-users/template.tpl.pug   |   1 -
 .../app/components/page-admin/controller.ts     |  28 +
 .../frontend/app/components/page-admin/index.js |  17 +-
 .../app/components/page-signup/component.js     |   2 -
 .../app/components/page-signup/controller.js    |  76 ---
 .../app/components/page-signup/controller.ts    |  66 +++
 .../app/components/page-signup/index.js         |   3 +-
 .../app/components/page-signup/style.scss       |  10 -
 .../app/components/page-signup/template.pug     |  94 +---
 .../app/components/page-signup/types.ts         |  36 --
 .../app/modules/agent/AgentManager.service.js   |   2 +-
 .../agent/components/cluster-login/service.js   |  21 +-
 .../frontend/app/modules/user/Auth.service.js   | 100 ----
 .../frontend/app/modules/user/Auth.service.ts   |  90 +++
 .../frontend/app/primitives/dropdown/index.pug  |   3 +-
 .../app/primitives/form-field/checkbox.pug      |   5 +-
 .../app/primitives/form-field/email.pug         |   7 +-
 .../app/primitives/form-field/password.pug      |  12 +-
 .../app/primitives/form-field/phone.pug         |   5 +-
 .../frontend/app/utils/dialogState.ts           |  56 ++
 .../console/agent/handlers/ClusterListener.java |   1 +
 171 files changed, 6003 insertions(+), 3894 deletions(-)
----------------------------------------------------------------------



[23/28] ignite git commit: IGNITE09917 Write proper tests for start/stop client - Fixes #5062.

Posted by sb...@apache.org.
IGNITE09917 Write proper tests for start/stop client - Fixes #5062.

Signed-off-by: Dmitriy Govorukhin <dm...@gmail.com>


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

Branch: refs/heads/ignite-627
Commit: 8bd9575788545f724b9cc514e2e5fb8891313950
Parents: 92af538
Author: ibessonov <be...@gmail.com>
Authored: Mon Oct 29 16:53:06 2018 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Mon Oct 29 16:53:06 2018 +0300

----------------------------------------------------------------------
 .../GridDhtPartitionsExchangeFuture.java        |  16 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |   2 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   2 +
 .../distributed/CacheBlockOnGetAllTest.java     |  48 ++++
 .../CacheBlockOnReadAbstractTest.java           | 286 +++++++++++++++----
 .../cache/distributed/CacheBlockOnScanTest.java |  48 ++++
 .../distributed/CacheBlockOnSingleGetTest.java  |  48 ++++
 .../distributed/CacheBlockOnSqlQueryTest.java   |  24 ++
 8 files changed, 406 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8bd95757/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 9314096..b26db67 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
@@ -1301,8 +1301,6 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
             finally {
                 cctx.exchange().exchangerBlockingSectionEnd();
             }
-
-            return;
         }
         else {
             if (centralizedAff) { // Last server node failed.
@@ -1316,15 +1314,15 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
             }
             else
                 onAllServersLeft();
-        }
 
-        cctx.exchange().exchangerBlockingSectionBegin();
+            cctx.exchange().exchangerBlockingSectionBegin();
 
-        try {
-            onDone(initialVersion());
-        }
-        finally {
-            cctx.exchange().exchangerBlockingSectionEnd();
+            try {
+                onDone(initialVersion());
+            }
+            finally {
+                cctx.exchange().exchangerBlockingSectionEnd();
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8bd95757/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 f26a217..032c9a6 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
@@ -6871,7 +6871,7 @@ class ServerImpl extends TcpDiscoveryImpl {
          * @param msgBytes Optional message bytes.
          */
         void addMessage(TcpDiscoveryAbstractMessage msg, @Nullable byte[] msgBytes) {
-            T2 t = new T2<>(msg, msgBytes);
+            T2<TcpDiscoveryAbstractMessage, byte[]> t = new T2<>(msg, msgBytes);
 
             if (msg.highPriority())
                 queue.addFirst(t);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8bd95757/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 55462ff..9f70d43 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -108,6 +108,7 @@ import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryDuplicateIdMessa
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryEnsureDelivery;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryJoinRequestMessage;
 import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.TestOnly;
 
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_CONSISTENT_ID_BY_HOST_WITHOUT_PORT;
 import static org.apache.ignite.IgniteSystemProperties.getBoolean;
@@ -1612,6 +1613,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements IgniteDiscovery
     /**
      * @param msg Message.
      */
+    @TestOnly
     protected void startMessageProcess(TcpDiscoveryAbstractMessage msg) {
         // No-op, intended for usage in tests.
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8bd95757/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnGetAllTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnGetAllTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnGetAllTest.java
index 084a431..b970787 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnGetAllTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnGetAllTest.java
@@ -193,4 +193,52 @@ public class CacheBlockOnGetAllTest extends CacheBlockOnReadAbstractTest {
     @Override public void testUpdateBaselineTopologyTransactionalReplicated() {
         fail("https://issues.apache.org/jira/browse/IGNITE-9883");
     }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = ATOMIC, cacheMode = PARTITIONED)
+    @Override public void testStartClientAtomicPartitioned() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = ATOMIC, cacheMode = REPLICATED)
+    @Override public void testStartClientAtomicReplicated() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = TRANSACTIONAL, cacheMode = PARTITIONED)
+    @Override public void testStartClientTransactionalPartitioned() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = TRANSACTIONAL, cacheMode = REPLICATED)
+    @Override public void testStartClientTransactionalReplicated() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = ATOMIC, cacheMode = PARTITIONED)
+    @Override public void testStopClientAtomicPartitioned() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = ATOMIC, cacheMode = REPLICATED)
+    @Override public void testStopClientAtomicReplicated() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = TRANSACTIONAL, cacheMode = PARTITIONED)
+    @Override public void testStopClientTransactionalPartitioned() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = TRANSACTIONAL, cacheMode = REPLICATED)
+    @Override public void testStopClientTransactionalReplicated() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8bd95757/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnReadAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnReadAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnReadAbstractTest.java
index 42b5df0..211e9bc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnReadAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnReadAbstractTest.java
@@ -27,6 +27,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Objects;
 import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -34,6 +35,7 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
+import java.util.function.BiConsumer;
 import java.util.function.Predicate;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCheckedException;
@@ -68,9 +70,12 @@ import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiPredicate;
 import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi;
 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.spi.discovery.tcp.messages.TcpDiscoveryNodeAddFinishedMessage;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeLeftMessage;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jetbrains.annotations.NotNull;
@@ -105,9 +110,12 @@ public abstract class CacheBlockOnReadAbstractTest extends GridCommonAbstractTes
     /** Latch that is used to wait until all required messages are blocked. */
     private volatile CountDownLatch cntFinishedReadOperations;
 
-    /** Custom ip finder. */
+    /** Custom ip finder. Replaces {@link #IP_FINDER} if present at the moment of node starting. */
     private volatile TcpDiscoveryIpFinder customIpFinder;
 
+    /** Discovery message processor. Used in every started node. */
+    private volatile BiConsumer<TcpDiscoveryAbstractMessage, String> discoveryMsgProcessor;
+
     /**
      * Number of baseline servers to start before test.
      *
@@ -264,10 +272,16 @@ public abstract class CacheBlockOnReadAbstractTest extends GridCommonAbstractTes
 
         cfg.setConsistentId(igniteInstanceName);
 
-        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(customIpFinder == null ? IP_FINDER : customIpFinder);
-
         cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());
 
+        cfg.setDiscoverySpi(new TestTcpDiscoverySpi() {
+            /** {@inheritDoc} */
+            @Override protected void startMessageProcess(TcpDiscoveryAbstractMessage msg) {
+                if (discoveryMsgProcessor != null)
+                    discoveryMsgProcessor.accept(msg, igniteInstanceName);
+            }
+        }.setIpFinder(customIpFinder == null ? IP_FINDER : customIpFinder));
+
         cfg.setDataStorageConfiguration(
             new DataStorageConfiguration()
                 .setDefaultDataRegionConfiguration(
@@ -413,56 +427,6 @@ public abstract class CacheBlockOnReadAbstractTest extends GridCommonAbstractTes
             () -> baseline.get(0).destroyCache(cacheNames.remove(0))
         );
     }
-    /**
-     * @throws Exception If failed.
-     */
-    public void _testStartClient() throws Exception {
-        startNodesInClientMode(true);
-
-        doTest(
-            asMessagePredicate(discoEvt -> discoEvt.type() == EventType.EVT_NODE_JOINED),
-            () -> {
-                for (int i = 0; i < baselineServersCount() - 2; i++)
-                    cntFinishedReadOperations.countDown();
-
-                customIpFinder = new TcpDiscoveryVmIpFinder(false)
-                    .setAddresses(
-                        Collections.singletonList("127.0.0.1:47500")
-                    );
-
-                startGrid(UUID.randomUUID().toString());
-
-                customIpFinder = null;
-            }
-        );
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void _testStopClient() throws Exception {
-        customIpFinder = new TcpDiscoveryVmIpFinder(false)
-            .setAddresses(
-                Collections.singletonList("127.0.0.1:47500")
-            );
-
-        startNodesInClientMode(true);
-
-        for (int i = 0; i < 3; i++)
-            clients.add(startGrid(UUID.randomUUID().toString()));
-
-        customIpFinder = null;
-
-        doTest(
-            asMessagePredicate(discoEvt -> discoEvt.type() == EventType.EVT_NODE_LEFT),
-            () -> {
-                for (int i = 0; i < baselineServersCount() - 2; i++)
-                    cntFinishedReadOperations.countDown();
-
-                stopGrid(clients.remove(clients.size() - 1).name());
-            }
-        );
-    }
 
     /**
      * @throws Exception If failed.
@@ -684,6 +648,102 @@ public abstract class CacheBlockOnReadAbstractTest extends GridCommonAbstractTes
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    @Params(atomicityMode = ATOMIC, cacheMode = PARTITIONED)
+    public void testStartClientAtomicPartitioned() throws Exception {
+        testStartClientTransactionalReplicated();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Params(atomicityMode = ATOMIC, cacheMode = REPLICATED)
+    public void testStartClientAtomicReplicated() throws Exception {
+        testStartClientTransactionalReplicated();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Params(atomicityMode = TRANSACTIONAL, cacheMode = PARTITIONED)
+    public void testStartClientTransactionalPartitioned() throws Exception {
+        testStartClientTransactionalReplicated();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Params(atomicityMode = TRANSACTIONAL, cacheMode = REPLICATED)
+    public void testStartClientTransactionalReplicated() throws Exception {
+        doTest(
+            TcpDiscoveryNodeAddFinishedMessage.class,
+            () -> {
+                startNodesInClientMode(true);
+
+                customIpFinder = new TcpDiscoveryVmIpFinder(false)
+                    .setAddresses(
+                        Collections.singletonList("127.0.0.1:47502")
+                    );
+
+                try {
+                    startGrid(UUID.randomUUID().toString());
+                }
+                finally {
+                    customIpFinder = null;
+                }
+            }
+        );
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Params(atomicityMode = ATOMIC, cacheMode = PARTITIONED)
+    public void testStopClientAtomicPartitioned() throws Exception {
+        testStopClientTransactionalReplicated();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Params(atomicityMode = ATOMIC, cacheMode = REPLICATED)
+    public void testStopClientAtomicReplicated() throws Exception {
+        testStopClientTransactionalReplicated();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Params(atomicityMode = TRANSACTIONAL, cacheMode = PARTITIONED)
+    public void testStopClientTransactionalPartitioned() throws Exception {
+        testStopClientTransactionalReplicated();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Params(atomicityMode = TRANSACTIONAL, cacheMode = REPLICATED, timeout = 5_000L)
+    public void testStopClientTransactionalReplicated() throws Exception {
+        startNodesInClientMode(true);
+
+        customIpFinder = new TcpDiscoveryVmIpFinder(false)
+            .setAddresses(
+                Collections.singletonList("127.0.0.1:47502")
+            );
+
+        for (int i = 0; i < 3; i++)
+            clients.add(startGrid(UUID.randomUUID().toString()));
+
+        customIpFinder = null;
+
+        doTest(
+            TcpDiscoveryNodeLeftMessage.class,
+            () -> stopGrid(clients.remove(clients.size() - 1).name())
+        );
+    }
+
+    /**
      * Checks that given discovery event is from "Create cache" operation.
      *
      * @param discoEvt Discovery event.
@@ -754,6 +814,34 @@ public abstract class CacheBlockOnReadAbstractTest extends GridCommonAbstractTes
             blockMsgPred
         );
 
+        doTest(backgroundOperation);
+    }
+
+    /**
+     * Checks that {@code block} closure doesn't block read operation.
+     * Does it for client, baseline and regular server node.
+     *
+     * @param blockMsgCls Class of discovery message to block.
+     * @param block Blocking operation.
+     * @throws Exception If failed.
+     */
+    public void doTest(Class<? extends TcpDiscoveryAbstractMessage> blockMsgCls, RunnableX block) throws Exception {
+        BlockDiscoveryMessageBackgroundOperation backgroundOperation = new BlockDiscoveryMessageBackgroundOperation(
+            block,
+            blockMsgCls
+        );
+
+        doTest(backgroundOperation);
+    }
+
+    /**
+     * Checks that {@code block} closure doesn't block read operation.
+     * Does it for client, baseline and regular server node.
+     *
+     * @param backgroundOperation Background operation.
+     * @throws Exception If failed.
+     */
+    public void doTest(BackgroundOperation backgroundOperation) throws Exception {
         CacheReadBackgroundOperation<?, ?> readOperation = getReadOperation();
 
         readOperation.initCache(baseline.get(0), true);
@@ -776,14 +864,12 @@ public abstract class CacheBlockOnReadAbstractTest extends GridCommonAbstractTes
             );
         }
 
-
         doTest0(clients.get(0), readOperation, backgroundOperation);
 
         doTest0(srvs.get(0), readOperation, backgroundOperation);
 
         doTest0(baseline.get(0), readOperation, backgroundOperation);
 
-
         try (AutoCloseable read = readOperation.start()) {
             Thread.sleep(500L);
         }
@@ -963,8 +1049,8 @@ public abstract class CacheBlockOnReadAbstractTest extends GridCommonAbstractTes
     }
 
     /**
-     * Background operation that executes some node request and doesn't allow its messages to be fully processed until
-     * operation is stopped.
+     * Background operation that executes some node request and doesn't allow its exchange messages to be fully
+     * processed until operation is stopped.
      */
     protected class BlockMessageOnBaselineBackgroundOperation extends BackgroundOperation {
         /** */
@@ -1033,6 +1119,90 @@ public abstract class CacheBlockOnReadAbstractTest extends GridCommonAbstractTes
         }
     }
 
+    /**
+     * Background operation that executes some node request and doesn't allow its discovery messages to be fully
+     * processed until operation is stopped.
+     */
+    protected class BlockDiscoveryMessageBackgroundOperation extends BackgroundOperation {
+        /** */
+        private final RunnableX block;
+
+        /** */
+        private final Class<? extends TcpDiscoveryAbstractMessage> blockMsgCls;
+
+        /** */
+        private volatile CountDownLatch blockLatch;
+
+        /**
+         * @param block Blocking operation.
+         * @param blockMsgCls Class of message to block.
+         *
+         * @see BlockMessageOnBaselineBackgroundOperation#blockMessage(ClusterNode, Message)
+         */
+        protected BlockDiscoveryMessageBackgroundOperation(
+            RunnableX block,
+            Class<? extends TcpDiscoveryAbstractMessage> blockMsgCls
+        ) {
+            this.block = block;
+            this.blockMsgCls = blockMsgCls;
+        }
+
+        /** {@inheritDoc} */
+        @Override protected void execute() {
+            try {
+                blockLatch = new CountDownLatch(1);
+
+                discoveryMsgProcessor = this::processMessage;
+
+                for (int i = 0; i < baselineServersCount() - 2; i++)
+                    cntFinishedReadOperations.countDown();
+
+                block.run();
+            }
+            finally {
+                discoveryMsgProcessor = null;
+            }
+        }
+
+        /**
+         * Process discovery spi message.
+         *
+         * @param msg Message.
+         * @param receiverConsistentId Consistent ID of message receiver.
+         */
+        private void processMessage(TcpDiscoveryAbstractMessage msg, String receiverConsistentId) {
+            if (!blockMsgCls.isInstance(msg))
+                return;
+
+            boolean baselineSnd = Objects.equals(
+                baseline.get(1).localNode().consistentId(),
+                receiverConsistentId
+            );
+
+            if (baselineSnd) {
+                cntFinishedReadOperations.countDown();
+
+                try {
+                    blockLatch.await();
+                }
+                catch (InterruptedException ignore) {
+                }
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override protected long stopTimeout() {
+            // Should be big enough so thread will stop by it's own. Otherwise test will fail, but that's fine.
+            return 30_000L;
+        }
+
+        /** {@inheritDoc} */
+        @Override void stop() throws Exception {
+            blockLatch.countDown();
+
+            super.stop();
+        }
+    }
 
     /**
      * Runnable that can throw exceptions.

http://git-wip-us.apache.org/repos/asf/ignite/blob/8bd95757/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnScanTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnScanTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnScanTest.java
index 2912d05..dfe6808 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnScanTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnScanTest.java
@@ -70,4 +70,52 @@ public class CacheBlockOnScanTest extends CacheBlockOnReadAbstractTest {
     @Override public void testStopBaselineTransactionalReplicated() throws Exception {
         super.testStopBaselineTransactionalReplicated();
     }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = ATOMIC, cacheMode = REPLICATED)
+    @Override public void testStartClientAtomicReplicated() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = TRANSACTIONAL, cacheMode = REPLICATED)
+    @Override public void testStartClientTransactionalReplicated() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = ATOMIC, cacheMode = REPLICATED)
+    @Override public void testStopClientAtomicReplicated() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = TRANSACTIONAL, cacheMode = REPLICATED)
+    @Override public void testStopClientTransactionalReplicated() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(atomicityMode = ATOMIC, cacheMode = PARTITIONED)
+    @Override public void testStartClientAtomicPartitioned() throws Exception {
+        super.testStartClientTransactionalReplicated();
+    }
+
+    /** {@inheritDoc} */
+    @Params(atomicityMode = TRANSACTIONAL, cacheMode = PARTITIONED)
+    @Override public void testStartClientTransactionalPartitioned() throws Exception {
+        super.testStartClientTransactionalReplicated();
+    }
+
+    /** {@inheritDoc} */
+    @Params(atomicityMode = ATOMIC, cacheMode = PARTITIONED)
+    @Override public void testStopClientAtomicPartitioned() throws Exception {
+        super.testStopClientTransactionalReplicated();
+    }
+
+    /** {@inheritDoc} */
+    @Params(atomicityMode = TRANSACTIONAL, cacheMode = PARTITIONED)
+    @Override public void testStopClientTransactionalPartitioned() throws Exception {
+        super.testStopClientTransactionalReplicated();
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8bd95757/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnSingleGetTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnSingleGetTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnSingleGetTest.java
index fc181be..e5d1fe1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnSingleGetTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnSingleGetTest.java
@@ -187,4 +187,52 @@ public class CacheBlockOnSingleGetTest extends CacheBlockOnReadAbstractTest {
     @Override public void testUpdateBaselineTopologyTransactionalReplicated() {
         fail("https://issues.apache.org/jira/browse/IGNITE-9883");
     }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = ATOMIC, cacheMode = PARTITIONED)
+    @Override public void testStartClientAtomicPartitioned() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = ATOMIC, cacheMode = REPLICATED)
+    @Override public void testStartClientAtomicReplicated() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = TRANSACTIONAL, cacheMode = PARTITIONED)
+    @Override public void testStartClientTransactionalPartitioned() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = TRANSACTIONAL, cacheMode = REPLICATED)
+    @Override public void testStartClientTransactionalReplicated() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = ATOMIC, cacheMode = PARTITIONED)
+    @Override public void testStopClientAtomicPartitioned() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = ATOMIC, cacheMode = REPLICATED)
+    @Override public void testStopClientAtomicReplicated() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = TRANSACTIONAL, cacheMode = PARTITIONED)
+    @Override public void testStopClientTransactionalPartitioned() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = TRANSACTIONAL, cacheMode = REPLICATED)
+    @Override public void testStopClientTransactionalReplicated() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9987");
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8bd95757/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnSqlQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnSqlQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnSqlQueryTest.java
index f1d96ea..e9645b2 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnSqlQueryTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnSqlQueryTest.java
@@ -128,4 +128,28 @@ public class CacheBlockOnSqlQueryTest extends CacheBlockOnReadAbstractTest {
     @Override public void testStopBaselineTransactionalPartitioned() {
         fail("https://issues.apache.org/jira/browse/IGNITE-9916");
     }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = ATOMIC, cacheMode = PARTITIONED)
+    @Override public void testStartClientAtomicPartitioned() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9916");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = TRANSACTIONAL, cacheMode = PARTITIONED)
+    @Override public void testStartClientTransactionalPartitioned() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9916");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = ATOMIC, cacheMode = PARTITIONED)
+    @Override public void testStopClientAtomicPartitioned() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9916");
+    }
+
+    /** {@inheritDoc} */
+    @Params(baseline = 1, atomicityMode = TRANSACTIONAL, cacheMode = PARTITIONED)
+    @Override public void testStopClientTransactionalPartitioned() {
+        fail("https://issues.apache.org/jira/browse/IGNITE-9916");
+    }
 }


[07/28] ignite git commit: IGNITE-9910: [ML] Move the static copy-pasted datasets from examples to special Util class

Posted by sb...@apache.org.
IGNITE-9910: [ML] Move the static copy-pasted datasets from examples
to special Util class

this closes #5028


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

Branch: refs/heads/ignite-627
Commit: 370cd3e1d60237e4a238c1c789cddbd1164e57e6
Parents: c7449f6
Author: zaleslaw <za...@gmail.com>
Authored: Fri Oct 26 16:06:42 2018 +0300
Committer: Yury Babak <yb...@gridgain.com>
Committed: Fri Oct 26 16:06:42 2018 +0300

----------------------------------------------------------------------
 .../clustering/KMeansClusterizationExample.java | 150 +----
 .../ml/knn/ANNClassificationExample.java        |   2 +-
 .../ml/knn/KNNClassificationExample.java        | 183 +------
 .../examples/ml/knn/KNNRegressionExample.java   | 221 +-------
 .../examples/ml/nn/MLPTrainerExample.java       |   2 +-
 .../LinearRegressionLSQRTrainerExample.java     |  86 +--
 ...ssionLSQRTrainerWithMinMaxScalerExample.java |  85 +--
 .../LinearRegressionSGDTrainerExample.java      |  86 +--
 .../LogisticRegressionSGDTrainerExample.java    | 132 +----
 ...gressionMultiClassClassificationExample.java | 158 +-----
 .../ml/selection/cv/CrossValidationExample.java |   2 +-
 .../split/TrainTestDatasetSplitterExample.java  |  90 +--
 .../binary/SVMBinaryClassificationExample.java  | 132 +----
 .../SVMMultiClassClassificationExample.java     | 189 ++-----
 ...ecisionTreeClassificationTrainerExample.java |   2 +-
 .../DecisionTreeRegressionTrainerExample.java   |   2 +-
 .../GDBOnTreesClassificationTrainerExample.java |   2 +-
 .../RandomForestClassificationExample.java      | 216 +-------
 .../RandomForestRegressionExample.java          | 543 +------------------
 .../examples/ml/util/MLSandboxDatasets.java     |  87 +++
 .../ignite/examples/ml/util/SandboxMLCache.java | 144 +++++
 .../ignite/examples/ml/util/TestCache.java      |  77 ---
 .../datasets/boston_housing_dataset.txt         | 505 +++++++++++++++++
 .../resources/datasets/cleared_machines.csv     | 209 +++++++
 .../resources/datasets/cleared_machines.txt     | 209 -------
 .../resources/datasets/glass_identification.csv | 116 ++++
 .../main/resources/datasets/mortalitydata.csv   |  53 ++
 .../resources/datasets/two_classed_iris.csv     | 100 ++++
 examples/src/main/resources/datasets/wine.txt   | 178 ++++++
 .../ml/knn/regression/KNNRegressionModel.java   |   2 +
 .../math/primitives/vector/AbstractVector.java  |   9 +
 .../ml/math/primitives/vector/Vector.java       |   9 +
 .../vector/impl/DelegatingVector.java           |   5 +
 33 files changed, 1643 insertions(+), 2343 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/clustering/KMeansClusterizationExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/clustering/KMeansClusterizationExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/clustering/KMeansClusterizationExample.java
index 567775b..3c8eeaa 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/clustering/KMeansClusterizationExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/clustering/KMeansClusterizationExample.java
@@ -17,19 +17,19 @@
 
 package org.apache.ignite.examples.ml.clustering;
 
-import java.util.Arrays;
+import java.io.FileNotFoundException;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.TestCache;
+import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
+import org.apache.ignite.examples.ml.util.SandboxMLCache;
 import org.apache.ignite.ml.clustering.kmeans.KMeansModel;
 import org.apache.ignite.ml.clustering.kmeans.KMeansTrainer;
 import org.apache.ignite.ml.math.Tracer;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
-import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 
 /**
  * Run KMeans clustering algorithm ({@link KMeansTrainer}) over distributed dataset.
@@ -47,14 +47,15 @@ import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
  */
 public class KMeansClusterizationExample {
     /** Run example. */
-    public static void main(String[] args) throws InterruptedException {
+    public static void main(String[] args) throws FileNotFoundException {
         System.out.println();
         System.out.println(">>> KMeans clustering algorithm over cached dataset usage example started.");
         // Start ignite grid.
         try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
             System.out.println(">>> Ignite grid started.");
 
-            IgniteCache<Integer, double[]> dataCache = new TestCache(ignite).fillCacheWith(data);
+            IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
+                .fillCacheWith(MLSandboxDatasets.TWO_CLASSED_IRIS);
 
             KMeansTrainer trainer = new KMeansTrainer()
                 .withSeed(7867L);
@@ -62,8 +63,8 @@ public class KMeansClusterizationExample {
             KMeansModel mdl = trainer.fit(
                 ignite,
                 dataCache,
-                (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
-                (k, v) -> v[0]
+                (k, v) -> v.copyOfRange(1, v.size()),
+                (k, v) -> v.get(0)
             );
 
             System.out.println(">>> KMeans centroids");
@@ -71,139 +72,24 @@ public class KMeansClusterizationExample {
             Tracer.showAscii(mdl.getCenters()[1]);
             System.out.println(">>>");
 
-            System.out.println(">>> -----------------------------------");
-            System.out.println(">>> | Predicted cluster\t| Real Label\t|");
-            System.out.println(">>> -----------------------------------");
+            System.out.println(">>> --------------------------------------------");
+            System.out.println(">>> | Predicted cluster\t| Erased class label\t|");
+            System.out.println(">>> --------------------------------------------");
 
-            int amountOfErrors = 0;
-            int totalAmount = 0;
+            try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(new ScanQuery<>())) {
+                for (Cache.Entry<Integer, Vector> observation : observations) {
+                    Vector val = observation.getValue();
+                    Vector inputs = val.copyOfRange(1, val.size());
+                    double groundTruth = val.get(0);
 
-            try (QueryCursor<Cache.Entry<Integer, double[]>> observations = dataCache.query(new ScanQuery<>())) {
-                for (Cache.Entry<Integer, double[]> observation : observations) {
-                    double[] val = observation.getValue();
-                    double[] inputs = Arrays.copyOfRange(val, 1, val.length);
-                    double groundTruth = val[0];
-
-                    double prediction = mdl.apply(new DenseVector(inputs));
-
-                    totalAmount++;
-                    if (groundTruth != prediction)
-                        amountOfErrors++;
+                    double prediction = mdl.apply(inputs);
 
                     System.out.printf(">>> | %.4f\t\t\t| %.4f\t\t|\n", prediction, groundTruth);
                 }
 
                 System.out.println(">>> ---------------------------------");
-
-                System.out.println("\n>>> Absolute amount of errors " + amountOfErrors);
-                System.out.println("\n>>> Accuracy " + (1 - amountOfErrors / (double)totalAmount));
-
                 System.out.println(">>> KMeans clustering algorithm over cached dataset usage example completed.");
             }
         }
     }
-
-    /** The Iris dataset. */
-    private static final double[][] data = {
-        {0, 5.1, 3.5, 1.4, 0.2},
-        {0, 4.9, 3, 1.4, 0.2},
-        {0, 4.7, 3.2, 1.3, 0.2},
-        {0, 4.6, 3.1, 1.5, 0.2},
-        {0, 5, 3.6, 1.4, 0.2},
-        {0, 5.4, 3.9, 1.7, 0.4},
-        {0, 4.6, 3.4, 1.4, 0.3},
-        {0, 5, 3.4, 1.5, 0.2},
-        {0, 4.4, 2.9, 1.4, 0.2},
-        {0, 4.9, 3.1, 1.5, 0.1},
-        {0, 5.4, 3.7, 1.5, 0.2},
-        {0, 4.8, 3.4, 1.6, 0.2},
-        {0, 4.8, 3, 1.4, 0.1},
-        {0, 4.3, 3, 1.1, 0.1},
-        {0, 5.8, 4, 1.2, 0.2},
-        {0, 5.7, 4.4, 1.5, 0.4},
-        {0, 5.4, 3.9, 1.3, 0.4},
-        {0, 5.1, 3.5, 1.4, 0.3},
-        {0, 5.7, 3.8, 1.7, 0.3},
-        {0, 5.1, 3.8, 1.5, 0.3},
-        {0, 5.4, 3.4, 1.7, 0.2},
-        {0, 5.1, 3.7, 1.5, 0.4},
-        {0, 4.6, 3.6, 1, 0.2},
-        {0, 5.1, 3.3, 1.7, 0.5},
-        {0, 4.8, 3.4, 1.9, 0.2},
-        {0, 5, 3, 1.6, 0.2},
-        {0, 5, 3.4, 1.6, 0.4},
-        {0, 5.2, 3.5, 1.5, 0.2},
-        {0, 5.2, 3.4, 1.4, 0.2},
-        {0, 4.7, 3.2, 1.6, 0.2},
-        {0, 4.8, 3.1, 1.6, 0.2},
-        {0, 5.4, 3.4, 1.5, 0.4},
-        {0, 5.2, 4.1, 1.5, 0.1},
-        {0, 5.5, 4.2, 1.4, 0.2},
-        {0, 4.9, 3.1, 1.5, 0.1},
-        {0, 5, 3.2, 1.2, 0.2},
-        {0, 5.5, 3.5, 1.3, 0.2},
-        {0, 4.9, 3.1, 1.5, 0.1},
-        {0, 4.4, 3, 1.3, 0.2},
-        {0, 5.1, 3.4, 1.5, 0.2},
-        {0, 5, 3.5, 1.3, 0.3},
-        {0, 4.5, 2.3, 1.3, 0.3},
-        {0, 4.4, 3.2, 1.3, 0.2},
-        {0, 5, 3.5, 1.6, 0.6},
-        {0, 5.1, 3.8, 1.9, 0.4},
-        {0, 4.8, 3, 1.4, 0.3},
-        {0, 5.1, 3.8, 1.6, 0.2},
-        {0, 4.6, 3.2, 1.4, 0.2},
-        {0, 5.3, 3.7, 1.5, 0.2},
-        {0, 5, 3.3, 1.4, 0.2},
-        {1, 7, 3.2, 4.7, 1.4},
-        {1, 6.4, 3.2, 4.5, 1.5},
-        {1, 6.9, 3.1, 4.9, 1.5},
-        {1, 5.5, 2.3, 4, 1.3},
-        {1, 6.5, 2.8, 4.6, 1.5},
-        {1, 5.7, 2.8, 4.5, 1.3},
-        {1, 6.3, 3.3, 4.7, 1.6},
-        {1, 4.9, 2.4, 3.3, 1},
-        {1, 6.6, 2.9, 4.6, 1.3},
-        {1, 5.2, 2.7, 3.9, 1.4},
-        {1, 5, 2, 3.5, 1},
-        {1, 5.9, 3, 4.2, 1.5},
-        {1, 6, 2.2, 4, 1},
-        {1, 6.1, 2.9, 4.7, 1.4},
-        {1, 5.6, 2.9, 3.6, 1.3},
-        {1, 6.7, 3.1, 4.4, 1.4},
-        {1, 5.6, 3, 4.5, 1.5},
-        {1, 5.8, 2.7, 4.1, 1},
-        {1, 6.2, 2.2, 4.5, 1.5},
-        {1, 5.6, 2.5, 3.9, 1.1},
-        {1, 5.9, 3.2, 4.8, 1.8},
-        {1, 6.1, 2.8, 4, 1.3},
-        {1, 6.3, 2.5, 4.9, 1.5},
-        {1, 6.1, 2.8, 4.7, 1.2},
-        {1, 6.4, 2.9, 4.3, 1.3},
-        {1, 6.6, 3, 4.4, 1.4},
-        {1, 6.8, 2.8, 4.8, 1.4},
-        {1, 6.7, 3, 5, 1.7},
-        {1, 6, 2.9, 4.5, 1.5},
-        {1, 5.7, 2.6, 3.5, 1},
-        {1, 5.5, 2.4, 3.8, 1.1},
-        {1, 5.5, 2.4, 3.7, 1},
-        {1, 5.8, 2.7, 3.9, 1.2},
-        {1, 6, 2.7, 5.1, 1.6},
-        {1, 5.4, 3, 4.5, 1.5},
-        {1, 6, 3.4, 4.5, 1.6},
-        {1, 6.7, 3.1, 4.7, 1.5},
-        {1, 6.3, 2.3, 4.4, 1.3},
-        {1, 5.6, 3, 4.1, 1.3},
-        {1, 5.5, 2.5, 4, 1.3},
-        {1, 5.5, 2.6, 4.4, 1.2},
-        {1, 6.1, 3, 4.6, 1.4},
-        {1, 5.8, 2.6, 4, 1.2},
-        {1, 5, 2.3, 3.3, 1},
-        {1, 5.6, 2.7, 4.2, 1.3},
-        {1, 5.7, 3, 4.2, 1.2},
-        {1, 5.7, 2.9, 4.2, 1.3},
-        {1, 6.2, 2.9, 4.3, 1.3},
-        {1, 5.1, 2.5, 3, 1.1},
-        {1, 5.7, 2.8, 4.1, 1.3},
-    };
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/knn/ANNClassificationExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/knn/ANNClassificationExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/knn/ANNClassificationExample.java
index c9490fc..419eccb 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/knn/ANNClassificationExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/knn/ANNClassificationExample.java
@@ -51,7 +51,7 @@ import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
  */
 public class ANNClassificationExample {
     /** Run example. */
-    public static void main(String[] args) throws InterruptedException {
+    public static void main(String[] args) {
         System.out.println();
         System.out.println(">>> ANN multi-class classification algorithm over cached dataset usage example started.");
         // Start ignite grid.

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/knn/KNNClassificationExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/knn/KNNClassificationExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/knn/KNNClassificationExample.java
index 5cbb2ad..31ecdac 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/knn/KNNClassificationExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/knn/KNNClassificationExample.java
@@ -17,20 +17,20 @@
 
 package org.apache.ignite.examples.ml.knn;
 
-import java.util.Arrays;
+import java.io.FileNotFoundException;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.TestCache;
+import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
+import org.apache.ignite.examples.ml.util.SandboxMLCache;
 import org.apache.ignite.ml.knn.NNClassificationModel;
 import org.apache.ignite.ml.knn.classification.KNNClassificationTrainer;
 import org.apache.ignite.ml.knn.classification.NNStrategy;
 import org.apache.ignite.ml.math.distances.EuclideanDistance;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
-import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 
 /**
  * Run kNN multi-class classification trainer ({@link KNNClassificationTrainer}) over distributed dataset.
@@ -48,22 +48,23 @@ import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
  */
 public class KNNClassificationExample {
     /** Run example. */
-    public static void main(String[] args) throws InterruptedException {
+    public static void main(String[] args) throws FileNotFoundException {
         System.out.println();
         System.out.println(">>> kNN multi-class classification algorithm over cached dataset usage example started.");
         // Start ignite grid.
         try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
             System.out.println(">>> Ignite grid started.");
 
-            IgniteCache<Integer, double[]> dataCache = new TestCache(ignite).fillCacheWith(data);
+            IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
+                .fillCacheWith(MLSandboxDatasets.IRIS);
 
             KNNClassificationTrainer trainer = new KNNClassificationTrainer();
 
             NNClassificationModel knnMdl = trainer.fit(
                 ignite,
                 dataCache,
-                (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
-                (k, v) -> v[0]
+                (k, v) -> v.copyOfRange(1, v.size()),
+                (k, v) -> v.get(0)
             ).withK(3)
                 .withDistanceMeasure(new EuclideanDistance())
                 .withStrategy(NNStrategy.WEIGHTED);
@@ -75,13 +76,13 @@ public class KNNClassificationExample {
             int amountOfErrors = 0;
             int totalAmount = 0;
 
-            try (QueryCursor<Cache.Entry<Integer, double[]>> observations = dataCache.query(new ScanQuery<>())) {
-                for (Cache.Entry<Integer, double[]> observation : observations) {
-                    double[] val = observation.getValue();
-                    double[] inputs = Arrays.copyOfRange(val, 1, val.length);
-                    double groundTruth = val[0];
+            try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(new ScanQuery<>())) {
+                for (Cache.Entry<Integer, Vector> observation : observations) {
+                    Vector val = observation.getValue();
+                    Vector inputs = val.copyOfRange(1, val.size());
+                    double groundTruth = val.get(0);
 
-                    double prediction = knnMdl.apply(new DenseVector(inputs));
+                    double prediction = knnMdl.apply(inputs);
 
                     totalAmount++;
                     if (groundTruth != prediction)
@@ -99,158 +100,4 @@ public class KNNClassificationExample {
             }
         }
     }
-
-    /** The Iris dataset. */
-    private static final double[][] data = {
-        {1, 5.1, 3.5, 1.4, 0.2},
-        {1, 4.9, 3, 1.4, 0.2},
-        {1, 4.7, 3.2, 1.3, 0.2},
-        {1, 4.6, 3.1, 1.5, 0.2},
-        {1, 5, 3.6, 1.4, 0.2},
-        {1, 5.4, 3.9, 1.7, 0.4},
-        {1, 4.6, 3.4, 1.4, 0.3},
-        {1, 5, 3.4, 1.5, 0.2},
-        {1, 4.4, 2.9, 1.4, 0.2},
-        {1, 4.9, 3.1, 1.5, 0.1},
-        {1, 5.4, 3.7, 1.5, 0.2},
-        {1, 4.8, 3.4, 1.6, 0.2},
-        {1, 4.8, 3, 1.4, 0.1},
-        {1, 4.3, 3, 1.1, 0.1},
-        {1, 5.8, 4, 1.2, 0.2},
-        {1, 5.7, 4.4, 1.5, 0.4},
-        {1, 5.4, 3.9, 1.3, 0.4},
-        {1, 5.1, 3.5, 1.4, 0.3},
-        {1, 5.7, 3.8, 1.7, 0.3},
-        {1, 5.1, 3.8, 1.5, 0.3},
-        {1, 5.4, 3.4, 1.7, 0.2},
-        {1, 5.1, 3.7, 1.5, 0.4},
-        {1, 4.6, 3.6, 1, 0.2},
-        {1, 5.1, 3.3, 1.7, 0.5},
-        {1, 4.8, 3.4, 1.9, 0.2},
-        {1, 5, 3, 1.6, 0.2},
-        {1, 5, 3.4, 1.6, 0.4},
-        {1, 5.2, 3.5, 1.5, 0.2},
-        {1, 5.2, 3.4, 1.4, 0.2},
-        {1, 4.7, 3.2, 1.6, 0.2},
-        {1, 4.8, 3.1, 1.6, 0.2},
-        {1, 5.4, 3.4, 1.5, 0.4},
-        {1, 5.2, 4.1, 1.5, 0.1},
-        {1, 5.5, 4.2, 1.4, 0.2},
-        {1, 4.9, 3.1, 1.5, 0.1},
-        {1, 5, 3.2, 1.2, 0.2},
-        {1, 5.5, 3.5, 1.3, 0.2},
-        {1, 4.9, 3.1, 1.5, 0.1},
-        {1, 4.4, 3, 1.3, 0.2},
-        {1, 5.1, 3.4, 1.5, 0.2},
-        {1, 5, 3.5, 1.3, 0.3},
-        {1, 4.5, 2.3, 1.3, 0.3},
-        {1, 4.4, 3.2, 1.3, 0.2},
-        {1, 5, 3.5, 1.6, 0.6},
-        {1, 5.1, 3.8, 1.9, 0.4},
-        {1, 4.8, 3, 1.4, 0.3},
-        {1, 5.1, 3.8, 1.6, 0.2},
-        {1, 4.6, 3.2, 1.4, 0.2},
-        {1, 5.3, 3.7, 1.5, 0.2},
-        {1, 5, 3.3, 1.4, 0.2},
-        {2, 7, 3.2, 4.7, 1.4},
-        {2, 6.4, 3.2, 4.5, 1.5},
-        {2, 6.9, 3.1, 4.9, 1.5},
-        {2, 5.5, 2.3, 4, 1.3},
-        {2, 6.5, 2.8, 4.6, 1.5},
-        {2, 5.7, 2.8, 4.5, 1.3},
-        {2, 6.3, 3.3, 4.7, 1.6},
-        {2, 4.9, 2.4, 3.3, 1},
-        {2, 6.6, 2.9, 4.6, 1.3},
-        {2, 5.2, 2.7, 3.9, 1.4},
-        {2, 5, 2, 3.5, 1},
-        {2, 5.9, 3, 4.2, 1.5},
-        {2, 6, 2.2, 4, 1},
-        {2, 6.1, 2.9, 4.7, 1.4},
-        {2, 5.6, 2.9, 3.6, 1.3},
-        {2, 6.7, 3.1, 4.4, 1.4},
-        {2, 5.6, 3, 4.5, 1.5},
-        {2, 5.8, 2.7, 4.1, 1},
-        {2, 6.2, 2.2, 4.5, 1.5},
-        {2, 5.6, 2.5, 3.9, 1.1},
-        {2, 5.9, 3.2, 4.8, 1.8},
-        {2, 6.1, 2.8, 4, 1.3},
-        {2, 6.3, 2.5, 4.9, 1.5},
-        {2, 6.1, 2.8, 4.7, 1.2},
-        {2, 6.4, 2.9, 4.3, 1.3},
-        {2, 6.6, 3, 4.4, 1.4},
-        {2, 6.8, 2.8, 4.8, 1.4},
-        {2, 6.7, 3, 5, 1.7},
-        {2, 6, 2.9, 4.5, 1.5},
-        {2, 5.7, 2.6, 3.5, 1},
-        {2, 5.5, 2.4, 3.8, 1.1},
-        {2, 5.5, 2.4, 3.7, 1},
-        {2, 5.8, 2.7, 3.9, 1.2},
-        {2, 6, 2.7, 5.1, 1.6},
-        {2, 5.4, 3, 4.5, 1.5},
-        {2, 6, 3.4, 4.5, 1.6},
-        {2, 6.7, 3.1, 4.7, 1.5},
-        {2, 6.3, 2.3, 4.4, 1.3},
-        {2, 5.6, 3, 4.1, 1.3},
-        {2, 5.5, 2.5, 4, 1.3},
-        {2, 5.5, 2.6, 4.4, 1.2},
-        {2, 6.1, 3, 4.6, 1.4},
-        {2, 5.8, 2.6, 4, 1.2},
-        {2, 5, 2.3, 3.3, 1},
-        {2, 5.6, 2.7, 4.2, 1.3},
-        {2, 5.7, 3, 4.2, 1.2},
-        {2, 5.7, 2.9, 4.2, 1.3},
-        {2, 6.2, 2.9, 4.3, 1.3},
-        {2, 5.1, 2.5, 3, 1.1},
-        {2, 5.7, 2.8, 4.1, 1.3},
-        {3, 6.3, 3.3, 6, 2.5},
-        {3, 5.8, 2.7, 5.1, 1.9},
-        {3, 7.1, 3, 5.9, 2.1},
-        {3, 6.3, 2.9, 5.6, 1.8},
-        {3, 6.5, 3, 5.8, 2.2},
-        {3, 7.6, 3, 6.6, 2.1},
-        {3, 4.9, 2.5, 4.5, 1.7},
-        {3, 7.3, 2.9, 6.3, 1.8},
-        {3, 6.7, 2.5, 5.8, 1.8},
-        {3, 7.2, 3.6, 6.1, 2.5},
-        {3, 6.5, 3.2, 5.1, 2},
-        {3, 6.4, 2.7, 5.3, 1.9},
-        {3, 6.8, 3, 5.5, 2.1},
-        {3, 5.7, 2.5, 5, 2},
-        {3, 5.8, 2.8, 5.1, 2.4},
-        {3, 6.4, 3.2, 5.3, 2.3},
-        {3, 6.5, 3, 5.5, 1.8},
-        {3, 7.7, 3.8, 6.7, 2.2},
-        {3, 7.7, 2.6, 6.9, 2.3},
-        {3, 6, 2.2, 5, 1.5},
-        {3, 6.9, 3.2, 5.7, 2.3},
-        {3, 5.6, 2.8, 4.9, 2},
-        {3, 7.7, 2.8, 6.7, 2},
-        {3, 6.3, 2.7, 4.9, 1.8},
-        {3, 6.7, 3.3, 5.7, 2.1},
-        {3, 7.2, 3.2, 6, 1.8},
-        {3, 6.2, 2.8, 4.8, 1.8},
-        {3, 6.1, 3, 4.9, 1.8},
-        {3, 6.4, 2.8, 5.6, 2.1},
-        {3, 7.2, 3, 5.8, 1.6},
-        {3, 7.4, 2.8, 6.1, 1.9},
-        {3, 7.9, 3.8, 6.4, 2},
-        {3, 6.4, 2.8, 5.6, 2.2},
-        {3, 6.3, 2.8, 5.1, 1.5},
-        {3, 6.1, 2.6, 5.6, 1.4},
-        {3, 7.7, 3, 6.1, 2.3},
-        {3, 6.3, 3.4, 5.6, 2.4},
-        {3, 6.4, 3.1, 5.5, 1.8},
-        {3, 6, 3, 4.8, 1.8},
-        {3, 6.9, 3.1, 5.4, 2.1},
-        {3, 6.7, 3.1, 5.6, 2.4},
-        {3, 6.9, 3.1, 5.1, 2.3},
-        {3, 5.8, 2.7, 5.1, 1.9},
-        {3, 6.8, 3.2, 5.9, 2.3},
-        {3, 6.7, 3.3, 5.7, 2.5},
-        {3, 6.7, 3, 5.2, 2.3},
-        {3, 6.3, 2.5, 5, 1.9},
-        {3, 6.5, 3, 5.2, 2},
-        {3, 6.2, 3.4, 5.4, 2.3},
-        {3, 5.9, 3, 5.1, 1.8}
-    };
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/knn/KNNRegressionExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/knn/KNNRegressionExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/knn/KNNRegressionExample.java
index 3969f0c..9917e80 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/knn/KNNRegressionExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/knn/KNNRegressionExample.java
@@ -17,20 +17,20 @@
 
 package org.apache.ignite.examples.ml.knn;
 
-import java.util.Arrays;
+import java.io.FileNotFoundException;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.TestCache;
+import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
+import org.apache.ignite.examples.ml.util.SandboxMLCache;
 import org.apache.ignite.ml.knn.classification.NNStrategy;
 import org.apache.ignite.ml.knn.regression.KNNRegressionModel;
 import org.apache.ignite.ml.knn.regression.KNNRegressionTrainer;
 import org.apache.ignite.ml.math.distances.ManhattanDistance;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
-import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 
 /**
  * Run kNN regression trainer ({@link KNNRegressionTrainer}) over distributed dataset.
@@ -49,22 +49,23 @@ import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
  */
 public class KNNRegressionExample {
     /** Run example. */
-    public static void main(String[] args) throws InterruptedException {
+    public static void main(String[] args) throws FileNotFoundException {
         System.out.println();
         System.out.println(">>> kNN regression over cached dataset usage example started.");
         // Start ignite grid.
         try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
             System.out.println(">>> Ignite grid started.");
 
-            IgniteCache<Integer, double[]> dataCache = new TestCache(ignite).fillCacheWith(data);
+            IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
+                .fillCacheWith(MLSandboxDatasets.CLEARED_MACHINES);
 
             KNNRegressionTrainer trainer = new KNNRegressionTrainer();
 
             KNNRegressionModel knnMdl = (KNNRegressionModel) trainer.fit(
                 ignite,
                 dataCache,
-                (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
-                (k, v) -> v[0]
+                (k, v) -> v.copyOfRange(1, v.size()),
+                (k, v) -> v.get(0)
             ).withK(5)
                 .withDistanceMeasure(new ManhattanDistance())
                 .withStrategy(NNStrategy.WEIGHTED);
@@ -79,13 +80,13 @@ public class KNNRegressionExample {
             // Calculate mean absolute error (MAE)
             double mae = 0.0;
 
-            try (QueryCursor<Cache.Entry<Integer, double[]>> observations = dataCache.query(new ScanQuery<>())) {
-                for (Cache.Entry<Integer, double[]> observation : observations) {
-                    double[] val = observation.getValue();
-                    double[] inputs = Arrays.copyOfRange(val, 1, val.length);
-                    double groundTruth = val[0];
+            try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(new ScanQuery<>())) {
+                for (Cache.Entry<Integer, Vector> observation : observations) {
+                    Vector val = observation.getValue();
+                    Vector inputs = val.copyOfRange(1, val.size());
+                    double groundTruth = val.get(0);
 
-                    double prediction = knnMdl.apply(new DenseVector(inputs));
+                    double prediction = knnMdl.apply(inputs);
 
                     mse += Math.pow(prediction - groundTruth, 2.0);
                     mae += Math.abs(prediction - groundTruth);
@@ -107,196 +108,4 @@ public class KNNRegressionExample {
             }
         }
     }
-
-    /** The Iris dataset. */
-    private static final double[][] data = {
-        {199, 125, 256, 6000, 256, 16, 128},
-        {253, 29, 8000, 32000, 32, 8, 32},
-        {132, 29, 8000, 16000, 32, 8, 16},
-        {290, 26, 8000, 32000, 64, 8, 32},
-        {381, 23, 16000, 32000, 64, 16, 32},
-        {749, 23, 16000, 64000, 64, 16, 32},
-        {1238, 23, 32000, 64000, 128, 32, 64},
-        {23, 400, 1000, 3000, 0, 1, 2},
-        {24, 400, 512, 3500, 4, 1, 6},
-        {70, 60, 2000, 8000, 65, 1, 8},
-        {117, 50, 4000, 16000, 65, 1, 8},
-        {15, 350, 64, 64, 0, 1, 4},
-        {64, 200, 512, 16000, 0, 4, 32},
-        {23, 167, 524, 2000, 8, 4, 15},
-        {29, 143, 512, 5000, 0, 7, 32},
-        {22, 143, 1000, 2000, 0, 5, 16},
-        {124, 110, 5000, 5000, 142, 8, 64},
-        {35, 143, 1500, 6300, 0, 5, 32},
-        {39, 143, 3100, 6200, 0, 5, 20},
-        {40, 143, 2300, 6200, 0, 6, 64},
-        {45, 110, 3100, 6200, 0, 6, 64},
-        {28, 320, 128, 6000, 0, 1, 12},
-        {21, 320, 512, 2000, 4, 1, 3},
-        {28, 320, 256, 6000, 0, 1, 6},
-        {22, 320, 256, 3000, 4, 1, 3},
-        {28, 320, 512, 5000, 4, 1, 5},
-        {27, 320, 256, 5000, 4, 1, 6},
-        {102, 25, 1310, 2620, 131, 12, 24},
-        {74, 50, 2620, 10480, 30, 12, 24},
-        {138, 56, 5240, 20970, 30, 12, 24},
-        {136, 64, 5240, 20970, 30, 12, 24},
-        {23, 50, 500, 2000, 8, 1, 4},
-        {29, 50, 1000, 4000, 8, 1, 5},
-        {44, 50, 2000, 8000, 8, 1, 5},
-        {30, 50, 1000, 4000, 8, 3, 5},
-        {41, 50, 1000, 8000, 8, 3, 5},
-        {74, 50, 2000, 16000, 8, 3, 5},
-        {54, 133, 1000, 12000, 9, 3, 12},
-        {41, 133, 1000, 8000, 9, 3, 12},
-        {18, 810, 512, 512, 8, 1, 1},
-        {28, 810, 1000, 5000, 0, 1, 1},
-        {36, 320, 512, 8000, 4, 1, 5},
-        {38, 200, 512, 8000, 8, 1, 8},
-        {34, 700, 384, 8000, 0, 1, 1},
-        {19, 700, 256, 2000, 0, 1, 1},
-        {72, 140, 1000, 16000, 16, 1, 3},
-        {36, 200, 1000, 8000, 0, 1, 2},
-        {30, 110, 1000, 4000, 16, 1, 2},
-        {56, 110, 1000, 12000, 16, 1, 2},
-        {42, 220, 1000, 8000, 16, 1, 2},
-        {34, 800, 256, 8000, 0, 1, 4},
-        {19, 125, 512, 1000, 0, 8, 20},
-        {75, 75, 2000, 8000, 64, 1, 38},
-        {113, 75, 2000, 16000, 64, 1, 38},
-        {157, 75, 2000, 16000, 128, 1, 38},
-        {18, 90, 256, 1000, 0, 3, 10},
-        {20, 105, 256, 2000, 0, 3, 10},
-        {28, 105, 1000, 4000, 0, 3, 24},
-        {33, 105, 2000, 4000, 8, 3, 19},
-        {47, 75, 2000, 8000, 8, 3, 24},
-        {54, 75, 3000, 8000, 8, 3, 48},
-        {20, 175, 256, 2000, 0, 3, 24},
-        {23, 300, 768, 3000, 0, 6, 24},
-        {25, 300, 768, 3000, 6, 6, 24},
-        {52, 300, 768, 12000, 6, 6, 24},
-        {27, 300, 768, 4500, 0, 1, 24},
-        {50, 300, 384, 12000, 6, 1, 24},
-        {18, 300, 192, 768, 6, 6, 24},
-        {53, 180, 768, 12000, 6, 1, 31},
-        {23, 330, 1000, 3000, 0, 2, 4},
-        {30, 300, 1000, 4000, 8, 3, 64},
-        {73, 300, 1000, 16000, 8, 2, 112},
-        {20, 330, 1000, 2000, 0, 1, 2},
-        {25, 330, 1000, 4000, 0, 3, 6},
-        {28, 140, 2000, 4000, 0, 3, 6},
-        {29, 140, 2000, 4000, 0, 4, 8},
-        {32, 140, 2000, 4000, 8, 1, 20},
-        {175, 140, 2000, 32000, 32, 1, 20},
-        {57, 140, 2000, 8000, 32, 1, 54},
-        {181, 140, 2000, 32000, 32, 1, 54},
-        {32, 140, 2000, 4000, 8, 1, 20},
-        {82, 57, 4000, 16000, 1, 6, 12},
-        {171, 57, 4000, 24000, 64, 12, 16},
-        {361, 26, 16000, 32000, 64, 16, 24},
-        {350, 26, 16000, 32000, 64, 8, 24},
-        {220, 26, 8000, 32000, 0, 8, 24},
-        {113, 26, 8000, 16000, 0, 8, 16},
-        {15, 480, 96, 512, 0, 1, 1},
-        {21, 203, 1000, 2000, 0, 1, 5},
-        {35, 115, 512, 6000, 16, 1, 6},
-        {18, 1100, 512, 1500, 0, 1, 1},
-        {20, 1100, 768, 2000, 0, 1, 1},
-        {20, 600, 768, 2000, 0, 1, 1},
-        {28, 400, 2000, 4000, 0, 1, 1},
-        {45, 400, 4000, 8000, 0, 1, 1},
-        {18, 900, 1000, 1000, 0, 1, 2},
-        {17, 900, 512, 1000, 0, 1, 2},
-        {26, 900, 1000, 4000, 4, 1, 2},
-        {28, 900, 1000, 4000, 8, 1, 2},
-        {28, 900, 2000, 4000, 0, 3, 6},
-        {31, 225, 2000, 4000, 8, 3, 6},
-        {42, 180, 2000, 8000, 8, 1, 6},
-        {76, 185, 2000, 16000, 16, 1, 6},
-        {76, 180, 2000, 16000, 16, 1, 6},
-        {26, 225, 1000, 4000, 2, 3, 6},
-        {59, 25, 2000, 12000, 8, 1, 4},
-        {65, 25, 2000, 12000, 16, 3, 5},
-        {101, 17, 4000, 16000, 8, 6, 12},
-        {116, 17, 4000, 16000, 32, 6, 12},
-        {18, 1500, 768, 1000, 0, 0, 0},
-        {20, 1500, 768, 2000, 0, 0, 0},
-        {20, 800, 768, 2000, 0, 0, 0},
-        {30, 50, 2000, 4000, 0, 3, 6},
-        {44, 50, 2000, 8000, 8, 3, 6},
-        {82, 50, 2000, 16000, 24, 1, 6},
-        {128, 50, 8000, 16000, 48, 1, 10},
-        {37, 100, 1000, 8000, 0, 2, 6},
-        {46, 100, 1000, 8000, 24, 2, 6},
-        {46, 100, 1000, 8000, 24, 3, 6},
-        {80, 50, 2000, 16000, 12, 3, 16},
-        {88, 50, 2000, 16000, 24, 6, 16},
-        {33, 150, 512, 4000, 0, 8, 128},
-        {46, 115, 2000, 8000, 16, 1, 3},
-        {29, 115, 2000, 4000, 2, 1, 5},
-        {53, 92, 2000, 8000, 32, 1, 6},
-        {41, 92, 2000, 8000, 4, 1, 6},
-        {86, 75, 4000, 16000, 16, 1, 6},
-        {95, 60, 4000, 16000, 32, 1, 6},
-        {107, 60, 2000, 16000, 64, 5, 8},
-        {117, 60, 4000, 16000, 64, 5, 8},
-        {119, 50, 4000, 16000, 64, 5, 10},
-        {120, 72, 4000, 16000, 64, 8, 16},
-        {48, 72, 2000, 8000, 16, 6, 8},
-        {126, 40, 8000, 16000, 32, 8, 16},
-        {266, 40, 8000, 32000, 64, 8, 24},
-        {270, 35, 8000, 32000, 64, 8, 24},
-        {426, 38, 16000, 32000, 128, 16, 32},
-        {151, 48, 4000, 24000, 32, 8, 24},
-        {267, 38, 8000, 32000, 64, 8, 24},
-        {603, 30, 16000, 32000, 256, 16, 24},
-        {19, 112, 1000, 1000, 0, 1, 4},
-        {21, 84, 1000, 2000, 0, 1, 6},
-        {26, 56, 1000, 4000, 0, 1, 6},
-        {35, 56, 2000, 6000, 0, 1, 8},
-        {41, 56, 2000, 8000, 0, 1, 8},
-        {47, 56, 4000, 8000, 0, 1, 8},
-        {62, 56, 4000, 12000, 0, 1, 8},
-        {78, 56, 4000, 16000, 0, 1, 8},
-        {80, 38, 4000, 8000, 32, 16, 32},
-        {142, 38, 8000, 16000, 64, 4, 8},
-        {281, 38, 8000, 24000, 160, 4, 8},
-        {190, 38, 4000, 16000, 128, 16, 32},
-        {21, 200, 1000, 2000, 0, 1, 2},
-        {25, 200, 1000, 4000, 0, 1, 4},
-        {67, 200, 2000, 8000, 64, 1, 5},
-        {24, 250, 512, 4000, 0, 1, 7},
-        {24, 250, 512, 4000, 0, 4, 7},
-        {64, 250, 1000, 16000, 1, 1, 8},
-        {25, 160, 512, 4000, 2, 1, 5},
-        {20, 160, 512, 2000, 2, 3, 8},
-        {29, 160, 1000, 4000, 8, 1, 14},
-        {43, 160, 1000, 8000, 16, 1, 14},
-        {53, 160, 2000, 8000, 32, 1, 13},
-        {19, 240, 512, 1000, 8, 1, 3},
-        {22, 240, 512, 2000, 8, 1, 5},
-        {31, 105, 2000, 4000, 8, 3, 8},
-        {41, 105, 2000, 6000, 16, 6, 16},
-        {47, 105, 2000, 8000, 16, 4, 14},
-        {99, 52, 4000, 16000, 32, 4, 12},
-        {67, 70, 4000, 12000, 8, 6, 8},
-        {81, 59, 4000, 12000, 32, 6, 12},
-        {149, 59, 8000, 16000, 64, 12, 24},
-        {183, 26, 8000, 24000, 32, 8, 16},
-        {275, 26, 8000, 32000, 64, 12, 16},
-        {382, 26, 8000, 32000, 128, 24, 32},
-        {56, 116, 2000, 8000, 32, 5, 28},
-        {182, 50, 2000, 32000, 24, 6, 26},
-        {227, 50, 2000, 32000, 48, 26, 52},
-        {341, 50, 2000, 32000, 112, 52, 104},
-        {360, 50, 4000, 32000, 112, 52, 104},
-        {919, 30, 8000, 64000, 96, 12, 176},
-        {978, 30, 8000, 64000, 128, 12, 176},
-        {24, 180, 262, 4000, 0, 1, 3},
-        {37, 124, 1000, 8000, 0, 1, 8},
-        {50, 98, 1000, 8000, 32, 2, 8},
-        {41, 125, 2000, 8000, 0, 2, 14},
-        {47, 480, 512, 8000, 32, 0, 0},
-        {25, 480, 1000, 4000, 0, 0, 0}
-    };
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/nn/MLPTrainerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/nn/MLPTrainerExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/nn/MLPTrainerExample.java
index 6d5745e..dc67aa1 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/nn/MLPTrainerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/nn/MLPTrainerExample.java
@@ -61,7 +61,7 @@ public class MLPTrainerExample {
      *
      * @param args Command line arguments, none required.
      */
-    public static void main(String[] args) throws InterruptedException {
+    public static void main(String[] args) {
         // IMPL NOTE based on MLPGroupTrainerTest#testXOR
         System.out.println(">>> Distributed multilayer perceptron example started.");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionLSQRTrainerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionLSQRTrainerExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionLSQRTrainerExample.java
index 862a37f..aeb7a0d 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionLSQRTrainerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionLSQRTrainerExample.java
@@ -17,16 +17,16 @@
 
 package org.apache.ignite.examples.ml.regression.linear;
 
-import java.util.Arrays;
+import java.io.FileNotFoundException;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.TestCache;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
-import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
+import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
+import org.apache.ignite.examples.ml.util.SandboxMLCache;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.regressions.linear.LinearRegressionLSQRTrainer;
 import org.apache.ignite.ml.regressions.linear.LinearRegressionModel;
 
@@ -44,72 +44,16 @@ import org.apache.ignite.ml.regressions.linear.LinearRegressionModel;
  * You can change the test data used in this example and re-run it to explore this algorithm further.</p>
  */
 public class LinearRegressionLSQRTrainerExample {
-    /** */
-    private static final double[][] data = {
-        {8, 78, 284, 9.100000381, 109},
-        {9.300000191, 68, 433, 8.699999809, 144},
-        {7.5, 70, 739, 7.199999809, 113},
-        {8.899999619, 96, 1792, 8.899999619, 97},
-        {10.19999981, 74, 477, 8.300000191, 206},
-        {8.300000191, 111, 362, 10.89999962, 124},
-        {8.800000191, 77, 671, 10, 152},
-        {8.800000191, 168, 636, 9.100000381, 162},
-        {10.69999981, 82, 329, 8.699999809, 150},
-        {11.69999981, 89, 634, 7.599999905, 134},
-        {8.5, 149, 631, 10.80000019, 292},
-        {8.300000191, 60, 257, 9.5, 108},
-        {8.199999809, 96, 284, 8.800000191, 111},
-        {7.900000095, 83, 603, 9.5, 182},
-        {10.30000019, 130, 686, 8.699999809, 129},
-        {7.400000095, 145, 345, 11.19999981, 158},
-        {9.600000381, 112, 1357, 9.699999809, 186},
-        {9.300000191, 131, 544, 9.600000381, 177},
-        {10.60000038, 80, 205, 9.100000381, 127},
-        {9.699999809, 130, 1264, 9.199999809, 179},
-        {11.60000038, 140, 688, 8.300000191, 80},
-        {8.100000381, 154, 354, 8.399999619, 103},
-        {9.800000191, 118, 1632, 9.399999619, 101},
-        {7.400000095, 94, 348, 9.800000191, 117},
-        {9.399999619, 119, 370, 10.39999962, 88},
-        {11.19999981, 153, 648, 9.899999619, 78},
-        {9.100000381, 116, 366, 9.199999809, 102},
-        {10.5, 97, 540, 10.30000019, 95},
-        {11.89999962, 176, 680, 8.899999619, 80},
-        {8.399999619, 75, 345, 9.600000381, 92},
-        {5, 134, 525, 10.30000019, 126},
-        {9.800000191, 161, 870, 10.39999962, 108},
-        {9.800000191, 111, 669, 9.699999809, 77},
-        {10.80000019, 114, 452, 9.600000381, 60},
-        {10.10000038, 142, 430, 10.69999981, 71},
-        {10.89999962, 238, 822, 10.30000019, 86},
-        {9.199999809, 78, 190, 10.69999981, 93},
-        {8.300000191, 196, 867, 9.600000381, 106},
-        {7.300000191, 125, 969, 10.5, 162},
-        {9.399999619, 82, 499, 7.699999809, 95},
-        {9.399999619, 125, 925, 10.19999981, 91},
-        {9.800000191, 129, 353, 9.899999619, 52},
-        {3.599999905, 84, 288, 8.399999619, 110},
-        {8.399999619, 183, 718, 10.39999962, 69},
-        {10.80000019, 119, 540, 9.199999809, 57},
-        {10.10000038, 180, 668, 13, 106},
-        {9, 82, 347, 8.800000191, 40},
-        {10, 71, 345, 9.199999809, 50},
-        {11.30000019, 118, 463, 7.800000191, 35},
-        {11.30000019, 121, 728, 8.199999809, 86},
-        {12.80000019, 68, 383, 7.400000095, 57},
-        {10, 112, 316, 10.39999962, 57},
-        {6.699999809, 109, 388, 8.899999619, 94}
-    };
-
     /** Run example. */
-    public static void main(String[] args) throws InterruptedException {
+    public static void main(String[] args) throws FileNotFoundException {
         System.out.println();
         System.out.println(">>> Linear regression model over cache based dataset usage example started.");
         // Start ignite grid.
         try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
             System.out.println(">>> Ignite grid started.");
 
-            IgniteCache<Integer, double[]> dataCache = new TestCache(ignite).fillCacheWith(data);
+            IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
+                .fillCacheWith(MLSandboxDatasets.MORTALITY_DATA);
 
             System.out.println(">>> Create new linear regression trainer object.");
             LinearRegressionLSQRTrainer trainer = new LinearRegressionLSQRTrainer();
@@ -118,8 +62,8 @@ public class LinearRegressionLSQRTrainerExample {
             LinearRegressionModel mdl = trainer.fit(
                 ignite,
                 dataCache,
-                (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
-                (k, v) -> v[0]
+                (k, v) -> v.copyOfRange(1, v.size()),
+                (k, v) -> v.get(0)
             );
 
             System.out.println(">>> Linear regression model: " + mdl);
@@ -128,13 +72,13 @@ public class LinearRegressionLSQRTrainerExample {
             System.out.println(">>> | Prediction\t| Ground Truth\t|");
             System.out.println(">>> ---------------------------------");
 
-            try (QueryCursor<Cache.Entry<Integer, double[]>> observations = dataCache.query(new ScanQuery<>())) {
-                for (Cache.Entry<Integer, double[]> observation : observations) {
-                    double[] val = observation.getValue();
-                    double[] inputs = Arrays.copyOfRange(val, 1, val.length);
-                    double groundTruth = val[0];
+            try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(new ScanQuery<>())) {
+                for (Cache.Entry<Integer, Vector> observation : observations) {
+                    Vector val = observation.getValue();
+                    Vector inputs = val.copyOfRange(1, val.size());
+                    double groundTruth = val.get(0);
 
-                    double prediction = mdl.apply(new DenseVector(inputs));
+                    double prediction = mdl.apply(inputs);
 
                     System.out.printf(">>> | %.4f\t\t| %.4f\t\t|\n", prediction, groundTruth);
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionLSQRTrainerWithMinMaxScalerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionLSQRTrainerWithMinMaxScalerExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionLSQRTrainerWithMinMaxScalerExample.java
index 5692cb3..873cefb 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionLSQRTrainerWithMinMaxScalerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionLSQRTrainerWithMinMaxScalerExample.java
@@ -17,17 +17,17 @@
 
 package org.apache.ignite.examples.ml.regression.linear;
 
-import java.util.Arrays;
+import java.io.FileNotFoundException;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.TestCache;
+import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
+import org.apache.ignite.examples.ml.util.SandboxMLCache;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.math.primitives.vector.Vector;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.preprocessing.minmaxscaling.MinMaxScalerPreprocessor;
 import org.apache.ignite.ml.preprocessing.minmaxscaling.MinMaxScalerTrainer;
 import org.apache.ignite.ml.regressions.linear.LinearRegressionLSQRTrainer;
@@ -50,84 +50,25 @@ import org.apache.ignite.ml.regressions.linear.LinearRegressionModel;
  * You can change the test data used in this example and re-run it to explore this algorithm further.</p>
  */
 public class LinearRegressionLSQRTrainerWithMinMaxScalerExample {
-    /** */
-    private static final double[][] data = {
-        {8, 78, 284, 9.100000381, 109},
-        {9.300000191, 68, 433, 8.699999809, 144},
-        {7.5, 70, 739, 7.199999809, 113},
-        {8.899999619, 96, 1792, 8.899999619, 97},
-        {10.19999981, 74, 477, 8.300000191, 206},
-        {8.300000191, 111, 362, 10.89999962, 124},
-        {8.800000191, 77, 671, 10, 152},
-        {8.800000191, 168, 636, 9.100000381, 162},
-        {10.69999981, 82, 329, 8.699999809, 150},
-        {11.69999981, 89, 634, 7.599999905, 134},
-        {8.5, 149, 631, 10.80000019, 292},
-        {8.300000191, 60, 257, 9.5, 108},
-        {8.199999809, 96, 284, 8.800000191, 111},
-        {7.900000095, 83, 603, 9.5, 182},
-        {10.30000019, 130, 686, 8.699999809, 129},
-        {7.400000095, 145, 345, 11.19999981, 158},
-        {9.600000381, 112, 1357, 9.699999809, 186},
-        {9.300000191, 131, 544, 9.600000381, 177},
-        {10.60000038, 80, 205, 9.100000381, 127},
-        {9.699999809, 130, 1264, 9.199999809, 179},
-        {11.60000038, 140, 688, 8.300000191, 80},
-        {8.100000381, 154, 354, 8.399999619, 103},
-        {9.800000191, 118, 1632, 9.399999619, 101},
-        {7.400000095, 94, 348, 9.800000191, 117},
-        {9.399999619, 119, 370, 10.39999962, 88},
-        {11.19999981, 153, 648, 9.899999619, 78},
-        {9.100000381, 116, 366, 9.199999809, 102},
-        {10.5, 97, 540, 10.30000019, 95},
-        {11.89999962, 176, 680, 8.899999619, 80},
-        {8.399999619, 75, 345, 9.600000381, 92},
-        {5, 134, 525, 10.30000019, 126},
-        {9.800000191, 161, 870, 10.39999962, 108},
-        {9.800000191, 111, 669, 9.699999809, 77},
-        {10.80000019, 114, 452, 9.600000381, 60},
-        {10.10000038, 142, 430, 10.69999981, 71},
-        {10.89999962, 238, 822, 10.30000019, 86},
-        {9.199999809, 78, 190, 10.69999981, 93},
-        {8.300000191, 196, 867, 9.600000381, 106},
-        {7.300000191, 125, 969, 10.5, 162},
-        {9.399999619, 82, 499, 7.699999809, 95},
-        {9.399999619, 125, 925, 10.19999981, 91},
-        {9.800000191, 129, 353, 9.899999619, 52},
-        {3.599999905, 84, 288, 8.399999619, 110},
-        {8.399999619, 183, 718, 10.39999962, 69},
-        {10.80000019, 119, 540, 9.199999809, 57},
-        {10.10000038, 180, 668, 13, 106},
-        {9, 82, 347, 8.800000191, 40},
-        {10, 71, 345, 9.199999809, 50},
-        {11.30000019, 118, 463, 7.800000191, 35},
-        {11.30000019, 121, 728, 8.199999809, 86},
-        {12.80000019, 68, 383, 7.400000095, 57},
-        {10, 112, 316, 10.39999962, 57},
-        {6.699999809, 109, 388, 8.899999619, 94}
-    };
-
     /** Run example. */
-    public static void main(String[] args) throws InterruptedException {
+    public static void main(String[] args) throws FileNotFoundException {
         System.out.println();
-        System.out.println(">>> Linear regression model with minmaxscaling preprocessor over cached dataset usage example started.");
+        System.out.println(">>> Linear regression model with Min Max Scaling preprocessor over cached dataset usage example started.");
         // Start ignite grid.
         try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
             System.out.println(">>> Ignite grid started.");
 
-            IgniteCache<Integer, Vector> dataCache = new TestCache(ignite).getVectors(data);
+            IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
+                .fillCacheWith(MLSandboxDatasets.MORTALITY_DATA);
 
-            System.out.println(">>> Create new minmaxscaling trainer object.");
-            MinMaxScalerTrainer<Integer, Vector> normalizationTrainer = new MinMaxScalerTrainer<>();
+            System.out.println(">>> Create new MinMaxScaler trainer object.");
+            MinMaxScalerTrainer<Integer, Vector> minMaxScalerTrainer = new MinMaxScalerTrainer<>();
 
-            System.out.println(">>> Perform the training to get the minmaxscaling preprocessor.");
-            IgniteBiFunction<Integer, Vector, Vector> preprocessor = normalizationTrainer.fit(
+            System.out.println(">>> Perform the training to get the MinMaxScaler preprocessor.");
+            IgniteBiFunction<Integer, Vector, Vector> preprocessor = minMaxScalerTrainer.fit(
                 ignite,
                 dataCache,
-                (k, v) -> {
-                    double[] arr = v.asArray();
-                    return VectorUtils.of(Arrays.copyOfRange(arr, 1, arr.length));
-                }
+                (k, v) -> v.copyOfRange(1, v.size())
             );
 
             System.out.println(">>> Create new linear regression trainer object.");
@@ -155,7 +96,7 @@ public class LinearRegressionLSQRTrainerWithMinMaxScalerExample {
             }
 
             System.out.println(">>> ---------------------------------");
-            System.out.println(">>> Linear regression model with minmaxscaling preprocessor over cache based dataset usage example completed.");
+            System.out.println(">>> Linear regression model with MinMaxScaler preprocessor over cache based dataset usage example completed.");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionSGDTrainerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionSGDTrainerExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionSGDTrainerExample.java
index 1e9bd5a..1dad08b 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionSGDTrainerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/regression/linear/LinearRegressionSGDTrainerExample.java
@@ -17,16 +17,16 @@
 
 package org.apache.ignite.examples.ml.regression.linear;
 
-import java.util.Arrays;
+import java.io.FileNotFoundException;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.TestCache;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
-import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
+import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
+import org.apache.ignite.examples.ml.util.SandboxMLCache;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.nn.UpdatesStrategy;
 import org.apache.ignite.ml.optimization.updatecalculators.RPropParameterUpdate;
 import org.apache.ignite.ml.optimization.updatecalculators.RPropUpdateCalculator;
@@ -49,72 +49,16 @@ import org.apache.ignite.ml.regressions.linear.LinearRegressionSGDTrainer;
  * You can change the test data used in this example and re-run it to explore this algorithm further.</p>
  */
 public class LinearRegressionSGDTrainerExample {
-    /** */
-    private static final double[][] data = {
-        {8, 78, 284, 9.100000381, 109},
-        {9.300000191, 68, 433, 8.699999809, 144},
-        {7.5, 70, 739, 7.199999809, 113},
-        {8.899999619, 96, 1792, 8.899999619, 97},
-        {10.19999981, 74, 477, 8.300000191, 206},
-        {8.300000191, 111, 362, 10.89999962, 124},
-        {8.800000191, 77, 671, 10, 152},
-        {8.800000191, 168, 636, 9.100000381, 162},
-        {10.69999981, 82, 329, 8.699999809, 150},
-        {11.69999981, 89, 634, 7.599999905, 134},
-        {8.5, 149, 631, 10.80000019, 292},
-        {8.300000191, 60, 257, 9.5, 108},
-        {8.199999809, 96, 284, 8.800000191, 111},
-        {7.900000095, 83, 603, 9.5, 182},
-        {10.30000019, 130, 686, 8.699999809, 129},
-        {7.400000095, 145, 345, 11.19999981, 158},
-        {9.600000381, 112, 1357, 9.699999809, 186},
-        {9.300000191, 131, 544, 9.600000381, 177},
-        {10.60000038, 80, 205, 9.100000381, 127},
-        {9.699999809, 130, 1264, 9.199999809, 179},
-        {11.60000038, 140, 688, 8.300000191, 80},
-        {8.100000381, 154, 354, 8.399999619, 103},
-        {9.800000191, 118, 1632, 9.399999619, 101},
-        {7.400000095, 94, 348, 9.800000191, 117},
-        {9.399999619, 119, 370, 10.39999962, 88},
-        {11.19999981, 153, 648, 9.899999619, 78},
-        {9.100000381, 116, 366, 9.199999809, 102},
-        {10.5, 97, 540, 10.30000019, 95},
-        {11.89999962, 176, 680, 8.899999619, 80},
-        {8.399999619, 75, 345, 9.600000381, 92},
-        {5, 134, 525, 10.30000019, 126},
-        {9.800000191, 161, 870, 10.39999962, 108},
-        {9.800000191, 111, 669, 9.699999809, 77},
-        {10.80000019, 114, 452, 9.600000381, 60},
-        {10.10000038, 142, 430, 10.69999981, 71},
-        {10.89999962, 238, 822, 10.30000019, 86},
-        {9.199999809, 78, 190, 10.69999981, 93},
-        {8.300000191, 196, 867, 9.600000381, 106},
-        {7.300000191, 125, 969, 10.5, 162},
-        {9.399999619, 82, 499, 7.699999809, 95},
-        {9.399999619, 125, 925, 10.19999981, 91},
-        {9.800000191, 129, 353, 9.899999619, 52},
-        {3.599999905, 84, 288, 8.399999619, 110},
-        {8.399999619, 183, 718, 10.39999962, 69},
-        {10.80000019, 119, 540, 9.199999809, 57},
-        {10.10000038, 180, 668, 13, 106},
-        {9, 82, 347, 8.800000191, 40},
-        {10, 71, 345, 9.199999809, 50},
-        {11.30000019, 118, 463, 7.800000191, 35},
-        {11.30000019, 121, 728, 8.199999809, 86},
-        {12.80000019, 68, 383, 7.400000095, 57},
-        {10, 112, 316, 10.39999962, 57},
-        {6.699999809, 109, 388, 8.899999619, 94}
-    };
-
     /** Run example. */
-    public static void main(String[] args) throws InterruptedException {
+    public static void main(String[] args) throws FileNotFoundException {
         System.out.println();
         System.out.println(">>> Linear regression model over sparse distributed matrix API usage example started.");
         // Start ignite grid.
         try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
             System.out.println(">>> Ignite grid started.");
 
-            IgniteCache<Integer, double[]> dataCache = new TestCache(ignite).fillCacheWith(data);
+            IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
+                .fillCacheWith(MLSandboxDatasets.MORTALITY_DATA);
 
             System.out.println(">>> Create new linear regression trainer object.");
             LinearRegressionSGDTrainer<?> trainer = new LinearRegressionSGDTrainer<>(new UpdatesStrategy<>(
@@ -127,8 +71,8 @@ public class LinearRegressionSGDTrainerExample {
             LinearRegressionModel mdl = trainer.fit(
                 ignite,
                 dataCache,
-                (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
-                (k, v) -> v[0]
+                (k, v) -> v.copyOfRange(1, v.size()),
+                (k, v) -> v.get(0)
             );
 
             System.out.println(">>> Linear regression model: " + mdl);
@@ -137,13 +81,13 @@ public class LinearRegressionSGDTrainerExample {
             System.out.println(">>> | Prediction\t| Ground Truth\t|");
             System.out.println(">>> ---------------------------------");
 
-            try (QueryCursor<Cache.Entry<Integer, double[]>> observations = dataCache.query(new ScanQuery<>())) {
-                for (Cache.Entry<Integer, double[]> observation : observations) {
-                    double[] val = observation.getValue();
-                    double[] inputs = Arrays.copyOfRange(val, 1, val.length);
-                    double groundTruth = val[0];
+            try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(new ScanQuery<>())) {
+                for (Cache.Entry<Integer, Vector> observation : observations) {
+                    Vector val = observation.getValue();
+                    Vector inputs = val.copyOfRange(1, val.size());
+                    double groundTruth = val.get(0);
 
-                    double prediction = mdl.apply(new DenseVector(inputs));
+                    double prediction = mdl.apply(inputs);
 
                     System.out.printf(">>> | %.4f\t\t| %.4f\t\t|\n", prediction, groundTruth);
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/binary/LogisticRegressionSGDTrainerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/binary/LogisticRegressionSGDTrainerExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/binary/LogisticRegressionSGDTrainerExample.java
index 15330d0..52ee330 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/binary/LogisticRegressionSGDTrainerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/binary/LogisticRegressionSGDTrainerExample.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.examples.ml.regression.logistic.binary;
 
+import java.io.FileNotFoundException;
 import java.util.Arrays;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
@@ -24,9 +25,9 @@ import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.TestCache;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
-import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
+import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
+import org.apache.ignite.examples.ml.util.SandboxMLCache;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.nn.UpdatesStrategy;
 import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDParameterUpdate;
 import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDUpdateCalculator;
@@ -50,14 +51,15 @@ import org.apache.ignite.ml.regressions.logistic.binomial.LogisticRegressionSGDT
  */
 public class LogisticRegressionSGDTrainerExample {
     /** Run example. */
-    public static void main(String[] args) throws InterruptedException {
+    public static void main(String[] args) throws FileNotFoundException {
         System.out.println();
         System.out.println(">>> Logistic regression model over partitioned dataset usage example started.");
         // Start ignite grid.
         try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
             System.out.println(">>> Ignite grid started.");
 
-            IgniteCache<Integer, double[]> dataCache = new TestCache(ignite).fillCacheWith(data);
+            IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
+                .fillCacheWith(MLSandboxDatasets.TWO_CLASSED_IRIS);
 
             System.out.println(">>> Create new logistic regression trainer object.");
             LogisticRegressionSGDTrainer<?> trainer = new LogisticRegressionSGDTrainer<>()
@@ -75,8 +77,8 @@ public class LogisticRegressionSGDTrainerExample {
             LogisticRegressionModel mdl = trainer.fit(
                 ignite,
                 dataCache,
-                (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
-                (k, v) -> v[0]
+                (k, v) -> v.copyOfRange(1, v.size()),
+                (k, v) -> v.get(0)
             );
 
             System.out.println(">>> Logistic regression model: " + mdl);
@@ -87,13 +89,13 @@ public class LogisticRegressionSGDTrainerExample {
             // Build confusion matrix. See https://en.wikipedia.org/wiki/Confusion_matrix
             int[][] confusionMtx = {{0, 0}, {0, 0}};
 
-            try (QueryCursor<Cache.Entry<Integer, double[]>> observations = dataCache.query(new ScanQuery<>())) {
-                for (Cache.Entry<Integer, double[]> observation : observations) {
-                    double[] val = observation.getValue();
-                    double[] inputs = Arrays.copyOfRange(val, 1, val.length);
-                    double groundTruth = val[0];
+            try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(new ScanQuery<>())) {
+                for (Cache.Entry<Integer, Vector> observation : observations) {
+                    Vector val = observation.getValue();
+                    Vector inputs = val.copyOfRange(1, val.size());
+                    double groundTruth = val.get(0);
 
-                    double prediction = mdl.apply(new DenseVector(inputs));
+                    double prediction = mdl.apply(inputs);
 
                     totalAmount++;
                     if(groundTruth != prediction)
@@ -119,108 +121,4 @@ public class LogisticRegressionSGDTrainerExample {
             System.out.println(">>> Logistic regression model over partitioned dataset usage example completed.");
         }
     }
-
-    /** The 1st and 2nd classes from the Iris dataset. */
-    private static final double[][] data = {
-        {0, 5.1, 3.5, 1.4, 0.2},
-        {0, 4.9, 3, 1.4, 0.2},
-        {0, 4.7, 3.2, 1.3, 0.2},
-        {0, 4.6, 3.1, 1.5, 0.2},
-        {0, 5, 3.6, 1.4, 0.2},
-        {0, 5.4, 3.9, 1.7, 0.4},
-        {0, 4.6, 3.4, 1.4, 0.3},
-        {0, 5, 3.4, 1.5, 0.2},
-        {0, 4.4, 2.9, 1.4, 0.2},
-        {0, 4.9, 3.1, 1.5, 0.1},
-        {0, 5.4, 3.7, 1.5, 0.2},
-        {0, 4.8, 3.4, 1.6, 0.2},
-        {0, 4.8, 3, 1.4, 0.1},
-        {0, 4.3, 3, 1.1, 0.1},
-        {0, 5.8, 4, 1.2, 0.2},
-        {0, 5.7, 4.4, 1.5, 0.4},
-        {0, 5.4, 3.9, 1.3, 0.4},
-        {0, 5.1, 3.5, 1.4, 0.3},
-        {0, 5.7, 3.8, 1.7, 0.3},
-        {0, 5.1, 3.8, 1.5, 0.3},
-        {0, 5.4, 3.4, 1.7, 0.2},
-        {0, 5.1, 3.7, 1.5, 0.4},
-        {0, 4.6, 3.6, 1, 0.2},
-        {0, 5.1, 3.3, 1.7, 0.5},
-        {0, 4.8, 3.4, 1.9, 0.2},
-        {0, 5, 3, 1.6, 0.2},
-        {0, 5, 3.4, 1.6, 0.4},
-        {0, 5.2, 3.5, 1.5, 0.2},
-        {0, 5.2, 3.4, 1.4, 0.2},
-        {0, 4.7, 3.2, 1.6, 0.2},
-        {0, 4.8, 3.1, 1.6, 0.2},
-        {0, 5.4, 3.4, 1.5, 0.4},
-        {0, 5.2, 4.1, 1.5, 0.1},
-        {0, 5.5, 4.2, 1.4, 0.2},
-        {0, 4.9, 3.1, 1.5, 0.1},
-        {0, 5, 3.2, 1.2, 0.2},
-        {0, 5.5, 3.5, 1.3, 0.2},
-        {0, 4.9, 3.1, 1.5, 0.1},
-        {0, 4.4, 3, 1.3, 0.2},
-        {0, 5.1, 3.4, 1.5, 0.2},
-        {0, 5, 3.5, 1.3, 0.3},
-        {0, 4.5, 2.3, 1.3, 0.3},
-        {0, 4.4, 3.2, 1.3, 0.2},
-        {0, 5, 3.5, 1.6, 0.6},
-        {0, 5.1, 3.8, 1.9, 0.4},
-        {0, 4.8, 3, 1.4, 0.3},
-        {0, 5.1, 3.8, 1.6, 0.2},
-        {0, 4.6, 3.2, 1.4, 0.2},
-        {0, 5.3, 3.7, 1.5, 0.2},
-        {0, 5, 3.3, 1.4, 0.2},
-        {1, 7, 3.2, 4.7, 1.4},
-        {1, 6.4, 3.2, 4.5, 1.5},
-        {1, 6.9, 3.1, 4.9, 1.5},
-        {1, 5.5, 2.3, 4, 1.3},
-        {1, 6.5, 2.8, 4.6, 1.5},
-        {1, 5.7, 2.8, 4.5, 1.3},
-        {1, 6.3, 3.3, 4.7, 1.6},
-        {1, 4.9, 2.4, 3.3, 1},
-        {1, 6.6, 2.9, 4.6, 1.3},
-        {1, 5.2, 2.7, 3.9, 1.4},
-        {1, 5, 2, 3.5, 1},
-        {1, 5.9, 3, 4.2, 1.5},
-        {1, 6, 2.2, 4, 1},
-        {1, 6.1, 2.9, 4.7, 1.4},
-        {1, 5.6, 2.9, 3.6, 1.3},
-        {1, 6.7, 3.1, 4.4, 1.4},
-        {1, 5.6, 3, 4.5, 1.5},
-        {1, 5.8, 2.7, 4.1, 1},
-        {1, 6.2, 2.2, 4.5, 1.5},
-        {1, 5.6, 2.5, 3.9, 1.1},
-        {1, 5.9, 3.2, 4.8, 1.8},
-        {1, 6.1, 2.8, 4, 1.3},
-        {1, 6.3, 2.5, 4.9, 1.5},
-        {1, 6.1, 2.8, 4.7, 1.2},
-        {1, 6.4, 2.9, 4.3, 1.3},
-        {1, 6.6, 3, 4.4, 1.4},
-        {1, 6.8, 2.8, 4.8, 1.4},
-        {1, 6.7, 3, 5, 1.7},
-        {1, 6, 2.9, 4.5, 1.5},
-        {1, 5.7, 2.6, 3.5, 1},
-        {1, 5.5, 2.4, 3.8, 1.1},
-        {1, 5.5, 2.4, 3.7, 1},
-        {1, 5.8, 2.7, 3.9, 1.2},
-        {1, 6, 2.7, 5.1, 1.6},
-        {1, 5.4, 3, 4.5, 1.5},
-        {1, 6, 3.4, 4.5, 1.6},
-        {1, 6.7, 3.1, 4.7, 1.5},
-        {1, 6.3, 2.3, 4.4, 1.3},
-        {1, 5.6, 3, 4.1, 1.3},
-        {1, 5.5, 2.5, 4, 1.3},
-        {1, 5.5, 2.6, 4.4, 1.2},
-        {1, 6.1, 3, 4.6, 1.4},
-        {1, 5.8, 2.6, 4, 1.2},
-        {1, 5, 2.3, 3.3, 1},
-        {1, 5.6, 2.7, 4.2, 1.3},
-        {1, 5.7, 3, 4.2, 1.2},
-        {1, 5.7, 2.9, 4.2, 1.3},
-        {1, 6.2, 2.9, 4.3, 1.3},
-        {1, 5.1, 2.5, 3, 1.1},
-        {1, 5.7, 2.8, 4.1, 1.3},
-    };
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/multiclass/LogRegressionMultiClassClassificationExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/multiclass/LogRegressionMultiClassClassificationExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/multiclass/LogRegressionMultiClassClassificationExample.java
index ff2761a..962fdac 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/multiclass/LogRegressionMultiClassClassificationExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/regression/logistic/multiclass/LogRegressionMultiClassClassificationExample.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.examples.ml.regression.logistic.multiclass;
 
+import java.io.FileNotFoundException;
 import java.util.Arrays;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
@@ -24,11 +25,10 @@ import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.TestCache;
+import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
+import org.apache.ignite.examples.ml.util.SandboxMLCache;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.math.primitives.vector.Vector;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
-import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
 import org.apache.ignite.ml.nn.UpdatesStrategy;
 import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDParameterUpdate;
 import org.apache.ignite.ml.optimization.updatecalculators.SimpleGDUpdateCalculator;
@@ -54,14 +54,15 @@ import org.apache.ignite.ml.regressions.logistic.multiclass.LogRegressionMultiCl
  */
 public class LogRegressionMultiClassClassificationExample {
     /** Run example. */
-    public static void main(String[] args) throws InterruptedException {
+    public static void main(String[] args) throws FileNotFoundException {
         System.out.println();
         System.out.println(">>> Logistic Regression Multi-class classification model over cached dataset usage example started.");
         // Start ignite grid.
         try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
             System.out.println(">>> Ignite grid started.");
 
-            IgniteCache<Integer, Vector> dataCache = new TestCache(ignite).getVectors(data);
+            IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
+                .fillCacheWith(MLSandboxDatasets.GLASS_IDENTIFICATION);
 
             LogRegressionMultiClassTrainer<?> trainer = new LogRegressionMultiClassTrainer<>()
                 .withUpdatesStgy(new UpdatesStrategy<>(
@@ -77,10 +78,7 @@ public class LogRegressionMultiClassClassificationExample {
             LogRegressionMultiClassModel mdl = trainer.fit(
                 ignite,
                 dataCache,
-                (k, v) -> {
-                    double[] arr = v.asArray();
-                    return VectorUtils.of(Arrays.copyOfRange(arr, 1, arr.length));
-                },
+                (k, v) -> v.copyOfRange(1, v.size()),
                 (k, v) -> v.get(0)
             );
 
@@ -92,10 +90,7 @@ public class LogRegressionMultiClassClassificationExample {
             IgniteBiFunction<Integer, Vector, Vector> preprocessor = normalizationTrainer.fit(
                 ignite,
                 dataCache,
-                (k, v) -> {
-                    double[] arr = v.asArray();
-                    return VectorUtils.of(Arrays.copyOfRange(arr, 1, arr.length));
-                }
+                (k, v) -> v.copyOfRange(1, v.size())
             );
 
             LogRegressionMultiClassModel mdlWithNormalization = trainer.fit(
@@ -105,7 +100,7 @@ public class LogRegressionMultiClassClassificationExample {
                 (k, v) -> v.get(0)
             );
 
-            System.out.println(">>> Logistic Regression Multi-class model with minmaxscaling");
+            System.out.println(">>> Logistic Regression Multi-class model with normalization");
             System.out.println(mdlWithNormalization.toString());
 
             System.out.println(">>> ----------------------------------------------------------------");
@@ -122,12 +117,12 @@ public class LogRegressionMultiClassClassificationExample {
 
             try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(new ScanQuery<>())) {
                 for (Cache.Entry<Integer, Vector> observation : observations) {
-                    double[] val = observation.getValue().asArray();
-                    double[] inputs = Arrays.copyOfRange(val, 1, val.length);
-                    double groundTruth = val[0];
+                    Vector val = observation.getValue();
+                    Vector inputs = val.copyOfRange(1, val.size());
+                    double groundTruth = val.get(0);
 
-                    double prediction = mdl.apply(new DenseVector(inputs));
-                    double predictionWithNormalization = mdlWithNormalization.apply(new DenseVector(inputs));
+                    double prediction = mdl.apply(inputs);
+                    double predictionWithNormalization = mdlWithNormalization.apply(inputs);
 
                     totalAmount++;
 
@@ -140,7 +135,7 @@ public class LogRegressionMultiClassClassificationExample {
 
                     confusionMtx[idx1][idx2]++;
 
-                    // Collect data for model with minmaxscaling
+                    // Collect data for model with normalization
                     if(groundTruth != predictionWithNormalization)
                         amountOfErrorsWithNormalization++;
 
@@ -166,127 +161,4 @@ public class LogRegressionMultiClassClassificationExample {
             }
         }
     }
-
-    /** The preprocessed Glass dataset from the Machine Learning Repository https://archive.ics.uci.edu/ml/datasets/Glass+Identification
-     *  There are 3 classes with labels: 1 {building_windows_float_processed}, 3 {vehicle_windows_float_processed}, 7 {headlamps}.
-     *  Feature names: 'Na-Sodium', 'Mg-Magnesium', 'Al-Aluminum', 'Ba-Barium', 'Fe-Iron'.
-     */
-    private static final double[][] data = {
-        {1, 1.52101, 4.49, 1.10, 0.00, 0.00},
-        {1, 1.51761, 3.60, 1.36, 0.00, 0.00},
-        {1, 1.51618, 3.55, 1.54, 0.00, 0.00},
-        {1, 1.51766, 3.69, 1.29, 0.00, 0.00},
-        {1, 1.51742, 3.62, 1.24, 0.00, 0.00},
-        {1, 1.51596, 3.61, 1.62, 0.00, 0.26},
-        {1, 1.51743, 3.60, 1.14, 0.00, 0.00},
-        {1, 1.51756, 3.61, 1.05, 0.00, 0.00},
-        {1, 1.51918, 3.58, 1.37, 0.00, 0.00},
-        {1, 1.51755, 3.60, 1.36, 0.00, 0.11},
-        {1, 1.51571, 3.46, 1.56, 0.00, 0.24},
-        {1, 1.51763, 3.66, 1.27, 0.00, 0.00},
-        {1, 1.51589, 3.43, 1.40, 0.00, 0.24},
-        {1, 1.51748, 3.56, 1.27, 0.00, 0.17},
-        {1, 1.51763, 3.59, 1.31, 0.00, 0.00},
-        {1, 1.51761, 3.54, 1.23, 0.00, 0.00},
-        {1, 1.51784, 3.67, 1.16, 0.00, 0.00},
-        {1, 1.52196, 3.85, 0.89, 0.00, 0.00},
-        {1, 1.51911, 3.73, 1.18, 0.00, 0.00},
-        {1, 1.51735, 3.54, 1.69, 0.00, 0.07},
-        {1, 1.51750, 3.55, 1.49, 0.00, 0.19},
-        {1, 1.51966, 3.75, 0.29, 0.00, 0.00},
-        {1, 1.51736, 3.62, 1.29, 0.00, 0.00},
-        {1, 1.51751, 3.57, 1.35, 0.00, 0.00},
-        {1, 1.51720, 3.50, 1.15, 0.00, 0.00},
-        {1, 1.51764, 3.54, 1.21, 0.00, 0.00},
-        {1, 1.51793, 3.48, 1.41, 0.00, 0.00},
-        {1, 1.51721, 3.48, 1.33, 0.00, 0.00},
-        {1, 1.51768, 3.52, 1.43, 0.00, 0.00},
-        {1, 1.51784, 3.49, 1.28, 0.00, 0.00},
-        {1, 1.51768, 3.56, 1.30, 0.00, 0.14},
-        {1, 1.51747, 3.50, 1.14, 0.00, 0.00},
-        {1, 1.51775, 3.48, 1.23, 0.09, 0.22},
-        {1, 1.51753, 3.47, 1.38, 0.00, 0.06},
-        {1, 1.51783, 3.54, 1.34, 0.00, 0.00},
-        {1, 1.51567, 3.45, 1.21, 0.00, 0.00},
-        {1, 1.51909, 3.53, 1.32, 0.11, 0.00},
-        {1, 1.51797, 3.48, 1.35, 0.00, 0.00},
-        {1, 1.52213, 3.82, 0.47, 0.00, 0.00},
-        {1, 1.52213, 3.82, 0.47, 0.00, 0.00},
-        {1, 1.51793, 3.50, 1.12, 0.00, 0.00},
-        {1, 1.51755, 3.42, 1.20, 0.00, 0.00},
-        {1, 1.51779, 3.39, 1.33, 0.00, 0.00},
-        {1, 1.52210, 3.84, 0.72, 0.00, 0.00},
-        {1, 1.51786, 3.43, 1.19, 0.00, 0.30},
-        {1, 1.51900, 3.48, 1.35, 0.00, 0.00},
-        {1, 1.51869, 3.37, 1.18, 0.00, 0.16},
-        {1, 1.52667, 3.70, 0.71, 0.00, 0.10},
-        {1, 1.52223, 3.77, 0.79, 0.00, 0.00},
-        {1, 1.51898, 3.35, 1.23, 0.00, 0.00},
-        {1, 1.52320, 3.72, 0.51, 0.00, 0.16},
-        {1, 1.51926, 3.33, 1.28, 0.00, 0.11},
-        {1, 1.51808, 2.87, 1.19, 0.00, 0.00},
-        {1, 1.51837, 2.84, 1.28, 0.00, 0.00},
-        {1, 1.51778, 2.81, 1.29, 0.00, 0.09},
-        {1, 1.51769, 2.71, 1.29, 0.00, 0.24},
-        {1, 1.51215, 3.47, 1.12, 0.00, 0.31},
-        {1, 1.51824, 3.48, 1.29, 0.00, 0.00},
-        {1, 1.51754, 3.74, 1.17, 0.00, 0.00},
-        {1, 1.51754, 3.66, 1.19, 0.00, 0.11},
-        {1, 1.51905, 3.62, 1.11, 0.00, 0.00},
-        {1, 1.51977, 3.58, 1.32, 0.69, 0.00},
-        {1, 1.52172, 3.86, 0.88, 0.00, 0.11},
-        {1, 1.52227, 3.81, 0.78, 0.00, 0.00},
-        {1, 1.52172, 3.74, 0.90, 0.00, 0.07},
-        {1, 1.52099, 3.59, 1.12, 0.00, 0.00},
-        {1, 1.52152, 3.65, 0.87, 0.00, 0.17},
-        {1, 1.52152, 3.65, 0.87, 0.00, 0.17},
-        {1, 1.52152, 3.58, 0.90, 0.00, 0.16},
-        {1, 1.52300, 3.58, 0.82, 0.00, 0.03},
-        {3, 1.51769, 3.66, 1.11, 0.00, 0.00},
-        {3, 1.51610, 3.53, 1.34, 0.00, 0.00},
-        {3, 1.51670, 3.57, 1.38, 0.00, 0.10},
-        {3, 1.51643, 3.52, 1.35, 0.00, 0.00},
-        {3, 1.51665, 3.45, 1.76, 0.00, 0.17},
-        {3, 1.52127, 3.90, 0.83, 0.00, 0.00},
-        {3, 1.51779, 3.65, 0.65, 0.00, 0.00},
-        {3, 1.51610, 3.40, 1.22, 0.00, 0.00},
-        {3, 1.51694, 3.58, 1.31, 0.00, 0.00},
-        {3, 1.51646, 3.40, 1.26, 0.00, 0.00},
-        {3, 1.51655, 3.39, 1.28, 0.00, 0.00},
-        {3, 1.52121, 3.76, 0.58, 0.00, 0.00},
-        {3, 1.51776, 3.41, 1.52, 0.00, 0.00},
-        {3, 1.51796, 3.36, 1.63, 0.00, 0.09},
-        {3, 1.51832, 3.34, 1.54, 0.00, 0.00},
-        {3, 1.51934, 3.54, 0.75, 0.15, 0.24},
-        {3, 1.52211, 3.78, 0.91, 0.00, 0.37},
-        {7, 1.51131, 3.20, 1.81, 1.19, 0.00},
-        {7, 1.51838, 3.26, 2.22, 1.63, 0.00},
-        {7, 1.52315, 3.34, 1.23, 0.00, 0.00},
-        {7, 1.52247, 2.20, 2.06, 0.00, 0.00},
-        {7, 1.52365, 1.83, 1.31, 1.68, 0.00},
-        {7, 1.51613, 1.78, 1.79, 0.76, 0.00},
-        {7, 1.51602, 0.00, 2.38, 0.64, 0.09},
-        {7, 1.51623, 0.00, 2.79, 0.40, 0.09},
-        {7, 1.51719, 0.00, 2.00, 1.59, 0.08},
-        {7, 1.51683, 0.00, 1.98, 1.57, 0.07},
-        {7, 1.51545, 0.00, 2.68, 0.61, 0.05},
-        {7, 1.51556, 0.00, 2.54, 0.81, 0.01},
-        {7, 1.51727, 0.00, 2.34, 0.66, 0.00},
-        {7, 1.51531, 0.00, 2.66, 0.64, 0.00},
-        {7, 1.51609, 0.00, 2.51, 0.53, 0.00},
-        {7, 1.51508, 0.00, 2.25, 0.63, 0.00},
-        {7, 1.51653, 0.00, 1.19, 0.00, 0.00},
-        {7, 1.51514, 0.00, 2.42, 0.56, 0.00},
-        {7, 1.51658, 0.00, 1.99, 1.71, 0.00},
-        {7, 1.51617, 0.00, 2.27, 0.67, 0.00},
-        {7, 1.51732, 0.00, 1.80, 1.55, 0.00},
-        {7, 1.51645, 0.00, 1.87, 1.38, 0.00},
-        {7, 1.51831, 0.00, 1.82, 2.88, 0.00},
-        {7, 1.51640, 0.00, 2.74, 0.54, 0.00},
-        {7, 1.51623, 0.00, 2.88, 1.06, 0.00},
-        {7, 1.51685, 0.00, 1.99, 1.59, 0.00},
-        {7, 1.52065, 0.00, 2.02, 1.64, 0.00},
-        {7, 1.51651, 0.00, 1.94, 1.57, 0.00},
-        {7, 1.51711, 0.00, 2.08, 1.67, 0.00},
-    };
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/selection/cv/CrossValidationExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/selection/cv/CrossValidationExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/selection/cv/CrossValidationExample.java
index 25ce156..552bcd2 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/selection/cv/CrossValidationExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/selection/cv/CrossValidationExample.java
@@ -45,7 +45,7 @@ public class CrossValidationExample {
      *
      * @param args Command line arguments, none required.
      */
-    public static void main(String... args) throws InterruptedException {
+    public static void main(String... args) {
         System.out.println(">>> Cross validation score calculator example started.");
 
         // Start ignite grid.

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/selection/split/TrainTestDatasetSplitterExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/selection/split/TrainTestDatasetSplitterExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/selection/split/TrainTestDatasetSplitterExample.java
index 8b104f5..4bfd993 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/selection/split/TrainTestDatasetSplitterExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/selection/split/TrainTestDatasetSplitterExample.java
@@ -17,16 +17,16 @@
 
 package org.apache.ignite.examples.ml.selection.split;
 
-import java.util.Arrays;
+import java.io.FileNotFoundException;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.TestCache;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
-import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
+import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
+import org.apache.ignite.examples.ml.util.SandboxMLCache;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.regressions.linear.LinearRegressionLSQRTrainer;
 import org.apache.ignite.ml.regressions.linear.LinearRegressionModel;
 import org.apache.ignite.ml.selection.split.TrainTestDatasetSplitter;
@@ -47,78 +47,22 @@ import org.apache.ignite.ml.selection.split.TrainTestSplit;
  * further.</p>
  */
 public class TrainTestDatasetSplitterExample {
-    /** */
-    private static final double[][] data = {
-        {8, 78, 284, 9.100000381, 109},
-        {9.300000191, 68, 433, 8.699999809, 144},
-        {7.5, 70, 739, 7.199999809, 113},
-        {8.899999619, 96, 1792, 8.899999619, 97},
-        {10.19999981, 74, 477, 8.300000191, 206},
-        {8.300000191, 111, 362, 10.89999962, 124},
-        {8.800000191, 77, 671, 10, 152},
-        {8.800000191, 168, 636, 9.100000381, 162},
-        {10.69999981, 82, 329, 8.699999809, 150},
-        {11.69999981, 89, 634, 7.599999905, 134},
-        {8.5, 149, 631, 10.80000019, 292},
-        {8.300000191, 60, 257, 9.5, 108},
-        {8.199999809, 96, 284, 8.800000191, 111},
-        {7.900000095, 83, 603, 9.5, 182},
-        {10.30000019, 130, 686, 8.699999809, 129},
-        {7.400000095, 145, 345, 11.19999981, 158},
-        {9.600000381, 112, 1357, 9.699999809, 186},
-        {9.300000191, 131, 544, 9.600000381, 177},
-        {10.60000038, 80, 205, 9.100000381, 127},
-        {9.699999809, 130, 1264, 9.199999809, 179},
-        {11.60000038, 140, 688, 8.300000191, 80},
-        {8.100000381, 154, 354, 8.399999619, 103},
-        {9.800000191, 118, 1632, 9.399999619, 101},
-        {7.400000095, 94, 348, 9.800000191, 117},
-        {9.399999619, 119, 370, 10.39999962, 88},
-        {11.19999981, 153, 648, 9.899999619, 78},
-        {9.100000381, 116, 366, 9.199999809, 102},
-        {10.5, 97, 540, 10.30000019, 95},
-        {11.89999962, 176, 680, 8.899999619, 80},
-        {8.399999619, 75, 345, 9.600000381, 92},
-        {5, 134, 525, 10.30000019, 126},
-        {9.800000191, 161, 870, 10.39999962, 108},
-        {9.800000191, 111, 669, 9.699999809, 77},
-        {10.80000019, 114, 452, 9.600000381, 60},
-        {10.10000038, 142, 430, 10.69999981, 71},
-        {10.89999962, 238, 822, 10.30000019, 86},
-        {9.199999809, 78, 190, 10.69999981, 93},
-        {8.300000191, 196, 867, 9.600000381, 106},
-        {7.300000191, 125, 969, 10.5, 162},
-        {9.399999619, 82, 499, 7.699999809, 95},
-        {9.399999619, 125, 925, 10.19999981, 91},
-        {9.800000191, 129, 353, 9.899999619, 52},
-        {3.599999905, 84, 288, 8.399999619, 110},
-        {8.399999619, 183, 718, 10.39999962, 69},
-        {10.80000019, 119, 540, 9.199999809, 57},
-        {10.10000038, 180, 668, 13, 106},
-        {9, 82, 347, 8.800000191, 40},
-        {10, 71, 345, 9.199999809, 50},
-        {11.30000019, 118, 463, 7.800000191, 35},
-        {11.30000019, 121, 728, 8.199999809, 86},
-        {12.80000019, 68, 383, 7.400000095, 57},
-        {10, 112, 316, 10.39999962, 57},
-        {6.699999809, 109, 388, 8.899999619, 94}
-    };
-
     /** Run example. */
-    public static void main(String[] args) throws InterruptedException {
+    public static void main(String[] args) throws FileNotFoundException {
         System.out.println();
         System.out.println(">>> Linear regression model over cache based dataset usage example started.");
         // Start ignite grid.
         try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
             System.out.println(">>> Ignite grid started.");
 
-            IgniteCache<Integer, double[]> dataCache = new TestCache(ignite).fillCacheWith(data);
+            IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
+                .fillCacheWith(MLSandboxDatasets.MORTALITY_DATA);
 
             System.out.println(">>> Create new linear regression trainer object.");
             LinearRegressionLSQRTrainer trainer = new LinearRegressionLSQRTrainer();
 
             System.out.println(">>> Create new training dataset splitter object.");
-            TrainTestSplit<Integer, double[]> split = new TrainTestDatasetSplitter<Integer, double[]>()
+            TrainTestSplit<Integer, Vector> split = new TrainTestDatasetSplitter<Integer, Vector>()
                 .split(0.75);
 
             System.out.println(">>> Perform the training to get the model.");
@@ -126,8 +70,8 @@ public class TrainTestDatasetSplitterExample {
                 ignite,
                 dataCache,
                 split.getTrainFilter(),
-                (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
-                (k, v) -> v[0]
+                (k, v) -> v.copyOfRange(1, v.size()),
+                (k, v) -> v.get(0)
             );
 
             System.out.println(">>> Linear regression model: " + mdl);
@@ -136,16 +80,16 @@ public class TrainTestDatasetSplitterExample {
             System.out.println(">>> | Prediction\t| Ground Truth\t|");
             System.out.println(">>> ---------------------------------");
 
-            ScanQuery<Integer, double[]> qry = new ScanQuery<>();
+            ScanQuery<Integer, Vector> qry = new ScanQuery<>();
             qry.setFilter(split.getTestFilter());
 
-            try (QueryCursor<Cache.Entry<Integer, double[]>> observations = dataCache.query(qry)) {
-                for (Cache.Entry<Integer, double[]> observation : observations) {
-                    double[] val = observation.getValue();
-                    double[] inputs = Arrays.copyOfRange(val, 1, val.length);
-                    double groundTruth = val[0];
+            try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(qry)) {
+                for (Cache.Entry<Integer, Vector> observation : observations) {
+                    Vector val = observation.getValue();
+                    Vector inputs = val.copyOfRange(1, val.size());
+                    double groundTruth = val.get(0);
 
-                    double prediction = mdl.apply(new DenseVector(inputs));
+                    double prediction = mdl.apply(inputs);
 
                     System.out.printf(">>> | %.4f\t\t| %.4f\t\t|\n", prediction, groundTruth);
                 }


[26/28] ignite git commit: IGNITE-10024: MVCC: Fixed stack overflow due to incorrect afgument in GridTimeoutProcessor callback. This closes #5192.

Posted by sb...@apache.org.
IGNITE-10024: MVCC: Fixed stack overflow due to incorrect afgument in GridTimeoutProcessor callback. This closes #5192.


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

Branch: refs/heads/ignite-627
Commit: d6154e143f7b7ee1416bb6f659176071a8d47a7b
Parents: e0cbaec
Author: ipavlukhin <vo...@gmail.com>
Authored: Mon Oct 29 20:30:48 2018 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Mon Oct 29 20:30:48 2018 +0300

----------------------------------------------------------------------
 .../cache/distributed/near/GridNearTxAbstractEnlistFuture.java | 4 ++--
 .../internal/processors/timeout/GridTimeoutProcessor.java      | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d6154e14/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxAbstractEnlistFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxAbstractEnlistFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxAbstractEnlistFuture.java
index 9691936..bd09424 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxAbstractEnlistFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxAbstractEnlistFuture.java
@@ -150,7 +150,7 @@ public abstract class GridNearTxAbstractEnlistFuture<T> extends GridCacheCompoun
         else if (timeout > 0)
             timeoutObj = new LockTimeoutObject();
 
-        while(true) {
+        while (true) {
             IgniteInternalFuture<?> fut = tx.lockFuture();
 
             if (fut == GridDhtTxLocalAdapter.ROLLBACK_FUT) {
@@ -345,7 +345,7 @@ public abstract class GridNearTxAbstractEnlistFuture<T> extends GridCacheCompoun
             }
         }
         finally {
-            if(cctx.topology().holdsLock())
+            if (cctx.topology().holdsLock())
                 cctx.topology().readUnlock();
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/d6154e14/modules/core/src/main/java/org/apache/ignite/internal/processors/timeout/GridTimeoutProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/timeout/GridTimeoutProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/timeout/GridTimeoutProcessor.java
index 405e321..7efcea9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/timeout/GridTimeoutProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/timeout/GridTimeoutProcessor.java
@@ -144,15 +144,15 @@ public class GridTimeoutProcessor extends GridProcessorAdapter {
     /**
      * Wait for a future (listen with timeout).
      * @param fut Future.
-     * @param timeout Timeout millis. -1 means expired timeout, 0 - no timeout.
+     * @param timeout Timeout millis. -1 means expired timeout, 0 means waiting without timeout.
      * @param clo Finish closure. First argument contains error on future or null if no errors,
-     * second is {@code true} if wait timed out.
+     * second is {@code true} if wait timed out or passed timeout argument means expired timeout.
      */
     public void waitAsync(final IgniteInternalFuture<?> fut,
         long timeout,
         IgniteBiInClosure<IgniteCheckedException, Boolean> clo) {
         if (timeout == -1) {
-            clo.apply(null, false);
+            clo.apply(null, true);
 
             return;
         }


[09/28] ignite git commit: IGNITE-8873 Fixed tests - Fixes #5091.

Posted by sb...@apache.org.
IGNITE-8873 Fixed tests - Fixes #5091.

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

Branch: refs/heads/ignite-627
Commit: ad99fbae735307e56ea6c78dcbd88fa1454ecee2
Parents: 11e142d
Author: Aleksei Scherbakov <al...@gmail.com>
Authored: Sat Oct 27 11:45:32 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Sat Oct 27 11:45:32 2018 +0300

----------------------------------------------------------------------
 .../db/IgnitePdsPartitionPreloadTest.java       | 49 +++++++++++++-------
 1 file changed, 33 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ad99fbae/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java
index b9d28ae..0452ad4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java
@@ -388,27 +388,31 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest {
     }
 
     /**
-     * @param testNodeFactory Test node factory.
+     * @param execNodeFactory Test node factory.
      * @param preloadMode Preload mode.
      */
-    private void preloadPartition(Supplier<Ignite> testNodeFactory, PreloadMode preloadMode) throws Exception {
+    private void preloadPartition(Supplier<Ignite> execNodeFactory, PreloadMode preloadMode) throws Exception {
         Ignite crd = startGridsMultiThreaded(GRIDS_CNT);
 
-        int cnt = 0;
+        Ignite testNode = grid(1);
+
+        Object consistentId = testNode.cluster().localNode().consistentId();
 
-        Ignite primary = grid(1);
+        assertEquals(PRIMARY_NODE, testNode.cluster().localNode().consistentId());
 
-        assertEquals(PRIMARY_NODE, primary.cluster().localNode().consistentId());
+        boolean locCacheMode = testNode.cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getCacheMode() == LOCAL;
 
-        Integer key = primaryKey(primary.cache(DEFAULT_CACHE_NAME));
+        Integer key = primaryKey(testNode.cache(DEFAULT_CACHE_NAME));
 
         int preloadPart = crd.affinity(DEFAULT_CACHE_NAME).partition(key);
 
-        try (IgniteDataStreamer<Integer, Integer> streamer = primary.dataStreamer(DEFAULT_CACHE_NAME)) {
+        int cnt = 0;
+
+        try (IgniteDataStreamer<Integer, Integer> streamer = testNode.dataStreamer(DEFAULT_CACHE_NAME)) {
             int k = 0;
 
             while (cnt < ENTRY_CNT) {
-                if (primary.affinity(DEFAULT_CACHE_NAME).partition(k) == preloadPart) {
+                if (testNode.affinity(DEFAULT_CACHE_NAME).partition(k) == preloadPart) {
                     streamer.addData(k, k);
 
                     cnt++;
@@ -424,36 +428,49 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest {
 
         startGridsMultiThreaded(GRIDS_CNT);
 
-        primary = G.allGrids().stream().
+        testNode = G.allGrids().stream().
             filter(ignite -> PRIMARY_NODE.equals(ignite.cluster().localNode().consistentId())).findFirst().get();
 
-        assertEquals(primary, primaryNode(key, DEFAULT_CACHE_NAME));
+        if (!locCacheMode)
+            assertEquals(testNode, primaryNode(key, DEFAULT_CACHE_NAME));
 
-        Ignite testNode = testNodeFactory.get();
+        Ignite execNode = execNodeFactory.get();
 
         switch (preloadMode) {
             case SYNC:
-                testNode.cache(DEFAULT_CACHE_NAME).preloadPartition(preloadPart);
+                execNode.cache(DEFAULT_CACHE_NAME).preloadPartition(preloadPart);
+
+                if (locCacheMode) {
+                    testNode = G.allGrids().stream().filter(ignite ->
+                        ignite.cluster().localNode().consistentId().equals(consistentId)).findFirst().get();
+                }
 
                 break;
             case ASYNC:
-                testNode.cache(DEFAULT_CACHE_NAME).preloadPartitionAsync(preloadPart).get();
+                execNode.cache(DEFAULT_CACHE_NAME).preloadPartitionAsync(preloadPart).get();
+
+                if (locCacheMode) {
+                    testNode = G.allGrids().stream().filter(ignite ->
+                        ignite.cluster().localNode().consistentId().equals(consistentId)).findFirst().get();
+                }
 
                 break;
             case LOCAL:
-                assertTrue(testNode.cache(DEFAULT_CACHE_NAME).localPreloadPartition(preloadPart));
+                assertTrue(execNode.cache(DEFAULT_CACHE_NAME).localPreloadPartition(preloadPart));
+
+                testNode = execNode; // For local preloading testNode == execNode
 
                 break;
         }
 
-        long c0 = primary.dataRegionMetrics(DEFAULT_REGION).getPagesRead();
+        long c0 = testNode.dataRegionMetrics(DEFAULT_REGION).getPagesRead();
 
         // After partition preloading no pages should be read from store.
         List<Cache.Entry<Object, Object>> list = U.arrayList(testNode.cache(DEFAULT_CACHE_NAME).localEntries(), 1000);
 
         assertEquals(ENTRY_CNT, list.size());
 
-        assertEquals("Read pages count must be same", c0, primary.dataRegionMetrics(DEFAULT_REGION).getPagesRead());
+        assertEquals("Read pages count must be same", c0, testNode.dataRegionMetrics(DEFAULT_REGION).getPagesRead());
     }
 
     /** */


[14/28] ignite git commit: IGNITE-9941 Web Console: Added configuration parameter to disable signup and possibility to create user accounts by administrator.

Posted by sb...@apache.org.
IGNITE-9941 Web Console: Added configuration parameter to disable signup and possibility to create user accounts by administrator.


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

Branch: refs/heads/ignite-627
Commit: fe824a0e287f3b3432900357c3b09d939752ead7
Parents: 781d4e7
Author: Ilya Borisov <kl...@gmail.com>
Authored: Mon Oct 29 15:36:46 2018 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Mon Oct 29 15:36:46 2018 +0700

----------------------------------------------------------------------
 modules/web-console/DEVNOTES.txt                |  17 ++
 modules/web-console/assembly/README.txt         |   1 +
 modules/web-console/backend/app/settings.js     |   4 +-
 .../backend/config/settings.json.sample         |   6 +-
 modules/web-console/backend/routes/public.js    |  22 +-
 modules/web-console/backend/services/mails.js   |  24 ++-
 modules/web-console/backend/services/users.js   |  12 +-
 modules/web-console/frontend/app/app.js         |   6 +-
 .../dialog-admin-create-user/component.ts       |  27 +++
 .../dialog-admin-create-user/controller.ts      |  78 +++++++
 .../dialog-admin-create-user/index.ts           |  23 ++
 .../dialog-admin-create-user/state.ts           |  29 +++
 .../dialog-admin-create-user/template.pug       |  37 ++++
 .../app/components/form-signup/component.ts     |  32 +++
 .../app/components/form-signup/controller.ts    |  46 ++++
 .../app/components/form-signup/index.ts         |  41 ++++
 .../app/components/form-signup/style.scss       |  31 +++
 .../app/components/form-signup/template.pug     | 105 +++++++++
 .../input-dialog/input-dialog.service.ts        |  12 +-
 .../input-dialog/input-dialog.tpl.pug           |  14 ++
 .../list-of-registered-users/column-defs.js     |  23 --
 .../list-of-registered-users/controller.js      | 214 ++++++++++---------
 .../list-of-registered-users/template.tpl.pug   |   1 -
 .../app/components/page-admin/controller.ts     |  28 +++
 .../frontend/app/components/page-admin/index.js |  17 +-
 .../app/components/page-signup/component.js     |   2 -
 .../app/components/page-signup/controller.js    |  76 -------
 .../app/components/page-signup/controller.ts    |  66 ++++++
 .../app/components/page-signup/index.js         |   3 +-
 .../app/components/page-signup/style.scss       |  10 -
 .../app/components/page-signup/template.pug     |  94 +-------
 .../app/components/page-signup/types.ts         |  36 ----
 .../frontend/app/modules/user/Auth.service.js   | 100 ---------
 .../frontend/app/modules/user/Auth.service.ts   |  90 ++++++++
 .../frontend/app/primitives/dropdown/index.pug  |   3 +-
 .../app/primitives/form-field/checkbox.pug      |   5 +-
 .../app/primitives/form-field/email.pug         |   7 +-
 .../app/primitives/form-field/password.pug      |  12 +-
 .../app/primitives/form-field/phone.pug         |   5 +-
 .../frontend/app/utils/dialogState.ts           |  56 +++++
 40 files changed, 934 insertions(+), 481 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/modules/web-console/DEVNOTES.txt b/modules/web-console/DEVNOTES.txt
index ba61150..a06608d 100644
--- a/modules/web-console/DEVNOTES.txt
+++ b/modules/web-console/DEVNOTES.txt
@@ -139,3 +139,20 @@ Unit tests are performed with Mocha framework - https://mochajs.org
 To launch tests on your local machine you will need:
 1. In new terminal change directory to 'modules/web-console/backend' folder and execute: "npm install".
 2. To start test environment and tests execute: "npm run test".
+
+
+Web Console settings
+====================
+Web Console backend could be configured with custom parameters.
+
+See "backend/config/settings.json.sample" for list of parameters with example value.
+
+If you need custom parameters, you will need create "backend/config/settings.json" and adjust values.
+
+Web Console settings for Docker
+===============================
+Web Console backend could be configured with custom parameters.
+
+You may pass custom parameters with help of "-e" option.
+
+For example: docker run -e "server_disable_signup=true" -p 9090:80 $IMAGE_ID

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/assembly/README.txt
----------------------------------------------------------------------
diff --git a/modules/web-console/assembly/README.txt b/modules/web-console/assembly/README.txt
index dd32399..f1e114c 100644
--- a/modules/web-console/assembly/README.txt
+++ b/modules/web-console/assembly/README.txt
@@ -47,6 +47,7 @@ All available parameters with defaults:
     HTTPS key:                  --server:key "serve/keys/test.key"
     HTTPS certificate:          --server:cert "serve/keys/test.crt"
     HTTPS passphrase:           --server:keyPassphrase "password"
+    Disable self registration:  --server:disable:signup false
     MongoDB URL:                --mongodb:url mongodb://localhost/console
     Mail service:               --mail:service "gmail"
     Signature text:             --mail:sign "Kind regards, Apache Ignite Team"

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/backend/app/settings.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/settings.js b/modules/web-console/backend/app/settings.js
index 104b66d..1c75041 100644
--- a/modules/web-console/backend/app/settings.js
+++ b/modules/web-console/backend/app/settings.js
@@ -68,7 +68,9 @@ module.exports = {
                     key: fs.readFileSync(nconf.get('server:key')),
                     cert: fs.readFileSync(nconf.get('server:cert')),
                     passphrase: nconf.get('server:keyPassphrase')
-                }
+                },
+                // eslint-disable-next-line eqeqeq
+                disableSignup: nconf.get('server:disable:signup') == 'true'
             },
             mail,
             mongoUrl: nconf.get('mongodb:url') || 'mongodb://127.0.0.1/console',

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/backend/config/settings.json.sample
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/config/settings.json.sample b/modules/web-console/backend/config/settings.json.sample
index aa93e07..4070163 100644
--- a/modules/web-console/backend/config/settings.json.sample
+++ b/modules/web-console/backend/config/settings.json.sample
@@ -5,8 +5,10 @@
         "ssl": false,
         "key": "serve/keys/test.key",
         "cert": "serve/keys/test.crt",
-        "keyPassphrase": "password"
-    },
+        "keyPassphrase": "password",
+        "disable": {
+            "signup": false
+    }    },
     "mongodb": {
         "url": "mongodb://localhost/console"
     },

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/backend/routes/public.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/routes/public.js b/modules/web-console/backend/routes/public.js
index 155b2e9..8aa3b43 100644
--- a/modules/web-console/backend/routes/public.js
+++ b/modules/web-console/backend/routes/public.js
@@ -17,6 +17,7 @@
 
 'use strict';
 
+const _ = require('lodash');
 const express = require('express');
 const passport = require('passport');
 
@@ -49,15 +50,22 @@ module.exports.factory = function(mongo, mailsService, usersService, authService
          * Register new account.
          */
         router.post('/signup', (req, res) => {
-            usersService.create(req.origin(), req.body)
-                .then((user) => new Promise((resolve, reject) => {
-                    req.logIn(user, {}, (err) => {
-                        if (err)
-                            reject(err);
+            const createdByAdmin = _.get(req, 'user.admin', false);
 
-                        resolve(user);
+            usersService.create(req.origin(), req.body, createdByAdmin)
+                .then((user) => {
+                    if (createdByAdmin)
+                        return user;
+
+                    return new Promise((resolve, reject) => {
+                        req.logIn(user, {}, (err) => {
+                            if (err)
+                                reject(err);
+
+                            resolve(user);
+                        });
                     });
-                }))
+                })
                 .then(res.api.ok)
                 .catch(res.api.error);
         });

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/backend/services/mails.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/services/mails.js b/modules/web-console/backend/services/mails.js
index e0737cd..75da128 100644
--- a/modules/web-console/backend/services/mails.js
+++ b/modules/web-console/backend/services/mails.js
@@ -81,17 +81,27 @@ module.exports.factory = (settings) => {
         }
 
         /**
-         * Send email to user for password reset.
-         * @param host
-         * @param user
+         * Send email when user signed up.
+         *
+         * @param host Web Console host.
+         * @param user User that signed up.
+         * @param createdByAdmin Whether user was created by admin.
          */
-        emailUserSignUp(host, user) {
+        emailUserSignUp(host, user, createdByAdmin) {
             const resetLink = `${host}/password/reset?token=${user.resetPasswordToken}`;
 
-            return this.send(user, `Thanks for signing up for ${settings.mail.greeting}.`,
+            const sbj = createdByAdmin
+                ? 'Account was created for'
+                : 'Thanks for signing up for';
+
+            const reason = createdByAdmin
+                ? 'administrator created account for you'
+                : 'you have signed up';
+
+            return this.send(user, `${sbj} ${settings.mail.greeting}.`,
                 `Hello ${user.firstName} ${user.lastName}!<br><br>` +
-                `You are receiving this email because you have signed up to use <a href="${host}">${settings.mail.greeting}</a>.<br><br>` +
-                'If you have not done the sign up and do not know what this email is about, please ignore it.<br>' +
+                `You are receiving this email because ${reason} to use <a href="${host}">${settings.mail.greeting}</a>.<br><br>` +
+                'If you do not know what this email is about, please ignore it.<br>' +
                 'You may reset the password by clicking on the following link, or paste this into your browser:<br><br>' +
                 `<a href="${resetLink}">${resetLink}</a>`);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/backend/services/users.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/services/users.js b/modules/web-console/backend/services/users.js
index 43bceda..79578c5 100644
--- a/modules/web-console/backend/services/users.js
+++ b/modules/web-console/backend/services/users.js
@@ -42,17 +42,21 @@ module.exports.factory = (errors, settings, mongo, spacesService, mailsService,
         /**
          * Save profile information.
          *
-         * @param {String} host - The host
-         * @param {Object} user - The user
+         * @param {String} host - The host.
+         * @param {Object} user - The user.
+         * @param {Object} createdByAdmin - Whether user created by admin.
          * @returns {Promise.<mongo.ObjectId>} that resolves account id of merge operation.
          */
-        static create(host, user) {
+        static create(host, user, createdByAdmin) {
             return mongo.Account.count().exec()
                 .then((cnt) => {
                     user.admin = cnt === 0;
                     user.registered = new Date();
                     user.token = utilsService.randomString(settings.tokenLength);
 
+                    if (settings.server.disableSignup && !user.admin && !createdByAdmin)
+                        throw new errors.ServerErrorException('Sign-up is not allowed. Ask your Web Console administrator to create account for you.');
+
                     return new mongo.Account(user);
                 })
                 .then((created) => {
@@ -74,7 +78,7 @@ module.exports.factory = (errors, settings, mongo, spacesService, mailsService,
                     return registered.save()
                         .then(() => mongo.Space.create({name: 'Personal space', owner: registered._id}))
                         .then(() => {
-                            mailsService.emailUserSignUp(host, registered);
+                            mailsService.emailUserSignUp(host, registered, createdByAdmin);
 
                             return registered;
                         });

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/app.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.js b/modules/web-console/frontend/app/app.js
index c890fa4..47374aa 100644
--- a/modules/web-console/frontend/app/app.js
+++ b/modules/web-console/frontend/app/app.js
@@ -112,6 +112,7 @@ import id8 from './filters/id8.filter';
 
 // Components
 import igniteListOfRegisteredUsers from './components/list-of-registered-users';
+import dialogAdminCreateUser from './components/dialog-admin-create-user';
 import IgniteActivitiesUserDialog from './components/activities-user-dialog';
 import './components/input-dialog';
 import webConsoleHeader from './components/web-console-header';
@@ -156,6 +157,7 @@ import pagePasswordReset from './components/page-password-reset';
 import pageSignup from './components/page-signup';
 import pageSignin from './components/page-signin';
 import pageForgotPassword from './components/page-forgot-password';
+import formSignup from './components/form-signup';
 
 import igniteServices from './services';
 
@@ -245,6 +247,7 @@ export default angular.module('ignite-console', [
     connectedClusters.name,
     connectedClustersDialog.name,
     igniteListOfRegisteredUsers.name,
+    dialogAdminCreateUser.name,
     pageProfile.name,
     pageLanding.name,
     pagePasswordChanged.name,
@@ -260,7 +263,8 @@ export default angular.module('ignite-console', [
     igniteChartSelector.name,
     statusOutput.name,
     progressLine.name,
-    formField.name
+    formField.name,
+    formSignup.name
 ])
 .service('$exceptionHandler', $exceptionHandler)
 // Directives.

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/dialog-admin-create-user/component.ts
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/dialog-admin-create-user/component.ts b/modules/web-console/frontend/app/components/dialog-admin-create-user/component.ts
new file mode 100644
index 0000000..3a60d93
--- /dev/null
+++ b/modules/web-console/frontend/app/components/dialog-admin-create-user/component.ts
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+import template from './template.pug';
+import {DialogAdminCreateUser} from './controller';
+
+export default {
+    template,
+    controller: DialogAdminCreateUser,
+    bindings: {
+        close: '&onHide'
+    }
+};

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/dialog-admin-create-user/controller.ts
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/dialog-admin-create-user/controller.ts b/modules/web-console/frontend/app/components/dialog-admin-create-user/controller.ts
new file mode 100644
index 0000000..e8a29e1
--- /dev/null
+++ b/modules/web-console/frontend/app/components/dialog-admin-create-user/controller.ts
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+import Auth from '../../modules/user/Auth.service';
+import MessagesFactory from '../../services/Messages.service';
+import FormUtilsFactoryFactory from '../../services/FormUtils.service';
+import LoadingServiceFactory from '../../modules/loading/loading.service';
+import {ISignupData} from '../form-signup';
+
+export class DialogAdminCreateUser {
+    close: ng.ICompiledExpression;
+
+    form: ng.IFormController;
+
+    data: ISignupData = {
+        email: null,
+        password: null,
+        firstName: null,
+        lastName: null,
+        company: null,
+        country: null
+    };
+
+    serverError: string | null = null;
+
+    static $inject = ['Auth', 'IgniteMessages', 'IgniteFormUtils', 'IgniteLoading'];
+
+    constructor(
+        private Auth: Auth,
+        private IgniteMessages: ReturnType<typeof MessagesFactory>,
+        private IgniteFormUtils: ReturnType<typeof FormUtilsFactoryFactory>,
+        private loading: ReturnType<typeof LoadingServiceFactory>
+    ) {}
+
+    canSubmitForm(form: DialogAdminCreateUser['form']) {
+        return form.$error.server ? true : !form.$invalid;
+    }
+
+    setServerError(error: DialogAdminCreateUser['serverError']) {
+        this.serverError = error;
+    }
+
+    createUser() {
+        this.IgniteFormUtils.triggerValidation(this.form);
+
+        this.setServerError(null);
+
+        if (!this.canSubmitForm(this.form))
+            return;
+
+        this.loading.start('createUser');
+
+        this.Auth.signup(this.data, false)
+            .then(() => {
+                this.IgniteMessages.showInfo(`User ${this.data.email} created`);
+                this.close({});
+            })
+            .catch((res) => {
+                this.loading.finish('createUser');
+                this.IgniteMessages.showError(null, res.data);
+                this.setServerError(res.data);
+            });
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/dialog-admin-create-user/index.ts
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/dialog-admin-create-user/index.ts b/modules/web-console/frontend/app/components/dialog-admin-create-user/index.ts
new file mode 100644
index 0000000..5a23368
--- /dev/null
+++ b/modules/web-console/frontend/app/components/dialog-admin-create-user/index.ts
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+import component from './component';
+import {registerState} from './state';
+
+export default angular.module('ignite-console.dialog-admin-create-user', [])
+    .run(registerState)
+    .component('dialogAdminCreateUser', component);

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/dialog-admin-create-user/state.ts
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/dialog-admin-create-user/state.ts b/modules/web-console/frontend/app/components/dialog-admin-create-user/state.ts
new file mode 100644
index 0000000..c64238e
--- /dev/null
+++ b/modules/web-console/frontend/app/components/dialog-admin-create-user/state.ts
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {UIRouter} from '@uirouter/angularjs';
+import {dialogState} from '../../utils/dialogState';
+
+registerState.$inject = ['$uiRouter'];
+
+export function registerState(router: UIRouter) {
+    router.stateRegistry.register({
+        ...dialogState('dialog-admin-create-user'),
+        name: 'base.settings.admin.createUser',
+        url: '/create-user'
+    });
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/dialog-admin-create-user/template.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/dialog-admin-create-user/template.pug b/modules/web-console/frontend/app/components/dialog-admin-create-user/template.pug
new file mode 100644
index 0000000..0a9f2b4
--- /dev/null
+++ b/modules/web-console/frontend/app/components/dialog-admin-create-user/template.pug
@@ -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.
+
+.modal-dialog(ng-click='$event.stopPropagation()' )
+    form.modal-content(
+        name='$ctrl.form' novalidate
+        ignite-loading='createUser'
+        ignite-loading-text='Creating user…'
+    )
+        .modal-header
+            h4.modal-title Create User
+
+            button.close(type='button' aria-label='Close' ng-click='$ctrl.close()')
+                svg(ignite-icon="cross")
+        .modal-body
+            form-signup(
+                outer-form='$ctrl.form'
+                ng-model='$ctrl.data'
+                server-error='$ctrl.serverError'
+            )
+        .modal-footer
+            div
+                button.btn-ignite.btn-ignite--link-success(ng-click='$ctrl.close()') Cancel
+                button.btn-ignite.btn-ignite--success(ng-click='$ctrl.createUser()') Create user

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/form-signup/component.ts
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/form-signup/component.ts b/modules/web-console/frontend/app/components/form-signup/component.ts
new file mode 100644
index 0000000..79863db
--- /dev/null
+++ b/modules/web-console/frontend/app/components/form-signup/component.ts
@@ -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.
+ */
+
+import template from './template.pug';
+import './style.scss';
+import {FormSignup} from './controller';
+
+export const component: ng.IComponentOptions = {
+    template,
+    controller: FormSignup,
+    bindings: {
+        outerForm: '<',
+        serverError: '<'
+    },
+    require: {
+        ngModel: 'ngModel'
+    }
+};

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/form-signup/controller.ts
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/form-signup/controller.ts b/modules/web-console/frontend/app/components/form-signup/controller.ts
new file mode 100644
index 0000000..eedf6d0
--- /dev/null
+++ b/modules/web-console/frontend/app/components/form-signup/controller.ts
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+import CountriesService from '../../services/Countries.service';
+import {ISignupFormController} from '.';
+
+export class FormSignup implements ng.IPostLink, ng.IOnDestroy, ng.IOnChanges {
+    static $inject = ['IgniteCountries'];
+
+    constructor(private Countries: ReturnType<typeof CountriesService>) {}
+
+    countries = this.Countries.getAll();
+
+    innerForm: ISignupFormController;
+    outerForm: ng.IFormController;
+    ngModel: ng.INgModelController;
+    serverError: string | null = null;
+
+    $postLink() {
+        this.outerForm.$addControl(this.innerForm);
+        this.innerForm.email.$validators.server = () => !this.serverError;
+    }
+
+    $onDestroy() {
+        this.outerForm.$removeControl(this.innerForm);
+    }
+
+    $onChanges(changes: {serverError: ng.IChangesObject<FormSignup['serverError']>}) {
+        if (changes.serverError && this.innerForm)
+            this.innerForm.email.$validate();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/form-signup/index.ts
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/form-signup/index.ts b/modules/web-console/frontend/app/components/form-signup/index.ts
new file mode 100644
index 0000000..1798aa0
--- /dev/null
+++ b/modules/web-console/frontend/app/components/form-signup/index.ts
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+import {component} from './component';
+
+export default angular.module('ignite-console.form-signup', [])
+    .component('formSignup', component);
+
+export interface ISignupData {
+    email: string,
+    password: string,
+    firstName: string,
+    lastName: string,
+    phone?: string,
+    company: string,
+    country: string
+}
+
+export interface ISignupFormController extends ng.IFormController {
+    email: ng.INgModelController,
+    password: ng.INgModelController,
+    firstName: ng.INgModelController,
+    lastName: ng.INgModelController,
+    phone: ng.INgModelController,
+    company: ng.INgModelController,
+    country: ng.INgModelController
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/form-signup/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/form-signup/style.scss b/modules/web-console/frontend/app/components/form-signup/style.scss
new file mode 100644
index 0000000..e80b510
--- /dev/null
+++ b/modules/web-console/frontend/app/components/form-signup/style.scss
@@ -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.
+ */
+
+form-signup {
+    .form-signup__grid {
+        display: grid;
+        grid-gap: 10px;
+        grid-template-columns: 1fr 1fr;
+
+        .span-1 {
+            grid-column: span 1;
+        }
+        .span-2 {
+            grid-column: span 2;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/form-signup/template.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/form-signup/template.pug b/modules/web-console/frontend/app/components/form-signup/template.pug
new file mode 100644
index 0000000..375ea95
--- /dev/null
+++ b/modules/web-console/frontend/app/components/form-signup/template.pug
@@ -0,0 +1,105 @@
+//-
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+include /app/helpers/jade/mixins
+
+.form-signup__grid(ng-form='signup' ng-ref='$ctrl.innerForm' ng-ref-read='form')
+    .span-2
+        +form-field__email({
+            label: 'Email:',
+            model: '$ctrl.ngModel.$viewValue.email',
+            name: '"email"',
+            placeholder: 'Input email',
+            required: true
+        })(
+            ng-model-options='{allowInvalid: true}'
+            autocomplete='email'
+            ignite-auto-focus
+        )
+            +form-field__error({error: 'server', message: `{{$ctrl.serverError}}`})
+    .span-1
+        +form-field__password({
+            label: 'Password:',
+            model: '$ctrl.ngModel.$viewValue.password',
+            name: '"password"',
+            placeholder: 'Input password',
+            required: true
+        })(
+            autocomplete='new-password'
+        )
+    .span-1
+        +form-field__password({
+            label: 'Confirm:',
+            model: 'confirm',
+            name: '"confirm"',
+            placeholder: 'Confirm password',
+            required: true
+        })(
+            ignite-match='$ctrl.ngModel.$viewValue.password'
+            autocomplete='off'
+        )
+    .span-1
+        +form-field__text({
+            label: 'First name:',
+            model: '$ctrl.ngModel.$viewValue.firstName',
+            name: '"firstName"',
+            placeholder: 'Input first name',
+            required: true
+        })(
+            autocomplete='given-name'
+        )
+    .span-1
+        +form-field__text({
+            label: 'Last name:',
+            model: '$ctrl.ngModel.$viewValue.lastName',
+            name: '"lastName"',
+            placeholder: 'Input last name',
+            required: true
+        })(
+            autocomplete='family-name'
+        )
+    .span-1
+        +form-field__phone({
+            label: 'Phone:',
+            model: '$ctrl.ngModel.$viewValue.phone',
+            name: '"phone"',
+            placeholder: 'Input phone (ex.: +15417543010)',
+            optional: true
+        })(
+            autocomplete='tel'
+        )
+    .span-1
+        +form-field__dropdown({
+            label: 'Country:',
+            model: '$ctrl.ngModel.$viewValue.country',
+            name: '"country"',
+            required: true,
+            placeholder: 'Choose your country',
+            options: '$ctrl.countries'
+        })(
+            autocomplete='country'
+        )
+    .span-2
+        +form-field__text({
+            label: 'Company:',
+            model: '$ctrl.ngModel.$viewValue.company',
+            name: '"company"',
+            placeholder: 'Input company name',
+            required: true
+        })(
+            ignite-on-enter-focus-move='countryInput'
+            autocomplete='organization'
+        )

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/input-dialog/input-dialog.service.ts
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/input-dialog/input-dialog.service.ts b/modules/web-console/frontend/app/components/input-dialog/input-dialog.service.ts
index 4d8ebd7..b2a241f 100644
--- a/modules/web-console/frontend/app/components/input-dialog/input-dialog.service.ts
+++ b/modules/web-console/frontend/app/components/input-dialog/input-dialog.service.ts
@@ -20,7 +20,7 @@ import controller from './input-dialog.controller';
 import templateUrl from './input-dialog.tpl.pug';
 import {CancellationError} from 'app/errors/CancellationError';
 
-type InputModes = 'text' | 'number' | 'date' | 'time' | 'date-and-time';
+type InputModes = 'text' | 'number' | 'email' | 'date' | 'time' | 'date-and-time';
 
 interface ValidationFunction<T> {
     (value: T): boolean
@@ -131,6 +131,16 @@ export default class InputDialog {
     }
 
     /**
+     * Open input dialog to configure custom e-mail.
+     *
+     * @param options Object with settings for rendering e-mail input.
+     * @return User input.
+     */
+    email(options: InputOptions<string>) {
+        return this.dialogFabric({mode: 'email', ...options});
+    }
+
+    /**
      * Open input dialog to configure custom date value.
      *
      * @param options Settings for rendering date input.

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/input-dialog/input-dialog.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/input-dialog/input-dialog.tpl.pug b/modules/web-console/frontend/app/components/input-dialog/input-dialog.tpl.pug
index 4674c97..d79cb56 100644
--- a/modules/web-console/frontend/app/components/input-dialog/input-dialog.tpl.pug
+++ b/modules/web-console/frontend/app/components/input-dialog/input-dialog.tpl.pug
@@ -39,6 +39,7 @@ include /app/helpers/jade/mixins
                             ignite-form-field-input-autofocus='true'
                             ignite-on-enter='form.$valid && ctrl.confirm()'
                         )
+
                 .row(ng-switch-when='number')
                     .col-100
                         +form-field__number({
@@ -53,6 +54,19 @@ include /app/helpers/jade/mixins
                             required: true
                         })
 
+                .row(ng-switch-when='email')
+                    .col-100
+                        +form-field__email({
+                            label: '{{ ctrl.options.label }}',
+                            model: 'ctrl.options.value',
+                            name: '"email"',
+                            required: true,
+                            placeholder: 'Input email'
+                        })(
+                            ignite-form-field-input-autofocus='true'
+                            ignite-on-enter='form.$valid && ctrl.confirm()'
+                        )
+
                 .row(ng-switch-when='date')
                     .col-100
                         .form-field--inline

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/list-of-registered-users/column-defs.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/column-defs.js b/modules/web-console/frontend/app/components/list-of-registered-users/column-defs.js
index 419a063..2094f0c 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/column-defs.js
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/column-defs.js
@@ -25,34 +25,11 @@ const MODEL_HEADER_TEMPLATE = `<div class='ui-grid-cell-contents' bs-tooltip dat
 const CACHE_HEADER_TEMPLATE = `<div class='ui-grid-cell-contents' bs-tooltip data-title='{{ col.headerTooltip(col) }}' data-placement='top'><i class='fa fa-database'></i>${ICON_SORT}</div>`;
 const IGFS_HEADER_TEMPLATE = `<div class='ui-grid-cell-contents' bs-tooltip data-title='{{ col.headerTooltip(col) }}' data-placement='top'><i class='fa fa-folder-o'></i>${ICON_SORT}</div>`;
 
-const ACTIONS_TEMPLATE = `
-<div class='text-center ui-grid-cell-actions'>
-    <a class='btn btn-default dropdown-toggle' bs-dropdown='' data-placement='bottom-right' data-container='.panel'>
-        <i class='fa fa-gear'></i>&nbsp;
-        <span class='caret'></span>
-    </a>
-    <ul class='dropdown-menu' role='menu'>
-        <li ng-show='row.entity._id != $root.user._id'>
-            <a ng-click='grid.api.becomeUser(row.entity)'>Become this user</a>
-        </li>
-        <li ng-show='row.entity._id != $root.user._id'>
-            <a ng-click='grid.api.toggleAdmin(row.entity)' ng-if='row.entity.admin && row.entity._id !== $root.user._id'>Revoke admin</a>
-            <a ng-click='grid.api.toggleAdmin(row.entity)' ng-if='!row.entity.admin && row.entity._id !== $root.user._id'>Grant admin</a>
-        </li>
-        <li ng-show='row.entity._id != $root.user._id'>
-            <a ng-click='grid.api.removeUser(row.entity)'>Remove user</a>
-        </li>
-        <li>
-            <a ng-click='grid.api.showActivities(row.entity)'>Activity detail</a>
-        </li>
-</div>`;
-
 const EMAIL_TEMPLATE = '<div class="ui-grid-cell-contents"><a bs-tooltip data-title="{{ COL_FIELD }}" ng-href="mailto:{{ COL_FIELD }}">{{ COL_FIELD }}</a></div>';
 const DATE_WITH_TITLE = '<div class="ui-grid-cell-contents"><label bs-tooltip data-title="{{ COL_FIELD | date:\'M/d/yy HH:mm\' }}">{{ COL_FIELD | date:"M/d/yy HH:mm" }}</label></div>';
 const VALUE_WITH_TITLE = '<div class="ui-grid-cell-contents"><label bs-tooltip data-title="{{ COL_FIELD }}">{{ COL_FIELD }}</label></div>';
 
 export default [
-    {name: 'actions', enableHiding: false, displayName: 'Actions', categoryDisplayName: 'Actions', cellTemplate: ACTIONS_TEMPLATE, field: 'actions', minWidth: 70, width: 70, enableFiltering: false, enableSorting: false, visible: false},
     {name: 'user', enableHiding: false, displayName: 'User', categoryDisplayName: 'User', field: 'userName', cellTemplate: USER_TEMPLATE, minWidth: 160, enableFiltering: true, pinnedLeft: true, filter: { placeholder: 'Filter by name...' }},
     {name: 'email', displayName: 'Email', categoryDisplayName: 'Email', field: 'email', cellTemplate: EMAIL_TEMPLATE, minWidth: 160, width: 220, enableFiltering: true, filter: { placeholder: 'Filter by email...' }},
     {name: 'company', displayName: 'Company', categoryDisplayName: 'Company', field: 'company', cellTemplate: VALUE_WITH_TITLE, minWidth: 180, enableFiltering: true, filter: { placeholder: 'Filter by company...' }},

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/list-of-registered-users/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/controller.js b/modules/web-console/frontend/app/components/list-of-registered-users/controller.js
index f8b2797..6a7e098 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/controller.js
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/controller.js
@@ -15,11 +15,13 @@
  * limitations under the License.
  */
 
-import headerTemplate from 'app/primitives/ui-grid-header/index.tpl.pug';
+import _ from 'lodash';
 
 import columnDefs from './column-defs';
 import categories from './categories';
 
+import headerTemplate from 'app/primitives/ui-grid-header/index.tpl.pug';
+
 const rowTemplate = `<div
   ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.uid"
   ui-grid-one-bind-id-grid="rowRenderIndex + '-' + col.uid + '-cell'"
@@ -36,120 +38,80 @@ export default class IgniteListOfRegisteredUsersCtrl {
     static $inject = ['$scope', '$state', '$filter', 'User', 'uiGridGroupingConstants', 'uiGridPinningConstants', 'IgniteAdminData', 'IgniteNotebookData', 'IgniteConfirm', 'IgniteActivitiesUserDialog'];
 
     constructor($scope, $state, $filter, User, uiGridGroupingConstants, uiGridPinningConstants, AdminData, NotebookData, Confirm, ActivitiesUserDialog) {
-        const $ctrl = this;
+        this.$state = $state;
+        this.AdminData = AdminData;
+        this.ActivitiesDialogFactory = ActivitiesUserDialog;
+        this.Confirm = Confirm;
+        this.User = User;
+        this.NotebookData = NotebookData;
 
         const dtFilter = $filter('date');
 
-        $ctrl.groupBy = 'user';
+        this.groupBy = 'user';
 
-        $ctrl.selected = [];
+        this.selected = [];
 
-        $ctrl.params = {
+        this.params = {
             startDate: new Date(),
             endDate: new Date()
         };
 
-        $ctrl.uiGridPinningConstants = uiGridPinningConstants;
-        $ctrl.uiGridGroupingConstants = uiGridGroupingConstants;
-
-        User.read().then((user) => $ctrl.user = user);
-
-        const becomeUser = () => {
-            const user = this.gridApi.selection.legacyGetSelectedRows()[0];
-
-            AdminData.becomeUser(user._id)
-                .then(() => User.load())
-                .then(() => $state.go('default-state'))
-                .then(() => NotebookData.load());
-        };
-
-        const removeUser = () => {
-            const user = this.gridApi.selection.legacyGetSelectedRows()[0];
-
-            Confirm.confirm(`Are you sure you want to remove user: "${user.userName}"?`)
-                .then(() => AdminData.removeUser(user))
-                .then(() => {
-                    const i = _.findIndex($ctrl.gridOptions.data, (u) => u._id === user._id);
+        this.uiGridPinningConstants = uiGridPinningConstants;
+        this.uiGridGroupingConstants = uiGridGroupingConstants;
 
-                    if (i >= 0) {
-                        $ctrl.gridOptions.data.splice(i, 1);
-                        $ctrl.gridApi.selection.clearSelectedRows();
-                    }
-
-                    $ctrl.adjustHeight($ctrl.gridOptions.data.length);
-
-                    return $ctrl._refreshRows();
-                });
-        };
-
-        const toggleAdmin = () => {
-            const user = this.gridApi.selection.legacyGetSelectedRows()[0];
-
-            if (user.adminChanging)
-                return;
-
-            user.adminChanging = true;
-
-            AdminData.toggleAdmin(user)
-                .finally(() => {
-                    $ctrl._updateSelected();
-
-                    user.adminChanging = false;
-                });
-        };
-
-        const showActivities = () => {
-            const user = this.gridApi.selection.legacyGetSelectedRows()[0];
-
-            return new ActivitiesUserDialog({ user });
-        };
+        User.read().then((user) => this.user = user);
 
         const companiesExcludeFilter = (renderableRows) => {
-            if (_.isNil($ctrl.params.companiesExclude))
+            if (_.isNil(this.params.companiesExclude))
                 return renderableRows;
 
             _.forEach(renderableRows, (row) => {
-                row.visible = _.isEmpty($ctrl.params.companiesExclude) ||
-                    row.entity.company.toLowerCase().indexOf($ctrl.params.companiesExclude.toLowerCase()) === -1;
+                row.visible = _.isEmpty(this.params.companiesExclude) ||
+                    row.entity.company.toLowerCase().indexOf(this.params.companiesExclude.toLowerCase()) === -1;
             });
 
             return renderableRows;
         };
 
-        $ctrl.actionOptions = [
+        this.actionOptions = [
             {
                 action: 'Become this user',
-                click: becomeUser.bind(this),
+                click: () => this.becomeUser(),
                 available: true
             },
             {
                 action: 'Revoke admin',
-                click: toggleAdmin.bind(this),
+                click: () => this.toggleAdmin(),
                 available: true
             },
             {
                 action: 'Grant admin',
-                click: toggleAdmin.bind(this),
+                click: () => this.toggleAdmin(),
                 available: false
             },
             {
+                action: 'Add user',
+                sref: '.createUser',
+                available: true
+            },
+            {
                 action: 'Remove user',
-                click: removeUser.bind(this),
+                click: () => this.removeUser(),
                 available: true
             },
             {
                 action: 'Activity detail',
-                click: showActivities.bind(this),
+                click: () => this.showActivities(),
                 available: true
             }
         ];
 
-        $ctrl._userGridOptions = {
+        this._userGridOptions = {
             columnDefs,
             categories
         };
 
-        $ctrl.gridOptions = {
+        this.gridOptions = {
             data: [],
 
             columnDefs,
@@ -176,18 +138,18 @@ export default class IgniteListOfRegisteredUsersCtrl {
             rowIdentity: (row) => row._id,
             getRowIdentity: (row) => row._id,
             onRegisterApi: (api) => {
-                $ctrl.gridApi = api;
+                this.gridApi = api;
 
-                api.selection.on.rowSelectionChanged($scope, $ctrl._updateSelected.bind($ctrl));
-                api.selection.on.rowSelectionChangedBatch($scope, $ctrl._updateSelected.bind($ctrl));
+                api.selection.on.rowSelectionChanged($scope, this._updateSelected.bind(this));
+                api.selection.on.rowSelectionChangedBatch($scope, this._updateSelected.bind(this));
 
-                api.core.on.filterChanged($scope, $ctrl._filteredRows.bind($ctrl));
-                api.core.on.rowsVisibleChanged($scope, $ctrl._filteredRows.bind($ctrl));
+                api.core.on.filterChanged($scope, this._filteredRows.bind(this));
+                api.core.on.rowsVisibleChanged($scope, this._filteredRows.bind(this));
 
                 api.grid.registerRowsProcessor(companiesExcludeFilter, 50);
 
-                $scope.$watch(() => $ctrl.gridApi.grid.getVisibleRows().length, (rows) => $ctrl.adjustHeight(rows));
-                $scope.$watch(() => $ctrl.params.companiesExclude, () => $ctrl.gridApi.grid.refreshRows());
+                $scope.$watch(() => this.gridApi.grid.getVisibleRows().length, (rows) => this.adjustHeight(rows));
+                $scope.$watch(() => this.params.companiesExclude, () => this.gridApi.grid.refreshRows());
             }
         };
 
@@ -197,20 +159,20 @@ export default class IgniteListOfRegisteredUsersCtrl {
         const reloadUsers = (params) => {
             AdminData.loadUsers(params)
                 .then((data) => {
-                    $ctrl.gridOptions.data = data;
+                    this.gridOptions.data = data;
 
-                    $ctrl.companies = _.values(_.groupBy(data, 'company'));
-                    $ctrl.countries = _.values(_.groupBy(data, 'countryCode'));
+                    this.companies = _.values(_.groupBy(data, 'company'));
+                    this.countries = _.values(_.groupBy(data, 'countryCode'));
 
-                    $ctrl._refreshRows();
+                    this._refreshRows();
                 });
         };
 
         const filterDates = _.debounce(() => {
-            const sdt = $ctrl.params.startDate;
-            const edt = $ctrl.params.endDate;
+            const sdt = this.params.startDate;
+            const edt = this.params.endDate;
 
-            $ctrl.exporterCsvFilename = `web_console_users_${dtFilter(sdt, 'yyyy_MM')}.csv`;
+            this.exporterCsvFilename = `web_console_users_${dtFilter(sdt, 'yyyy_MM')}.csv`;
 
             const startDate = Date.UTC(sdt.getFullYear(), sdt.getMonth(), 1);
             const endDate = Date.UTC(edt.getFullYear(), edt.getMonth() + 1, 1);
@@ -218,8 +180,9 @@ export default class IgniteListOfRegisteredUsersCtrl {
             reloadUsers({ startDate, endDate });
         }, 250);
 
-        $scope.$watch(() => $ctrl.params.startDate, filterDates);
-        $scope.$watch(() => $ctrl.params.endDate, filterDates);
+        $scope.$on('userCreated', filterDates);
+        $scope.$watch(() => this.params.startDate, filterDates);
+        $scope.$watch(() => this.params.endDate, filterDates);
     }
 
     adjustHeight(rows) {
@@ -233,36 +196,95 @@ export default class IgniteListOfRegisteredUsersCtrl {
 
     _filteredRows() {
         const filtered = _.filter(this.gridApi.grid.rows, ({ visible}) => visible);
-        const entities = _.map(filtered, 'entity');
 
-        this.filteredRows = entities;
+        this.filteredRows = _.map(filtered, 'entity');
     }
 
     _updateSelected() {
         const ids = this.gridApi.selection.legacyGetSelectedRows().map(({ _id }) => _id).sort();
 
+        if (!_.isEqual(ids, this.selected))
+            this.selected = ids;
+
         if (ids.length) {
             const user = this.gridApi.selection.legacyGetSelectedRows()[0];
             const other = this.user._id !== user._id;
 
-            this.actionOptions[1].available = other && user.admin;
-            this.actionOptions[2].available = other && !user.admin;
-
-            this.actionOptions[0].available = other;
-            this.actionOptions[3].available = other;
+            this.actionOptions[0].available = other; // Become this user.
+            this.actionOptions[1].available = other && user.admin; // Revoke admin.
+            this.actionOptions[2].available = other && !user.admin; // Grant admin.
+            this.actionOptions[4].available = other; // Remove user.
+            this.actionOptions[5].available = true; // Activity detail.
+        }
+        else {
+            this.actionOptions[0].available = false; // Become this user.
+            this.actionOptions[1].available = false; // Revoke admin.
+            this.actionOptions[2].available = false; // Grant admin.
+            this.actionOptions[4].available = false; // Remove user.
+            this.actionOptions[5].available = false; // Activity detail.
         }
-
-        if (!_.isEqual(ids, this.selected))
-            this.selected = ids;
     }
 
     _refreshRows() {
         if (this.gridApi) {
             this.gridApi.grid.refreshRows()
-                .then(() => this.selected.length && this._updateSelected());
+                .then(() => this._updateSelected());
         }
     }
 
+    becomeUser() {
+        const user = this.gridApi.selection.legacyGetSelectedRows()[0];
+
+        this.AdminData.becomeUser(user._id)
+            .then(() => this.User.load())
+            .then(() => this.$state.go('default-state'))
+            .then(() => this.NotebookData.load());
+    }
+
+    toggleAdmin() {
+        if (!this.gridApi)
+            return;
+
+        const user = this.gridApi.selection.legacyGetSelectedRows()[0];
+
+        if (user.adminChanging)
+            return;
+
+        user.adminChanging = true;
+
+        this.AdminData.toggleAdmin(user)
+            .finally(() => {
+                this._updateSelected();
+
+                user.adminChanging = false;
+            });
+    }
+
+    removeUser() {
+        const user = this.gridApi.selection.legacyGetSelectedRows()[0];
+
+        this.Confirm.confirm(`Are you sure you want to remove user: "${user.userName}"?`)
+            .then(() => this.AdminData.removeUser(user))
+            .then(() => {
+                const i = _.findIndex(this.gridOptions.data, (u) => u._id === user._id);
+
+                if (i >= 0) {
+                    this.gridOptions.data.splice(i, 1);
+                    this.gridApi.selection.clearSelectedRows();
+                }
+
+                this.adjustHeight(this.gridOptions.data.length);
+
+                return this._refreshRows();
+            });
+    }
+
+    showActivities() {
+        const user = this.gridApi.selection.legacyGetSelectedRows()[0];
+
+        return new this.ActivitiesDialogFactory({ user });
+    }
+
     groupByUser() {
         this.groupBy = 'user';
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/list-of-registered-users/template.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/template.tpl.pug b/modules/web-console/frontend/app/components/list-of-registered-users/template.tpl.pug
index d32b64d..ff1c851 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/template.tpl.pug
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/template.tpl.pug
@@ -74,7 +74,6 @@ ul.tabs.tabs--blue
                 label: 'Actions',
                 model: '$ctrl.action',
                 name: 'action',
-                disabled: '!$ctrl.selected.length',
                 options: '$ctrl.actionOptions'
             })
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/page-admin/controller.ts
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-admin/controller.ts b/modules/web-console/frontend/app/components/page-admin/controller.ts
new file mode 100644
index 0000000..45a5c0a
--- /dev/null
+++ b/modules/web-console/frontend/app/components/page-admin/controller.ts
@@ -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.
+ */
+
+import UserNotificationsService from '../user-notifications/service';
+
+export default class PageAdminCtrl {
+    static $inject = ['UserNotifications'];
+
+    constructor(private UserNotifications: UserNotificationsService) {}
+
+    changeUserNotifications() {
+        this.UserNotifications.editor();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/page-admin/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-admin/index.js b/modules/web-console/frontend/app/components/page-admin/index.js
index 232d889..8b26f2c 100644
--- a/modules/web-console/frontend/app/components/page-admin/index.js
+++ b/modules/web-console/frontend/app/components/page-admin/index.js
@@ -17,23 +17,12 @@
 
 import './style.scss';
 
+import controller from './controller';
 import templateUrl from './template.tpl.pug';
 
-class PageAdminCtrl {
-    static $inject = ['UserNotifications'];
-
-    constructor(UserNotifications) {
-        this.UserNotifications = UserNotifications;
-    }
-
-    changeUserNotifications() {
-        this.UserNotifications.editor();
-    }
-}
-
 export default angular
     .module('ignite-console.page-admin', [])
     .component('pageAdmin', {
-        templateUrl,
-        controller: PageAdminCtrl
+        controller,
+        templateUrl
     });

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/page-signup/component.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-signup/component.js b/modules/web-console/frontend/app/components/page-signup/component.js
index 789a681..968ff39 100644
--- a/modules/web-console/frontend/app/components/page-signup/component.js
+++ b/modules/web-console/frontend/app/components/page-signup/component.js
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-import angular from 'angular';
-
 import template from './template.pug';
 import controller from './controller';
 import './style.scss';

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/page-signup/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-signup/controller.js b/modules/web-console/frontend/app/components/page-signup/controller.js
deleted file mode 100644
index 1039776..0000000
--- a/modules/web-console/frontend/app/components/page-signup/controller.js
+++ /dev/null
@@ -1,76 +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.
- */
-
-export default class PageSignup {
-    /** @type {import('./types').ISignupFormController} */
-    form;
-    /** @type {import('./types').ISignupData} */
-    data = {
-        email: null,
-        password: null,
-        firstName: null,
-        lastName: null,
-        company: null,
-        country: null
-    };
-    /** @type {string} */
-    serverError = null;
-
-    static $inject = ['IgniteCountries', 'Auth', 'IgniteMessages', 'IgniteFormUtils'];
-
-    /**
-     * @param {ReturnType<typeof import('app/services/Countries.service').default>} Countries
-     * @param {import('app/modules/user/Auth.service').default} Auth
-     * @param {ReturnType<typeof import('app/services/Messages.service').default>} IgniteMessages
-     * @param {ReturnType<typeof import('app/services/FormUtils.service').default>} IgniteFormUtils
-     */
-    constructor(Countries, Auth, IgniteMessages, IgniteFormUtils) {
-        this.Auth = Auth;
-        this.IgniteMessages = IgniteMessages;
-        this.countries = Countries.getAll();
-        this.IgniteFormUtils = IgniteFormUtils;
-    }
-
-    /** @param {import('./types').ISignupFormController} form */
-    canSubmitForm(form) {
-        return form.$error.server ? true : !form.$invalid;
-    }
-
-    $postLink() {
-        this.form.email.$validators.server = () => !this.serverError;
-    }
-
-    /** @param {string} error */
-    setServerError(error) {
-        this.serverError = error;
-        this.form.email.$validate();
-    }
-
-    signup() {
-        this.IgniteFormUtils.triggerValidation(this.form);
-
-        this.setServerError(null);
-
-        if (!this.canSubmitForm(this.form))
-            return;
-
-        return this.Auth.signnup(this.data).catch((res) => {
-            this.IgniteMessages.showError(null, res.data);
-            this.setServerError(res.data);
-        });
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/page-signup/controller.ts
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-signup/controller.ts b/modules/web-console/frontend/app/components/page-signup/controller.ts
new file mode 100644
index 0000000..ddf77be
--- /dev/null
+++ b/modules/web-console/frontend/app/components/page-signup/controller.ts
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+import Auth from '../../modules/user/Auth.service';
+import MessagesFactory from '../../services/Messages.service';
+import FormUtilsFactoryFactory from '../../services/FormUtils.service';
+import {ISignupData} from '../form-signup';
+
+export default class PageSignup {
+    form: ng.IFormController;
+
+    data: ISignupData = {
+        email: null,
+        password: null,
+        firstName: null,
+        lastName: null,
+        company: null,
+        country: null
+    };
+
+    serverError: string | null = null;
+
+    static $inject = ['Auth', 'IgniteMessages', 'IgniteFormUtils'];
+
+    constructor(
+        private Auth: Auth,
+        private IgniteMessages: ReturnType<typeof MessagesFactory>,
+        private IgniteFormUtils: ReturnType<typeof FormUtilsFactoryFactory>
+    ) {}
+
+    canSubmitForm(form: PageSignup['form']) {
+        return form.$error.server ? true : !form.$invalid;
+    }
+
+    setServerError(error: PageSignup['serverError']) {
+        this.serverError = error;
+    }
+
+    signup() {
+        this.IgniteFormUtils.triggerValidation(this.form);
+
+        this.setServerError(null);
+
+        if (!this.canSubmitForm(this.form))
+            return;
+
+        return this.Auth.signup(this.data).catch((res) => {
+            this.IgniteMessages.showError(null, res.data);
+            this.setServerError(res.data);
+        });
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/page-signup/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-signup/index.js b/modules/web-console/frontend/app/components/page-signup/index.js
index 4efadb5..001d269 100644
--- a/modules/web-console/frontend/app/components/page-signup/index.js
+++ b/modules/web-console/frontend/app/components/page-signup/index.js
@@ -22,7 +22,8 @@ import {registerState} from './run';
 export default angular
     .module('ignite-console.page-signup', [
         'ui.router',
-        'ignite-console.user'
+        'ignite-console.user',
+        'ignite-console.form-signup'
     ])
     .component('pageSignup', component)
     .run(registerState);

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/page-signup/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-signup/style.scss b/modules/web-console/frontend/app/components/page-signup/style.scss
index 93167ce..98c4729 100644
--- a/modules/web-console/frontend/app/components/page-signup/style.scss
+++ b/modules/web-console/frontend/app/components/page-signup/style.scss
@@ -41,16 +41,6 @@ page-signup {
                 margin-left: auto;
             }
         }
-
-        form {
-            display: grid;
-            grid-gap: 10px;
-            grid-template-columns: 1fr 1fr;
-
-            .full-width {
-                grid-column: 1 / 3;
-            }
-        }
     }
 
     .page-signup__has-account-message {

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/page-signup/template.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-signup/template.pug b/modules/web-console/frontend/app/components/page-signup/template.pug
index 11bb50a..5584dfc 100644
--- a/modules/web-console/frontend/app/components/page-signup/template.pug
+++ b/modules/web-console/frontend/app/components/page-signup/template.pug
@@ -22,95 +22,13 @@ web-console-header
 
 .container--responsive.body-container
     section
-        -var form = '$ctrl.form'
         h3 Don't Have An Account?
-        form(name=form novalidate ng-submit='$ctrl.signup()')
-            .full-width
-                +form-field__email({
-                    label: 'Email:',
-                    model: '$ctrl.data.email',
-                    name: '"email"',
-                    placeholder: 'Input email',
-                    required: true
-                })(
-                    ng-model-options='{allowInvalid: true}'
-                    autocomplete='email'
-                    ignite-auto-focus
-                )
-                    +form-field__error({error: 'server', message: `{{$ctrl.serverError}}`})
-            div
-                +form-field__password({
-                    label: 'Password:',
-                    model: '$ctrl.data.password',
-                    name: '"password"',
-                    placeholder: 'Input password',
-                    required: true
-                })(
-                    autocomplete='new-password'
-                )
-            div
-                +form-field__password({
-                    label: 'Confirm:',
-                    model: 'confirm',
-                    name: '"confirm"',
-                    placeholder: 'Confirm password',
-                    required: true
-                })(
-                    ignite-match='$ctrl.data.password'
-                    autocomplete='off'
-                )
-            div
-                +form-field__text({
-                    label: 'First name:',
-                    model: '$ctrl.data.firstName',
-                    name: '"firstName"',
-                    placeholder: 'Input first name',
-                    required: true
-                })(
-                    autocomplete='given-name'
-                )
-            div
-                +form-field__text({
-                    label: 'Last name:',
-                    model: '$ctrl.data.lastName',
-                    name: '"lastName"',
-                    placeholder: 'Input last name',
-                    required: true
-                })(
-                    autocomplete='family-name'
-                )
-            div
-                +form-field__phone({
-                    label: 'Phone:',
-                    model: '$ctrl.data.phone',
-                    name: '"phone"',
-                    placeholder: 'Input phone (ex.: +15417543010)',
-                    optional: true
-                })(
-                    autocomplete='tel'
-                )
-            div
-                +form-field__dropdown({
-                    label: 'Country:',
-                    model: '$ctrl.data.country',
-                    name: '"country"',
-                    required: true,
-                    placeholder: 'Choose your country',
-                    options: '$ctrl.countries'
-                })(
-                    autocomplete='country'
-                )
-            .full-width
-                +form-field__text({
-                    label: 'Company:',
-                    model: '$ctrl.data.company',
-                    name: '"company"',
-                    placeholder: 'Input company name',
-                    required: true
-                })(
-                    ignite-on-enter-focus-move='countryInput'
-                    autocomplete='organization'
-                )
+        form(name='$ctrl.form' novalidate ng-submit='$ctrl.signup()')
+            form-signup(
+                outer-form='$ctrl.form'
+                ng-model='$ctrl.data'
+                server-error='$ctrl.serverError'
+            )
             footer.full-width.form-footer
                 button.btn-ignite.btn-ignite--primary(
                     type='submit'

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/components/page-signup/types.ts
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-signup/types.ts b/modules/web-console/frontend/app/components/page-signup/types.ts
deleted file mode 100644
index 49e8d5d..0000000
--- a/modules/web-console/frontend/app/components/page-signup/types.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export interface ISignupData {
-    email: string,
-    password: string,
-    firstName: string,
-    lastName: string,
-    phone?: string,
-    company: string,
-    country: string
-}
-
-export interface ISignupFormController extends ng.IFormController {
-    email: ng.INgModelController,
-    password: ng.INgModelController,
-    firstName: ng.INgModelController,
-    lastName: ng.INgModelController,
-    phone: ng.INgModelController,
-    company: ng.INgModelController,
-    country: ng.INgModelController
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/modules/user/Auth.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/user/Auth.service.js b/modules/web-console/frontend/app/modules/user/Auth.service.js
deleted file mode 100644
index 8c3cc4e..0000000
--- a/modules/web-console/frontend/app/modules/user/Auth.service.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @typedef {object} SignupUserInfo
- * @prop {string} email
- * @prop {string} password
- * @prop {string} firstName
- * @prop {string} lastName
- * @prop {string} company
- * @prop {string} country
- */
-
-export default class AuthService {
-    static $inject = ['$http', '$rootScope', '$state', '$window', 'IgniteMessages', 'gettingStarted', 'User'];
-    /**
-     * @param {ng.IHttpService} $http
-     * @param {ng.IRootScopeService} $root
-     * @param {import('@uirouter/angularjs').StateService} $state
-     * @param {ng.IWindowService} $window
-     * @param {ReturnType<typeof import('app/services/Messages.service').default>} Messages
-     * @param {ReturnType<typeof import('app/modules/getting-started/GettingStarted.provider').service>} gettingStarted
-     * @param {ReturnType<typeof import('./User.service').default>} User
-     */
-    constructor($http, $root, $state, $window, Messages, gettingStarted, User) {
-        this.$http = $http;
-        this.$root = $root;
-        this.$state = $state;
-        this.$window = $window;
-        this.Messages = Messages;
-        this.gettingStarted = gettingStarted;
-        this.User = User;
-    }
-    /**
-     * @param {SignupUserInfo} userInfo
-     */
-    signnup(userInfo) {
-        return this._auth('signup', userInfo);
-    }
-    /**
-     * @param {string} email
-     * @param {string} password
-     */
-    signin(email, password) {
-        return this._auth('signin', {email, password});
-    }
-    /**
-     * @param {string} email
-     */
-    remindPassword(email) {
-        return this._auth('password/forgot', {email}).then(() => this.$state.go('password.send'));
-    }
-
-    // TODO IGNITE-7994: Remove _auth and move API calls to corresponding methods
-    /**
-     * Performs the REST API call.
-     * @private
-     * @param {('signin'|'signup'|'password/forgot')} action
-     * @param {{email:string,password:string}|SignupUserInfo|{email:string}} userInfo
-     */
-    _auth(action, userInfo) {
-        return this.$http.post('/api/v1/' + action, userInfo)
-            .then(() => {
-                if (action === 'password/forgot')
-                    return;
-
-                this.User.read()
-                    .then((user) => {
-                        this.$root.$broadcast('user', user);
-
-                        this.$state.go('default-state');
-
-                        this.$root.gettingStarted.tryShow();
-                    });
-            });
-    }
-    logout() {
-        return this.$http.post('/api/v1/logout')
-            .then(() => {
-                this.User.clean();
-
-                this.$window.open(this.$state.href('signin'), '_self');
-            })
-            .catch((e) => this.Messages.showError(e));
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/modules/user/Auth.service.ts
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/user/Auth.service.ts b/modules/web-console/frontend/app/modules/user/Auth.service.ts
new file mode 100644
index 0000000..55956ad
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/user/Auth.service.ts
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+
+import {StateService} from '@uirouter/angularjs';
+import MessagesFactory from '../../services/Messages.service';
+import {service as GettingsStartedFactory} from '../../modules/getting-started/GettingStarted.provider';
+import UserServiceFactory from './User.service';
+
+type SignupUserInfo = {
+    email: string,
+    password: string,
+    firstName: string,
+    lastName: string,
+    company: string,
+    country: string,
+};
+
+type AuthActions = 'signin' | 'signup' | 'password/forgot';
+type AuthOptions = {email:string, password:string}|SignupUserInfo|{email:string};
+
+export default class AuthService {
+    static $inject = ['$http', '$rootScope', '$state', '$window', 'IgniteMessages', 'gettingStarted', 'User'];
+
+    constructor(
+        private $http: ng.IHttpService,
+        private $root: ng.IRootScopeService,
+        private $state: StateService,
+        private $window: ng.IWindowService,
+        private Messages: ReturnType<typeof MessagesFactory>,
+        private gettingStarted: ReturnType<typeof GettingsStartedFactory>,
+        private User: ReturnType<typeof UserServiceFactory>
+    ) {}
+
+    signup(userInfo: SignupUserInfo, loginAfterSignup: boolean = true) {
+        return this._auth('signup', userInfo, loginAfterSignup);
+    }
+
+    signin(email: string, password: string) {
+        return this._auth('signin', {email, password});
+    }
+
+    remindPassword(email: string) {
+        return this._auth('password/forgot', {email}).then(() => this.$state.go('password.send'));
+    }
+
+    // TODO IGNITE-7994: Remove _auth and move API calls to corresponding methods
+    /**
+     * Performs the REST API call.
+     */
+    private _auth(action: AuthActions, userInfo: AuthOptions, loginAfterwards: boolean = true) {
+        return this.$http.post('/api/v1/' + action, userInfo)
+            .then(() => {
+                if (action === 'password/forgot')
+                    return;
+
+                this.User.read()
+                    .then((user) => {
+                        if (loginAfterwards) {
+                            this.$root.$broadcast('user', user);
+                            this.$state.go('default-state');
+                            this.$root.gettingStarted.tryShow();
+                        } else
+                            this.$root.$broadcast('userCreated');
+                    });
+            });
+    }
+    logout() {
+        return this.$http.post('/api/v1/logout')
+            .then(() => {
+                this.User.clean();
+
+                this.$window.open(this.$state.href('signin'), '_self');
+            })
+            .catch((e) => this.Messages.showError(e));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/primitives/dropdown/index.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/dropdown/index.pug b/modules/web-console/frontend/app/primitives/dropdown/index.pug
index 0099457..aad6efd 100644
--- a/modules/web-console/frontend/app/primitives/dropdown/index.pug
+++ b/modules/web-console/frontend/app/primitives/dropdown/index.pug
@@ -37,5 +37,6 @@ mixin ignite-form-field-bsdropdown({label, model, name, disabled, required, opti
 
         ul.dropdown-menu(role='menu')
             li(ng-repeat=`item in ${options}` ng-if='item.available')
-                a(ng-click='item.click()') {{ item.action }}
+                a(ng-if='item.click' ng-click='item.click()') {{ item.action }}
+                a(ng-if='item.sref' ui-sref='{{:: item.sref}}') {{ item.action }}
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/primitives/form-field/checkbox.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/form-field/checkbox.pug b/modules/web-console/frontend/app/primitives/form-field/checkbox.pug
index 88b8f5a..fe0f808 100644
--- a/modules/web-console/frontend/app/primitives/form-field/checkbox.pug
+++ b/modules/web-console/frontend/app/primitives/form-field/checkbox.pug
@@ -15,7 +15,7 @@
     limitations under the License.
 
 mixin form-field__checkbox({ label, model, name, disabled, required, tip, tipOpts })
-    .form-field.form-field__checkbox(id=`{{ ${name} }}Field`)
+    .form-field.ignite-form-field.form-field__checkbox(id=`{{ ${name} }}Field`)
         +form-field__label({ label, name, required, disabled })
             +form-field__tooltip({ title: tip, options: tipOpts })
 
@@ -24,7 +24,8 @@ mixin form-field__checkbox({ label, model, name, disabled, required, tip, tipOpt
             +form-field__input({ name, model, disabled, required, placeholder })(attributes=attributes)
 
         .form-field__errors(
-            ng-messages=`(${form}[${name}].$dirty || ${form}[${name}].$touched || ${form}[${name}].$submitted) && ${form}[${name}].$invalid ? ${form}[${name}].$error : {}`
+            ng-messages=`$input.$error`
+            ng-show=`($input.$dirty || $input.$touched || $input.$submitted) && $input.$invalid`
         )
             if block
                 block

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/primitives/form-field/email.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/form-field/email.pug b/modules/web-console/frontend/app/primitives/form-field/email.pug
index b68a520..5fb0c30 100644
--- a/modules/web-console/frontend/app/primitives/form-field/email.pug
+++ b/modules/web-console/frontend/app/primitives/form-field/email.pug
@@ -15,9 +15,9 @@
     limitations under the License.
 
 mixin form-field__email({ label, model, name, disabled, required, placeholder, tip })
-    -var errLbl = label.substring(0, label.length - 1)
+    -let errLbl = label[label.length - 1] === ':' ? label.substring(0, label.length - 1) : label
 
-    .form-field
+    .form-field.ignite-form-field
         +form-field__label({ label, name, required, disabled })
             +form-field__tooltip({ title: tip, options: tipOpts })
 
@@ -26,7 +26,8 @@ mixin form-field__email({ label, model, name, disabled, required, placeholder, t
             +form-field__input({ name, model, disabled, required, placeholder })(attributes=attributes)
 
         .form-field__errors(
-            ng-messages=`(${form}[${name}].$dirty || ${form}[${name}].$touched || ${form}[${name}].$submitted) && ${form}[${name}].$invalid ? ${form}[${name}].$error : {}`
+            ng-messages=`$input.$error`
+            ng-show=`($input.$dirty || $input.$touched || $input.$submitted) && $input.$invalid`
         )
             if block
                 block


[15/28] ignite git commit: IGNITE-10031 REST: Added "caches" parameter to "top" command to include/exclude information about caches.

Posted by sb...@apache.org.
IGNITE-10031 REST: Added "caches" parameter to "top" command to include/exclude information about caches.


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

Branch: refs/heads/ignite-627
Commit: 594aac83c39eec1d12f2e9cef0ed9af35e9a9dba
Parents: fe824a0
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Mon Oct 29 16:01:12 2018 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Mon Oct 29 16:01:12 2018 +0700

----------------------------------------------------------------------
 .../JettyRestProcessorAbstractSelfTest.java     | 41 ++++++++++++++++++++
 .../top/GridTopologyCommandHandler.java         | 28 +++++++------
 .../rest/request/GridRestTopologyRequest.java   | 19 ++++++++-
 .../http/jetty/GridJettyRestHandler.java        |  3 ++
 .../app/modules/agent/AgentManager.service.js   |  2 +-
 .../console/agent/handlers/ClusterListener.java |  1 +
 6 files changed, 80 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/594aac83/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 a972bc3..703f50d 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
@@ -1428,6 +1428,25 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
                 assertEquals(publicCache.getConfiguration(CacheConfiguration.class).getCacheMode(), cacheMode);
             }
         }
+
+        // Test that caches not included.
+        ret = content(null, GridRestCommand.TOPOLOGY,
+            "attr", "false",
+            "mtr", "false",
+            "caches", "false"
+        );
+
+        info("Topology command result: " + ret);
+
+        res = jsonResponse(ret);
+
+        assertEquals(gridCount(), res.size());
+
+        for (JsonNode node : res) {
+            assertTrue(node.get("attributes").isNull());
+            assertTrue(node.get("metrics").isNull());
+            assertTrue(node.get("caches").isNull());
+        }
     }
 
     /**
@@ -1447,6 +1466,12 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
         assertTrue(res.get("attributes").isObject());
         assertTrue(res.get("metrics").isObject());
 
+        JsonNode caches = res.get("caches");
+
+        assertTrue(caches.isArray());
+        assertFalse(caches.isNull());
+        assertEquals(grid(0).context().cache().publicCaches().size(), caches.size());
+
         ret = content(null, GridRestCommand.NODE,
             "attr", "false",
             "mtr", "false",
@@ -1472,6 +1497,22 @@ public abstract class JettyRestProcessorAbstractSelfTest extends JettyRestProces
         res = jsonResponse(ret);
 
         assertTrue(res.isNull());
+
+        // Check that caches not included.
+        ret = content(null, GridRestCommand.NODE,
+            "id", grid(0).localNode().id().toString(),
+            "attr", "false",
+            "mtr", "false",
+            "caches", "false"
+        );
+
+        info("Topology command result: " + ret);
+
+        res = jsonResponse(ret);
+
+        assertTrue(res.get("attributes").isNull());
+        assertTrue(res.get("metrics").isNull());
+        assertTrue(res.get("caches").isNull());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/594aac83/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
index 0390936..edcb374 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
@@ -97,6 +97,7 @@ public class GridTopologyCommandHandler extends GridRestCommandHandlerAdapter {
 
         boolean mtr = req0.includeMetrics();
         boolean attr = req0.includeAttributes();
+        boolean caches = req0.includeCaches();
 
         switch (req.command()) {
             case TOPOLOGY: {
@@ -107,7 +108,7 @@ public class GridTopologyCommandHandler extends GridRestCommandHandlerAdapter {
                     new ArrayList<>(allNodes.size());
 
                 for (ClusterNode node : allNodes)
-                    top.add(createNodeBean(node, mtr, attr));
+                    top.add(createNodeBean(node, mtr, attr, caches));
 
                 res.setResponse(top);
 
@@ -143,7 +144,7 @@ public class GridTopologyCommandHandler extends GridRestCommandHandlerAdapter {
                     });
 
                 if (node != null)
-                    res.setResponse(createNodeBean(node, mtr, attr));
+                    res.setResponse(createNodeBean(node, mtr, attr, caches));
                 else
                     res.setResponse(null);
 
@@ -196,14 +197,15 @@ public class GridTopologyCommandHandler extends GridRestCommandHandlerAdapter {
     }
 
     /**
-     * Creates node bean out of grid node. Notice that cache attribute is handled separately.
+     * Creates node bean out of cluster node. Notice that cache attribute is handled separately.
      *
-     * @param node Grid node.
-     * @param mtr {@code true} to add metrics.
-     * @param attr {@code true} to add attributes.
+     * @param node Cluster node.
+     * @param mtr Whether to include node metrics.
+     * @param attr Whether to include node attributes.
+     * @param caches Whether to include node caches.
      * @return Grid Node bean.
      */
-    private GridClientNodeBean createNodeBean(ClusterNode node, boolean mtr, boolean attr) {
+    private GridClientNodeBean createNodeBean(ClusterNode node, boolean mtr, boolean attr, boolean caches) {
         assert node != null;
 
         GridClientNodeBean nodeBean = new GridClientNodeBean();
@@ -216,14 +218,16 @@ public class GridTopologyCommandHandler extends GridRestCommandHandlerAdapter {
         nodeBean.setTcpAddresses(nonEmptyList(node.<Collection<String>>attribute(ATTR_REST_TCP_ADDRS)));
         nodeBean.setTcpHostNames(nonEmptyList(node.<Collection<String>>attribute(ATTR_REST_TCP_HOST_NAMES)));
 
-        Map<String, CacheConfiguration> nodeCaches = ctx.discovery().nodePublicCaches(node);
+        if (caches) {
+            Map<String, CacheConfiguration> nodeCaches = ctx.discovery().nodePublicCaches(node);
 
-        Collection<GridClientCacheBean> caches = new ArrayList<>(nodeCaches.size());
+            Collection<GridClientCacheBean> cacheBeans = new ArrayList<>(nodeCaches.size());
 
-        for (CacheConfiguration ccfg : nodeCaches.values())
-            caches.add(createCacheBean(ccfg));
+            for (CacheConfiguration ccfg : nodeCaches.values())
+                cacheBeans.add(createCacheBean(ccfg));
 
-        nodeBean.setCaches(caches);
+            nodeBean.setCaches(cacheBeans);
+        }
 
         if (mtr) {
             ClusterMetrics metrics = node.metrics();

http://git-wip-us.apache.org/repos/asf/ignite/blob/594aac83/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/GridRestTopologyRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/GridRestTopologyRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/GridRestTopologyRequest.java
index b028367..fadd178 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/GridRestTopologyRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/GridRestTopologyRequest.java
@@ -36,6 +36,9 @@ public class GridRestTopologyRequest extends GridRestRequest {
     /** Include node attributes flag. */
     private boolean includeAttrs;
 
+    /** Include caches flag. With default value for compatibility. */
+    private boolean includeCaches = true;
+
     /**
      * @return Include metrics flag.
      */
@@ -65,6 +68,20 @@ public class GridRestTopologyRequest extends GridRestRequest {
     }
 
     /**
+     * @return Include caches flag.
+     */
+    public boolean includeCaches() {
+        return includeCaches;
+    }
+
+    /**
+     * @param includeCaches Include caches flag.
+     */
+    public void includeCaches(boolean includeCaches) {
+        this.includeCaches = includeCaches;
+    }
+
+    /**
      * @return Node identifier, if specified, {@code null} otherwise.
      */
     public UUID nodeId() {
@@ -96,4 +113,4 @@ public class GridRestTopologyRequest extends GridRestRequest {
     @Override public String toString() {
         return S.toString(GridRestTopologyRequest.class, this, super.toString());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/594aac83/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index 03bed69..c0a4fe1 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -689,6 +689,9 @@ public class GridJettyRestHandler extends AbstractHandler {
                 restReq0.includeMetrics(Boolean.parseBoolean((String)params.get("mtr")));
                 restReq0.includeAttributes(Boolean.parseBoolean((String)params.get("attr")));
 
+                String caches = (String)params.get("caches");
+                restReq0.includeCaches(caches == null || Boolean.parseBoolean(caches));
+
                 restReq0.nodeIp((String)params.get("ip"));
 
                 restReq0.nodeId(uuidValue("id", params));

http://git-wip-us.apache.org/repos/asf/ignite/blob/594aac83/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/agent/AgentManager.service.js b/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
index 8f02177..7226cff 100644
--- a/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
+++ b/modules/web-console/frontend/app/modules/agent/AgentManager.service.js
@@ -542,7 +542,7 @@ export default class AgentManager {
      * @returns {Promise}
      */
     topology(attr = false, mtr = false) {
-        return this._executeOnCluster('node:rest', {cmd: 'top', attr, mtr});
+        return this._executeOnCluster('node:rest', {cmd: 'top', attr, mtr, caches: false});
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/594aac83/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/ClusterListener.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/ClusterListener.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/ClusterListener.java
index 98a7d0f..6985837 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/ClusterListener.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/ClusterListener.java
@@ -426,6 +426,7 @@ public class ClusterListener implements AutoCloseable {
             params.put("cmd", "top");
             params.put("attr", true);
             params.put("mtr", full);
+            params.put("caches", false);
 
             return restCommand(params);
         }


[21/28] ignite git commit: IGNITE-10004: MVCC: Do not rollback transaction in case of parsing error. This closes #5088.

Posted by sb...@apache.org.
IGNITE-10004: MVCC: Do not rollback transaction in case of parsing error. This closes #5088.


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

Branch: refs/heads/ignite-627
Commit: ac093b9e343f1f599054406c5421c0cd921392dd
Parents: 2ad0493
Author: AMRepo <an...@gmail.com>
Authored: Mon Oct 29 16:33:18 2018 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Oct 29 16:33:18 2018 +0300

----------------------------------------------------------------------
 .../jdbc/thin/JdbcThinTransactionsSelfTest.java | 28 ++++++++++++
 .../processors/query/h2/IgniteH2Indexing.java   |  7 ++-
 .../mvcc/CacheMvccSqlTxQueriesAbstractTest.java | 48 ++++++++++++++++++++
 3 files changed, 82 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ac093b9e/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsSelfTest.java
index 1d68712..783a8cd 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsSelfTest.java
@@ -444,4 +444,32 @@ public class JdbcThinTransactionsSelfTest extends JdbcThinAbstractSelfTest {
             }
         }
     }
+
+    /**
+     * Test that exception in one of the statements does not kill connection worker altogether.
+     * @throws SQLException if failed.
+     */
+    @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+    public void testParsingErrorHasNoSideEffect() throws SQLException {
+        try (Connection c = c(false, NestedTxMode.ERROR)) {
+            try (Statement s = c.createStatement()) {
+                s.execute("INSERT INTO INTS(k, v) values(1, 1)");
+
+                GridTestUtils.assertThrows(null, new Callable<Void>() {
+                    @Override public Void call() throws Exception {
+                        s.execute("INSERT INTO INTS(k, v) values(1)");
+
+                        return null;
+                    }
+                }, SQLException.class, "Failed to parse query");
+
+                s.execute("INSERT INTO INTS(k, v) values(2, 2)");
+
+                c.commit();
+            }
+
+            assertEquals(1, grid(0).cache("ints").get(1));
+            assertEquals(2, grid(0).cache("ints").get(2));
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ac093b9e/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 3194eed..866ae99 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -85,6 +85,7 @@ import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
 import org.apache.ignite.internal.processors.cache.query.QueryTable;
 import org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter;
+import org.apache.ignite.internal.processors.odbc.SqlStateCode;
 import org.apache.ignite.internal.processors.query.CacheQueryObjectValueContext;
 import org.apache.ignite.internal.processors.query.GridQueryCacheObjectsIterator;
 import org.apache.ignite.internal.processors.query.GridQueryCancel;
@@ -2202,8 +2203,12 @@ public class IgniteH2Indexing implements GridQueryIndexing {
         catch (RuntimeException | Error e) {
             GridNearTxLocal tx;
 
-            if (mvccEnabled && (tx = tx(ctx)) != null)
+            if (mvccEnabled && (tx = tx(ctx)) != null &&
+                (!(e instanceof IgniteSQLException) || /* Parsing errors should not rollback Tx. */
+                    ((IgniteSQLException)e).sqlState() != SqlStateCode.PARSING_EXCEPTION) ) {
+
                 tx.setRollbackOnly();
+            }
 
             throw e;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ac093b9e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxQueriesAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxQueriesAbstractTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxQueriesAbstractTest.java
index 053d370..b71dd26 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxQueriesAbstractTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxQueriesAbstractTest.java
@@ -50,6 +50,7 @@ import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
 import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
 import org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter;
+import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
 import org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx;
 import org.apache.ignite.internal.processors.query.IgniteSQLException;
 import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException;
@@ -237,6 +238,53 @@ public abstract class CacheMvccSqlTxQueriesAbstractTest extends CacheMvccAbstrac
     /**
      * @throws Exception If failed.
      */
+    public void testParsingErrorHasNoSideEffect() throws Exception {
+        ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 0, 4)
+            .setIndexedTypes(Integer.class, Integer.class);
+
+        IgniteEx node = startGrid(0);
+
+        IgniteCache<Object, Object> cache = node.cache(DEFAULT_CACHE_NAME);
+
+        try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
+            tx.timeout(TX_TIMEOUT);
+
+            SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1),(2,2),(3,3)");
+
+            try {
+                try (FieldsQueryCursor<List<?>> cur = cache.query(qry)) {
+                    fail("We should not get there.");
+                }
+            }
+            catch (CacheException ex){
+                IgniteSQLException cause = X.cause(ex, IgniteSQLException.class);
+
+                assertNotNull(cause);
+                assertEquals(IgniteQueryErrorCode.PARSING, cause.statusCode());
+
+                assertFalse(tx.isRollbackOnly());
+            }
+
+            qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (4,4),(5,5),(6,6)");
+
+            try (FieldsQueryCursor<List<?>> cur = cache.query(qry)) {
+                assertEquals(3L, cur.iterator().next().get(0));
+            }
+
+            tx.commit();
+        }
+
+        assertNull(cache.get(1));
+        assertNull(cache.get(2));
+        assertNull(cache.get(3));
+        assertEquals(4, cache.get(4));
+        assertEquals(5, cache.get(5));
+        assertEquals(6, cache.get(6));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testQueryInsertStaticCache() throws Exception {
         ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT)
             .setIndexedTypes(Integer.class, Integer.class);


[20/28] ignite git commit: IGNITE-10022: JS, PHP thin clients: a more meaningful exception when ENUM type is not registered

Posted by sb...@apache.org.
IGNITE-10022: JS, PHP thin clients: a more meaningful exception when
ENUM type is not registered

This closes #5187


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

Branch: refs/heads/ignite-627
Commit: 2ad04930dd5854c4272fb347858292e464daa83d
Parents: 862c926
Author: ekaterina-nbl <ek...@nobitlost.com>
Authored: Mon Oct 29 15:49:33 2018 +0300
Committer: Igor Sapego <is...@apache.org>
Committed: Mon Oct 29 15:49:33 2018 +0300

----------------------------------------------------------------------
 modules/platforms/nodejs/lib/EnumItem.js        |  17 ++-
 modules/platforms/nodejs/lib/Errors.js          |  12 ++
 .../nodejs/lib/internal/BinaryUtils.js          |   4 +
 modules/platforms/nodejs/spec/TestingHelper.js  |   7 ++
 .../spec/cache/CachePutGetDiffTypes.spec.js     |  39 ++++++
 .../Internal/Binary/BinaryCommunicator.php      |  27 +++--
 .../Ignite/Internal/Binary/BinaryUtils.php      |  12 ++
 modules/platforms/php/tests/CachePutGetTest.php | 119 +++++++++++++++++++
 8 files changed, 221 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad04930/modules/platforms/nodejs/lib/EnumItem.js
----------------------------------------------------------------------
diff --git a/modules/platforms/nodejs/lib/EnumItem.js b/modules/platforms/nodejs/lib/EnumItem.js
index 1d1725e..5e80da9 100644
--- a/modules/platforms/nodejs/lib/EnumItem.js
+++ b/modules/platforms/nodejs/lib/EnumItem.js
@@ -17,6 +17,7 @@
 
 'use strict';
 
+const Util = require('util');
 const ArgumentChecker = require('./internal/ArgumentChecker');
 const Errors = require('./Errors');
 
@@ -157,14 +158,18 @@ class EnumItem {
      * @ignore
      */
     async _write(communicator, buffer) {
+        const type = await this._getType(communicator, this._typeId);
+        if (!type || !type._isEnum) {
+            throw Errors.IgniteClientError.enumSerializationError(
+                true, Util.format('enum type id "%d" is not registered', this._typeId));
+        }
         buffer.writeInteger(this._typeId);
         if (this._ordinal !== null) {
             buffer.writeInteger(this._ordinal);
             return;
         }
         else if (this._name !== null || this._value !== null) {
-            const type = await this._getType(communicator, this._typeId);
-            if (type._isEnum && type._enumValues) {
+            if (type._enumValues) {
                 for (let i = 0; i < type._enumValues.length; i++) {
                     if (this._name === type._enumValues[i][0] ||
                         this._value === type._enumValues[i][1]) {
@@ -185,8 +190,12 @@ class EnumItem {
         this._typeId = buffer.readInteger();
         this._ordinal = buffer.readInteger();
         const type = await this._getType(communicator, this._typeId);
-        if (!type._isEnum || !type._enumValues || type._enumValues.length <= this._ordinal) {
-            throw new Errors.IgniteClientError('EnumItem can not be deserialized: type mismatch');
+        if (!type || !type._isEnum) {
+            throw Errors.IgniteClientError.enumSerializationError(
+                false, Util.format('enum type id "%d" is not registered', this._typeId));
+        }
+        else if (!type._enumValues || type._enumValues.length <= this._ordinal) {
+            throw Errors.IgniteClientError.enumSerializationError(false, 'type mismatch');
         }
         this._name = type._enumValues[this._ordinal][0];
         this._value = type._enumValues[this._ordinal][1];

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad04930/modules/platforms/nodejs/lib/Errors.js
----------------------------------------------------------------------
diff --git a/modules/platforms/nodejs/lib/Errors.js b/modules/platforms/nodejs/lib/Errors.js
index 57a7a8c..89baf38 100644
--- a/modules/platforms/nodejs/lib/Errors.js
+++ b/modules/platforms/nodejs/lib/Errors.js
@@ -83,6 +83,18 @@ class IgniteClientError extends Error {
         }
         return new IgniteClientError(msg);
     }
+
+    /**
+     * EnumItem serialization/deserialization errors.
+     * @ignore
+     */
+    static enumSerializationError(serialize, message = null) {
+        let msg = serialize ? 'Enum item can not be serialized' : 'Enum item can not be deserialized';
+        if (message) {
+            msg = msg + ': ' + message;
+        }
+        return new IgniteClientError(msg);
+    }
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad04930/modules/platforms/nodejs/lib/internal/BinaryUtils.js
----------------------------------------------------------------------
diff --git a/modules/platforms/nodejs/lib/internal/BinaryUtils.js b/modules/platforms/nodejs/lib/internal/BinaryUtils.js
index 2619df7..fe1e403 100644
--- a/modules/platforms/nodejs/lib/internal/BinaryUtils.js
+++ b/modules/platforms/nodejs/lib/internal/BinaryUtils.js
@@ -497,6 +497,10 @@ class BinaryUtils {
             expectedTypeCode === BinaryUtils.TYPE_CODE.COMPLEX_OBJECT) {
             return;
         }
+        else if (expectedTypeCode === BinaryUtils.TYPE_CODE.ENUM &&
+            actualTypeCode === BinaryUtils.TYPE_CODE.BINARY_ENUM) {
+            return;
+        }
         else if (actualTypeCode !== expectedTypeCode) {
             throw Errors.IgniteClientError.typeCastError(actualTypeCode, expectedTypeCode);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad04930/modules/platforms/nodejs/spec/TestingHelper.js
----------------------------------------------------------------------
diff --git a/modules/platforms/nodejs/spec/TestingHelper.js b/modules/platforms/nodejs/spec/TestingHelper.js
index 79a5336..78df0cb 100644
--- a/modules/platforms/nodejs/spec/TestingHelper.js
+++ b/modules/platforms/nodejs/spec/TestingHelper.js
@@ -232,6 +232,13 @@ class TestingHelper {
         TestingHelper.checkError(error, Errors.IgniteClientError, done)
     }
 
+    static checkEnumItemSerializationError(error, done) {
+        if (!(error instanceof Errors.IgniteClientError) ||
+            error.message.indexOf('Enum item can not be serialized') < 0) {
+            done.fail('unexpected error: ' + error);
+        }
+    }
+
     static checkError(error, errorType, done) {
         if (!(error instanceof errorType)) {
             done.fail('unexpected error: ' + error);

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad04930/modules/platforms/nodejs/spec/cache/CachePutGetDiffTypes.spec.js
----------------------------------------------------------------------
diff --git a/modules/platforms/nodejs/spec/cache/CachePutGetDiffTypes.spec.js b/modules/platforms/nodejs/spec/cache/CachePutGetDiffTypes.spec.js
index 28a9ae3..a6e1bba 100644
--- a/modules/platforms/nodejs/spec/cache/CachePutGetDiffTypes.spec.js
+++ b/modules/platforms/nodejs/spec/cache/CachePutGetDiffTypes.spec.js
@@ -543,6 +543,45 @@ describe('cache put get test suite >', () => {
             catch(error => done.fail(error));
     });
 
+    it('put enum items', (done) => {
+        Promise.resolve().
+            then(async () => {
+                const fakeTypeId = 12345;
+                const enumItem1 = new EnumItem(fakeTypeId);
+                enumItem1.setOrdinal(1);
+                await putEnumItem(enumItem1, null, done);
+                await putEnumItem(enumItem1, ObjectType.PRIMITIVE_TYPE.ENUM, done);
+                const enumItem2 = new EnumItem(fakeTypeId);
+                enumItem2.setName('name');
+                await putEnumItem(enumItem2, null, done);
+                await putEnumItem(enumItem2, ObjectType.PRIMITIVE_TYPE.ENUM, done);
+                const enumItem3 = new EnumItem(fakeTypeId);
+                enumItem3.setValue(2);
+                await putEnumItem(enumItem3, null, done);
+                await putEnumItem(enumItem3, ObjectType.PRIMITIVE_TYPE.ENUM, done);
+            }).
+            then(done).
+            catch(error => done.fail(error));
+    });
+
+    async function putEnumItem(value, valueType, done) {
+        const cache = igniteClient.getCache(CACHE_NAME).
+            setKeyType(null).
+            setValueType(valueType);
+        const key = new Date();
+        // Enums registration is not supported by the client, therefore put EnumItem must throw IgniteClientError
+        try {
+            await cache.put(key, value);
+            done.fail('put EnumItem must throw IgniteClientError');
+        }
+        catch (err) {
+            TestingHelper.checkEnumItemSerializationError(err, done);
+        }
+        finally {
+            await cache.removeAll();
+        }
+    }
+
     async function putGetPrimitiveValues(keyType, valueType, key, value, modificator) {
         const cache = await igniteClient.getCache(CACHE_NAME).
             setKeyType(keyType).

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad04930/modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryCommunicator.php
----------------------------------------------------------------------
diff --git a/modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryCommunicator.php b/modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryCommunicator.php
index 520063c..781a730 100644
--- a/modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryCommunicator.php
+++ b/modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryCommunicator.php
@@ -265,8 +265,10 @@ class BinaryCommunicator
         $ordinal = $buffer->readInteger();
         $enumItem->setOrdinal($ordinal);
         $type = $this->typeStorage->getType($enumItem->getTypeId());
-        if (!$type->isEnum() || !$type->getEnumValues() || count($type->getEnumValues()) <= $ordinal) {
-            BinaryUtils::serializationError(false, 'EnumItem can not be deserialized: type mismatch');
+        if (!$type || !$type->isEnum()) {
+            BinaryUtils::enumSerializationError(false, sprintf('enum type id "%d" is not registered', $enumItem->getTypeId()));
+        } elseif (!$type->getEnumValues() || count($type->getEnumValues()) <= $ordinal) {
+            BinaryUtils::enumSerializationError(false, 'type mismatch');
         }
         $enumValues = $type->getEnumValues();
         $enumItem->setName($enumValues[$ordinal][0]);
@@ -396,21 +398,22 @@ class BinaryCommunicator
 
     private function writeEnum(MessageBuffer $buffer, EnumItem $enumValue): void
     {
+        $type = $this->typeStorage->getType($enumValue->getTypeId());
+        if (!$type || !$type->isEnum()) {
+            BinaryUtils::enumSerializationError(true, sprintf('enum type id "%d" is not registered', $enumValue->getTypeId()));
+        }
         $buffer->writeInteger($enumValue->getTypeId());
         if ($enumValue->getOrdinal() !== null) {
             $buffer->writeInteger($enumValue->getOrdinal());
             return;
         } elseif ($enumValue->getName() !== null || $enumValue->getValue() !== null) {
-            $type = $this->typeStorage->getType($enumValue->getTypeId());
-            if ($type && $type->isEnum()) {
-                $enumValues = $type->getEnumValues();
-                if ($enumValues) {
-                    for ($i = 0; $i < count($enumValues); $i++) {
-                        if ($enumValue->getName() === $enumValues[$i][0] ||
-                            $enumValue->getValue() === $enumValues[$i][1]) {
-                            $buffer->writeInteger($i);
-                            return;
-                        }
+            $enumValues = $type->getEnumValues();
+            if ($enumValues) {
+                for ($i = 0; $i < count($enumValues); $i++) {
+                    if ($enumValue->getName() === $enumValues[$i][0] ||
+                        $enumValue->getValue() === $enumValues[$i][1]) {
+                        $buffer->writeInteger($i);
+                        return;
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad04930/modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryUtils.php
----------------------------------------------------------------------
diff --git a/modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryUtils.php b/modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryUtils.php
index ad0bf56..e9ff2f1 100644
--- a/modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryUtils.php
+++ b/modules/platforms/php/src/Apache/Ignite/Internal/Binary/BinaryUtils.php
@@ -203,6 +203,9 @@ class BinaryUtils
             $actualTypeCode === ObjectType::BINARY_OBJECT &&
             $expectedTypeCode === ObjectType::COMPLEX_OBJECT) {
             return;
+        } elseif ($expectedTypeCode === ObjectType::ENUM &&
+            $actualTypeCode === ObjectType::BINARY_ENUM) {
+            return;
         } elseif ($actualTypeCode !== $expectedTypeCode) {
             BinaryUtils::typeCastError($actualTypeCode, $expectedTypeCode);
         }
@@ -419,6 +422,15 @@ class BinaryUtils
         throw new ClientException($msg);
     }
 
+    public static function enumSerializationError(bool $serialize, string $message = null): void
+    {
+        $msg = $serialize ? 'Enum item can not be serialized' : 'Enum item can not be deserialized';
+        if ($message) {
+            $msg = $msg . ': ' . $message;
+        }
+        throw new ClientException($msg);
+    }
+
     public static function typeCastError($fromType, $toType): void
     {
         throw new ClientException(sprintf('Type "%s" can not be cast to %s',

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad04930/modules/platforms/php/tests/CachePutGetTest.php
----------------------------------------------------------------------
diff --git a/modules/platforms/php/tests/CachePutGetTest.php b/modules/platforms/php/tests/CachePutGetTest.php
index 9d15ab2..c3ff1e9 100644
--- a/modules/platforms/php/tests/CachePutGetTest.php
+++ b/modules/platforms/php/tests/CachePutGetTest.php
@@ -18,14 +18,20 @@
 
 namespace Apache\Ignite\Tests;
 
+use \DateTime;
 use Ds\Map;
 use Ds\Set;
 use PHPUnit\Framework\TestCase;
+use Apache\Ignite\Type\ObjectType;
 use Apache\Ignite\Type\MapObjectType;
 use Apache\Ignite\Type\CollectionObjectType;
 use Apache\Ignite\Type\ObjectArrayType;
 use Apache\Ignite\Type\ComplexObjectType;
 use Apache\Ignite\Data\BinaryObject;
+use Apache\Ignite\Data\Date;
+use Apache\Ignite\Data\Timestamp;
+use Apache\Ignite\Data\EnumItem;
+use Apache\Ignite\Exception\ClientException;
 
 class TstComplObjectWithPrimitiveFields
 {
@@ -490,6 +496,119 @@ final class CachePutGetTestCase extends TestCase
         $this->putGetObjectArrays(new ObjectArrayType(new ObjectArrayType(new ComplexObjectType())), $array);
     }
 
+    public function testPutGetDateTime(): void
+    {
+        $this->putGetDate("Y-m-d H:i:s", "2018-10-19 18:31:13", 0);
+        $this->putGetDate("Y-m-d H:i:s", "2018-10-19 18:31:13", 29726);
+        $this->putGetDate("Y-m-d H:i:s", "2018-10-19 18:31:13", 999999);
+
+        $this->putGetTimestamp("Y-m-d H:i:s", "2018-10-19 18:31:13", 0);
+        $this->putGetTimestamp("Y-m-d H:i:s", "2018-10-19 18:31:13", 29726000);
+        $this->putGetTimestamp("Y-m-d H:i:s", "2018-10-19 18:31:13", 999999999);
+
+        $this->putGetTimestampFromDateTime("Y-m-d H:i:s", "2018-10-19 18:31:13", 0);
+        $this->putGetTimestampFromDateTime("Y-m-d H:i:s", "2018-10-19 18:31:13", 29726);
+        $this->putGetTimestampFromDateTime("Y-m-d H:i:s", "2018-10-19 18:31:13", 999999);
+    }
+
+    public function testPutEnumItems(): void
+    {
+        $fakeTypeId = 12345;
+        $enumItem1 = new EnumItem($fakeTypeId);
+        $enumItem1->setOrdinal(1);
+        $this->putEnumItem($enumItem1, null);
+        $this->putEnumItem($enumItem1, ObjectType::ENUM);
+        $enumItem2 = new EnumItem($fakeTypeId);
+        $enumItem2->setName('name');
+        $this->putEnumItem($enumItem2, null);
+        $this->putEnumItem($enumItem2, ObjectType::ENUM);
+        $enumItem3 = new EnumItem($fakeTypeId);
+        $enumItem3->setOrdinal(2);
+        $this->putEnumItem($enumItem3, null);
+        $this->putEnumItem($enumItem3, ObjectType::ENUM);
+    }
+
+    private function putEnumItem($value, $valueType): void
+    {
+        $key = microtime();
+        self::$cache->
+            setKeyType(null)->
+            setValueType($valueType);
+        // Enums registration is not supported by the client, therefore put EnumItem must throw ClientException
+        try {
+            self::$cache->put($key, $value);
+            $this->fail('put EnumItem must throw ClientException');
+        } catch (ClientException $e) {
+            $this->assertContains('Enum item can not be serialized', $e->getMessage());
+        } finally {
+            self::$cache->removeAll();
+        }
+    }
+
+    private function putGetDate(string $format, string $dateString, int $micros): void
+    {
+        $key = microtime();
+        self::$cache->
+            setKeyType(null)->
+            setValueType(ObjectType::DATE);
+        try {
+            $dt = DateTime::createFromFormat("$format.u", sprintf("%s.%06d", $dateString, $micros));
+            $iDate = Date::fromDateTime($dt);
+            self::$cache->put($key, $iDate);
+            $result = self::$cache->get($key);
+
+            $this->assertEquals(sprintf("%06d", intval($micros / 1000) * 1000), $result->toDateTime()->format('u'));
+            $this->assertEquals($dateString, $result->toDateTime()->format($format));
+        } finally {
+            self::$cache->removeAll();
+        }
+    }
+
+    private function putGetTimestamp(string $format, string $dateString, int $nanos): void
+    {
+        $key = microtime();
+        self::$cache->
+            setKeyType(null)->
+            setValueType(ObjectType::TIMESTAMP);
+
+        try {
+            $millis = intval($nanos / 1000000);
+            $nanosInMillis = $nanos % 1000000;
+            self::$cache->put($key,
+                new Timestamp(
+                    DateTime::createFromFormat($format, $dateString)->getTimestamp() * 1000 + $millis,
+                    $nanosInMillis
+                )
+            );
+            $result = self::$cache->get($key);
+
+            $this->assertEquals($nanos % 1000000, $result->getNanos());
+            $this->assertEquals($dateString, $result->toDateTime()->format($format));
+        } finally {
+            self::$cache->removeAll();
+        }
+    }
+
+    private function putGetTimestampFromDateTime(string $format, string $dateString, $micros): void
+    {
+        $key = microtime();
+        self::$cache->
+            setKeyType(null)->
+            setValueType(ObjectType::TIMESTAMP);
+
+        try {
+            self::$cache->put($key, Timestamp::fromDateTime(
+                DateTime::createFromFormat("$format.u", sprintf("%s.%06d", $dateString, $micros))
+            ));
+            $result = self::$cache->get($key);
+
+            $this->assertEquals(intval($micros / 1000) * 1000, $result->toDateTime()->format('u'));
+            $this->assertEquals($dateString, $result->toDateTime()->format($format));
+        } finally {
+            self::$cache->removeAll();
+        }
+    }
+
     private function putGetObjectArrays(?ObjectArrayType $arrayType, array $value): void
     {
         $key = microtime();


[19/28] ignite git commit: IGNITE-9682 Update partition full map in parallel - Fixes #4824.

Posted by sb...@apache.org.
IGNITE-9682 Update partition full map in parallel - Fixes #4824.

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

Branch: refs/heads/ignite-627
Commit: 862c9264fc05816f96ea594807854502ff3dd00a
Parents: 2906a16
Author: Oleg Ostanin <oo...@gridgain.com>
Authored: Mon Oct 29 13:28:07 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Oct 29 13:28:07 2018 +0300

----------------------------------------------------------------------
 .../GridDhtPartitionsExchangeFuture.java        | 66 ++++++++++++--------
 1 file changed, 39 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/862c9264/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 0fc9c24..9314096 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
@@ -130,6 +130,7 @@ import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYS
 import static org.apache.ignite.internal.processors.cache.ExchangeDiscoveryEvents.serverJoinEvent;
 import static org.apache.ignite.internal.processors.cache.ExchangeDiscoveryEvents.serverLeftEvent;
 import static org.apache.ignite.internal.processors.cache.distributed.dht.preloader.CachePartitionPartialCountersMap.PARTIAL_COUNTERS_MAP_SINCE;
+import static org.apache.ignite.internal.util.IgniteUtils.doInParallel;
 
 /**
  * Future for exchanging partition maps.
@@ -3948,39 +3949,50 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
 
         long time = System.currentTimeMillis();
 
-        for (Map.Entry<Integer, GridDhtPartitionFullMap> entry : msg.partitions().entrySet()) {
-            Integer grpId = entry.getKey();
+        int parallelismLvl = cctx.kernalContext().config().getSystemThreadPoolSize();
 
-            CacheGroupContext grp = cctx.cache().cacheGroup(grpId);
+        // Reserve at least 2 threads for system operations.
+        parallelismLvl = Math.max(1, parallelismLvl - 2);
 
-            if (grp != null) {
-                CachePartitionFullCountersMap cntrMap = msg.partitionUpdateCounters(grpId,
-                    grp.topology().partitions());
+        try {
+            doInParallel(
+                parallelismLvl,
+                cctx.kernalContext().getSystemExecutorService(),
+                msg.partitions().keySet(), grpId -> {
+                    CacheGroupContext grp = cctx.cache().cacheGroup(grpId);
 
-                grp.topology().update(resTopVer,
-                    entry.getValue(),
-                    cntrMap,
-                    msg.partsToReload(cctx.localNodeId(), grpId),
-                    msg.partitionSizes(grpId),
-                    null);
-            }
-            else {
-                ClusterNode oldest = cctx.discovery().oldestAliveServerNode(AffinityTopologyVersion.NONE);
+                    if (grp != null) {
+                        CachePartitionFullCountersMap cntrMap = msg.partitionUpdateCounters(grpId,
+                            grp.topology().partitions());
 
-                if (oldest != null && oldest.isLocal()) {
-                    GridDhtPartitionTopology top = cctx.exchange().clientTopology(grpId, events().discoveryCache());
+                        grp.topology().update(resTopVer,
+                            msg.partitions().get(grpId),
+                            cntrMap,
+                            msg.partsToReload(cctx.localNodeId(), grpId),
+                            msg.partitionSizes(grpId),
+                            null);
+                    }
+                    else {
+                        ClusterNode oldest = cctx.discovery().oldestAliveServerNode(AffinityTopologyVersion.NONE);
 
-                    CachePartitionFullCountersMap cntrMap = msg.partitionUpdateCounters(grpId,
-                        top.partitions());
+                        if (oldest != null && oldest.isLocal()) {
+                            GridDhtPartitionTopology top = cctx.exchange().clientTopology(grpId, events().discoveryCache());
 
-                    top.update(resTopVer,
-                        entry.getValue(),
-                        cntrMap,
-                        Collections.emptySet(),
-                        null,
-                        null);
-                }
-            }
+                            CachePartitionFullCountersMap cntrMap = msg.partitionUpdateCounters(grpId,
+                                top.partitions());
+
+                            top.update(resTopVer,
+                                msg.partitions().get(grpId),
+                                cntrMap,
+                                Collections.emptySet(),
+                                null,
+                                null);
+                        }
+                    }
+                });
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
         }
 
         partitionsReceived = true;


[12/28] ignite git commit: GNITE-8006 Fixed flaky test

Posted by sb...@apache.org.
GNITE-8006 Fixed flaky test


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

Branch: refs/heads/ignite-627
Commit: 781d4e7812d0eaf789c287ba69374d625a13e32c
Parents: b873c45
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Sat Oct 27 17:55:54 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Sat Oct 27 17:55:54 2018 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/781d4e78/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 13a1044..ad678b6 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
@@ -923,7 +923,7 @@ public class IgniteUtilsSelfTest extends GridCommonAbstractTest {
             fail("Should throw timeout exception");
         }
         catch (Exception e) {
-            assertTrue(e.getCause() instanceof TimeoutException);
+            assertTrue(e.toString(), X.hasCause(e, TimeoutException.class));
         }
     }
 


[11/28] ignite git commit: IGNITE-9884 Tests should be muted correctly (unmuted passing tests) - Fixes #5055.

Posted by sb...@apache.org.
IGNITE-9884 Tests should be muted correctly (unmuted passing tests) - Fixes #5055.

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

Branch: refs/heads/ignite-627
Commit: b873c4563029394ba341da2c0ea442cb8a473fd0
Parents: e111d89
Author: Oleg Ignatenko <oi...@gridgain.com>
Authored: Sat Oct 27 17:23:16 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Sat Oct 27 17:28:15 2018 +0300

----------------------------------------------------------------------
 .../cache/GridCacheAbstractFullApiSelfTest.java | 14 +++-----
 ...ridCacheStoreManagerDeserializationTest.java |  4 +--
 .../IgniteCacheConfigVariationsFullApiTest.java |  4 +--
 .../cache/mvcc/CacheMvccTransactionsTest.java   |  6 ++--
 .../pagemem/PageIdDistributionTest.java         |  4 +--
 .../continuous/GridEventConsumeSelfTest.java    |  2 +-
 .../processors/database/BPlusTreeSelfTest.java  | 34 --------------------
 ...GridServiceProcessorBatchDeploySelfTest.java | 22 ++++++-------
 ...gniteClientReconnectMassiveShutdownTest.java |  4 +--
 .../tcp/TcpDiscoveryMultiThreadedTest.java      |  4 ++-
 10 files changed, 26 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b873c456/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 371ca9f..5f4f349 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -273,20 +273,14 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      * Checks that any invoke returns result.
      *
      * @throws Exception if something goes bad.
-     *
-     * TODO https://issues.apache.org/jira/browse/IGNITE-4380.
      */
-    public void _testInvokeAllMultithreaded() throws Exception {
+    public void testInvokeAllMultithreaded() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-4380");
+
         final IgniteCache<String, Integer> cache = jcache();
         final int threadCnt = 4;
         final int cnt = 5000;
 
-        // Concurrent invoke can not be used for ATOMIC cache in CLOCK mode.
-        if (atomicityMode() == ATOMIC &&
-            cacheMode() != LOCAL &&
-            false)
-            return;
-
         final Set<String> keys = Collections.singleton("myKey");
 
         GridTestUtils.runMultiThreaded(new Runnable() {
@@ -5031,7 +5025,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
                 // If AssertionFailedError is in the chain, assume we need to wait and retry.
                 if (!X.hasCause(t, AssertionFailedError.class))
                     throw t;
-                
+
                 if (i == 9) {
                     for (int j = 0; j < gridCount(); j++)
                         executeOnLocalOrRemoteJvm(j, new PrintIteratorStateTask());

http://git-wip-us.apache.org/repos/asf/ignite/blob/b873c456/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
index a1623d2..1332d36 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
@@ -203,13 +203,11 @@ public class GridCacheStoreManagerDeserializationTest extends GridCommonAbstract
     }
 
     /**
-     * TODO GG-11148.
-     *
      * Check whether binary objects are stored without unmarshalling via stream API.
      *
      * @throws Exception If failed.
      */
-    public void _testBinaryStream() throws Exception {
+    public void testBinaryStream() throws Exception {
         final Ignite grid = startGrid("binaryGrid");
 
         final IgniteCache<BinaryObject, BinaryObject> cache = grid.createCache(CACHE_NAME).withKeepBinary();

http://git-wip-us.apache.org/repos/asf/ignite/blob/b873c456/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
index e2b1a2e..6422463 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
@@ -3203,11 +3203,9 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
     }
 
     /**
-     * TODO: GG-11241.
-     *
      * @throws Exception If failed.
      */
-    public void _testDeletedEntriesFlag() throws Exception {
+    public void testDeletedEntriesFlag() throws Exception {
         if (cacheMode() != LOCAL && cacheMode() != REPLICATED) {
             final int cnt = 3;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b873c456/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java
index ca3c09f..b9bbfcf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java
@@ -2064,11 +2064,11 @@ public class CacheMvccTransactionsTest extends CacheMvccAbstractTest {
     }
 
     /**
-     * TODO IGNITE-5935 enable when recovery is implemented.
-     *
      * @throws Exception If failed.
      */
-    public void _testNodesRestartNoHang() throws Exception {
+    public void testNodesRestartNoHang() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-5935");
+
         final int srvs = 4;
         final int clients = 4;
         final int writers = 6;

http://git-wip-us.apache.org/repos/asf/ignite/blob/b873c456/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageIdDistributionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageIdDistributionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageIdDistributionTest.java
index 2008b22..1f4b94f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageIdDistributionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageIdDistributionTest.java
@@ -140,7 +140,7 @@ public class PageIdDistributionTest extends GridCommonAbstractTest {
     }
 
     /**
-     * Uncomment and run this test manually to get data to plot histogram for per-element distance from ideal.
+     * If needed run this test manually to get data to plot histogram for per-element distance from ideal.
      * You can use Octave to plot the histogram:
      * <pre>
      *     all = csvread("histo.txt");
@@ -149,7 +149,7 @@ public class PageIdDistributionTest extends GridCommonAbstractTest {
      *
      * @throws Exception If failed.
      */
-    public void _testRealHistory() throws Exception {
+    public void testRealHistory() throws Exception {
         int capacity = CACHE_IDS.length * PARTS * PAGES;
 
         info("Capacity: " + capacity);

http://git-wip-us.apache.org/repos/asf/ignite/blob/b873c456/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
index 1a7abd4..d2d895e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
@@ -1145,7 +1145,7 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
-    public void _testMultithreadedWithNodeRestart() throws Exception {
+    public void testMultithreadedWithNodeRestart() throws Exception {
         final AtomicBoolean stop = new AtomicBoolean();
         final BlockingQueue<IgniteBiTuple<Integer, UUID>> queue = new LinkedBlockingQueue<>();
         final Collection<UUID> started = new GridConcurrentHashSet<>();

http://git-wip-us.apache.org/repos/asf/ignite/blob/b873c456/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 6b694c9..fa72978 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
@@ -299,40 +299,6 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest {
     }
 
     /**
-     * @throws IgniteCheckedException If failed.
-     */
-    public void _testBenchInvoke() throws IgniteCheckedException {
-        MAX_PER_PAGE = 10;
-
-        TestTree tree = createTestTree(true);
-
-        long start = System.nanoTime();
-
-        for (int i = 0; i < 10_000_000; i++) {
-            final long key = BPlusTree.randomInt(1000);
-
-//            tree.findOne(key); // 39
-//            tree.putx(key); // 22
-
-            tree.invoke(key, null, new IgniteTree.InvokeClosure<Long>() { // 25
-                @Override public void call(@Nullable Long row) throws IgniteCheckedException {
-                    // No-op.
-                }
-
-                @Override public Long newRow() {
-                    return key;
-                }
-
-                @Override public IgniteTree.OperationType operationType() {
-                    return PUT;
-                }
-            });
-        }
-
-        X.println("   __ time: " + TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start));
-    }
-
-    /**
      * @param cursor cursor to check.
      * @param iterator iterator with expected result.
      * @throws IgniteCheckedException If failed

http://git-wip-us.apache.org/repos/asf/ignite/blob/b873c456/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorBatchDeploySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorBatchDeploySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorBatchDeploySelfTest.java
index f0e2e71..c461ce2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorBatchDeploySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorBatchDeploySelfTest.java
@@ -129,11 +129,9 @@ public class GridServiceProcessorBatchDeploySelfTest extends GridCommonAbstractT
     }
 
     /**
-     * TODO: enable when IGNITE-6259 is fixed.
-     *
      * @throws Exception If failed.
      */
-    public void _testDeployAllTopologyChange() throws Exception {
+    public void testDeployAllTopologyChange() throws Exception {
         Ignite client = grid(CLIENT_NODE_NAME);
 
         final AtomicBoolean finished = new AtomicBoolean();
@@ -141,7 +139,7 @@ public class GridServiceProcessorBatchDeploySelfTest extends GridCommonAbstractT
         IgniteInternalFuture<Object> topChangeFut = runTopChanger(finished);
 
         try {
-            int numServices = 500;
+            int numServices = 50;
             int batchSize = 5;
 
             CountDownLatch latch = new CountDownLatch(numServices);
@@ -171,7 +169,7 @@ public class GridServiceProcessorBatchDeploySelfTest extends GridCommonAbstractT
                 from = to;
             }
 
-            assertTrue(latch.await(30, TimeUnit.SECONDS));
+            assertTrue(latch.await(120, TimeUnit.SECONDS));
 
             assertDeployedServices(client, cfgs);
         }
@@ -183,11 +181,9 @@ public class GridServiceProcessorBatchDeploySelfTest extends GridCommonAbstractT
     }
 
     /**
-     * TODO: enable when IGNITE-6259 is fixed.
-     *
      * @throws Exception If failed.
      */
-    public void _testDeployAllTopologyChangeFail() throws Exception {
+    public void testDeployAllTopologyChangeFail() throws Exception {
         final Ignite client = grid(CLIENT_NODE_NAME);
 
         final AtomicBoolean finished = new AtomicBoolean();
@@ -195,7 +191,7 @@ public class GridServiceProcessorBatchDeploySelfTest extends GridCommonAbstractT
         IgniteInternalFuture<Object> topChangeFut = runTopChanger(finished);
 
         try {
-            int numServices = 500;
+            int numServices = 200;
             int batchSize = 5;
 
             CountDownLatch latch = new CountDownLatch(numServices);
@@ -248,7 +244,7 @@ public class GridServiceProcessorBatchDeploySelfTest extends GridCommonAbstractT
                 from = to;
             }
 
-            assertTrue(latch.await(30, TimeUnit.SECONDS));
+            assertTrue(latch.await(120, TimeUnit.SECONDS));
 
             cfgs.removeAll(failingCfgs);
 
@@ -436,11 +432,11 @@ public class GridServiceProcessorBatchDeploySelfTest extends GridCommonAbstractT
     }
 
     /**
-     * TODO: enable when IGNITE-6259 is fixed.
-     *
      * @throws Exception If failed.
      */
-    public void _testCancelAllTopologyChange() throws Exception {
+    public void testCancelAllTopologyChange() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-10021");
+
         Ignite client = grid(CLIENT_NODE_NAME);
 
         int numServices = 500;

http://git-wip-us.apache.org/repos/asf/ignite/blob/b873c456/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/IgniteClientReconnectMassiveShutdownTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/IgniteClientReconnectMassiveShutdownTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/IgniteClientReconnectMassiveShutdownTest.java
index 2878110..6bd2a45 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/IgniteClientReconnectMassiveShutdownTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/IgniteClientReconnectMassiveShutdownTest.java
@@ -95,7 +95,7 @@ public class IgniteClientReconnectMassiveShutdownTest extends GridCommonAbstract
     /**
      * @throws Exception If any error occurs.
      */
-    public void _testMassiveServersShutdown1() throws Exception {
+    public void testMassiveServersShutdown1() throws Exception {
         massiveServersShutdown(StopType.FAIL_EVENT);
     }
 
@@ -109,7 +109,7 @@ public class IgniteClientReconnectMassiveShutdownTest extends GridCommonAbstract
     /**
      * @throws Exception If any error occurs.
      */
-    public void _testMassiveServersShutdown3() throws Exception {
+    public void testMassiveServersShutdown3() throws Exception {
         massiveServersShutdown(StopType.CLOSE);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b873c456/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
index 70d5078..06021d2 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
@@ -228,7 +228,9 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
     /**
      * @throws Exception If any error occurs.
      */
-    public void _testMultiThreadedServersRestart() throws Throwable {
+    public void testMultiThreadedServersRestart() throws Throwable {
+        fail("https://issues.apache.org/jira/browse/IGNITE-1123");
+
         multiThreadedClientsServersRestart(GRID_CNT * 2, 0);
     }
 


[02/28] ignite git commit: IGNITE-8873 Added methods to preload partitions to page memory - Fixes #5053.

Posted by sb...@apache.org.
IGNITE-8873 Added methods to preload partitions to page memory - Fixes #5053.

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

Branch: refs/heads/ignite-627
Commit: 28e3dec5b4c9bffcca5391cac8bee824973fc7a4
Parents: 51d8c9f
Author: Aleksei Scherbakov <al...@gmail.com>
Authored: Fri Oct 26 13:00:22 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Oct 26 13:01:10 2018 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/IgniteCache.java     |  49 +-
 .../cache/GatewayProtectedCacheProxy.java       |  36 ++
 .../processors/cache/GridCacheAdapter.java      | 132 +++++
 .../processors/cache/GridCacheProxyImpl.java    |  36 ++
 .../cache/IgniteCacheOffheapManager.java        |  20 +-
 .../cache/IgniteCacheOffheapManagerImpl.java    |  10 +
 .../processors/cache/IgniteCacheProxyImpl.java  |  30 ++
 .../processors/cache/IgniteInternalCache.java   |  23 +
 .../topology/GridDhtPartitionsReservation.java  |   2 +-
 .../processors/cache/local/GridLocalCache.java  |  23 +
 .../persistence/GridCacheOffheapManager.java    |  49 ++
 .../db/IgnitePdsPartitionPreloadTest.java       | 495 +++++++++++++++++++
 .../multijvm/IgniteCacheProcessProxy.java       |  15 +
 .../ignite/testsuites/IgnitePdsTestSuite4.java  |   3 +
 .../cache/hibernate/HibernateCacheProxy.java    |  15 +
 .../ApiParity/CacheParityTest.cs                |   5 +-
 16 files changed, 937 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/28e3dec5/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index 8479420..70ee0d5 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -1516,7 +1516,7 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
     /**
      * Gets a collection of lost partition IDs.
      *
-     * @return Lost paritions.
+     * @return Lost partitions.
      */
     public Collection<Integer> lostPartitions();
 
@@ -1531,4 +1531,51 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * Clear cluster statistics for this cache.
      */
     public void clearStatistics();
+
+    /**
+     * Efficiently preloads cache primary partition into page memory.
+     * <p>
+     * This is useful for fast iteration over cache partition data if persistence is enabled and the data is "cold".
+     * <p>
+     * Preload will reduce available amount of page memory for subsequent operations and may lead to earlier page
+     * replacement.
+     * <p>
+     * This method is irrelevant for in-memory caches. Calling this method on an in-memory cache will result in
+     * exception.
+     *
+     * @param partition Partition.
+     */
+    public void preloadPartition(int partition);
+
+    /**
+     * Efficiently preloads cache partition into page memory.
+     * <p>
+     * This is useful for fast iteration over cache partition data if persistence is enabled and the data is "cold".
+     * <p>
+     * Preload will reduce available amount of page memory for subsequent operations and may lead to earlier page
+     * replacement.
+     * <p>
+     * This method is irrelevant for in-memory caches. Calling this method on an in-memory cache will result in
+     * exception.
+     *
+     * @param partition Partition.
+     * @return A future representing pending completion of the partition preloading.
+     */
+    public IgniteFuture<Void> preloadPartitionAsync(int partition);
+
+    /**
+     * Efficiently preloads cache partition into page memory if it exists on the local node.
+     * <p>
+     * This is useful for fast iteration over cache partition data if persistence is enabled and the data is "cold".
+     * <p>
+     * Preload will reduce available amount of page memory for subsequent operations and may lead to earlier page
+     * replacement.
+     * <p>
+     * This method is irrelevant for in-memory caches. Calling this method on an in-memory cache will result in
+     * exception.
+     *
+     * @param partition Partition.
+     * @return {@code True} if partition was preloaded, {@code false} if it doesn't belong to local node.
+     */
+    public boolean localPreloadPartition(int partition);
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/28e3dec5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java
index c99eb00..0735a88 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java
@@ -1494,6 +1494,42 @@ public class GatewayProtectedCacheProxy<K, V> extends AsyncSupportAdapter<Ignite
         }
     }
 
+    /** {@inheritDoc} */
+    @Override public void preloadPartition(int part) {
+        CacheOperationGate opGate = onEnter();
+
+        try {
+            delegate.preloadPartition(part);
+        }
+        finally {
+            onLeave(opGate);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteFuture<Void> preloadPartitionAsync(int part) {
+        CacheOperationGate opGate = onEnter();
+
+        try {
+            return delegate.preloadPartitionAsync(part);
+        }
+        finally {
+            onLeave(opGate);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean localPreloadPartition(int part) {
+        CacheOperationGate opGate = onEnter();
+
+        try {
+            return delegate.localPreloadPartition(part);
+        }
+        finally {
+            onLeave(opGate);
+        }
+    }
+
     /**
      * Safely get CacheGateway.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/28e3dec5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 9574d49..7cba419 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -90,6 +90,8 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheA
 import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtInvalidPartitionException;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter;
+import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition;
+import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionTopology;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
 import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot;
@@ -136,10 +138,13 @@ import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgniteOutClosure;
 import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.lang.IgniteProductVersion;
+import org.apache.ignite.lang.IgniteRunnable;
 import org.apache.ignite.mxbean.CacheMetricsMXBean;
 import org.apache.ignite.plugin.security.SecurityPermission;
 import org.apache.ignite.resources.IgniteInstanceResource;
 import org.apache.ignite.resources.JobContextResource;
+import org.apache.ignite.resources.LoggerResource;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
@@ -149,6 +154,7 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_CACHE_KEY_VALIDATI
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_CACHE_RETRIES_COUNT;
 import static org.apache.ignite.internal.GridClosureCallMode.BROADCAST;
 import static org.apache.ignite.internal.processors.cache.CacheOperationContext.DFLT_ALLOW_ATOMIC_OPS_IN_TX;
+import static org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState.OWNING;
 import static org.apache.ignite.internal.processors.dr.GridDrType.DR_LOAD;
 import static org.apache.ignite.internal.processors.dr.GridDrType.DR_NONE;
 import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.TC_NO_FAILOVER;
@@ -179,6 +185,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     /** Maximum number of retries when topology changes. */
     public static final int MAX_RETRIES = IgniteSystemProperties.getInteger(IGNITE_CACHE_RETRIES_COUNT, 100);
 
+    /** Minimum version supporting partition preloading. */
+    private static final IgniteProductVersion PRELOAD_PARTITION_SINCE = IgniteProductVersion.fromString("2.7.0");
+
     /** Deserialization stash. */
     private static final ThreadLocal<IgniteBiTuple<String, String>> stash = new ThreadLocal<IgniteBiTuple<String,
         String>>() {
@@ -284,6 +293,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     /** Asynchronous operations limit semaphore. */
     private Semaphore asyncOpsSem;
 
+    /** {@code True} if attempted to use partition preloading on outdated node. */
+    private volatile boolean partPreloadBadVerWarned;
+
     /** Active. */
     private volatile boolean active;
 
@@ -1262,6 +1274,31 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     }
 
     /**
+     * @param part Partition id.
+     * @return Future.
+     */
+    private IgniteInternalFuture<?> executePreloadTask(int part) throws IgniteCheckedException {
+        ClusterGroup grp = ctx.grid().cluster().forDataNodes(ctx.name());
+
+        @Nullable ClusterNode targetNode = ctx.affinity().primaryByPartition(part, ctx.topology().readyTopologyVersion());
+
+        if (targetNode == null || targetNode.version().compareTo(PRELOAD_PARTITION_SINCE) < 0) {
+            if (!partPreloadBadVerWarned) {
+                U.warn(log(), "Attempting to execute partition preloading task on outdated or not mapped node " +
+                    "[targetNodeVer=" + (targetNode == null ? "NA" : targetNode.version()) +
+                    ", minSupportedNodeVer=" + PRELOAD_PARTITION_SINCE + ']');
+
+                partPreloadBadVerWarned = true;
+            }
+
+            return new GridFinishedFuture<>();
+        }
+
+        return ctx.closures().affinityRun(Collections.singleton(name()), part,
+            new PartitionPreloadJob(ctx.name(), part), grp.nodes(), null);
+    }
+
+    /**
      * @param keys Keys.
      * @param readers Readers flag.
      */
@@ -4961,6 +4998,55 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         return new CacheEntryImpl<>((K)key0, (V)val0, entry.version());
     }
 
+    /** {@inheritDoc} */
+    @Override public void preloadPartition(int part) throws IgniteCheckedException {
+        if (isLocal())
+            ctx.offheap().preloadPartition(part);
+        else
+            executePreloadTask(part).get();
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> preloadPartitionAsync(int part) throws IgniteCheckedException {
+        if (isLocal()) {
+            return ctx.kernalContext().closure().runLocalSafe(() -> {
+                try {
+                    ctx.offheap().preloadPartition(part);
+                }
+                catch (IgniteCheckedException e) {
+                    throw new IgniteException(e);
+                }
+            });
+        }
+        else
+            return executePreloadTask(part);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean localPreloadPartition(int part) throws IgniteCheckedException {
+        if (!ctx.affinityNode())
+            return false;
+
+        GridDhtPartitionTopology top = ctx.group().topology();
+
+        @Nullable GridDhtLocalPartition p = top.localPartition(part, top.readyTopologyVersion(), false);
+
+        if (p == null)
+            return false;
+
+        try {
+            if (!p.reserve() || p.state() != OWNING)
+                return false;
+
+            p.dataStore().preload();
+        }
+        finally {
+            p.release();
+        }
+
+        return true;
+    }
+
     /**
      *
      */
@@ -6692,6 +6778,52 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     }
 
     /**
+     * Partition preload job.
+     */
+    @GridInternal
+    private static class PartitionPreloadJob implements IgniteRunnable {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** */
+        @IgniteInstanceResource
+        private IgniteEx ignite;
+
+        /** */
+        @LoggerResource
+        private IgniteLogger log;
+
+        /** */
+        private final String name;
+
+        /** Cache name. */
+        private final int part;
+
+        /**
+         * @param name Name.
+         * @param part Partition.
+         */
+        public PartitionPreloadJob(String name, int part) {
+            this.name = name;
+            this.part = part;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void run() {
+            IgniteInternalCache cache = ignite.context().cache().cache(name);
+
+            try {
+                cache.context().offheap().preloadPartition(part);
+            }
+            catch (IgniteCheckedException e) {
+                log.error("Failed to preload the partition [cache=" + name + ", partition=" + part + ']', e);
+
+                throw new IgniteException(e);
+            }
+        }
+    }
+
+    /**
      * Iterator implementation for KeySet.
      */
     private final class KeySetIterator implements Iterator<K> {

http://git-wip-us.apache.org/repos/asf/ignite/blob/28e3dec5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
index ebb8b5e..6b3ca56 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
@@ -239,6 +239,42 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K, V>, Exte
     }
 
     /** {@inheritDoc} */
+    @Override public void preloadPartition(int part) throws IgniteCheckedException {
+        CacheOperationContext prev = gate.enter(opCtx);
+
+        try {
+            delegate.preloadPartition(part);
+        }
+        finally {
+            gate.leave(prev);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> preloadPartitionAsync(int part) throws IgniteCheckedException {
+        CacheOperationContext prev = gate.enter(opCtx);
+
+        try {
+            return delegate.preloadPartitionAsync(part);
+        }
+        finally {
+            gate.leave(prev);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean localPreloadPartition(int part) throws IgniteCheckedException {
+        CacheOperationContext prev = gate.enter(opCtx);
+
+        try {
+            return delegate.localPreloadPartition(part);
+        }
+        finally {
+            gate.leave(prev);
+        }
+    }
+
+    /** {@inheritDoc} */
     @Override public GridCacheProxyImpl<K, V> forSubjectId(UUID subjId) {
         return new GridCacheProxyImpl<>(ctx, delegate,
             opCtx != null ? opCtx.forSubjectId(subjId) :

http://git-wip-us.apache.org/repos/asf/ignite/blob/28e3dec5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
index e9ec025..66d927f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
@@ -590,6 +590,14 @@ public interface IgniteCacheOffheapManager {
     public long totalPartitionEntriesCount(int part);
 
     /**
+     * Preload a partition. Must be called under partition reservation for DHT caches.
+     *
+     * @param part Partition.
+     * @throws IgniteCheckedException If failed.
+     */
+    public void preloadPartition(int part) throws IgniteCheckedException;
+
+    /**
      *
      */
     interface OffheapInvokeClosure extends IgniteTree.InvokeClosure<CacheDataRow> {
@@ -1054,7 +1062,7 @@ public interface IgniteCacheOffheapManager {
         /**
          * @param cntr Counter.
          */
-        void updateInitialCounter(long cntr);
+        public void updateInitialCounter(long cntr);
 
         /**
          * Inject rows cache cleaner.
@@ -1068,11 +1076,17 @@ public interface IgniteCacheOffheapManager {
          *
          * @return PendingTree instance.
          */
-        PendingEntriesTree pendingTree();
+        public PendingEntriesTree pendingTree();
 
         /**
          * Flushes pending update counters closing all possible gaps.
          */
-        void finalizeUpdateCountres();
+        public void finalizeUpdateCountres();
+
+        /**
+         * Preload a store into page memory.
+         * @throws IgniteCheckedException If failed.
+         */
+        public void preload() throws IgniteCheckedException;
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/28e3dec5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
index e547784..c450d02 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
@@ -336,6 +336,11 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
         }
     }
 
+    /** {@inheritDoc} */
+    @Override public void preloadPartition(int p) throws IgniteCheckedException {
+        throw new IgniteCheckedException("Operation only applicable to caches with enabled persistence");
+    }
+
     /**
      * @param p Partition.
      * @return Partition data.
@@ -2906,6 +2911,11 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
             return pendingEntries;
         }
 
+        /** {@inheritDoc} */
+        @Override public void preload() throws IgniteCheckedException {
+            // No-op.
+        }
+
         /**
          * @param cctx Cache context.
          * @param key Key.

http://git-wip-us.apache.org/repos/asf/ignite/blob/28e3dec5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
index 776e1cb..addd189 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
@@ -1827,6 +1827,36 @@ public class IgniteCacheProxyImpl<K, V> extends AsyncSupportAdapter<IgniteCache<
     }
 
     /** {@inheritDoc} */
+    @Override public void preloadPartition(int part) {
+        try {
+            delegate.preloadPartition(part);
+        }
+        catch (IgniteCheckedException e) {
+            throw cacheException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteFuture<Void> preloadPartitionAsync(int part) {
+        try {
+            return (IgniteFuture<Void>)createFuture(delegate.preloadPartitionAsync(part));
+        }
+        catch (IgniteCheckedException e) {
+            throw cacheException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean localPreloadPartition(int part) {
+        try {
+            return delegate.localPreloadPartition(part);
+        }
+        catch (IgniteCheckedException e) {
+            throw cacheException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         out.writeObject(ctx);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/28e3dec5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
index cba2228..9d40190 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
@@ -1818,4 +1818,27 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K, V>> {
      * @return A collection of lost partitions if a cache is in recovery state.
      */
     public Collection<Integer> lostPartitions();
+
+    /**
+     * Preload cache partition.
+     * @param part Partition.
+     * @throws IgniteCheckedException If failed.
+     */
+    public void preloadPartition(int part) throws IgniteCheckedException;
+
+    /**
+     * Preload cache partition.
+     * @param part Partition.
+     * @return Future to be completed whenever preloading completes.
+     * @throws IgniteCheckedException If failed.
+     */
+    public IgniteInternalFuture<?> preloadPartitionAsync(int part) throws IgniteCheckedException;
+
+    /**
+     * Preloads cache partition if it exists on local node.
+     * @param part Partition.
+     * @return {@code True} if partition was preloaded, {@code false} if it doesn't belong to local node.
+     * @throws IgniteCheckedException If failed.
+     */
+    public boolean localPreloadPartition(int part) throws IgniteCheckedException;
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/28e3dec5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionsReservation.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionsReservation.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionsReservation.java
index 2682a89..5017486 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionsReservation.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionsReservation.java
@@ -179,7 +179,7 @@ public class GridDhtPartitionsReservation implements GridReservable {
      */
     private static void tryEvict(GridDhtLocalPartition[] parts) {
         if (parts == null)  // Can be not initialized yet.
-            return ;
+            return;
 
         for (GridDhtLocalPartition part : parts)
             tryEvict(part);

http://git-wip-us.apache.org/repos/asf/ignite/blob/28e3dec5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
index 7b7ac66..481a6cf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
@@ -232,4 +232,27 @@ public class GridLocalCache<K, V> extends GridCacheAdapter<K, V> {
     @Override public long localSizeLong(int part, CachePeekMode[] peekModes) throws IgniteCheckedException {
         return localSizeLong(peekModes);
     }
+
+    /** {@inheritDoc} */
+    @Override public void preloadPartition(int part) throws IgniteCheckedException {
+        ctx.offheap().preloadPartition(part);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> preloadPartitionAsync(int part) throws IgniteCheckedException {
+        return ctx.closures().callLocalSafe(new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                preloadPartition(part);
+
+                return null;
+            }
+        });
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean localPreloadPartition(int part) throws IgniteCheckedException {
+        ctx.offheap().preloadPartition(part);
+
+        return true;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/28e3dec5/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 240fbbe..5f6511d 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
@@ -38,6 +38,7 @@ import org.apache.ignite.internal.pagemem.PageIdAllocator;
 import org.apache.ignite.internal.pagemem.PageIdUtils;
 import org.apache.ignite.internal.pagemem.PageMemory;
 import org.apache.ignite.internal.pagemem.PageSupport;
+import org.apache.ignite.internal.pagemem.store.IgnitePageStoreManager;
 import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
 import org.apache.ignite.internal.pagemem.wal.WALIterator;
 import org.apache.ignite.internal.pagemem.wal.WALPointer;
@@ -869,6 +870,21 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
         return size;
     }
 
+    /** {@inheritDoc} */
+    @Override public void preloadPartition(int part) throws IgniteCheckedException {
+        if (grp.isLocal()) {
+            dataStore(part).preload();
+
+            return;
+        }
+
+        GridDhtLocalPartition locPart = grp.topology().localPartition(part, AffinityTopologyVersion.NONE, false, false);
+
+        assert locPart != null && locPart.reservations() > 0;
+
+        locPart.dataStore().preload();
+    }
+
     /**
      * Calculates free space of all partition data stores - number of bytes available for use in allocated pages.
      *
@@ -1388,6 +1404,31 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
                         @Override public PendingEntriesTree pendingTree() {
                             return pendingTree0;
                         }
+
+                        /** {@inheritDoc} */
+                        @Override public void preload() throws IgniteCheckedException {
+                            IgnitePageStoreManager pageStoreMgr = ctx.pageStore();
+
+                            if (pageStoreMgr == null)
+                                return;
+
+                            final int pages = pageStoreMgr.pages(grp.groupId(), partId);
+
+                            long pageId = pageMem.partitionMetaPageId(grp.groupId(), partId);
+
+                            // For each page sequentially pin/unpin.
+                            for (int pageNo = 0; pageNo < pages; pageId++, pageNo++) {
+                                long pagePointer = -1;
+
+                                try {
+                                    pagePointer = pageMem.acquirePage(grp.groupId(), pageId);
+                                }
+                                finally {
+                                    if (pagePointer != -1)
+                                        pageMem.releasePage(grp.groupId(), pageId, pagePointer);
+                                }
+                            }
+                        }
                     };
 
                     pendingTree = pendingTree0;
@@ -2245,6 +2286,14 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
                 throw new IgniteException(e);
             }
         }
+
+        /** {@inheritDoc} */
+        @Override public void preload() throws IgniteCheckedException {
+            CacheDataStore delegate0 = init0(true);
+
+            if (delegate0 != null)
+                delegate0.preload();
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/28e3dec5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java
new file mode 100644
index 0000000..b9d28ae
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java
@@ -0,0 +1,495 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.persistence.db;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+import javax.cache.Cache;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.U;
+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.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.CacheMode.LOCAL;
+
+/**
+ * Test partition preload for varios cache modes.
+ */
+public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest {
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** Test entry count. */
+    public static final int ENTRY_CNT = 500;
+
+    /** Grid count. */
+    private static final int GRIDS_CNT = 3;
+
+    /** */
+    private static final String CLIENT_GRID_NAME = "client";
+
+    /** */
+    public static final String DEFAULT_REGION = "default";
+
+    /** */
+    private Supplier<CacheConfiguration> cfgFactory;
+
+    /** */
+    private static final String TEST_ATTR = "testId";
+
+    /** */
+    private static final String NO_CACHE_NODE = "node0";
+
+    /** */
+    private static final String PRIMARY_NODE = "node1";
+
+    /** */
+    private static final String BACKUP_NODE = "node2";
+
+    /** */
+    public static final String MEM = "mem";
+
+    /** */
+    public static final int MB = 1024 * 1024;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setClientMode(CLIENT_GRID_NAME.equals(gridName));
+
+        if (!cfg.isClientMode()) {
+            String val = "node" + getTestIgniteInstanceIndex(gridName);
+            cfg.setUserAttributes(Collections.singletonMap(TEST_ATTR, val));
+            cfg.setConsistentId(val);
+        }
+
+        DataStorageConfiguration memCfg = new DataStorageConfiguration()
+            .setDataRegionConfigurations(new DataRegionConfiguration().setName(MEM).setInitialSize(10 * MB))
+            .setDefaultDataRegionConfiguration(
+                new DataRegionConfiguration().
+                    setMetricsEnabled(true).
+                    setMaxSize(50L * MB).
+                    setPersistenceEnabled(true).
+                    setName(DEFAULT_REGION))
+            .setWalMode(WALMode.LOG_ONLY)
+            .setWalSegmentSize(16 * MB)
+            .setPageSize(1024)
+            .setMetricsEnabled(true);
+
+        cfg.setDataStorageConfiguration(memCfg);
+
+        cfg.setCacheConfiguration(cfgFactory.get());
+
+        cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER));
+
+        return cfg;
+    }
+
+    /**
+     * @param atomicityMode Atomicity mode.
+     */
+    private CacheConfiguration<Integer, Integer> cacheConfiguration(CacheAtomicityMode atomicityMode) {
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
+
+        ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+        ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
+        ccfg.setBackups(1);
+        ccfg.setNodeFilter(new TestIgnitePredicate());
+        ccfg.setAtomicityMode(atomicityMode);
+
+        return ccfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+    }
+
+    /** */
+    public void testLocalPreloadPartitionClient() throws Exception {
+        cfgFactory = () -> cacheConfiguration(TRANSACTIONAL).setDataRegionName(MEM);
+
+        startGridsMultiThreaded(GRIDS_CNT);
+
+        IgniteEx client = startGrid("client");
+
+        assertNotNull(client.cache(DEFAULT_CACHE_NAME));
+
+        assertFalse(client.cache(DEFAULT_CACHE_NAME).localPreloadPartition(0));
+        assertFalse(grid(0).cache(DEFAULT_CACHE_NAME).localPreloadPartition(0));
+    }
+
+    /** */
+    public void testLocalPreloadPartitionPrimary() throws Exception {
+        cfgFactory = () -> cacheConfiguration(TRANSACTIONAL);
+
+        preloadPartition(
+            () -> G.allGrids().stream().filter(PrimaryNodePredicate.INSTANCE).findFirst().get(), PreloadMode.LOCAL);
+    }
+
+    /** */
+    public void testLocalPreloadPartitionBackup() throws Exception {
+        cfgFactory = () -> cacheConfiguration(TRANSACTIONAL);
+
+        preloadPartition(
+            () -> G.allGrids().stream().filter(BackupNodePredicate.INSTANCE).findFirst().get(), PreloadMode.LOCAL);
+    }
+
+    /** */
+    public void testPreloadPartitionInMemoryRemote() throws Exception {
+        cfgFactory = () -> cacheConfiguration(TRANSACTIONAL).setDataRegionName(MEM);
+
+        startGridsMultiThreaded(GRIDS_CNT);
+
+        IgniteEx client = startGrid("client");
+
+        assertNotNull(client.cache(DEFAULT_CACHE_NAME));
+
+        try {
+            client.cache(DEFAULT_CACHE_NAME).preloadPartition(0);
+
+            fail("Exception is expected");
+        }
+        catch (Exception e) {
+            log.error("Expected", e);
+        }
+    }
+
+    /** */
+    public void testPreloadPartitionInMemoryLocal() throws Exception {
+        cfgFactory = () -> cacheConfiguration(TRANSACTIONAL).setDataRegionName(MEM);
+
+        startGridsMultiThreaded(GRIDS_CNT);
+
+        int key = 0;
+
+        Ignite prim = primaryNode(key, DEFAULT_CACHE_NAME);
+
+        int part = prim.affinity(DEFAULT_CACHE_NAME).partition(key);
+
+        try {
+            prim.cache(DEFAULT_CACHE_NAME).preloadPartition(part);
+
+            fail("Exception is expected");
+        }
+        catch (Exception e) {
+            log.error("Expected", e);
+        }
+    }
+
+    /** */
+    public void testPreloadPartitionTransactionalClientSync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(TRANSACTIONAL);
+
+        preloadPartition(() -> {
+            try {
+                return startGrid(CLIENT_GRID_NAME);
+            }
+            catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+        }, PreloadMode.SYNC);
+    }
+
+    /** */
+    public void testPreloadPartitionTransactionalClientAsync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(TRANSACTIONAL);
+
+        preloadPartition(() -> {
+            try {
+                return startGrid(CLIENT_GRID_NAME);
+            }
+            catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+        }, PreloadMode.ASYNC);
+    }
+
+    /** */
+    public void testPreloadPartitionTransactionalNodeFilteredSync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(TRANSACTIONAL);
+
+        preloadPartition(() -> grid(0), PreloadMode.SYNC);
+    }
+
+    /** */
+    public void testPreloadPartitionTransactionalNodeFilteredAsync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(TRANSACTIONAL);
+
+        preloadPartition(() -> grid(0), PreloadMode.ASYNC);
+    }
+
+    /** */
+    public void testPreloadPartitionTransactionalPrimarySync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(TRANSACTIONAL);
+
+        preloadPartition(
+            () -> G.allGrids().stream().filter(PrimaryNodePredicate.INSTANCE).findFirst().get(), PreloadMode.SYNC);
+    }
+
+    /** */
+    public void testPreloadPartitionTransactionalPrimaryAsync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(TRANSACTIONAL);
+
+        preloadPartition(
+            () -> G.allGrids().stream().filter(PrimaryNodePredicate.INSTANCE).findFirst().get(), PreloadMode.ASYNC);
+    }
+
+    /** */
+    public void testPreloadPartitionTransactionalBackupSync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(TRANSACTIONAL);
+
+        preloadPartition(
+            () -> G.allGrids().stream().filter(BackupNodePredicate.INSTANCE).findFirst().get(), PreloadMode.SYNC);
+    }
+
+    /** */
+    public void testPreloadPartitionTransactionalBackupAsync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(TRANSACTIONAL);
+
+        preloadPartition(
+            () -> G.allGrids().stream().filter(BackupNodePredicate.INSTANCE).findFirst().get(), PreloadMode.ASYNC);
+    }
+
+    /** */
+    public void testPreloadPartitionAtomicClientSync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(ATOMIC);
+
+        preloadPartition(() -> {
+            try {
+                return startGrid(CLIENT_GRID_NAME);
+            }
+            catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+        }, PreloadMode.SYNC);
+    }
+
+    /** */
+    public void testPreloadPartitionAtomicClientAsync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(ATOMIC);
+
+        preloadPartition(() -> {
+            try {
+                return startGrid(CLIENT_GRID_NAME);
+            }
+            catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+        }, PreloadMode.ASYNC);
+    }
+
+    /** */
+    public void testPreloadPartitionAtomicNodeFilteredSync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(ATOMIC);
+
+        preloadPartition(() -> grid(0), PreloadMode.SYNC);
+    }
+
+    /** */
+    public void testPreloadPartitionAtomicNodeFilteredAsync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(ATOMIC);
+
+        preloadPartition(() -> grid(0), PreloadMode.ASYNC);
+    }
+
+    /** */
+    public void testPreloadPartitionAtomicPrimarySync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(ATOMIC);
+
+        preloadPartition(
+            () -> G.allGrids().stream().filter(PrimaryNodePredicate.INSTANCE).findFirst().get(), PreloadMode.SYNC);
+    }
+
+    /** */
+    public void testPreloadPartitionAtomicPrimaryAsync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(ATOMIC);
+
+        preloadPartition(
+            () -> G.allGrids().stream().filter(PrimaryNodePredicate.INSTANCE).findFirst().get(), PreloadMode.ASYNC);
+    }
+
+    /** */
+    public void testPreloadPartitionAtomicBackupSync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(ATOMIC);
+
+        preloadPartition(
+            () -> G.allGrids().stream().filter(BackupNodePredicate.INSTANCE).findFirst().get(), PreloadMode.SYNC);
+    }
+
+    /** */
+    public void testPreloadPartitionAtomicBackupAsync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(ATOMIC);
+
+        preloadPartition(
+            () -> G.allGrids().stream().filter(BackupNodePredicate.INSTANCE).findFirst().get(), PreloadMode.ASYNC);
+    }
+
+    /** */
+    public void testPreloadLocalTransactionalSync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(TRANSACTIONAL).setCacheMode(LOCAL);
+
+        preloadPartition(
+            () -> G.allGrids().stream().filter(PrimaryNodePredicate.INSTANCE).findFirst().get(), PreloadMode.SYNC);
+    }
+
+    /** */
+    public void testPreloadLocalTransactionalAsync() throws Exception {
+        cfgFactory = () -> cacheConfiguration(TRANSACTIONAL).setCacheMode(LOCAL);
+
+        preloadPartition(
+            () -> G.allGrids().stream().filter(PrimaryNodePredicate.INSTANCE).findFirst().get(), PreloadMode.ASYNC);
+    }
+
+    /**
+     * @param testNodeFactory Test node factory.
+     * @param preloadMode Preload mode.
+     */
+    private void preloadPartition(Supplier<Ignite> testNodeFactory, PreloadMode preloadMode) throws Exception {
+        Ignite crd = startGridsMultiThreaded(GRIDS_CNT);
+
+        int cnt = 0;
+
+        Ignite primary = grid(1);
+
+        assertEquals(PRIMARY_NODE, primary.cluster().localNode().consistentId());
+
+        Integer key = primaryKey(primary.cache(DEFAULT_CACHE_NAME));
+
+        int preloadPart = crd.affinity(DEFAULT_CACHE_NAME).partition(key);
+
+        try (IgniteDataStreamer<Integer, Integer> streamer = primary.dataStreamer(DEFAULT_CACHE_NAME)) {
+            int k = 0;
+
+            while (cnt < ENTRY_CNT) {
+                if (primary.affinity(DEFAULT_CACHE_NAME).partition(k) == preloadPart) {
+                    streamer.addData(k, k);
+
+                    cnt++;
+                }
+
+                k++;
+            }
+        }
+
+        forceCheckpoint();
+
+        stopAllGrids();
+
+        startGridsMultiThreaded(GRIDS_CNT);
+
+        primary = G.allGrids().stream().
+            filter(ignite -> PRIMARY_NODE.equals(ignite.cluster().localNode().consistentId())).findFirst().get();
+
+        assertEquals(primary, primaryNode(key, DEFAULT_CACHE_NAME));
+
+        Ignite testNode = testNodeFactory.get();
+
+        switch (preloadMode) {
+            case SYNC:
+                testNode.cache(DEFAULT_CACHE_NAME).preloadPartition(preloadPart);
+
+                break;
+            case ASYNC:
+                testNode.cache(DEFAULT_CACHE_NAME).preloadPartitionAsync(preloadPart).get();
+
+                break;
+            case LOCAL:
+                assertTrue(testNode.cache(DEFAULT_CACHE_NAME).localPreloadPartition(preloadPart));
+
+                break;
+        }
+
+        long c0 = primary.dataRegionMetrics(DEFAULT_REGION).getPagesRead();
+
+        // After partition preloading no pages should be read from store.
+        List<Cache.Entry<Object, Object>> list = U.arrayList(testNode.cache(DEFAULT_CACHE_NAME).localEntries(), 1000);
+
+        assertEquals(ENTRY_CNT, list.size());
+
+        assertEquals("Read pages count must be same", c0, primary.dataRegionMetrics(DEFAULT_REGION).getPagesRead());
+    }
+
+    /** */
+    private static class TestIgnitePredicate implements IgnitePredicate<ClusterNode> {
+        /** {@inheritDoc} */
+        @Override public boolean apply(ClusterNode node) {
+            return !NO_CACHE_NODE.equals(node.attribute(TEST_ATTR));
+        }
+    }
+
+    /** */
+    private static class PrimaryNodePredicate implements Predicate<Ignite> {
+        /** */
+        private static final PrimaryNodePredicate INSTANCE = new PrimaryNodePredicate();
+
+        /** {@inheritDoc} */
+        @Override public boolean test(Ignite ignite) {
+            return PRIMARY_NODE.equals(ignite.cluster().localNode().consistentId());
+        }
+    }
+
+    /** */
+    private static class BackupNodePredicate implements Predicate<Ignite> {
+        /** */
+        private static final BackupNodePredicate INSTANCE = new BackupNodePredicate();
+
+        /** {@inheritDoc} */
+        @Override public boolean test(Ignite ignite) {
+            return BACKUP_NODE.equals(ignite.cluster().localNode().consistentId());
+        }
+    }
+
+    /** */
+    private enum PreloadMode {
+        /** Sync. */ SYNC,
+        /** Async. */ASYNC,
+        /** Local. */LOCAL;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/28e3dec5/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
index 681d904..18a2f7c 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
@@ -688,6 +688,21 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> {
     }
 
     /** {@inheritDoc} */
+    @Override public void preloadPartition(int partId) {
+        throw new UnsupportedOperationException("Method should be supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteFuture<Void> preloadPartitionAsync(int partId) {
+        throw new UnsupportedOperationException("Method should be supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean localPreloadPartition(int partition) {
+        throw new UnsupportedOperationException("Method should be supported.");
+    }
+
+    /** {@inheritDoc} */
     @Override public IgniteCache<K, V> withAllowAtomicOpsInTx() {
         return this;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/28e3dec5/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
index c164635..64615e2 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite4.java
@@ -23,6 +23,7 @@ import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsContinuo
 import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsRecoveryAfterFileCorruptionTest;
 import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsTaskCancelingTest;
 import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsPageEvictionDuringPartitionClearTest;
+import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsPartitionPreloadTest;
 import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsTransactionsHangTest;
 import org.apache.ignite.internal.processors.cache.persistence.file.FileDownloaderTest;
 
@@ -44,6 +45,8 @@ public class IgnitePdsTestSuite4 extends TestSuite {
 
         suite.addTestSuite(IgniteClusterActivateDeactivateTestWithPersistenceAndMemoryReuse.class);
 
+        suite.addTestSuite(IgnitePdsPartitionPreloadTest.class);
+
         return suite;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/28e3dec5/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
index cdccc3e..527b767 100644
--- a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
+++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
@@ -647,6 +647,21 @@ public class HibernateCacheProxy implements IgniteInternalCache<Object, Object>
     }
 
     /** {@inheritDoc} */
+    @Override public void preloadPartition(int part) throws IgniteCheckedException {
+        delegate.preloadPartition(part);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> preloadPartitionAsync(int part) throws IgniteCheckedException {
+        return delegate.preloadPartitionAsync(part);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean localPreloadPartition(int part) throws IgniteCheckedException {
+        return delegate.localPreloadPartition(part);
+    }
+
+    /** {@inheritDoc} */
     @Nullable @Override public EntryProcessorResult invoke(
         @Nullable AffinityTopologyVersion topVer,
         Object key,

http://git-wip-us.apache.org/repos/asf/ignite/blob/28e3dec5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheParityTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheParityTest.cs
index 7548740..d0a103f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheParityTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/CacheParityTest.cs
@@ -57,7 +57,10 @@ namespace Apache.Ignite.Core.Tests.ApiParity
             "sizeLongAsync",  // IGNITE-6563
             "localSizeLong",  // IGNITE-6563
             "enableStatistics",  // IGNITE-7276
-            "clearStatistics"  // IGNITE-9017
+            "clearStatistics",  // IGNITE-9017
+            "preloadPartition",  // IGNITE-9998
+            "preloadPartitionAsync",  // IGNITE-9998
+            "localPreloadPartition",  // IGNITE-9998
         };
 
         /// <summary>


[05/28] ignite git commit: IGNITE-9910: [ML] Move the static copy-pasted datasets from examples to special Util class

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestRegressionExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestRegressionExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestRegressionExample.java
index 9b4aece..3bf2c8e 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestRegressionExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestRegressionExample.java
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.examples.ml.tree.randomforest;
 
-import java.util.Arrays;
+import java.io.FileNotFoundException;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
@@ -27,14 +27,15 @@ import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.TestCache;
+import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
+import org.apache.ignite.examples.ml.util.SandboxMLCache;
 import org.apache.ignite.ml.composition.ModelsComposition;
 import org.apache.ignite.ml.dataset.feature.FeatureMeta;
 import org.apache.ignite.ml.environment.LearningEnvironment;
 import org.apache.ignite.ml.environment.logging.ConsoleLogger;
 import org.apache.ignite.ml.environment.logging.MLLogger;
 import org.apache.ignite.ml.environment.parallelism.ParallelismStrategy;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.tree.randomforest.RandomForestRegressionTrainer;
 import org.apache.ignite.ml.tree.randomforest.data.FeaturesCountSelectionStrategies;
 
@@ -58,18 +59,19 @@ public class RandomForestRegressionExample {
     /**
      * Run example.
      */
-    public static void main(String[] args) throws InterruptedException {
+    public static void main(String[] args) throws FileNotFoundException {
         System.out.println();
         System.out.println(">>> Random Forest regression algorithm over cached dataset usage example started.");
         // Start ignite grid.
         try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
             System.out.println(">>> Ignite grid started.");
 
-            IgniteCache<Integer, double[]> dataCache = new TestCache(ignite).fillCacheWith(data);
+            IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
+                .fillCacheWith(MLSandboxDatasets.BOSTON_HOUSE_PRICES);
 
             AtomicInteger idx = new AtomicInteger(0);
             RandomForestRegressionTrainer trainer = new RandomForestRegressionTrainer(
-                IntStream.range(0, data[0].length - 1).mapToObj(
+                IntStream.range(0, dataCache.get(1).size() - 1).mapToObj(
                     x -> new FeatureMeta("", idx.getAndIncrement(), false)).collect(Collectors.toList())
             ).withAmountOfTrees(101)
                 .withFeaturesCountSelectionStrgy(FeaturesCountSelectionStrategies.ONE_THIRD)
@@ -86,24 +88,24 @@ public class RandomForestRegressionExample {
 
             System.out.println(">>> Configured trainer: " + trainer.getClass().getSimpleName());
 
-            ModelsComposition randomForest = trainer.fit(ignite, dataCache,
-                (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 0, v.length - 1)),
-                (k, v) -> v[v.length - 1]
+            ModelsComposition randomForestMdl = trainer.fit(ignite, dataCache,
+                (k, v) -> v.copyOfRange(1, v.size()),
+                (k, v) -> v.get(0)
             );
 
-            System.out.println(">>> Trained model: " + randomForest.toString(true));
+            System.out.println(">>> Trained model: " + randomForestMdl.toString(true));
 
             double mse = 0.0;
             double mae = 0.0;
             int totalAmount = 0;
 
-            try (QueryCursor<Cache.Entry<Integer, double[]>> observations = dataCache.query(new ScanQuery<>())) {
-                for (Cache.Entry<Integer, double[]> observation : observations) {
-                    double[] val = observation.getValue();
-                    double[] inputs = Arrays.copyOfRange(val, 0, val.length - 1);
-                    double groundTruth = val[val.length - 1];
+            try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(new ScanQuery<>())) {
+                for (Cache.Entry<Integer, Vector> observation : observations) {
+                    Vector val = observation.getValue();
+                    Vector inputs = val.copyOfRange(1, val.size());
+                    double groundTruth = val.get(0);
 
-                    double prediction = randomForest.apply(VectorUtils.of(inputs));
+                    double prediction = randomForestMdl.apply(inputs);
 
                     mse += Math.pow(prediction - groundTruth, 2.0);
                     mae += Math.abs(prediction - groundTruth);
@@ -123,513 +125,4 @@ public class RandomForestRegressionExample {
             }
         }
     }
-
-    /** The Boston housing dataset. */
-    private static final double[][] data = {
-        {0.02731,0.00,7.070,0,0.4690,6.4210,78.90,4.9671,2,242.0,17.80,396.90,9.14,21.60},
-        {0.02729,0.00,7.070,0,0.4690,7.1850,61.10,4.9671,2,242.0,17.80,392.83,4.03,34.70},
-        {0.03237,0.00,2.180,0,0.4580,6.9980,45.80,6.0622,3,222.0,18.70,394.63,2.94,33.40},
-        {0.06905,0.00,2.180,0,0.4580,7.1470,54.20,6.0622,3,222.0,18.70,396.90,5.33,36.20},
-        {0.02985,0.00,2.180,0,0.4580,6.4300,58.70,6.0622,3,222.0,18.70,394.12,5.21,28.70},
-        {0.08829,12.50,7.870,0,0.5240,6.0120,66.60,5.5605,5,311.0,15.20,395.60,12.43,22.90},
-        {0.14455,12.50,7.870,0,0.5240,6.1720,96.10,5.9505,5,311.0,15.20,396.90,19.15,27.10},
-        {0.21124,12.50,7.870,0,0.5240,5.6310,100.00,6.0821,5,311.0,15.20,386.63,29.93,16.50},
-        {0.17004,12.50,7.870,0,0.5240,6.0040,85.90,6.5921,5,311.0,15.20,386.71,17.10,18.90},
-        {0.22489,12.50,7.870,0,0.5240,6.3770,94.30,6.3467,5,311.0,15.20,392.52,20.45,15.00},
-        {0.11747,12.50,7.870,0,0.5240,6.0090,82.90,6.2267,5,311.0,15.20,396.90,13.27,18.90},
-        {0.09378,12.50,7.870,0,0.5240,5.8890,39.00,5.4509,5,311.0,15.20,390.50,15.71,21.70},
-        {0.62976,0.00,8.140,0,0.5380,5.9490,61.80,4.7075,4,307.0,21.00,396.90,8.26,20.40},
-        {0.63796,0.00,8.140,0,0.5380,6.0960,84.50,4.4619,4,307.0,21.00,380.02,10.26,18.20},
-        {0.62739,0.00,8.140,0,0.5380,5.8340,56.50,4.4986,4,307.0,21.00,395.62,8.47,19.90},
-        {1.05393,0.00,8.140,0,0.5380,5.9350,29.30,4.4986,4,307.0,21.00,386.85,6.58,23.10},
-        {0.78420,0.00,8.140,0,0.5380,5.9900,81.70,4.2579,4,307.0,21.00,386.75,14.67,17.50},
-        {0.80271,0.00,8.140,0,0.5380,5.4560,36.60,3.7965,4,307.0,21.00,288.99,11.69,20.20},
-        {0.72580,0.00,8.140,0,0.5380,5.7270,69.50,3.7965,4,307.0,21.00,390.95,11.28,18.20},
-        {1.25179,0.00,8.140,0,0.5380,5.5700,98.10,3.7979,4,307.0,21.00,376.57,21.02,13.60},
-        {0.85204,0.00,8.140,0,0.5380,5.9650,89.20,4.0123,4,307.0,21.00,392.53,13.83,19.60},
-        {1.23247,0.00,8.140,0,0.5380,6.1420,91.70,3.9769,4,307.0,21.00,396.90,18.72,15.20},
-        {0.98843,0.00,8.140,0,0.5380,5.8130,100.00,4.0952,4,307.0,21.00,394.54,19.88,14.50},
-        {0.75026,0.00,8.140,0,0.5380,5.9240,94.10,4.3996,4,307.0,21.00,394.33,16.30,15.60},
-        {0.84054,0.00,8.140,0,0.5380,5.5990,85.70,4.4546,4,307.0,21.00,303.42,16.51,13.90},
-        {0.67191,0.00,8.140,0,0.5380,5.8130,90.30,4.6820,4,307.0,21.00,376.88,14.81,16.60},
-        {0.95577,0.00,8.140,0,0.5380,6.0470,88.80,4.4534,4,307.0,21.00,306.38,17.28,14.80},
-        {0.77299,0.00,8.140,0,0.5380,6.4950,94.40,4.4547,4,307.0,21.00,387.94,12.80,18.40},
-        {1.00245,0.00,8.140,0,0.5380,6.6740,87.30,4.2390,4,307.0,21.00,380.23,11.98,21.00},
-        {1.13081,0.00,8.140,0,0.5380,5.7130,94.10,4.2330,4,307.0,21.00,360.17,22.60,12.70},
-        {1.35472,0.00,8.140,0,0.5380,6.0720,100.00,4.1750,4,307.0,21.00,376.73,13.04,14.50},
-        {1.38799,0.00,8.140,0,0.5380,5.9500,82.00,3.9900,4,307.0,21.00,232.60,27.71,13.20},
-        {1.15172,0.00,8.140,0,0.5380,5.7010,95.00,3.7872,4,307.0,21.00,358.77,18.35,13.10},
-        {1.61282,0.00,8.140,0,0.5380,6.0960,96.90,3.7598,4,307.0,21.00,248.31,20.34,13.50},
-        {0.06417,0.00,5.960,0,0.4990,5.9330,68.20,3.3603,5,279.0,19.20,396.90,9.68,18.90},
-        {0.09744,0.00,5.960,0,0.4990,5.8410,61.40,3.3779,5,279.0,19.20,377.56,11.41,20.00},
-        {0.08014,0.00,5.960,0,0.4990,5.8500,41.50,3.9342,5,279.0,19.20,396.90,8.77,21.00},
-        {0.17505,0.00,5.960,0,0.4990,5.9660,30.20,3.8473,5,279.0,19.20,393.43,10.13,24.70},
-        {0.02763,75.00,2.950,0,0.4280,6.5950,21.80,5.4011,3,252.0,18.30,395.63,4.32,30.80},
-        {0.03359,75.00,2.950,0,0.4280,7.0240,15.80,5.4011,3,252.0,18.30,395.62,1.98,34.90},
-        {0.12744,0.00,6.910,0,0.4480,6.7700,2.90,5.7209,3,233.0,17.90,385.41,4.84,26.60},
-        {0.14150,0.00,6.910,0,0.4480,6.1690,6.60,5.7209,3,233.0,17.90,383.37,5.81,25.30},
-        {0.15936,0.00,6.910,0,0.4480,6.2110,6.50,5.7209,3,233.0,17.90,394.46,7.44,24.70},
-        {0.12269,0.00,6.910,0,0.4480,6.0690,40.00,5.7209,3,233.0,17.90,389.39,9.55,21.20},
-        {0.17142,0.00,6.910,0,0.4480,5.6820,33.80,5.1004,3,233.0,17.90,396.90,10.21,19.30},
-        {0.18836,0.00,6.910,0,0.4480,5.7860,33.30,5.1004,3,233.0,17.90,396.90,14.15,20.00},
-        {0.22927,0.00,6.910,0,0.4480,6.0300,85.50,5.6894,3,233.0,17.90,392.74,18.80,16.60},
-        {0.25387,0.00,6.910,0,0.4480,5.3990,95.30,5.8700,3,233.0,17.90,396.90,30.81,14.40},
-        {0.21977,0.00,6.910,0,0.4480,5.6020,62.00,6.0877,3,233.0,17.90,396.90,16.20,19.40},
-        {0.08873,21.00,5.640,0,0.4390,5.9630,45.70,6.8147,4,243.0,16.80,395.56,13.45,19.70},
-        {0.04337,21.00,5.640,0,0.4390,6.1150,63.00,6.8147,4,243.0,16.80,393.97,9.43,20.50},
-        {0.05360,21.00,5.640,0,0.4390,6.5110,21.10,6.8147,4,243.0,16.80,396.90,5.28,25.00},
-        {0.04981,21.00,5.640,0,0.4390,5.9980,21.40,6.8147,4,243.0,16.80,396.90,8.43,23.40},
-        {0.01360,75.00,4.000,0,0.4100,5.8880,47.60,7.3197,3,469.0,21.10,396.90,14.80,18.90},
-        {0.01311,90.00,1.220,0,0.4030,7.2490,21.90,8.6966,5,226.0,17.90,395.93,4.81,35.40},
-        {0.02055,85.00,0.740,0,0.4100,6.3830,35.70,9.1876,2,313.0,17.30,396.90,5.77,24.70},
-        {0.01432,100.00,1.320,0,0.4110,6.8160,40.50,8.3248,5,256.0,15.10,392.90,3.95,31.60},
-        {0.15445,25.00,5.130,0,0.4530,6.1450,29.20,7.8148,8,284.0,19.70,390.68,6.86,23.30},
-        {0.10328,25.00,5.130,0,0.4530,5.9270,47.20,6.9320,8,284.0,19.70,396.90,9.22,19.60},
-        {0.14932,25.00,5.130,0,0.4530,5.7410,66.20,7.2254,8,284.0,19.70,395.11,13.15,18.70},
-        {0.17171,25.00,5.130,0,0.4530,5.9660,93.40,6.8185,8,284.0,19.70,378.08,14.44,16.00},
-        {0.11027,25.00,5.130,0,0.4530,6.4560,67.80,7.2255,8,284.0,19.70,396.90,6.73,22.20},
-        {0.12650,25.00,5.130,0,0.4530,6.7620,43.40,7.9809,8,284.0,19.70,395.58,9.50,25.00},
-        {0.01951,17.50,1.380,0,0.4161,7.1040,59.50,9.2229,3,216.0,18.60,393.24,8.05,33.00},
-        {0.03584,80.00,3.370,0,0.3980,6.2900,17.80,6.6115,4,337.0,16.10,396.90,4.67,23.50},
-        {0.04379,80.00,3.370,0,0.3980,5.7870,31.10,6.6115,4,337.0,16.10,396.90,10.24,19.40},
-        {0.05789,12.50,6.070,0,0.4090,5.8780,21.40,6.4980,4,345.0,18.90,396.21,8.10,22.00},
-        {0.13554,12.50,6.070,0,0.4090,5.5940,36.80,6.4980,4,345.0,18.90,396.90,13.09,17.40},
-        {0.12816,12.50,6.070,0,0.4090,5.8850,33.00,6.4980,4,345.0,18.90,396.90,8.79,20.90},
-        {0.08826,0.00,10.810,0,0.4130,6.4170,6.60,5.2873,4,305.0,19.20,383.73,6.72,24.20},
-        {0.15876,0.00,10.810,0,0.4130,5.9610,17.50,5.2873,4,305.0,19.20,376.94,9.88,21.70},
-        {0.09164,0.00,10.810,0,0.4130,6.0650,7.80,5.2873,4,305.0,19.20,390.91,5.52,22.80},
-        {0.19539,0.00,10.810,0,0.4130,6.2450,6.20,5.2873,4,305.0,19.20,377.17,7.54,23.40},
-        {0.07896,0.00,12.830,0,0.4370,6.2730,6.00,4.2515,5,398.0,18.70,394.92,6.78,24.10},
-        {0.09512,0.00,12.830,0,0.4370,6.2860,45.00,4.5026,5,398.0,18.70,383.23,8.94,21.40},
-        {0.10153,0.00,12.830,0,0.4370,6.2790,74.50,4.0522,5,398.0,18.70,373.66,11.97,20.00},
-        {0.08707,0.00,12.830,0,0.4370,6.1400,45.80,4.0905,5,398.0,18.70,386.96,10.27,20.80},
-        {0.05646,0.00,12.830,0,0.4370,6.2320,53.70,5.0141,5,398.0,18.70,386.40,12.34,21.20},
-        {0.08387,0.00,12.830,0,0.4370,5.8740,36.60,4.5026,5,398.0,18.70,396.06,9.10,20.30},
-        {0.04113,25.00,4.860,0,0.4260,6.7270,33.50,5.4007,4,281.0,19.00,396.90,5.29,28.00},
-        {0.04462,25.00,4.860,0,0.4260,6.6190,70.40,5.4007,4,281.0,19.00,395.63,7.22,23.90},
-        {0.03659,25.00,4.860,0,0.4260,6.3020,32.20,5.4007,4,281.0,19.00,396.90,6.72,24.80},
-        {0.03551,25.00,4.860,0,0.4260,6.1670,46.70,5.4007,4,281.0,19.00,390.64,7.51,22.90},
-        {0.05059,0.00,4.490,0,0.4490,6.3890,48.00,4.7794,3,247.0,18.50,396.90,9.62,23.90},
-        {0.05735,0.00,4.490,0,0.4490,6.6300,56.10,4.4377,3,247.0,18.50,392.30,6.53,26.60},
-        {0.05188,0.00,4.490,0,0.4490,6.0150,45.10,4.4272,3,247.0,18.50,395.99,12.86,22.50},
-        {0.07151,0.00,4.490,0,0.4490,6.1210,56.80,3.7476,3,247.0,18.50,395.15,8.44,22.20},
-        {0.05660,0.00,3.410,0,0.4890,7.0070,86.30,3.4217,2,270.0,17.80,396.90,5.50,23.60},
-        {0.05302,0.00,3.410,0,0.4890,7.0790,63.10,3.4145,2,270.0,17.80,396.06,5.70,28.70},
-        {0.04684,0.00,3.410,0,0.4890,6.4170,66.10,3.0923,2,270.0,17.80,392.18,8.81,22.60},
-        {0.03932,0.00,3.410,0,0.4890,6.4050,73.90,3.0921,2,270.0,17.80,393.55,8.20,22.00},
-        {0.04203,28.00,15.040,0,0.4640,6.4420,53.60,3.6659,4,270.0,18.20,395.01,8.16,22.90},
-        {0.02875,28.00,15.040,0,0.4640,6.2110,28.90,3.6659,4,270.0,18.20,396.33,6.21,25.00},
-        {0.04294,28.00,15.040,0,0.4640,6.2490,77.30,3.6150,4,270.0,18.20,396.90,10.59,20.60},
-        {0.12204,0.00,2.890,0,0.4450,6.6250,57.80,3.4952,2,276.0,18.00,357.98,6.65,28.40},
-        {0.11504,0.00,2.890,0,0.4450,6.1630,69.60,3.4952,2,276.0,18.00,391.83,11.34,21.40},
-        {0.12083,0.00,2.890,0,0.4450,8.0690,76.00,3.4952,2,276.0,18.00,396.90,4.21,38.70},
-        {0.08187,0.00,2.890,0,0.4450,7.8200,36.90,3.4952,2,276.0,18.00,393.53,3.57,43.80},
-        {0.06860,0.00,2.890,0,0.4450,7.4160,62.50,3.4952,2,276.0,18.00,396.90,6.19,33.20},
-        {0.14866,0.00,8.560,0,0.5200,6.7270,79.90,2.7778,5,384.0,20.90,394.76,9.42,27.50},
-        {0.11432,0.00,8.560,0,0.5200,6.7810,71.30,2.8561,5,384.0,20.90,395.58,7.67,26.50},
-        {0.22876,0.00,8.560,0,0.5200,6.4050,85.40,2.7147,5,384.0,20.90,70.80,10.63,18.60},
-        {0.21161,0.00,8.560,0,0.5200,6.1370,87.40,2.7147,5,384.0,20.90,394.47,13.44,19.30},
-        {0.13960,0.00,8.560,0,0.5200,6.1670,90.00,2.4210,5,384.0,20.90,392.69,12.33,20.10},
-        {0.13262,0.00,8.560,0,0.5200,5.8510,96.70,2.1069,5,384.0,20.90,394.05,16.47,19.50},
-        {0.17120,0.00,8.560,0,0.5200,5.8360,91.90,2.2110,5,384.0,20.90,395.67,18.66,19.50},
-        {0.13117,0.00,8.560,0,0.5200,6.1270,85.20,2.1224,5,384.0,20.90,387.69,14.09,20.40},
-        {0.12802,0.00,8.560,0,0.5200,6.4740,97.10,2.4329,5,384.0,20.90,395.24,12.27,19.80},
-        {0.26363,0.00,8.560,0,0.5200,6.2290,91.20,2.5451,5,384.0,20.90,391.23,15.55,19.40},
-        {0.10793,0.00,8.560,0,0.5200,6.1950,54.40,2.7778,5,384.0,20.90,393.49,13.00,21.70},
-        {0.10084,0.00,10.010,0,0.5470,6.7150,81.60,2.6775,6,432.0,17.80,395.59,10.16,22.80},
-        {0.12329,0.00,10.010,0,0.5470,5.9130,92.90,2.3534,6,432.0,17.80,394.95,16.21,18.80},
-        {0.22212,0.00,10.010,0,0.5470,6.0920,95.40,2.5480,6,432.0,17.80,396.90,17.09,18.70},
-        {0.14231,0.00,10.010,0,0.5470,6.2540,84.20,2.2565,6,432.0,17.80,388.74,10.45,18.50},
-        {0.17134,0.00,10.010,0,0.5470,5.9280,88.20,2.4631,6,432.0,17.80,344.91,15.76,18.30},
-        {0.13158,0.00,10.010,0,0.5470,6.1760,72.50,2.7301,6,432.0,17.80,393.30,12.04,21.20},
-        {0.15098,0.00,10.010,0,0.5470,6.0210,82.60,2.7474,6,432.0,17.80,394.51,10.30,19.20},
-        {0.13058,0.00,10.010,0,0.5470,5.8720,73.10,2.4775,6,432.0,17.80,338.63,15.37,20.40},
-        {0.14476,0.00,10.010,0,0.5470,5.7310,65.20,2.7592,6,432.0,17.80,391.50,13.61,19.30},
-        {0.06899,0.00,25.650,0,0.5810,5.8700,69.70,2.2577,2,188.0,19.10,389.15,14.37,22.00},
-        {0.07165,0.00,25.650,0,0.5810,6.0040,84.10,2.1974,2,188.0,19.10,377.67,14.27,20.30},
-        {0.09299,0.00,25.650,0,0.5810,5.9610,92.90,2.0869,2,188.0,19.10,378.09,17.93,20.50},
-        {0.15038,0.00,25.650,0,0.5810,5.8560,97.00,1.9444,2,188.0,19.10,370.31,25.41,17.30},
-        {0.09849,0.00,25.650,0,0.5810,5.8790,95.80,2.0063,2,188.0,19.10,379.38,17.58,18.80},
-        {0.16902,0.00,25.650,0,0.5810,5.9860,88.40,1.9929,2,188.0,19.10,385.02,14.81,21.40},
-        {0.38735,0.00,25.650,0,0.5810,5.6130,95.60,1.7572,2,188.0,19.10,359.29,27.26,15.70},
-        {0.25915,0.00,21.890,0,0.6240,5.6930,96.00,1.7883,4,437.0,21.20,392.11,17.19,16.20},
-        {0.32543,0.00,21.890,0,0.6240,6.4310,98.80,1.8125,4,437.0,21.20,396.90,15.39,18.00},
-        {0.88125,0.00,21.890,0,0.6240,5.6370,94.70,1.9799,4,437.0,21.20,396.90,18.34,14.30},
-        {0.34006,0.00,21.890,0,0.6240,6.4580,98.90,2.1185,4,437.0,21.20,395.04,12.60,19.20},
-        {1.19294,0.00,21.890,0,0.6240,6.3260,97.70,2.2710,4,437.0,21.20,396.90,12.26,19.60},
-        {0.59005,0.00,21.890,0,0.6240,6.3720,97.90,2.3274,4,437.0,21.20,385.76,11.12,23.00},
-        {0.32982,0.00,21.890,0,0.6240,5.8220,95.40,2.4699,4,437.0,21.20,388.69,15.03,18.40},
-        {0.97617,0.00,21.890,0,0.6240,5.7570,98.40,2.3460,4,437.0,21.20,262.76,17.31,15.60},
-        {0.55778,0.00,21.890,0,0.6240,6.3350,98.20,2.1107,4,437.0,21.20,394.67,16.96,18.10},
-        {0.32264,0.00,21.890,0,0.6240,5.9420,93.50,1.9669,4,437.0,21.20,378.25,16.90,17.40},
-        {0.35233,0.00,21.890,0,0.6240,6.4540,98.40,1.8498,4,437.0,21.20,394.08,14.59,17.10},
-        {0.24980,0.00,21.890,0,0.6240,5.8570,98.20,1.6686,4,437.0,21.20,392.04,21.32,13.30},
-        {0.54452,0.00,21.890,0,0.6240,6.1510,97.90,1.6687,4,437.0,21.20,396.90,18.46,17.80},
-        {0.29090,0.00,21.890,0,0.6240,6.1740,93.60,1.6119,4,437.0,21.20,388.08,24.16,14.00},
-        {1.62864,0.00,21.890,0,0.6240,5.0190,100.00,1.4394,4,437.0,21.20,396.90,34.41,14.40},
-        {3.32105,0.00,19.580,1,0.8710,5.4030,100.00,1.3216,5,403.0,14.70,396.90,26.82,13.40},
-        {4.09740,0.00,19.580,0,0.8710,5.4680,100.00,1.4118,5,403.0,14.70,396.90,26.42,15.60},
-        {2.77974,0.00,19.580,0,0.8710,4.9030,97.80,1.3459,5,403.0,14.70,396.90,29.29,11.80},
-        {2.37934,0.00,19.580,0,0.8710,6.1300,100.00,1.4191,5,403.0,14.70,172.91,27.80,13.80},
-        {2.15505,0.00,19.580,0,0.8710,5.6280,100.00,1.5166,5,403.0,14.70,169.27,16.65,15.60},
-        {2.36862,0.00,19.580,0,0.8710,4.9260,95.70,1.4608,5,403.0,14.70,391.71,29.53,14.60},
-        {2.33099,0.00,19.580,0,0.8710,5.1860,93.80,1.5296,5,403.0,14.70,356.99,28.32,17.80},
-        {2.73397,0.00,19.580,0,0.8710,5.5970,94.90,1.5257,5,403.0,14.70,351.85,21.45,15.40},
-        {1.65660,0.00,19.580,0,0.8710,6.1220,97.30,1.6180,5,403.0,14.70,372.80,14.10,21.50},
-        {1.49632,0.00,19.580,0,0.8710,5.4040,100.00,1.5916,5,403.0,14.70,341.60,13.28,19.60},
-        {1.12658,0.00,19.580,1,0.8710,5.0120,88.00,1.6102,5,403.0,14.70,343.28,12.12,15.30},
-        {2.14918,0.00,19.580,0,0.8710,5.7090,98.50,1.6232,5,403.0,14.70,261.95,15.79,19.40},
-        {1.41385,0.00,19.580,1,0.8710,6.1290,96.00,1.7494,5,403.0,14.70,321.02,15.12,17.00},
-        {3.53501,0.00,19.580,1,0.8710,6.1520,82.60,1.7455,5,403.0,14.70,88.01,15.02,15.60},
-        {2.44668,0.00,19.580,0,0.8710,5.2720,94.00,1.7364,5,403.0,14.70,88.63,16.14,13.10},
-        {1.22358,0.00,19.580,0,0.6050,6.9430,97.40,1.8773,5,403.0,14.70,363.43,4.59,41.30},
-        {1.34284,0.00,19.580,0,0.6050,6.0660,100.00,1.7573,5,403.0,14.70,353.89,6.43,24.30},
-        {1.42502,0.00,19.580,0,0.8710,6.5100,100.00,1.7659,5,403.0,14.70,364.31,7.39,23.30},
-        {1.27346,0.00,19.580,1,0.6050,6.2500,92.60,1.7984,5,403.0,14.70,338.92,5.50,27.00},
-        {1.46336,0.00,19.580,0,0.6050,7.4890,90.80,1.9709,5,403.0,14.70,374.43,1.73,50.00},
-        {1.83377,0.00,19.580,1,0.6050,7.8020,98.20,2.0407,5,403.0,14.70,389.61,1.92,50.00},
-        {1.51902,0.00,19.580,1,0.6050,8.3750,93.90,2.1620,5,403.0,14.70,388.45,3.32,50.00},
-        {2.24236,0.00,19.580,0,0.6050,5.8540,91.80,2.4220,5,403.0,14.70,395.11,11.64,22.70},
-        {2.92400,0.00,19.580,0,0.6050,6.1010,93.00,2.2834,5,403.0,14.70,240.16,9.81,25.00},
-        {2.01019,0.00,19.580,0,0.6050,7.9290,96.20,2.0459,5,403.0,14.70,369.30,3.70,50.00},
-        {1.80028,0.00,19.580,0,0.6050,5.8770,79.20,2.4259,5,403.0,14.70,227.61,12.14,23.80},
-        {2.30040,0.00,19.580,0,0.6050,6.3190,96.10,2.1000,5,403.0,14.70,297.09,11.10,23.80},
-        {2.44953,0.00,19.580,0,0.6050,6.4020,95.20,2.2625,5,403.0,14.70,330.04,11.32,22.30},
-        {1.20742,0.00,19.580,0,0.6050,5.8750,94.60,2.4259,5,403.0,14.70,292.29,14.43,17.40},
-        {2.31390,0.00,19.580,0,0.6050,5.8800,97.30,2.3887,5,403.0,14.70,348.13,12.03,19.10},
-        {0.13914,0.00,4.050,0,0.5100,5.5720,88.50,2.5961,5,296.0,16.60,396.90,14.69,23.10},
-        {0.09178,0.00,4.050,0,0.5100,6.4160,84.10,2.6463,5,296.0,16.60,395.50,9.04,23.60},
-        {0.08447,0.00,4.050,0,0.5100,5.8590,68.70,2.7019,5,296.0,16.60,393.23,9.64,22.60},
-        {0.06664,0.00,4.050,0,0.5100,6.5460,33.10,3.1323,5,296.0,16.60,390.96,5.33,29.40},
-        {0.07022,0.00,4.050,0,0.5100,6.0200,47.20,3.5549,5,296.0,16.60,393.23,10.11,23.20},
-        {0.05425,0.00,4.050,0,0.5100,6.3150,73.40,3.3175,5,296.0,16.60,395.60,6.29,24.60},
-        {0.06642,0.00,4.050,0,0.5100,6.8600,74.40,2.9153,5,296.0,16.60,391.27,6.92,29.90},
-        {0.05780,0.00,2.460,0,0.4880,6.9800,58.40,2.8290,3,193.0,17.80,396.90,5.04,37.20},
-        {0.06588,0.00,2.460,0,0.4880,7.7650,83.30,2.7410,3,193.0,17.80,395.56,7.56,39.80},
-        {0.06888,0.00,2.460,0,0.4880,6.1440,62.20,2.5979,3,193.0,17.80,396.90,9.45,36.20},
-        {0.09103,0.00,2.460,0,0.4880,7.1550,92.20,2.7006,3,193.0,17.80,394.12,4.82,37.90},
-        {0.10008,0.00,2.460,0,0.4880,6.5630,95.60,2.8470,3,193.0,17.80,396.90,5.68,32.50},
-        {0.08308,0.00,2.460,0,0.4880,5.6040,89.80,2.9879,3,193.0,17.80,391.00,13.98,26.40},
-        {0.06047,0.00,2.460,0,0.4880,6.1530,68.80,3.2797,3,193.0,17.80,387.11,13.15,29.60},
-        {0.05602,0.00,2.460,0,0.4880,7.8310,53.60,3.1992,3,193.0,17.80,392.63,4.45,50.00},
-        {0.07875,45.00,3.440,0,0.4370,6.7820,41.10,3.7886,5,398.0,15.20,393.87,6.68,32.00},
-        {0.12579,45.00,3.440,0,0.4370,6.5560,29.10,4.5667,5,398.0,15.20,382.84,4.56,29.80},
-        {0.08370,45.00,3.440,0,0.4370,7.1850,38.90,4.5667,5,398.0,15.20,396.90,5.39,34.90},
-        {0.09068,45.00,3.440,0,0.4370,6.9510,21.50,6.4798,5,398.0,15.20,377.68,5.10,37.00},
-        {0.06911,45.00,3.440,0,0.4370,6.7390,30.80,6.4798,5,398.0,15.20,389.71,4.69,30.50},
-        {0.08664,45.00,3.440,0,0.4370,7.1780,26.30,6.4798,5,398.0,15.20,390.49,2.87,36.40},
-        {0.02187,60.00,2.930,0,0.4010,6.8000,9.90,6.2196,1,265.0,15.60,393.37,5.03,31.10},
-        {0.01439,60.00,2.930,0,0.4010,6.6040,18.80,6.2196,1,265.0,15.60,376.70,4.38,29.10},
-        {0.01381,80.00,0.460,0,0.4220,7.8750,32.00,5.6484,4,255.0,14.40,394.23,2.97,50.00},
-        {0.04011,80.00,1.520,0,0.4040,7.2870,34.10,7.3090,2,329.0,12.60,396.90,4.08,33.30},
-        {0.04666,80.00,1.520,0,0.4040,7.1070,36.60,7.3090,2,329.0,12.60,354.31,8.61,30.30},
-        {0.03768,80.00,1.520,0,0.4040,7.2740,38.30,7.3090,2,329.0,12.60,392.20,6.62,34.60},
-        {0.03150,95.00,1.470,0,0.4030,6.9750,15.30,7.6534,3,402.0,17.00,396.90,4.56,34.90},
-        {0.01778,95.00,1.470,0,0.4030,7.1350,13.90,7.6534,3,402.0,17.00,384.30,4.45,32.90},
-        {0.03445,82.50,2.030,0,0.4150,6.1620,38.40,6.2700,2,348.0,14.70,393.77,7.43,24.10},
-        {0.02177,82.50,2.030,0,0.4150,7.6100,15.70,6.2700,2,348.0,14.70,395.38,3.11,42.30},
-        {0.03510,95.00,2.680,0,0.4161,7.8530,33.20,5.1180,4,224.0,14.70,392.78,3.81,48.50},
-        {0.02009,95.00,2.680,0,0.4161,8.0340,31.90,5.1180,4,224.0,14.70,390.55,2.88,50.00},
-        {0.13642,0.00,10.590,0,0.4890,5.8910,22.30,3.9454,4,277.0,18.60,396.90,10.87,22.60},
-        {0.22969,0.00,10.590,0,0.4890,6.3260,52.50,4.3549,4,277.0,18.60,394.87,10.97,24.40},
-        {0.25199,0.00,10.590,0,0.4890,5.7830,72.70,4.3549,4,277.0,18.60,389.43,18.06,22.50},
-        {0.13587,0.00,10.590,1,0.4890,6.0640,59.10,4.2392,4,277.0,18.60,381.32,14.66,24.40},
-        {0.43571,0.00,10.590,1,0.4890,5.3440,100.00,3.8750,4,277.0,18.60,396.90,23.09,20.00},
-        {0.17446,0.00,10.590,1,0.4890,5.9600,92.10,3.8771,4,277.0,18.60,393.25,17.27,21.70},
-        {0.37578,0.00,10.590,1,0.4890,5.4040,88.60,3.6650,4,277.0,18.60,395.24,23.98,19.30},
-        {0.21719,0.00,10.590,1,0.4890,5.8070,53.80,3.6526,4,277.0,18.60,390.94,16.03,22.40},
-        {0.14052,0.00,10.590,0,0.4890,6.3750,32.30,3.9454,4,277.0,18.60,385.81,9.38,28.10},
-        {0.28955,0.00,10.590,0,0.4890,5.4120,9.80,3.5875,4,277.0,18.60,348.93,29.55,23.70},
-        {0.19802,0.00,10.590,0,0.4890,6.1820,42.40,3.9454,4,277.0,18.60,393.63,9.47,25.00},
-        {0.04560,0.00,13.890,1,0.5500,5.8880,56.00,3.1121,5,276.0,16.40,392.80,13.51,23.30},
-        {0.07013,0.00,13.890,0,0.5500,6.6420,85.10,3.4211,5,276.0,16.40,392.78,9.69,28.70},
-        {0.11069,0.00,13.890,1,0.5500,5.9510,93.80,2.8893,5,276.0,16.40,396.90,17.92,21.50},
-        {0.11425,0.00,13.890,1,0.5500,6.3730,92.40,3.3633,5,276.0,16.40,393.74,10.50,23.00},
-        {0.35809,0.00,6.200,1,0.5070,6.9510,88.50,2.8617,8,307.0,17.40,391.70,9.71,26.70},
-        {0.40771,0.00,6.200,1,0.5070,6.1640,91.30,3.0480,8,307.0,17.40,395.24,21.46,21.70},
-        {0.62356,0.00,6.200,1,0.5070,6.8790,77.70,3.2721,8,307.0,17.40,390.39,9.93,27.50},
-        {0.61470,0.00,6.200,0,0.5070,6.6180,80.80,3.2721,8,307.0,17.40,396.90,7.60,30.10},
-        {0.31533,0.00,6.200,0,0.5040,8.2660,78.30,2.8944,8,307.0,17.40,385.05,4.14,44.80},
-        {0.52693,0.00,6.200,0,0.5040,8.7250,83.00,2.8944,8,307.0,17.40,382.00,4.63,50.00},
-        {0.38214,0.00,6.200,0,0.5040,8.0400,86.50,3.2157,8,307.0,17.40,387.38,3.13,37.60},
-        {0.41238,0.00,6.200,0,0.5040,7.1630,79.90,3.2157,8,307.0,17.40,372.08,6.36,31.60},
-        {0.29819,0.00,6.200,0,0.5040,7.6860,17.00,3.3751,8,307.0,17.40,377.51,3.92,46.70},
-        {0.44178,0.00,6.200,0,0.5040,6.5520,21.40,3.3751,8,307.0,17.40,380.34,3.76,31.50},
-        {0.53700,0.00,6.200,0,0.5040,5.9810,68.10,3.6715,8,307.0,17.40,378.35,11.65,24.30},
-        {0.46296,0.00,6.200,0,0.5040,7.4120,76.90,3.6715,8,307.0,17.40,376.14,5.25,31.70},
-        {0.57529,0.00,6.200,0,0.5070,8.3370,73.30,3.8384,8,307.0,17.40,385.91,2.47,41.70},
-        {0.33147,0.00,6.200,0,0.5070,8.2470,70.40,3.6519,8,307.0,17.40,378.95,3.95,48.30},
-        {0.44791,0.00,6.200,1,0.5070,6.7260,66.50,3.6519,8,307.0,17.40,360.20,8.05,29.00},
-        {0.33045,0.00,6.200,0,0.5070,6.0860,61.50,3.6519,8,307.0,17.40,376.75,10.88,24.00},
-        {0.52058,0.00,6.200,1,0.5070,6.6310,76.50,4.1480,8,307.0,17.40,388.45,9.54,25.10},
-        {0.51183,0.00,6.200,0,0.5070,7.3580,71.60,4.1480,8,307.0,17.40,390.07,4.73,31.50},
-        {0.08244,30.00,4.930,0,0.4280,6.4810,18.50,6.1899,6,300.0,16.60,379.41,6.36,23.70},
-        {0.09252,30.00,4.930,0,0.4280,6.6060,42.20,6.1899,6,300.0,16.60,383.78,7.37,23.30},
-        {0.11329,30.00,4.930,0,0.4280,6.8970,54.30,6.3361,6,300.0,16.60,391.25,11.38,22.00},
-        {0.10612,30.00,4.930,0,0.4280,6.0950,65.10,6.3361,6,300.0,16.60,394.62,12.40,20.10},
-        {0.10290,30.00,4.930,0,0.4280,6.3580,52.90,7.0355,6,300.0,16.60,372.75,11.22,22.20},
-        {0.12757,30.00,4.930,0,0.4280,6.3930,7.80,7.0355,6,300.0,16.60,374.71,5.19,23.70},
-        {0.20608,22.00,5.860,0,0.4310,5.5930,76.50,7.9549,7,330.0,19.10,372.49,12.50,17.60},
-        {0.19133,22.00,5.860,0,0.4310,5.6050,70.20,7.9549,7,330.0,19.10,389.13,18.46,18.50},
-        {0.33983,22.00,5.860,0,0.4310,6.1080,34.90,8.0555,7,330.0,19.10,390.18,9.16,24.30},
-        {0.19657,22.00,5.860,0,0.4310,6.2260,79.20,8.0555,7,330.0,19.10,376.14,10.15,20.50},
-        {0.16439,22.00,5.860,0,0.4310,6.4330,49.10,7.8265,7,330.0,19.10,374.71,9.52,24.50},
-        {0.19073,22.00,5.860,0,0.4310,6.7180,17.50,7.8265,7,330.0,19.10,393.74,6.56,26.20},
-        {0.14030,22.00,5.860,0,0.4310,6.4870,13.00,7.3967,7,330.0,19.10,396.28,5.90,24.40},
-        {0.21409,22.00,5.860,0,0.4310,6.4380,8.90,7.3967,7,330.0,19.10,377.07,3.59,24.80},
-        {0.08221,22.00,5.860,0,0.4310,6.9570,6.80,8.9067,7,330.0,19.10,386.09,3.53,29.60},
-        {0.36894,22.00,5.860,0,0.4310,8.2590,8.40,8.9067,7,330.0,19.10,396.90,3.54,42.80},
-        {0.04819,80.00,3.640,0,0.3920,6.1080,32.00,9.2203,1,315.0,16.40,392.89,6.57,21.90},
-        {0.03548,80.00,3.640,0,0.3920,5.8760,19.10,9.2203,1,315.0,16.40,395.18,9.25,20.90},
-        {0.01538,90.00,3.750,0,0.3940,7.4540,34.20,6.3361,3,244.0,15.90,386.34,3.11,44.00},
-        {0.61154,20.00,3.970,0,0.6470,8.7040,86.90,1.8010,5,264.0,13.00,389.70,5.12,50.00},
-        {0.66351,20.00,3.970,0,0.6470,7.3330,100.00,1.8946,5,264.0,13.00,383.29,7.79,36.00},
-        {0.65665,20.00,3.970,0,0.6470,6.8420,100.00,2.0107,5,264.0,13.00,391.93,6.90,30.10},
-        {0.54011,20.00,3.970,0,0.6470,7.2030,81.80,2.1121,5,264.0,13.00,392.80,9.59,33.80},
-        {0.53412,20.00,3.970,0,0.6470,7.5200,89.40,2.1398,5,264.0,13.00,388.37,7.26,43.10},
-        {0.52014,20.00,3.970,0,0.6470,8.3980,91.50,2.2885,5,264.0,13.00,386.86,5.91,48.80},
-        {0.82526,20.00,3.970,0,0.6470,7.3270,94.50,2.0788,5,264.0,13.00,393.42,11.25,31.00},
-        {0.55007,20.00,3.970,0,0.6470,7.2060,91.60,1.9301,5,264.0,13.00,387.89,8.10,36.50},
-        {0.76162,20.00,3.970,0,0.6470,5.5600,62.80,1.9865,5,264.0,13.00,392.40,10.45,22.80},
-        {0.78570,20.00,3.970,0,0.6470,7.0140,84.60,2.1329,5,264.0,13.00,384.07,14.79,30.70},
-        {0.57834,20.00,3.970,0,0.5750,8.2970,67.00,2.4216,5,264.0,13.00,384.54,7.44,50.00},
-        {0.54050,20.00,3.970,0,0.5750,7.4700,52.60,2.8720,5,264.0,13.00,390.30,3.16,43.50},
-        {0.09065,20.00,6.960,1,0.4640,5.9200,61.50,3.9175,3,223.0,18.60,391.34,13.65,20.70},
-        {0.29916,20.00,6.960,0,0.4640,5.8560,42.10,4.4290,3,223.0,18.60,388.65,13.00,21.10},
-        {0.16211,20.00,6.960,0,0.4640,6.2400,16.30,4.4290,3,223.0,18.60,396.90,6.59,25.20},
-        {0.11460,20.00,6.960,0,0.4640,6.5380,58.70,3.9175,3,223.0,18.60,394.96,7.73,24.40},
-        {0.22188,20.00,6.960,1,0.4640,7.6910,51.80,4.3665,3,223.0,18.60,390.77,6.58,35.20},
-        {0.05644,40.00,6.410,1,0.4470,6.7580,32.90,4.0776,4,254.0,17.60,396.90,3.53,32.40},
-        {0.09604,40.00,6.410,0,0.4470,6.8540,42.80,4.2673,4,254.0,17.60,396.90,2.98,32.00},
-        {0.10469,40.00,6.410,1,0.4470,7.2670,49.00,4.7872,4,254.0,17.60,389.25,6.05,33.20},
-        {0.06127,40.00,6.410,1,0.4470,6.8260,27.60,4.8628,4,254.0,17.60,393.45,4.16,33.10},
-        {0.07978,40.00,6.410,0,0.4470,6.4820,32.10,4.1403,4,254.0,17.60,396.90,7.19,29.10},
-        {0.21038,20.00,3.330,0,0.4429,6.8120,32.20,4.1007,5,216.0,14.90,396.90,4.85,35.10},
-        {0.03578,20.00,3.330,0,0.4429,7.8200,64.50,4.6947,5,216.0,14.90,387.31,3.76,45.40},
-        {0.03705,20.00,3.330,0,0.4429,6.9680,37.20,5.2447,5,216.0,14.90,392.23,4.59,35.40},
-        {0.06129,20.00,3.330,1,0.4429,7.6450,49.70,5.2119,5,216.0,14.90,377.07,3.01,46.00},
-        {0.01501,90.00,1.210,1,0.4010,7.9230,24.80,5.8850,1,198.0,13.60,395.52,3.16,50.00},
-        {0.00906,90.00,2.970,0,0.4000,7.0880,20.80,7.3073,1,285.0,15.30,394.72,7.85,32.20},
-        {0.01096,55.00,2.250,0,0.3890,6.4530,31.90,7.3073,1,300.0,15.30,394.72,8.23,22.00},
-        {0.01965,80.00,1.760,0,0.3850,6.2300,31.50,9.0892,1,241.0,18.20,341.60,12.93,20.10},
-        {0.03871,52.50,5.320,0,0.4050,6.2090,31.30,7.3172,6,293.0,16.60,396.90,7.14,23.20},
-        {0.04590,52.50,5.320,0,0.4050,6.3150,45.60,7.3172,6,293.0,16.60,396.90,7.60,22.30},
-        {0.04297,52.50,5.320,0,0.4050,6.5650,22.90,7.3172,6,293.0,16.60,371.72,9.51,24.80},
-        {0.03502,80.00,4.950,0,0.4110,6.8610,27.90,5.1167,4,245.0,19.20,396.90,3.33,28.50},
-        {0.07886,80.00,4.950,0,0.4110,7.1480,27.70,5.1167,4,245.0,19.20,396.90,3.56,37.30},
-        {0.03615,80.00,4.950,0,0.4110,6.6300,23.40,5.1167,4,245.0,19.20,396.90,4.70,27.90},
-        {0.08265,0.00,13.920,0,0.4370,6.1270,18.40,5.5027,4,289.0,16.00,396.90,8.58,23.90},
-        {0.08199,0.00,13.920,0,0.4370,6.0090,42.30,5.5027,4,289.0,16.00,396.90,10.40,21.70},
-        {0.12932,0.00,13.920,0,0.4370,6.6780,31.10,5.9604,4,289.0,16.00,396.90,6.27,28.60},
-        {0.05372,0.00,13.920,0,0.4370,6.5490,51.00,5.9604,4,289.0,16.00,392.85,7.39,27.10},
-        {0.14103,0.00,13.920,0,0.4370,5.7900,58.00,6.3200,4,289.0,16.00,396.90,15.84,20.30},
-        {0.06466,70.00,2.240,0,0.4000,6.3450,20.10,7.8278,5,358.0,14.80,368.24,4.97,22.50},
-        {0.05561,70.00,2.240,0,0.4000,7.0410,10.00,7.8278,5,358.0,14.80,371.58,4.74,29.00},
-        {0.04417,70.00,2.240,0,0.4000,6.8710,47.40,7.8278,5,358.0,14.80,390.86,6.07,24.80},
-        {0.03537,34.00,6.090,0,0.4330,6.5900,40.40,5.4917,7,329.0,16.10,395.75,9.50,22.00},
-        {0.09266,34.00,6.090,0,0.4330,6.4950,18.40,5.4917,7,329.0,16.10,383.61,8.67,26.40},
-        {0.10000,34.00,6.090,0,0.4330,6.9820,17.70,5.4917,7,329.0,16.10,390.43,4.86,33.10},
-        {0.05515,33.00,2.180,0,0.4720,7.2360,41.10,4.0220,7,222.0,18.40,393.68,6.93,36.10},
-        {0.05479,33.00,2.180,0,0.4720,6.6160,58.10,3.3700,7,222.0,18.40,393.36,8.93,28.40},
-        {0.07503,33.00,2.180,0,0.4720,7.4200,71.90,3.0992,7,222.0,18.40,396.90,6.47,33.40},
-        {0.04932,33.00,2.180,0,0.4720,6.8490,70.30,3.1827,7,222.0,18.40,396.90,7.53,28.20},
-        {0.49298,0.00,9.900,0,0.5440,6.6350,82.50,3.3175,4,304.0,18.40,396.90,4.54,22.80},
-        {0.34940,0.00,9.900,0,0.5440,5.9720,76.70,3.1025,4,304.0,18.40,396.24,9.97,20.30},
-        {2.63548,0.00,9.900,0,0.5440,4.9730,37.80,2.5194,4,304.0,18.40,350.45,12.64,16.10},
-        {0.79041,0.00,9.900,0,0.5440,6.1220,52.80,2.6403,4,304.0,18.40,396.90,5.98,22.10},
-        {0.26169,0.00,9.900,0,0.5440,6.0230,90.40,2.8340,4,304.0,18.40,396.30,11.72,19.40},
-        {0.26938,0.00,9.900,0,0.5440,6.2660,82.80,3.2628,4,304.0,18.40,393.39,7.90,21.60},
-        {0.36920,0.00,9.900,0,0.5440,6.5670,87.30,3.6023,4,304.0,18.40,395.69,9.28,23.80},
-        {0.25356,0.00,9.900,0,0.5440,5.7050,77.70,3.9450,4,304.0,18.40,396.42,11.50,16.20},
-        {0.31827,0.00,9.900,0,0.5440,5.9140,83.20,3.9986,4,304.0,18.40,390.70,18.33,17.80},
-        {0.24522,0.00,9.900,0,0.5440,5.7820,71.70,4.0317,4,304.0,18.40,396.90,15.94,19.80},
-        {0.40202,0.00,9.900,0,0.5440,6.3820,67.20,3.5325,4,304.0,18.40,395.21,10.36,23.10},
-        {0.47547,0.00,9.900,0,0.5440,6.1130,58.80,4.0019,4,304.0,18.40,396.23,12.73,21.00},
-        {0.16760,0.00,7.380,0,0.4930,6.4260,52.30,4.5404,5,287.0,19.60,396.90,7.20,23.80},
-        {0.18159,0.00,7.380,0,0.4930,6.3760,54.30,4.5404,5,287.0,19.60,396.90,6.87,23.10},
-        {0.35114,0.00,7.380,0,0.4930,6.0410,49.90,4.7211,5,287.0,19.60,396.90,7.70,20.40},
-        {0.28392,0.00,7.380,0,0.4930,5.7080,74.30,4.7211,5,287.0,19.60,391.13,11.74,18.50},
-        {0.34109,0.00,7.380,0,0.4930,6.4150,40.10,4.7211,5,287.0,19.60,396.90,6.12,25.00},
-        {0.19186,0.00,7.380,0,0.4930,6.4310,14.70,5.4159,5,287.0,19.60,393.68,5.08,24.60},
-        {0.30347,0.00,7.380,0,0.4930,6.3120,28.90,5.4159,5,287.0,19.60,396.90,6.15,23.00},
-        {0.24103,0.00,7.380,0,0.4930,6.0830,43.70,5.4159,5,287.0,19.60,396.90,12.79,22.20},
-        {0.06617,0.00,3.240,0,0.4600,5.8680,25.80,5.2146,4,430.0,16.90,382.44,9.97,19.30},
-        {0.06724,0.00,3.240,0,0.4600,6.3330,17.20,5.2146,4,430.0,16.90,375.21,7.34,22.60},
-        {0.04544,0.00,3.240,0,0.4600,6.1440,32.20,5.8736,4,430.0,16.90,368.57,9.09,19.80},
-        {0.05023,35.00,6.060,0,0.4379,5.7060,28.40,6.6407,1,304.0,16.90,394.02,12.43,17.10},
-        {0.03466,35.00,6.060,0,0.4379,6.0310,23.30,6.6407,1,304.0,16.90,362.25,7.83,19.40},
-        {0.05083,0.00,5.190,0,0.5150,6.3160,38.10,6.4584,5,224.0,20.20,389.71,5.68,22.20},
-        {0.03738,0.00,5.190,0,0.5150,6.3100,38.50,6.4584,5,224.0,20.20,389.40,6.75,20.70},
-        {0.03961,0.00,5.190,0,0.5150,6.0370,34.50,5.9853,5,224.0,20.20,396.90,8.01,21.10},
-        {0.03427,0.00,5.190,0,0.5150,5.8690,46.30,5.2311,5,224.0,20.20,396.90,9.80,19.50},
-        {0.03041,0.00,5.190,0,0.5150,5.8950,59.60,5.6150,5,224.0,20.20,394.81,10.56,18.50},
-        {0.03306,0.00,5.190,0,0.5150,6.0590,37.30,4.8122,5,224.0,20.20,396.14,8.51,20.60},
-        {0.05497,0.00,5.190,0,0.5150,5.9850,45.40,4.8122,5,224.0,20.20,396.90,9.74,19.00},
-        {0.06151,0.00,5.190,0,0.5150,5.9680,58.50,4.8122,5,224.0,20.20,396.90,9.29,18.70},
-        {0.01301,35.00,1.520,0,0.4420,7.2410,49.30,7.0379,1,284.0,15.50,394.74,5.49,32.70},
-        {0.02498,0.00,1.890,0,0.5180,6.5400,59.70,6.2669,1,422.0,15.90,389.96,8.65,16.50},
-        {0.02543,55.00,3.780,0,0.4840,6.6960,56.40,5.7321,5,370.0,17.60,396.90,7.18,23.90},
-        {0.03049,55.00,3.780,0,0.4840,6.8740,28.10,6.4654,5,370.0,17.60,387.97,4.61,31.20},
-        {0.03113,0.00,4.390,0,0.4420,6.0140,48.50,8.0136,3,352.0,18.80,385.64,10.53,17.50},
-        {0.06162,0.00,4.390,0,0.4420,5.8980,52.30,8.0136,3,352.0,18.80,364.61,12.67,17.20},
-        {0.01870,85.00,4.150,0,0.4290,6.5160,27.70,8.5353,4,351.0,17.90,392.43,6.36,23.10},
-        {0.01501,80.00,2.010,0,0.4350,6.6350,29.70,8.3440,4,280.0,17.00,390.94,5.99,24.50},
-        {0.02899,40.00,1.250,0,0.4290,6.9390,34.50,8.7921,1,335.0,19.70,389.85,5.89,26.60},
-        {0.06211,40.00,1.250,0,0.4290,6.4900,44.40,8.7921,1,335.0,19.70,396.90,5.98,22.90},
-        {0.07950,60.00,1.690,0,0.4110,6.5790,35.90,10.7103,4,411.0,18.30,370.78,5.49,24.10},
-        {0.07244,60.00,1.690,0,0.4110,5.8840,18.50,10.7103,4,411.0,18.30,392.33,7.79,18.60},
-        {0.01709,90.00,2.020,0,0.4100,6.7280,36.10,12.1265,5,187.0,17.00,384.46,4.50,30.10},
-        {0.04301,80.00,1.910,0,0.4130,5.6630,21.90,10.5857,4,334.0,22.00,382.80,8.05,18.20},
-        {0.10659,80.00,1.910,0,0.4130,5.9360,19.50,10.5857,4,334.0,22.00,376.04,5.57,20.60},
-        {8.98296,0.00,18.100,1,0.7700,6.2120,97.40,2.1222,24,666.0,20.20,377.73,17.60,17.80},
-        {3.84970,0.00,18.100,1,0.7700,6.3950,91.00,2.5052,24,666.0,20.20,391.34,13.27,21.70},
-        {5.20177,0.00,18.100,1,0.7700,6.1270,83.40,2.7227,24,666.0,20.20,395.43,11.48,22.70},
-        {4.26131,0.00,18.100,0,0.7700,6.1120,81.30,2.5091,24,666.0,20.20,390.74,12.67,22.60},
-        {4.54192,0.00,18.100,0,0.7700,6.3980,88.00,2.5182,24,666.0,20.20,374.56,7.79,25.00},
-        {3.83684,0.00,18.100,0,0.7700,6.2510,91.10,2.2955,24,666.0,20.20,350.65,14.19,19.90},
-        {3.67822,0.00,18.100,0,0.7700,5.3620,96.20,2.1036,24,666.0,20.20,380.79,10.19,20.80},
-        {4.22239,0.00,18.100,1,0.7700,5.8030,89.00,1.9047,24,666.0,20.20,353.04,14.64,16.80},
-        {3.47428,0.00,18.100,1,0.7180,8.7800,82.90,1.9047,24,666.0,20.20,354.55,5.29,21.90},
-        {4.55587,0.00,18.100,0,0.7180,3.5610,87.90,1.6132,24,666.0,20.20,354.70,7.12,27.50},
-        {3.69695,0.00,18.100,0,0.7180,4.9630,91.40,1.7523,24,666.0,20.20,316.03,14.00,21.90},
-        {13.52220,0.00,18.100,0,0.6310,3.8630,100.00,1.5106,24,666.0,20.20,131.42,13.33,23.10},
-        {4.89822,0.00,18.100,0,0.6310,4.9700,100.00,1.3325,24,666.0,20.20,375.52,3.26,50.00},
-        {5.66998,0.00,18.100,1,0.6310,6.6830,96.80,1.3567,24,666.0,20.20,375.33,3.73,50.00},
-        {6.53876,0.00,18.100,1,0.6310,7.0160,97.50,1.2024,24,666.0,20.20,392.05,2.96,50.00},
-        {9.23230,0.00,18.100,0,0.6310,6.2160,100.00,1.1691,24,666.0,20.20,366.15,9.53,50.00},
-        {8.26725,0.00,18.100,1,0.6680,5.8750,89.60,1.1296,24,666.0,20.20,347.88,8.88,50.00},
-        {11.10810,0.00,18.100,0,0.6680,4.9060,100.00,1.1742,24,666.0,20.20,396.90,34.77,13.80},
-        {18.49820,0.00,18.100,0,0.6680,4.1380,100.00,1.1370,24,666.0,20.20,396.90,37.97,13.80},
-        {19.60910,0.00,18.100,0,0.6710,7.3130,97.90,1.3163,24,666.0,20.20,396.90,13.44,15.00},
-        {15.28800,0.00,18.100,0,0.6710,6.6490,93.30,1.3449,24,666.0,20.20,363.02,23.24,13.90},
-        {9.82349,0.00,18.100,0,0.6710,6.7940,98.80,1.3580,24,666.0,20.20,396.90,21.24,13.30},
-        {23.64820,0.00,18.100,0,0.6710,6.3800,96.20,1.3861,24,666.0,20.20,396.90,23.69,13.10},
-        {17.86670,0.00,18.100,0,0.6710,6.2230,100.00,1.3861,24,666.0,20.20,393.74,21.78,10.20},
-        {88.97620,0.00,18.100,0,0.6710,6.9680,91.90,1.4165,24,666.0,20.20,396.90,17.21,10.40},
-        {15.87440,0.00,18.100,0,0.6710,6.5450,99.10,1.5192,24,666.0,20.20,396.90,21.08,10.90},
-        {9.18702,0.00,18.100,0,0.7000,5.5360,100.00,1.5804,24,666.0,20.20,396.90,23.60,11.30},
-        {7.99248,0.00,18.100,0,0.7000,5.5200,100.00,1.5331,24,666.0,20.20,396.90,24.56,12.30},
-        {20.08490,0.00,18.100,0,0.7000,4.3680,91.20,1.4395,24,666.0,20.20,285.83,30.63,8.80},
-        {16.81180,0.00,18.100,0,0.7000,5.2770,98.10,1.4261,24,666.0,20.20,396.90,30.81,7.20},
-        {24.39380,0.00,18.100,0,0.7000,4.6520,100.00,1.4672,24,666.0,20.20,396.90,28.28,10.50},
-        {22.59710,0.00,18.100,0,0.7000,5.0000,89.50,1.5184,24,666.0,20.20,396.90,31.99,7.40},
-        {14.33370,0.00,18.100,0,0.7000,4.8800,100.00,1.5895,24,666.0,20.20,372.92,30.62,10.20},
-        {8.15174,0.00,18.100,0,0.7000,5.3900,98.90,1.7281,24,666.0,20.20,396.90,20.85,11.50},
-        {6.96215,0.00,18.100,0,0.7000,5.7130,97.00,1.9265,24,666.0,20.20,394.43,17.11,15.10},
-        {5.29305,0.00,18.100,0,0.7000,6.0510,82.50,2.1678,24,666.0,20.20,378.38,18.76,23.20},
-        {11.57790,0.00,18.100,0,0.7000,5.0360,97.00,1.7700,24,666.0,20.20,396.90,25.68,9.70},
-        {8.64476,0.00,18.100,0,0.6930,6.1930,92.60,1.7912,24,666.0,20.20,396.90,15.17,13.80},
-        {13.35980,0.00,18.100,0,0.6930,5.8870,94.70,1.7821,24,666.0,20.20,396.90,16.35,12.70},
-        {8.71675,0.00,18.100,0,0.6930,6.4710,98.80,1.7257,24,666.0,20.20,391.98,17.12,13.10},
-        {5.87205,0.00,18.100,0,0.6930,6.4050,96.00,1.6768,24,666.0,20.20,396.90,19.37,12.50},
-        {7.67202,0.00,18.100,0,0.6930,5.7470,98.90,1.6334,24,666.0,20.20,393.10,19.92,8.50},
-        {38.35180,0.00,18.100,0,0.6930,5.4530,100.00,1.4896,24,666.0,20.20,396.90,30.59,5.00},
-        {9.91655,0.00,18.100,0,0.6930,5.8520,77.80,1.5004,24,666.0,20.20,338.16,29.97,6.30},
-        {25.04610,0.00,18.100,0,0.6930,5.9870,100.00,1.5888,24,666.0,20.20,396.90,26.77,5.60},
-        {14.23620,0.00,18.100,0,0.6930,6.3430,100.00,1.5741,24,666.0,20.20,396.90,20.32,7.20},
-        {9.59571,0.00,18.100,0,0.6930,6.4040,100.00,1.6390,24,666.0,20.20,376.11,20.31,12.10},
-        {24.80170,0.00,18.100,0,0.6930,5.3490,96.00,1.7028,24,666.0,20.20,396.90,19.77,8.30},
-        {41.52920,0.00,18.100,0,0.6930,5.5310,85.40,1.6074,24,666.0,20.20,329.46,27.38,8.50},
-        {67.92080,0.00,18.100,0,0.6930,5.6830,100.00,1.4254,24,666.0,20.20,384.97,22.98,5.00},
-        {20.71620,0.00,18.100,0,0.6590,4.1380,100.00,1.1781,24,666.0,20.20,370.22,23.34,11.90},
-        {11.95110,0.00,18.100,0,0.6590,5.6080,100.00,1.2852,24,666.0,20.20,332.09,12.13,27.90},
-        {7.40389,0.00,18.100,0,0.5970,5.6170,97.90,1.4547,24,666.0,20.20,314.64,26.40,17.20},
-        {14.43830,0.00,18.100,0,0.5970,6.8520,100.00,1.4655,24,666.0,20.20,179.36,19.78,27.50},
-        {51.13580,0.00,18.100,0,0.5970,5.7570,100.00,1.4130,24,666.0,20.20,2.60,10.11,15.00},
-        {14.05070,0.00,18.100,0,0.5970,6.6570,100.00,1.5275,24,666.0,20.20,35.05,21.22,17.20},
-        {18.81100,0.00,18.100,0,0.5970,4.6280,100.00,1.5539,24,666.0,20.20,28.79,34.37,17.90},
-        {28.65580,0.00,18.100,0,0.5970,5.1550,100.00,1.5894,24,666.0,20.20,210.97,20.08,16.30},
-        {45.74610,0.00,18.100,0,0.6930,4.5190,100.00,1.6582,24,666.0,20.20,88.27,36.98,7.00},
-        {18.08460,0.00,18.100,0,0.6790,6.4340,100.00,1.8347,24,666.0,20.20,27.25,29.05,7.20},
-        {10.83420,0.00,18.100,0,0.6790,6.7820,90.80,1.8195,24,666.0,20.20,21.57,25.79,7.50},
-        {25.94060,0.00,18.100,0,0.6790,5.3040,89.10,1.6475,24,666.0,20.20,127.36,26.64,10.40},
-        {73.53410,0.00,18.100,0,0.6790,5.9570,100.00,1.8026,24,666.0,20.20,16.45,20.62,8.80},
-        {11.81230,0.00,18.100,0,0.7180,6.8240,76.50,1.7940,24,666.0,20.20,48.45,22.74,8.40},
-        {11.08740,0.00,18.100,0,0.7180,6.4110,100.00,1.8589,24,666.0,20.20,318.75,15.02,16.70},
-        {7.02259,0.00,18.100,0,0.7180,6.0060,95.30,1.8746,24,666.0,20.20,319.98,15.70,14.20},
-        {12.04820,0.00,18.100,0,0.6140,5.6480,87.60,1.9512,24,666.0,20.20,291.55,14.10,20.80},
-        {7.05042,0.00,18.100,0,0.6140,6.1030,85.10,2.0218,24,666.0,20.20,2.52,23.29,13.40},
-        {8.79212,0.00,18.100,0,0.5840,5.5650,70.60,2.0635,24,666.0,20.20,3.65,17.16,11.70},
-        {15.86030,0.00,18.100,0,0.6790,5.8960,95.40,1.9096,24,666.0,20.20,7.68,24.39,8.30},
-        {12.24720,0.00,18.100,0,0.5840,5.8370,59.70,1.9976,24,666.0,20.20,24.65,15.69,10.20},
-        {37.66190,0.00,18.100,0,0.6790,6.2020,78.70,1.8629,24,666.0,20.20,18.82,14.52,10.90},
-        {7.36711,0.00,18.100,0,0.6790,6.1930,78.10,1.9356,24,666.0,20.20,96.73,21.52,11.00},
-        {9.33889,0.00,18.100,0,0.6790,6.3800,95.60,1.9682,24,666.0,20.20,60.72,24.08,9.50},
-        {8.49213,0.00,18.100,0,0.5840,6.3480,86.10,2.0527,24,666.0,20.20,83.45,17.64,14.50},
-        {10.06230,0.00,18.100,0,0.5840,6.8330,94.30,2.0882,24,666.0,20.20,81.33,19.69,14.10},
-        {6.44405,0.00,18.100,0,0.5840,6.4250,74.80,2.2004,24,666.0,20.20,97.95,12.03,16.10},
-        {5.58107,0.00,18.100,0,0.7130,6.4360,87.90,2.3158,24,666.0,20.20,100.19,16.22,14.30},
-        {13.91340,0.00,18.100,0,0.7130,6.2080,95.00,2.2222,24,666.0,20.20,100.63,15.17,11.70},
-        {11.16040,0.00,18.100,0,0.7400,6.6290,94.60,2.1247,24,666.0,20.20,109.85,23.27,13.40},
-        {14.42080,0.00,18.100,0,0.7400,6.4610,93.30,2.0026,24,666.0,20.20,27.49,18.05,9.60},
-        {15.17720,0.00,18.100,0,0.7400,6.1520,100.00,1.9142,24,666.0,20.20,9.32,26.45,8.70},
-        {13.67810,0.00,18.100,0,0.7400,5.9350,87.90,1.8206,24,666.0,20.20,68.95,34.02,8.40},
-        {9.39063,0.00,18.100,0,0.7400,5.6270,93.90,1.8172,24,666.0,20.20,396.90,22.88,12.80},
-        {22.05110,0.00,18.100,0,0.7400,5.8180,92.40,1.8662,24,666.0,20.20,391.45,22.11,10.50},
-        {9.72418,0.00,18.100,0,0.7400,6.4060,97.20,2.0651,24,666.0,20.20,385.96,19.52,17.10},
-        {5.66637,0.00,18.100,0,0.7400,6.2190,100.00,2.0048,24,666.0,20.20,395.69,16.59,18.40},
-        {9.96654,0.00,18.100,0,0.7400,6.4850,100.00,1.9784,24,666.0,20.20,386.73,18.85,15.40},
-        {12.80230,0.00,18.100,0,0.7400,5.8540,96.60,1.8956,24,666.0,20.20,240.52,23.79,10.80},
-        {10.67180,0.00,18.100,0,0.7400,6.4590,94.80,1.9879,24,666.0,20.20,43.06,23.98,11.80},
-        {6.28807,0.00,18.100,0,0.7400,6.3410,96.40,2.0720,24,666.0,20.20,318.01,17.79,14.90},
-        {9.92485,0.00,18.100,0,0.7400,6.2510,96.60,2.1980,24,666.0,20.20,388.52,16.44,12.60},
-        {9.32909,0.00,18.100,0,0.7130,6.1850,98.70,2.2616,24,666.0,20.20,396.90,18.13,14.10},
-        {7.52601,0.00,18.100,0,0.7130,6.4170,98.30,2.1850,24,666.0,20.20,304.21,19.31,13.00},
-        {6.71772,0.00,18.100,0,0.7130,6.7490,92.60,2.3236,24,666.0,20.20,0.32,17.44,13.40},
-        {5.44114,0.00,18.100,0,0.7130,6.6550,98.20,2.3552,24,666.0,20.20,355.29,17.73,15.20},
-        {5.09017,0.00,18.100,0,0.7130,6.2970,91.80,2.3682,24,666.0,20.20,385.09,17.27,16.10},
-        {8.24809,0.00,18.100,0,0.7130,7.3930,99.30,2.4527,24,666.0,20.20,375.87,16.74,17.80},
-        {9.51363,0.00,18.100,0,0.7130,6.7280,94.10,2.4961,24,666.0,20.20,6.68,18.71,14.90},
-        {4.75237,0.00,18.100,0,0.7130,6.5250,86.50,2.4358,24,666.0,20.20,50.92,18.13,14.10},
-        {4.66883,0.00,18.100,0,0.7130,5.9760,87.90,2.5806,24,666.0,20.20,10.48,19.01,12.70},
-        {8.20058,0.00,18.100,0,0.7130,5.9360,80.30,2.7792,24,666.0,20.20,3.50,16.94,13.50},
-        {7.75223,0.00,18.100,0,0.7130,6.3010,83.70,2.7831,24,666.0,20.20,272.21,16.23,14.90},
-        {6.80117,0.00,18.100,0,0.7130,6.0810,84.40,2.7175,24,666.0,20.20,396.90,14.70,20.00},
-        {4.81213,0.00,18.100,0,0.7130,6.7010,90.00,2.5975,24,666.0,20.20,255.23,16.42,16.40},
-        {3.69311,0.00,18.100,0,0.7130,6.3760,88.40,2.5671,24,666.0,20.20,391.43,14.65,17.70},
-        {6.65492,0.00,18.100,0,0.7130,6.3170,83.00,2.7344,24,666.0,20.20,396.90,13.99,19.50},
-        {5.82115,0.00,18.100,0,0.7130,6.5130,89.90,2.8016,24,666.0,20.20,393.82,10.29,20.20},
-        {7.83932,0.00,18.100,0,0.6550,6.2090,65.40,2.9634,24,666.0,20.20,396.90,13.22,21.40},
-        {3.16360,0.00,18.100,0,0.6550,5.7590,48.20,3.0665,24,666.0,20.20,334.40,14.13,19.90},
-        {3.77498,0.00,18.100,0,0.6550,5.9520,84.70,2.8715,24,666.0,20.20,22.01,17.15,19.00},
-        {4.42228,0.00,18.100,0,0.5840,6.0030,94.50,2.5403,24,666.0,20.20,331.29,21.32,19.10},
-        {15.57570,0.00,18.100,0,0.5800,5.9260,71.00,2.9084,24,666.0,20.20,368.74,18.13,19.10},
-        {13.07510,0.00,18.100,0,0.5800,5.7130,56.70,2.8237,24,666.0,20.20,396.90,14.76,20.10},
-        {4.34879,0.00,18.100,0,0.5800,6.1670,84.00,3.0334,24,666.0,20.20,396.90,16.29,19.90},
-        {4.03841,0.00,18.100,0,0.5320,6.2290,90.70,3.0993,24,666.0,20.20,395.33,12.87,19.60},
-        {3.56868,0.00,18.100,0,0.5800,6.4370,75.00,2.8965,24,666.0,20.20,393.37,14.36,23.20},
-        {4.64689,0.00,18.100,0,0.6140,6.9800,67.60,2.5329,24,666.0,20.20,374.68,11.66,29.80},
-        {8.05579,0.00,18.100,0,0.5840,5.4270,95.40,2.4298,24,666.0,20.20,352.58,18.14,13.80},
-        {6.39312,0.00,18.100,0,0.5840,6.1620,97.40,2.2060,24,666.0,20.20,302.76,24.10,13.30},
-        {4.87141,0.00,18.100,0,0.6140,6.4840,93.60,2.3053,24,666.0,20.20,396.21,18.68,16.70},
-        {15.02340,0.00,18.100,0,0.6140,5.3040,97.30,2.1007,24,666.0,20.20,349.48,24.91,12.00},
-        {10.23300,0.00,18.100,0,0.6140,6.1850,96.70,2.1705,24,666.0,20.20,379.70,18.03,14.60},
-        {14.33370,0.00,18.100,0,0.6140,6.2290,88.00,1.9512,24,666.0,20.20,383.32,13.11,21.40},
-        {5.82401,0.00,18.100,0,0.5320,6.2420,64.70,3.4242,24,666.0,20.20,396.90,10.74,23.00},
-        {5.70818,0.00,18.100,0,0.5320,6.7500,74.90,3.3317,24,666.0,20.20,393.07,7.74,23.70},
-        {5.73116,0.00,18.100,0,0.5320,7.0610,77.00,3.4106,24,666.0,20.20,395.28,7.01,25.00},
-        {2.81838,0.00,18.100,0,0.5320,5.7620,40.30,4.0983,24,666.0,20.20,392.92,10.42,21.80},
-        {2.37857,0.00,18.100,0,0.5830,5.8710,41.90,3.7240,24,666.0,20.20,370.73,13.34,20.60},
-        {3.67367,0.00,18.100,0,0.5830,6.3120,51.90,3.9917,24,666.0,20.20,388.62,10.58,21.20},
-        {5.69175,0.00,18.100,0,0.5830,6.1140,79.80,3.5459,24,666.0,20.20,392.68,14.98,19.10},
-        {4.83567,0.00,18.100,0,0.5830,5.9050,53.20,3.1523,24,666.0,20.20,388.22,11.45,20.60},
-        {0.15086,0.00,27.740,0,0.6090,5.4540,92.70,1.8209,4,711.0,20.10,395.09,18.06,15.20},
-        {0.18337,0.00,27.740,0,0.6090,5.4140,98.30,1.7554,4,711.0,20.10,344.05,23.97,7.00},
-        {0.20746,0.00,27.740,0,0.6090,5.0930,98.00,1.8226,4,711.0,20.10,318.43,29.68,8.10},
-        {0.10574,0.00,27.740,0,0.6090,5.9830,98.80,1.8681,4,711.0,20.10,390.11,18.07,13.60},
-        {0.11132,0.00,27.740,0,0.6090,5.9830,83.50,2.1099,4,711.0,20.10,396.90,13.35,20.10},
-        {0.17331,0.00,9.690,0,0.5850,5.7070,54.00,2.3817,6,391.0,19.20,396.90,12.01,21.80},
-        {0.27957,0.00,9.690,0,0.5850,5.9260,42.60,2.3817,6,391.0,19.20,396.90,13.59,24.50},
-        {0.17899,0.00,9.690,0,0.5850,5.6700,28.80,2.7986,6,391.0,19.20,393.29,17.60,23.10},
-        {0.28960,0.00,9.690,0,0.5850,5.3900,72.90,2.7986,6,391.0,19.20,396.90,21.14,19.70},
-        {0.26838,0.00,9.690,0,0.5850,5.7940,70.60,2.8927,6,391.0,19.20,396.90,14.10,18.30},
-        {0.23912,0.00,9.690,0,0.5850,6.0190,65.30,2.4091,6,391.0,19.20,396.90,12.92,21.20},
-        {0.17783,0.00,9.690,0,0.5850,5.5690,73.50,2.3999,6,391.0,19.20,395.77,15.10,17.50},
-        {0.22438,0.00,9.690,0,0.5850,6.0270,79.70,2.4982,6,391.0,19.20,396.90,14.33,16.80},
-        {0.06263,0.00,11.930,0,0.5730,6.5930,69.10,2.4786,1,273.0,21.00,391.99,9.67,22.40},
-        {0.04527,0.00,11.930,0,0.5730,6.1200,76.70,2.2875,1,273.0,21.00,396.90,9.08,20.60},
-        {0.06076,0.00,11.930,0,0.5730,6.9760,91.00,2.1675,1,273.0,21.00,396.90,5.64,23.90},
-        {0.10959,0.00,11.930,0,0.5730,6.7940,89.30,2.3889,1,273.0,21.00,393.45,6.48,22.00},
-        {0.04741,0.00,11.930,0,0.5730,6.0300,80.80,2.5050,1,273.0,21.00,396.90,7.88,11.90}
-    };
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/util/MLSandboxDatasets.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/util/MLSandboxDatasets.java b/examples/src/main/java/org/apache/ignite/examples/ml/util/MLSandboxDatasets.java
new file mode 100644
index 0000000..b7380e0
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/util/MLSandboxDatasets.java
@@ -0,0 +1,87 @@
+/*
+ * 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.util;
+
+/**
+ * The names of popular datasets used in examples.
+ */
+public enum MLSandboxDatasets {
+    /** The full Iris dataset from Machine Learning Repository. */
+    IRIS("examples/src/main/resources/datasets/iris.txt", false, "\t"),
+
+    /** The Titanic dataset from Kaggle competition. */
+    TITANIC("examples/src/main/resources/datasets/titanic.csv", true, ";"),
+
+    /** The 1st and 2nd classes from the Iris dataset. */
+    TWO_CLASSED_IRIS("examples/src/main/resources/datasets/two_classed_iris.csv", false, "\t"),
+
+    /** The dataset is about different computers' properties based on https://archive.ics.uci.edu/ml/datasets/Computer+Hardware. */
+    CLEARED_MACHINES("examples/src/main/resources/datasets/cleared_machines.csv", false, ";"),
+
+    /**
+     * The health data is related to death rate based on; doctor availability, hospital availability,
+     * annual per capita income, and population density people per square mile.
+     */
+    MORTALITY_DATA("examples/src/main/resources/datasets/mortalitydata.csv", false, ";"),
+
+    /**
+     * The preprocessed Glass dataset from the Machine Learning Repository https://archive.ics.uci.edu/ml/datasets/Glass+Identification
+     * There are 3 classes with labels: 1 {building_windows_float_processed}, 3 {vehicle_windows_float_processed}, 7 {headlamps}.
+     * Feature names: 'Na-Sodium', 'Mg-Magnesium', 'Al-Aluminum', 'Ba-Barium', 'Fe-Iron'.
+     */
+    GLASS_IDENTIFICATION("examples/src/main/resources/datasets/glass_identification.csv", false, ";"),
+
+    /** The Wine recognition data. Could be found <a href="https://archive.ics.uci.edu/ml/machine-learning-databases/wine/">here</a>. */
+    WINE_RECOGNITION("examples/src/main/resources/datasets/wine.txt", false, ","),
+
+    /** The Boston house-prices dataset. Could be found <a href="https://archive.ics.uci.edu/ml/machine-learning-databases/housing/">here</a>. */
+    BOSTON_HOUSE_PRICES("examples/src/main/resources/datasets/boston_housing_dataset.txt", false, ",");
+
+    /** Filename. */
+    private final String filename;
+
+    /** The csv file has header. */
+    private final boolean hasHeader;
+
+    /** The separator between words. */
+    private final String separator;
+
+    /**
+     * @param filename Filename.
+     * @param hasHeader The csv file has header.
+     * @param separator The special sign to separate the line on words.
+     */
+    MLSandboxDatasets(final String filename, boolean hasHeader, String separator) {
+        this.filename = filename;
+        this.hasHeader = hasHeader;
+        this.separator = separator;
+    }
+
+    /** */
+    public String getFileName() { return filename; }
+
+    /** */
+    public boolean hasHeader() {
+        return hasHeader;
+    }
+
+    /** */
+    public String getSeparator() {
+        return separator;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/util/SandboxMLCache.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/util/SandboxMLCache.java b/examples/src/main/java/org/apache/ignite/examples/ml/util/SandboxMLCache.java
new file mode 100644
index 0000000..cc607be
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/util/SandboxMLCache.java
@@ -0,0 +1,144 @@
+/*
+ * 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.util;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.nio.file.Paths;
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.util.Locale;
+import java.util.Scanner;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.ml.math.exceptions.knn.FileParsingException;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
+import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
+
+
+/**
+ * Common utility code used in some ML examples to set up test cache.
+ */
+public class SandboxMLCache {
+    /** */
+    private final Ignite ignite;
+
+    /** */
+    public SandboxMLCache(Ignite ignite) {
+        this.ignite = ignite;
+    }
+
+    /**
+     * Fills cache with data and returns it.
+     *
+     * @param data Data to fill the cache with.
+     * @return Filled Ignite Cache.
+     */
+    public IgniteCache<Integer, double[]> fillCacheWith(double[][] data) {
+        CacheConfiguration<Integer, double[]> cacheConfiguration = new CacheConfiguration<>();
+        cacheConfiguration.setName("TEST_" + UUID.randomUUID());
+        cacheConfiguration.setAffinity(new RendezvousAffinityFunction(false, 10));
+
+        IgniteCache<Integer, double[]> cache = ignite.createCache(cacheConfiguration);
+
+        for (int i = 0; i < data.length; i++)
+            cache.put(i, data[i]);
+
+        return cache;
+    }
+
+    /**
+     * Fills cache with data and returns it.
+     *
+     * @param data Data to fill the cache with.
+     * @return Filled Ignite Cache.
+     */
+    public IgniteCache<Integer, Vector> getVectors(double[][] data) {
+        CacheConfiguration<Integer, Vector> cacheConfiguration = new CacheConfiguration<>();
+        cacheConfiguration.setName("TEST_" + UUID.randomUUID());
+        cacheConfiguration.setAffinity(new RendezvousAffinityFunction(false, 10));
+
+        IgniteCache<Integer, Vector> cache = ignite.createCache(cacheConfiguration);
+
+        for (int i = 0; i < data.length; i++)
+            cache.put(i, VectorUtils.of(data[i]));
+
+        return cache;
+    }
+
+    /**
+     * Fills cache with data and returns it.
+     *
+     * @param dataset The chosen dataset.
+     * @return Filled Ignite Cache.
+     * @throws FileNotFoundException If file not found.
+     */
+    public IgniteCache<Integer, Vector> fillCacheWith(MLSandboxDatasets dataset) throws FileNotFoundException {
+
+        IgniteCache<Integer, Vector> cache = getCache();
+
+        Scanner scanner = new Scanner(new File(dataset.getFileName()));
+
+        int cnt = 0;
+        while (scanner.hasNextLine()) {
+            String row = scanner.nextLine();
+            if(dataset.hasHeader() && cnt == 0) {
+                cnt++;
+                continue;
+            }
+
+            String[] cells = row.split(dataset.getSeparator());
+
+            double[] data = new double[cells.length];
+            NumberFormat format = NumberFormat.getInstance(Locale.FRANCE);
+
+            for (int i = 0; i < cells.length; i++)
+                try{
+                    if(cells[i].equals("")) data[i] = Double.NaN;
+                    else data[i] = Double.valueOf(cells[i]);
+                } catch (java.lang.NumberFormatException e) {
+                    try {
+                        data[i] = format.parse(cells[i]).doubleValue();
+                    }
+                    catch (ParseException e1) {
+                        throw new FileParsingException(cells[i], i, Paths.get(dataset.getFileName()));
+                    }
+                }
+            cache.put(cnt++, VectorUtils.of(data));
+        }
+        return cache;
+
+    }
+
+    /**
+     * Fills cache with data and returns it.
+     *
+     * @return Filled Ignite Cache.
+     */
+    private IgniteCache<Integer, Vector> getCache() {
+
+        CacheConfiguration<Integer, Vector> cacheConfiguration = new CacheConfiguration<>();
+        cacheConfiguration.setName("TUTORIAL_" + UUID.randomUUID());
+        cacheConfiguration.setAffinity(new RendezvousAffinityFunction(false, 10));
+
+        return ignite.createCache(cacheConfiguration);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/util/TestCache.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/util/TestCache.java b/examples/src/main/java/org/apache/ignite/examples/ml/util/TestCache.java
deleted file mode 100644
index 454aa76..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/ml/util/TestCache.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.ml.util;
-
-import java.util.UUID;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.ml.math.primitives.vector.Vector;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
-
-/**
- * Common utility code used in some ML examples to set up test cache.
- */
-public class TestCache {
-    /** */
-    private final Ignite ignite;
-
-    /** */
-    public TestCache(Ignite ignite) {
-        this.ignite = ignite;
-    }
-
-    /**
-     * Fills cache with data and returns it.
-     *
-     * @param data Data to fill the cache with.
-     * @return Filled Ignite Cache.
-     */
-    public IgniteCache<Integer, double[]> fillCacheWith(double[][] data) {
-        CacheConfiguration<Integer, double[]> cacheConfiguration = new CacheConfiguration<>();
-        cacheConfiguration.setName("TEST_" + UUID.randomUUID());
-        cacheConfiguration.setAffinity(new RendezvousAffinityFunction(false, 10));
-
-        IgniteCache<Integer, double[]> cache = ignite.createCache(cacheConfiguration);
-
-        for (int i = 0; i < data.length; i++)
-            cache.put(i, data[i]);
-
-        return cache;
-    }
-
-    /**
-     * Fills cache with data and returns it.
-     *
-     * @param data Data to fill the cache with.
-     * @return Filled Ignite Cache.
-     */
-    public IgniteCache<Integer, Vector> getVectors(double[][] data) {
-        CacheConfiguration<Integer, Vector> cacheConfiguration = new CacheConfiguration<>();
-        cacheConfiguration.setName("TEST_" + UUID.randomUUID());
-        cacheConfiguration.setAffinity(new RendezvousAffinityFunction(false, 10));
-
-        IgniteCache<Integer, Vector> cache = ignite.createCache(cacheConfiguration);
-
-        for (int i = 0; i < data.length; i++)
-            cache.put(i, VectorUtils.of(data[i]));
-
-        return cache;
-    }
-}


[10/28] ignite git commit: IGNITE-10020 Fixed control.sh error comparison method violates its general contract - Fixes #5087.

Posted by sb...@apache.org.
IGNITE-10020 Fixed control.sh error comparison method violates its general contract - Fixes #5087.

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

Branch: refs/heads/ignite-627
Commit: e111d895e7f7f32d6f764683ba8412d61d370455
Parents: ad99fba
Author: a-polyakov <po...@gmail.com>
Authored: Sat Oct 27 14:23:06 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Sat Oct 27 14:23:06 2018 +0300

----------------------------------------------------------------------
 .../cache/distribution/CacheDistributionTaskResult.java          | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e111d895/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/distribution/CacheDistributionTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/distribution/CacheDistributionTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/distribution/CacheDistributionTaskResult.java
index 71de3bb..52c6eec 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/distribution/CacheDistributionTaskResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/distribution/CacheDistributionTaskResult.java
@@ -294,10 +294,10 @@ public class CacheDistributionTaskResult extends VisorDataTransferObject {
 
             Row other = (Row)o;
 
-            int res = grpId - other.grpId;
+            int res = Integer.compare(grpId, other.grpId);
 
             if (res == 0) {
-                res = partId - other.partId;
+                res = Integer.compare(partId, other.partId);
 
                 if (res == 0)
                     res = nodeId.compareTo(other.nodeId);


[04/28] ignite git commit: IGNITE-9910: [ML] Move the static copy-pasted datasets from examples to special Util class

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/resources/datasets/boston_housing_dataset.txt
----------------------------------------------------------------------
diff --git a/examples/src/main/resources/datasets/boston_housing_dataset.txt b/examples/src/main/resources/datasets/boston_housing_dataset.txt
new file mode 100644
index 0000000..654a340
--- /dev/null
+++ b/examples/src/main/resources/datasets/boston_housing_dataset.txt
@@ -0,0 +1,505 @@
+0.02731,0.00,7.070,0,0.4690,6.4210,78.90,4.9671,2,242.0,17.80,396.90,9.14,21.60
+0.02729,0.00,7.070,0,0.4690,7.1850,61.10,4.9671,2,242.0,17.80,392.83,4.03,34.70
+0.03237,0.00,2.180,0,0.4580,6.9980,45.80,6.0622,3,222.0,18.70,394.63,2.94,33.40
+0.06905,0.00,2.180,0,0.4580,7.1470,54.20,6.0622,3,222.0,18.70,396.90,5.33,36.20
+0.02985,0.00,2.180,0,0.4580,6.4300,58.70,6.0622,3,222.0,18.70,394.12,5.21,28.70
+0.08829,12.50,7.870,0,0.5240,6.0120,66.60,5.5605,5,311.0,15.20,395.60,12.43,22.90
+0.14455,12.50,7.870,0,0.5240,6.1720,96.10,5.9505,5,311.0,15.20,396.90,19.15,27.10
+0.21124,12.50,7.870,0,0.5240,5.6310,100.00,6.0821,5,311.0,15.20,386.63,29.93,16.50
+0.17004,12.50,7.870,0,0.5240,6.0040,85.90,6.5921,5,311.0,15.20,386.71,17.10,18.90
+0.22489,12.50,7.870,0,0.5240,6.3770,94.30,6.3467,5,311.0,15.20,392.52,20.45,15.00
+0.11747,12.50,7.870,0,0.5240,6.0090,82.90,6.2267,5,311.0,15.20,396.90,13.27,18.90
+0.09378,12.50,7.870,0,0.5240,5.8890,39.00,5.4509,5,311.0,15.20,390.50,15.71,21.70
+0.62976,0.00,8.140,0,0.5380,5.9490,61.80,4.7075,4,307.0,21.00,396.90,8.26,20.40
+0.63796,0.00,8.140,0,0.5380,6.0960,84.50,4.4619,4,307.0,21.00,380.02,10.26,18.20
+0.62739,0.00,8.140,0,0.5380,5.8340,56.50,4.4986,4,307.0,21.00,395.62,8.47,19.90
+1.05393,0.00,8.140,0,0.5380,5.9350,29.30,4.4986,4,307.0,21.00,386.85,6.58,23.10
+0.78420,0.00,8.140,0,0.5380,5.9900,81.70,4.2579,4,307.0,21.00,386.75,14.67,17.50
+0.80271,0.00,8.140,0,0.5380,5.4560,36.60,3.7965,4,307.0,21.00,288.99,11.69,20.20
+0.72580,0.00,8.140,0,0.5380,5.7270,69.50,3.7965,4,307.0,21.00,390.95,11.28,18.20
+1.25179,0.00,8.140,0,0.5380,5.5700,98.10,3.7979,4,307.0,21.00,376.57,21.02,13.60
+0.85204,0.00,8.140,0,0.5380,5.9650,89.20,4.0123,4,307.0,21.00,392.53,13.83,19.60
+1.23247,0.00,8.140,0,0.5380,6.1420,91.70,3.9769,4,307.0,21.00,396.90,18.72,15.20
+0.98843,0.00,8.140,0,0.5380,5.8130,100.00,4.0952,4,307.0,21.00,394.54,19.88,14.50
+0.75026,0.00,8.140,0,0.5380,5.9240,94.10,4.3996,4,307.0,21.00,394.33,16.30,15.60
+0.84054,0.00,8.140,0,0.5380,5.5990,85.70,4.4546,4,307.0,21.00,303.42,16.51,13.90
+0.67191,0.00,8.140,0,0.5380,5.8130,90.30,4.6820,4,307.0,21.00,376.88,14.81,16.60
+0.95577,0.00,8.140,0,0.5380,6.0470,88.80,4.4534,4,307.0,21.00,306.38,17.28,14.80
+0.77299,0.00,8.140,0,0.5380,6.4950,94.40,4.4547,4,307.0,21.00,387.94,12.80,18.40
+1.00245,0.00,8.140,0,0.5380,6.6740,87.30,4.2390,4,307.0,21.00,380.23,11.98,21.00
+1.13081,0.00,8.140,0,0.5380,5.7130,94.10,4.2330,4,307.0,21.00,360.17,22.60,12.70
+1.35472,0.00,8.140,0,0.5380,6.0720,100.00,4.1750,4,307.0,21.00,376.73,13.04,14.50
+1.38799,0.00,8.140,0,0.5380,5.9500,82.00,3.9900,4,307.0,21.00,232.60,27.71,13.20
+1.15172,0.00,8.140,0,0.5380,5.7010,95.00,3.7872,4,307.0,21.00,358.77,18.35,13.10
+1.61282,0.00,8.140,0,0.5380,6.0960,96.90,3.7598,4,307.0,21.00,248.31,20.34,13.50
+0.06417,0.00,5.960,0,0.4990,5.9330,68.20,3.3603,5,279.0,19.20,396.90,9.68,18.90
+0.09744,0.00,5.960,0,0.4990,5.8410,61.40,3.3779,5,279.0,19.20,377.56,11.41,20.00
+0.08014,0.00,5.960,0,0.4990,5.8500,41.50,3.9342,5,279.0,19.20,396.90,8.77,21.00
+0.17505,0.00,5.960,0,0.4990,5.9660,30.20,3.8473,5,279.0,19.20,393.43,10.13,24.70
+0.02763,75.00,2.950,0,0.4280,6.5950,21.80,5.4011,3,252.0,18.30,395.63,4.32,30.80
+0.03359,75.00,2.950,0,0.4280,7.0240,15.80,5.4011,3,252.0,18.30,395.62,1.98,34.90
+0.12744,0.00,6.910,0,0.4480,6.7700,2.90,5.7209,3,233.0,17.90,385.41,4.84,26.60
+0.14150,0.00,6.910,0,0.4480,6.1690,6.60,5.7209,3,233.0,17.90,383.37,5.81,25.30
+0.15936,0.00,6.910,0,0.4480,6.2110,6.50,5.7209,3,233.0,17.90,394.46,7.44,24.70
+0.12269,0.00,6.910,0,0.4480,6.0690,40.00,5.7209,3,233.0,17.90,389.39,9.55,21.20
+0.17142,0.00,6.910,0,0.4480,5.6820,33.80,5.1004,3,233.0,17.90,396.90,10.21,19.30
+0.18836,0.00,6.910,0,0.4480,5.7860,33.30,5.1004,3,233.0,17.90,396.90,14.15,20.00
+0.22927,0.00,6.910,0,0.4480,6.0300,85.50,5.6894,3,233.0,17.90,392.74,18.80,16.60
+0.25387,0.00,6.910,0,0.4480,5.3990,95.30,5.8700,3,233.0,17.90,396.90,30.81,14.40
+0.21977,0.00,6.910,0,0.4480,5.6020,62.00,6.0877,3,233.0,17.90,396.90,16.20,19.40
+0.08873,21.00,5.640,0,0.4390,5.9630,45.70,6.8147,4,243.0,16.80,395.56,13.45,19.70
+0.04337,21.00,5.640,0,0.4390,6.1150,63.00,6.8147,4,243.0,16.80,393.97,9.43,20.50
+0.05360,21.00,5.640,0,0.4390,6.5110,21.10,6.8147,4,243.0,16.80,396.90,5.28,25.00
+0.04981,21.00,5.640,0,0.4390,5.9980,21.40,6.8147,4,243.0,16.80,396.90,8.43,23.40
+0.01360,75.00,4.000,0,0.4100,5.8880,47.60,7.3197,3,469.0,21.10,396.90,14.80,18.90
+0.01311,90.00,1.220,0,0.4030,7.2490,21.90,8.6966,5,226.0,17.90,395.93,4.81,35.40
+0.02055,85.00,0.740,0,0.4100,6.3830,35.70,9.1876,2,313.0,17.30,396.90,5.77,24.70
+0.01432,100.00,1.320,0,0.4110,6.8160,40.50,8.3248,5,256.0,15.10,392.90,3.95,31.60
+0.15445,25.00,5.130,0,0.4530,6.1450,29.20,7.8148,8,284.0,19.70,390.68,6.86,23.30
+0.10328,25.00,5.130,0,0.4530,5.9270,47.20,6.9320,8,284.0,19.70,396.90,9.22,19.60
+0.14932,25.00,5.130,0,0.4530,5.7410,66.20,7.2254,8,284.0,19.70,395.11,13.15,18.70
+0.17171,25.00,5.130,0,0.4530,5.9660,93.40,6.8185,8,284.0,19.70,378.08,14.44,16.00
+0.11027,25.00,5.130,0,0.4530,6.4560,67.80,7.2255,8,284.0,19.70,396.90,6.73,22.20
+0.12650,25.00,5.130,0,0.4530,6.7620,43.40,7.9809,8,284.0,19.70,395.58,9.50,25.00
+0.01951,17.50,1.380,0,0.4161,7.1040,59.50,9.2229,3,216.0,18.60,393.24,8.05,33.00
+0.03584,80.00,3.370,0,0.3980,6.2900,17.80,6.6115,4,337.0,16.10,396.90,4.67,23.50
+0.04379,80.00,3.370,0,0.3980,5.7870,31.10,6.6115,4,337.0,16.10,396.90,10.24,19.40
+0.05789,12.50,6.070,0,0.4090,5.8780,21.40,6.4980,4,345.0,18.90,396.21,8.10,22.00
+0.13554,12.50,6.070,0,0.4090,5.5940,36.80,6.4980,4,345.0,18.90,396.90,13.09,17.40
+0.12816,12.50,6.070,0,0.4090,5.8850,33.00,6.4980,4,345.0,18.90,396.90,8.79,20.90
+0.08826,0.00,10.810,0,0.4130,6.4170,6.60,5.2873,4,305.0,19.20,383.73,6.72,24.20
+0.15876,0.00,10.810,0,0.4130,5.9610,17.50,5.2873,4,305.0,19.20,376.94,9.88,21.70
+0.09164,0.00,10.810,0,0.4130,6.0650,7.80,5.2873,4,305.0,19.20,390.91,5.52,22.80
+0.19539,0.00,10.810,0,0.4130,6.2450,6.20,5.2873,4,305.0,19.20,377.17,7.54,23.40
+0.07896,0.00,12.830,0,0.4370,6.2730,6.00,4.2515,5,398.0,18.70,394.92,6.78,24.10
+0.09512,0.00,12.830,0,0.4370,6.2860,45.00,4.5026,5,398.0,18.70,383.23,8.94,21.40
+0.10153,0.00,12.830,0,0.4370,6.2790,74.50,4.0522,5,398.0,18.70,373.66,11.97,20.00
+0.08707,0.00,12.830,0,0.4370,6.1400,45.80,4.0905,5,398.0,18.70,386.96,10.27,20.80
+0.05646,0.00,12.830,0,0.4370,6.2320,53.70,5.0141,5,398.0,18.70,386.40,12.34,21.20
+0.08387,0.00,12.830,0,0.4370,5.8740,36.60,4.5026,5,398.0,18.70,396.06,9.10,20.30
+0.04113,25.00,4.860,0,0.4260,6.7270,33.50,5.4007,4,281.0,19.00,396.90,5.29,28.00
+0.04462,25.00,4.860,0,0.4260,6.6190,70.40,5.4007,4,281.0,19.00,395.63,7.22,23.90
+0.03659,25.00,4.860,0,0.4260,6.3020,32.20,5.4007,4,281.0,19.00,396.90,6.72,24.80
+0.03551,25.00,4.860,0,0.4260,6.1670,46.70,5.4007,4,281.0,19.00,390.64,7.51,22.90
+0.05059,0.00,4.490,0,0.4490,6.3890,48.00,4.7794,3,247.0,18.50,396.90,9.62,23.90
+0.05735,0.00,4.490,0,0.4490,6.6300,56.10,4.4377,3,247.0,18.50,392.30,6.53,26.60
+0.05188,0.00,4.490,0,0.4490,6.0150,45.10,4.4272,3,247.0,18.50,395.99,12.86,22.50
+0.07151,0.00,4.490,0,0.4490,6.1210,56.80,3.7476,3,247.0,18.50,395.15,8.44,22.20
+0.05660,0.00,3.410,0,0.4890,7.0070,86.30,3.4217,2,270.0,17.80,396.90,5.50,23.60
+0.05302,0.00,3.410,0,0.4890,7.0790,63.10,3.4145,2,270.0,17.80,396.06,5.70,28.70
+0.04684,0.00,3.410,0,0.4890,6.4170,66.10,3.0923,2,270.0,17.80,392.18,8.81,22.60
+0.03932,0.00,3.410,0,0.4890,6.4050,73.90,3.0921,2,270.0,17.80,393.55,8.20,22.00
+0.04203,28.00,15.040,0,0.4640,6.4420,53.60,3.6659,4,270.0,18.20,395.01,8.16,22.90
+0.02875,28.00,15.040,0,0.4640,6.2110,28.90,3.6659,4,270.0,18.20,396.33,6.21,25.00
+0.04294,28.00,15.040,0,0.4640,6.2490,77.30,3.6150,4,270.0,18.20,396.90,10.59,20.60
+0.12204,0.00,2.890,0,0.4450,6.6250,57.80,3.4952,2,276.0,18.00,357.98,6.65,28.40
+0.11504,0.00,2.890,0,0.4450,6.1630,69.60,3.4952,2,276.0,18.00,391.83,11.34,21.40
+0.12083,0.00,2.890,0,0.4450,8.0690,76.00,3.4952,2,276.0,18.00,396.90,4.21,38.70
+0.08187,0.00,2.890,0,0.4450,7.8200,36.90,3.4952,2,276.0,18.00,393.53,3.57,43.80
+0.06860,0.00,2.890,0,0.4450,7.4160,62.50,3.4952,2,276.0,18.00,396.90,6.19,33.20
+0.14866,0.00,8.560,0,0.5200,6.7270,79.90,2.7778,5,384.0,20.90,394.76,9.42,27.50
+0.11432,0.00,8.560,0,0.5200,6.7810,71.30,2.8561,5,384.0,20.90,395.58,7.67,26.50
+0.22876,0.00,8.560,0,0.5200,6.4050,85.40,2.7147,5,384.0,20.90,70.80,10.63,18.60
+0.21161,0.00,8.560,0,0.5200,6.1370,87.40,2.7147,5,384.0,20.90,394.47,13.44,19.30
+0.13960,0.00,8.560,0,0.5200,6.1670,90.00,2.4210,5,384.0,20.90,392.69,12.33,20.10
+0.13262,0.00,8.560,0,0.5200,5.8510,96.70,2.1069,5,384.0,20.90,394.05,16.47,19.50
+0.17120,0.00,8.560,0,0.5200,5.8360,91.90,2.2110,5,384.0,20.90,395.67,18.66,19.50
+0.13117,0.00,8.560,0,0.5200,6.1270,85.20,2.1224,5,384.0,20.90,387.69,14.09,20.40
+0.12802,0.00,8.560,0,0.5200,6.4740,97.10,2.4329,5,384.0,20.90,395.24,12.27,19.80
+0.26363,0.00,8.560,0,0.5200,6.2290,91.20,2.5451,5,384.0,20.90,391.23,15.55,19.40
+0.10793,0.00,8.560,0,0.5200,6.1950,54.40,2.7778,5,384.0,20.90,393.49,13.00,21.70
+0.10084,0.00,10.010,0,0.5470,6.7150,81.60,2.6775,6,432.0,17.80,395.59,10.16,22.80
+0.12329,0.00,10.010,0,0.5470,5.9130,92.90,2.3534,6,432.0,17.80,394.95,16.21,18.80
+0.22212,0.00,10.010,0,0.5470,6.0920,95.40,2.5480,6,432.0,17.80,396.90,17.09,18.70
+0.14231,0.00,10.010,0,0.5470,6.2540,84.20,2.2565,6,432.0,17.80,388.74,10.45,18.50
+0.17134,0.00,10.010,0,0.5470,5.9280,88.20,2.4631,6,432.0,17.80,344.91,15.76,18.30
+0.13158,0.00,10.010,0,0.5470,6.1760,72.50,2.7301,6,432.0,17.80,393.30,12.04,21.20
+0.15098,0.00,10.010,0,0.5470,6.0210,82.60,2.7474,6,432.0,17.80,394.51,10.30,19.20
+0.13058,0.00,10.010,0,0.5470,5.8720,73.10,2.4775,6,432.0,17.80,338.63,15.37,20.40
+0.14476,0.00,10.010,0,0.5470,5.7310,65.20,2.7592,6,432.0,17.80,391.50,13.61,19.30
+0.06899,0.00,25.650,0,0.5810,5.8700,69.70,2.2577,2,188.0,19.10,389.15,14.37,22.00
+0.07165,0.00,25.650,0,0.5810,6.0040,84.10,2.1974,2,188.0,19.10,377.67,14.27,20.30
+0.09299,0.00,25.650,0,0.5810,5.9610,92.90,2.0869,2,188.0,19.10,378.09,17.93,20.50
+0.15038,0.00,25.650,0,0.5810,5.8560,97.00,1.9444,2,188.0,19.10,370.31,25.41,17.30
+0.09849,0.00,25.650,0,0.5810,5.8790,95.80,2.0063,2,188.0,19.10,379.38,17.58,18.80
+0.16902,0.00,25.650,0,0.5810,5.9860,88.40,1.9929,2,188.0,19.10,385.02,14.81,21.40
+0.38735,0.00,25.650,0,0.5810,5.6130,95.60,1.7572,2,188.0,19.10,359.29,27.26,15.70
+0.25915,0.00,21.890,0,0.6240,5.6930,96.00,1.7883,4,437.0,21.20,392.11,17.19,16.20
+0.32543,0.00,21.890,0,0.6240,6.4310,98.80,1.8125,4,437.0,21.20,396.90,15.39,18.00
+0.88125,0.00,21.890,0,0.6240,5.6370,94.70,1.9799,4,437.0,21.20,396.90,18.34,14.30
+0.34006,0.00,21.890,0,0.6240,6.4580,98.90,2.1185,4,437.0,21.20,395.04,12.60,19.20
+1.19294,0.00,21.890,0,0.6240,6.3260,97.70,2.2710,4,437.0,21.20,396.90,12.26,19.60
+0.59005,0.00,21.890,0,0.6240,6.3720,97.90,2.3274,4,437.0,21.20,385.76,11.12,23.00
+0.32982,0.00,21.890,0,0.6240,5.8220,95.40,2.4699,4,437.0,21.20,388.69,15.03,18.40
+0.97617,0.00,21.890,0,0.6240,5.7570,98.40,2.3460,4,437.0,21.20,262.76,17.31,15.60
+0.55778,0.00,21.890,0,0.6240,6.3350,98.20,2.1107,4,437.0,21.20,394.67,16.96,18.10
+0.32264,0.00,21.890,0,0.6240,5.9420,93.50,1.9669,4,437.0,21.20,378.25,16.90,17.40
+0.35233,0.00,21.890,0,0.6240,6.4540,98.40,1.8498,4,437.0,21.20,394.08,14.59,17.10
+0.24980,0.00,21.890,0,0.6240,5.8570,98.20,1.6686,4,437.0,21.20,392.04,21.32,13.30
+0.54452,0.00,21.890,0,0.6240,6.1510,97.90,1.6687,4,437.0,21.20,396.90,18.46,17.80
+0.29090,0.00,21.890,0,0.6240,6.1740,93.60,1.6119,4,437.0,21.20,388.08,24.16,14.00
+1.62864,0.00,21.890,0,0.6240,5.0190,100.00,1.4394,4,437.0,21.20,396.90,34.41,14.40
+3.32105,0.00,19.580,1,0.8710,5.4030,100.00,1.3216,5,403.0,14.70,396.90,26.82,13.40
+4.09740,0.00,19.580,0,0.8710,5.4680,100.00,1.4118,5,403.0,14.70,396.90,26.42,15.60
+2.77974,0.00,19.580,0,0.8710,4.9030,97.80,1.3459,5,403.0,14.70,396.90,29.29,11.80
+2.37934,0.00,19.580,0,0.8710,6.1300,100.00,1.4191,5,403.0,14.70,172.91,27.80,13.80
+2.15505,0.00,19.580,0,0.8710,5.6280,100.00,1.5166,5,403.0,14.70,169.27,16.65,15.60
+2.36862,0.00,19.580,0,0.8710,4.9260,95.70,1.4608,5,403.0,14.70,391.71,29.53,14.60
+2.33099,0.00,19.580,0,0.8710,5.1860,93.80,1.5296,5,403.0,14.70,356.99,28.32,17.80
+2.73397,0.00,19.580,0,0.8710,5.5970,94.90,1.5257,5,403.0,14.70,351.85,21.45,15.40
+1.65660,0.00,19.580,0,0.8710,6.1220,97.30,1.6180,5,403.0,14.70,372.80,14.10,21.50
+1.49632,0.00,19.580,0,0.8710,5.4040,100.00,1.5916,5,403.0,14.70,341.60,13.28,19.60
+1.12658,0.00,19.580,1,0.8710,5.0120,88.00,1.6102,5,403.0,14.70,343.28,12.12,15.30
+2.14918,0.00,19.580,0,0.8710,5.7090,98.50,1.6232,5,403.0,14.70,261.95,15.79,19.40
+1.41385,0.00,19.580,1,0.8710,6.1290,96.00,1.7494,5,403.0,14.70,321.02,15.12,17.00
+3.53501,0.00,19.580,1,0.8710,6.1520,82.60,1.7455,5,403.0,14.70,88.01,15.02,15.60
+2.44668,0.00,19.580,0,0.8710,5.2720,94.00,1.7364,5,403.0,14.70,88.63,16.14,13.10
+1.22358,0.00,19.580,0,0.6050,6.9430,97.40,1.8773,5,403.0,14.70,363.43,4.59,41.30
+1.34284,0.00,19.580,0,0.6050,6.0660,100.00,1.7573,5,403.0,14.70,353.89,6.43,24.30
+1.42502,0.00,19.580,0,0.8710,6.5100,100.00,1.7659,5,403.0,14.70,364.31,7.39,23.30
+1.27346,0.00,19.580,1,0.6050,6.2500,92.60,1.7984,5,403.0,14.70,338.92,5.50,27.00
+1.46336,0.00,19.580,0,0.6050,7.4890,90.80,1.9709,5,403.0,14.70,374.43,1.73,50.00
+1.83377,0.00,19.580,1,0.6050,7.8020,98.20,2.0407,5,403.0,14.70,389.61,1.92,50.00
+1.51902,0.00,19.580,1,0.6050,8.3750,93.90,2.1620,5,403.0,14.70,388.45,3.32,50.00
+2.24236,0.00,19.580,0,0.6050,5.8540,91.80,2.4220,5,403.0,14.70,395.11,11.64,22.70
+2.92400,0.00,19.580,0,0.6050,6.1010,93.00,2.2834,5,403.0,14.70,240.16,9.81,25.00
+2.01019,0.00,19.580,0,0.6050,7.9290,96.20,2.0459,5,403.0,14.70,369.30,3.70,50.00
+1.80028,0.00,19.580,0,0.6050,5.8770,79.20,2.4259,5,403.0,14.70,227.61,12.14,23.80
+2.30040,0.00,19.580,0,0.6050,6.3190,96.10,2.1000,5,403.0,14.70,297.09,11.10,23.80
+2.44953,0.00,19.580,0,0.6050,6.4020,95.20,2.2625,5,403.0,14.70,330.04,11.32,22.30
+1.20742,0.00,19.580,0,0.6050,5.8750,94.60,2.4259,5,403.0,14.70,292.29,14.43,17.40
+2.31390,0.00,19.580,0,0.6050,5.8800,97.30,2.3887,5,403.0,14.70,348.13,12.03,19.10
+0.13914,0.00,4.050,0,0.5100,5.5720,88.50,2.5961,5,296.0,16.60,396.90,14.69,23.10
+0.09178,0.00,4.050,0,0.5100,6.4160,84.10,2.6463,5,296.0,16.60,395.50,9.04,23.60
+0.08447,0.00,4.050,0,0.5100,5.8590,68.70,2.7019,5,296.0,16.60,393.23,9.64,22.60
+0.06664,0.00,4.050,0,0.5100,6.5460,33.10,3.1323,5,296.0,16.60,390.96,5.33,29.40
+0.07022,0.00,4.050,0,0.5100,6.0200,47.20,3.5549,5,296.0,16.60,393.23,10.11,23.20
+0.05425,0.00,4.050,0,0.5100,6.3150,73.40,3.3175,5,296.0,16.60,395.60,6.29,24.60
+0.06642,0.00,4.050,0,0.5100,6.8600,74.40,2.9153,5,296.0,16.60,391.27,6.92,29.90
+0.05780,0.00,2.460,0,0.4880,6.9800,58.40,2.8290,3,193.0,17.80,396.90,5.04,37.20
+0.06588,0.00,2.460,0,0.4880,7.7650,83.30,2.7410,3,193.0,17.80,395.56,7.56,39.80
+0.06888,0.00,2.460,0,0.4880,6.1440,62.20,2.5979,3,193.0,17.80,396.90,9.45,36.20
+0.09103,0.00,2.460,0,0.4880,7.1550,92.20,2.7006,3,193.0,17.80,394.12,4.82,37.90
+0.10008,0.00,2.460,0,0.4880,6.5630,95.60,2.8470,3,193.0,17.80,396.90,5.68,32.50
+0.08308,0.00,2.460,0,0.4880,5.6040,89.80,2.9879,3,193.0,17.80,391.00,13.98,26.40
+0.06047,0.00,2.460,0,0.4880,6.1530,68.80,3.2797,3,193.0,17.80,387.11,13.15,29.60
+0.05602,0.00,2.460,0,0.4880,7.8310,53.60,3.1992,3,193.0,17.80,392.63,4.45,50.00
+0.07875,45.00,3.440,0,0.4370,6.7820,41.10,3.7886,5,398.0,15.20,393.87,6.68,32.00
+0.12579,45.00,3.440,0,0.4370,6.5560,29.10,4.5667,5,398.0,15.20,382.84,4.56,29.80
+0.08370,45.00,3.440,0,0.4370,7.1850,38.90,4.5667,5,398.0,15.20,396.90,5.39,34.90
+0.09068,45.00,3.440,0,0.4370,6.9510,21.50,6.4798,5,398.0,15.20,377.68,5.10,37.00
+0.06911,45.00,3.440,0,0.4370,6.7390,30.80,6.4798,5,398.0,15.20,389.71,4.69,30.50
+0.08664,45.00,3.440,0,0.4370,7.1780,26.30,6.4798,5,398.0,15.20,390.49,2.87,36.40
+0.02187,60.00,2.930,0,0.4010,6.8000,9.90,6.2196,1,265.0,15.60,393.37,5.03,31.10
+0.01439,60.00,2.930,0,0.4010,6.6040,18.80,6.2196,1,265.0,15.60,376.70,4.38,29.10
+0.01381,80.00,0.460,0,0.4220,7.8750,32.00,5.6484,4,255.0,14.40,394.23,2.97,50.00
+0.04011,80.00,1.520,0,0.4040,7.2870,34.10,7.3090,2,329.0,12.60,396.90,4.08,33.30
+0.04666,80.00,1.520,0,0.4040,7.1070,36.60,7.3090,2,329.0,12.60,354.31,8.61,30.30
+0.03768,80.00,1.520,0,0.4040,7.2740,38.30,7.3090,2,329.0,12.60,392.20,6.62,34.60
+0.03150,95.00,1.470,0,0.4030,6.9750,15.30,7.6534,3,402.0,17.00,396.90,4.56,34.90
+0.01778,95.00,1.470,0,0.4030,7.1350,13.90,7.6534,3,402.0,17.00,384.30,4.45,32.90
+0.03445,82.50,2.030,0,0.4150,6.1620,38.40,6.2700,2,348.0,14.70,393.77,7.43,24.10
+0.02177,82.50,2.030,0,0.4150,7.6100,15.70,6.2700,2,348.0,14.70,395.38,3.11,42.30
+0.03510,95.00,2.680,0,0.4161,7.8530,33.20,5.1180,4,224.0,14.70,392.78,3.81,48.50
+0.02009,95.00,2.680,0,0.4161,8.0340,31.90,5.1180,4,224.0,14.70,390.55,2.88,50.00
+0.13642,0.00,10.590,0,0.4890,5.8910,22.30,3.9454,4,277.0,18.60,396.90,10.87,22.60
+0.22969,0.00,10.590,0,0.4890,6.3260,52.50,4.3549,4,277.0,18.60,394.87,10.97,24.40
+0.25199,0.00,10.590,0,0.4890,5.7830,72.70,4.3549,4,277.0,18.60,389.43,18.06,22.50
+0.13587,0.00,10.590,1,0.4890,6.0640,59.10,4.2392,4,277.0,18.60,381.32,14.66,24.40
+0.43571,0.00,10.590,1,0.4890,5.3440,100.00,3.8750,4,277.0,18.60,396.90,23.09,20.00
+0.17446,0.00,10.590,1,0.4890,5.9600,92.10,3.8771,4,277.0,18.60,393.25,17.27,21.70
+0.37578,0.00,10.590,1,0.4890,5.4040,88.60,3.6650,4,277.0,18.60,395.24,23.98,19.30
+0.21719,0.00,10.590,1,0.4890,5.8070,53.80,3.6526,4,277.0,18.60,390.94,16.03,22.40
+0.14052,0.00,10.590,0,0.4890,6.3750,32.30,3.9454,4,277.0,18.60,385.81,9.38,28.10
+0.28955,0.00,10.590,0,0.4890,5.4120,9.80,3.5875,4,277.0,18.60,348.93,29.55,23.70
+0.19802,0.00,10.590,0,0.4890,6.1820,42.40,3.9454,4,277.0,18.60,393.63,9.47,25.00
+0.04560,0.00,13.890,1,0.5500,5.8880,56.00,3.1121,5,276.0,16.40,392.80,13.51,23.30
+0.07013,0.00,13.890,0,0.5500,6.6420,85.10,3.4211,5,276.0,16.40,392.78,9.69,28.70
+0.11069,0.00,13.890,1,0.5500,5.9510,93.80,2.8893,5,276.0,16.40,396.90,17.92,21.50
+0.11425,0.00,13.890,1,0.5500,6.3730,92.40,3.3633,5,276.0,16.40,393.74,10.50,23.00
+0.35809,0.00,6.200,1,0.5070,6.9510,88.50,2.8617,8,307.0,17.40,391.70,9.71,26.70
+0.40771,0.00,6.200,1,0.5070,6.1640,91.30,3.0480,8,307.0,17.40,395.24,21.46,21.70
+0.62356,0.00,6.200,1,0.5070,6.8790,77.70,3.2721,8,307.0,17.40,390.39,9.93,27.50
+0.61470,0.00,6.200,0,0.5070,6.6180,80.80,3.2721,8,307.0,17.40,396.90,7.60,30.10
+0.31533,0.00,6.200,0,0.5040,8.2660,78.30,2.8944,8,307.0,17.40,385.05,4.14,44.80
+0.52693,0.00,6.200,0,0.5040,8.7250,83.00,2.8944,8,307.0,17.40,382.00,4.63,50.00
+0.38214,0.00,6.200,0,0.5040,8.0400,86.50,3.2157,8,307.0,17.40,387.38,3.13,37.60
+0.41238,0.00,6.200,0,0.5040,7.1630,79.90,3.2157,8,307.0,17.40,372.08,6.36,31.60
+0.29819,0.00,6.200,0,0.5040,7.6860,17.00,3.3751,8,307.0,17.40,377.51,3.92,46.70
+0.44178,0.00,6.200,0,0.5040,6.5520,21.40,3.3751,8,307.0,17.40,380.34,3.76,31.50
+0.53700,0.00,6.200,0,0.5040,5.9810,68.10,3.6715,8,307.0,17.40,378.35,11.65,24.30
+0.46296,0.00,6.200,0,0.5040,7.4120,76.90,3.6715,8,307.0,17.40,376.14,5.25,31.70
+0.57529,0.00,6.200,0,0.5070,8.3370,73.30,3.8384,8,307.0,17.40,385.91,2.47,41.70
+0.33147,0.00,6.200,0,0.5070,8.2470,70.40,3.6519,8,307.0,17.40,378.95,3.95,48.30
+0.44791,0.00,6.200,1,0.5070,6.7260,66.50,3.6519,8,307.0,17.40,360.20,8.05,29.00
+0.33045,0.00,6.200,0,0.5070,6.0860,61.50,3.6519,8,307.0,17.40,376.75,10.88,24.00
+0.52058,0.00,6.200,1,0.5070,6.6310,76.50,4.1480,8,307.0,17.40,388.45,9.54,25.10
+0.51183,0.00,6.200,0,0.5070,7.3580,71.60,4.1480,8,307.0,17.40,390.07,4.73,31.50
+0.08244,30.00,4.930,0,0.4280,6.4810,18.50,6.1899,6,300.0,16.60,379.41,6.36,23.70
+0.09252,30.00,4.930,0,0.4280,6.6060,42.20,6.1899,6,300.0,16.60,383.78,7.37,23.30
+0.11329,30.00,4.930,0,0.4280,6.8970,54.30,6.3361,6,300.0,16.60,391.25,11.38,22.00
+0.10612,30.00,4.930,0,0.4280,6.0950,65.10,6.3361,6,300.0,16.60,394.62,12.40,20.10
+0.10290,30.00,4.930,0,0.4280,6.3580,52.90,7.0355,6,300.0,16.60,372.75,11.22,22.20
+0.12757,30.00,4.930,0,0.4280,6.3930,7.80,7.0355,6,300.0,16.60,374.71,5.19,23.70
+0.20608,22.00,5.860,0,0.4310,5.5930,76.50,7.9549,7,330.0,19.10,372.49,12.50,17.60
+0.19133,22.00,5.860,0,0.4310,5.6050,70.20,7.9549,7,330.0,19.10,389.13,18.46,18.50
+0.33983,22.00,5.860,0,0.4310,6.1080,34.90,8.0555,7,330.0,19.10,390.18,9.16,24.30
+0.19657,22.00,5.860,0,0.4310,6.2260,79.20,8.0555,7,330.0,19.10,376.14,10.15,20.50
+0.16439,22.00,5.860,0,0.4310,6.4330,49.10,7.8265,7,330.0,19.10,374.71,9.52,24.50
+0.19073,22.00,5.860,0,0.4310,6.7180,17.50,7.8265,7,330.0,19.10,393.74,6.56,26.20
+0.14030,22.00,5.860,0,0.4310,6.4870,13.00,7.3967,7,330.0,19.10,396.28,5.90,24.40
+0.21409,22.00,5.860,0,0.4310,6.4380,8.90,7.3967,7,330.0,19.10,377.07,3.59,24.80
+0.08221,22.00,5.860,0,0.4310,6.9570,6.80,8.9067,7,330.0,19.10,386.09,3.53,29.60
+0.36894,22.00,5.860,0,0.4310,8.2590,8.40,8.9067,7,330.0,19.10,396.90,3.54,42.80
+0.04819,80.00,3.640,0,0.3920,6.1080,32.00,9.2203,1,315.0,16.40,392.89,6.57,21.90
+0.03548,80.00,3.640,0,0.3920,5.8760,19.10,9.2203,1,315.0,16.40,395.18,9.25,20.90
+0.01538,90.00,3.750,0,0.3940,7.4540,34.20,6.3361,3,244.0,15.90,386.34,3.11,44.00
+0.61154,20.00,3.970,0,0.6470,8.7040,86.90,1.8010,5,264.0,13.00,389.70,5.12,50.00
+0.66351,20.00,3.970,0,0.6470,7.3330,100.00,1.8946,5,264.0,13.00,383.29,7.79,36.00
+0.65665,20.00,3.970,0,0.6470,6.8420,100.00,2.0107,5,264.0,13.00,391.93,6.90,30.10
+0.54011,20.00,3.970,0,0.6470,7.2030,81.80,2.1121,5,264.0,13.00,392.80,9.59,33.80
+0.53412,20.00,3.970,0,0.6470,7.5200,89.40,2.1398,5,264.0,13.00,388.37,7.26,43.10
+0.52014,20.00,3.970,0,0.6470,8.3980,91.50,2.2885,5,264.0,13.00,386.86,5.91,48.80
+0.82526,20.00,3.970,0,0.6470,7.3270,94.50,2.0788,5,264.0,13.00,393.42,11.25,31.00
+0.55007,20.00,3.970,0,0.6470,7.2060,91.60,1.9301,5,264.0,13.00,387.89,8.10,36.50
+0.76162,20.00,3.970,0,0.6470,5.5600,62.80,1.9865,5,264.0,13.00,392.40,10.45,22.80
+0.78570,20.00,3.970,0,0.6470,7.0140,84.60,2.1329,5,264.0,13.00,384.07,14.79,30.70
+0.57834,20.00,3.970,0,0.5750,8.2970,67.00,2.4216,5,264.0,13.00,384.54,7.44,50.00
+0.54050,20.00,3.970,0,0.5750,7.4700,52.60,2.8720,5,264.0,13.00,390.30,3.16,43.50
+0.09065,20.00,6.960,1,0.4640,5.9200,61.50,3.9175,3,223.0,18.60,391.34,13.65,20.70
+0.29916,20.00,6.960,0,0.4640,5.8560,42.10,4.4290,3,223.0,18.60,388.65,13.00,21.10
+0.16211,20.00,6.960,0,0.4640,6.2400,16.30,4.4290,3,223.0,18.60,396.90,6.59,25.20
+0.11460,20.00,6.960,0,0.4640,6.5380,58.70,3.9175,3,223.0,18.60,394.96,7.73,24.40
+0.22188,20.00,6.960,1,0.4640,7.6910,51.80,4.3665,3,223.0,18.60,390.77,6.58,35.20
+0.05644,40.00,6.410,1,0.4470,6.7580,32.90,4.0776,4,254.0,17.60,396.90,3.53,32.40
+0.09604,40.00,6.410,0,0.4470,6.8540,42.80,4.2673,4,254.0,17.60,396.90,2.98,32.00
+0.10469,40.00,6.410,1,0.4470,7.2670,49.00,4.7872,4,254.0,17.60,389.25,6.05,33.20
+0.06127,40.00,6.410,1,0.4470,6.8260,27.60,4.8628,4,254.0,17.60,393.45,4.16,33.10
+0.07978,40.00,6.410,0,0.4470,6.4820,32.10,4.1403,4,254.0,17.60,396.90,7.19,29.10
+0.21038,20.00,3.330,0,0.4429,6.8120,32.20,4.1007,5,216.0,14.90,396.90,4.85,35.10
+0.03578,20.00,3.330,0,0.4429,7.8200,64.50,4.6947,5,216.0,14.90,387.31,3.76,45.40
+0.03705,20.00,3.330,0,0.4429,6.9680,37.20,5.2447,5,216.0,14.90,392.23,4.59,35.40
+0.06129,20.00,3.330,1,0.4429,7.6450,49.70,5.2119,5,216.0,14.90,377.07,3.01,46.00
+0.01501,90.00,1.210,1,0.4010,7.9230,24.80,5.8850,1,198.0,13.60,395.52,3.16,50.00
+0.00906,90.00,2.970,0,0.4000,7.0880,20.80,7.3073,1,285.0,15.30,394.72,7.85,32.20
+0.01096,55.00,2.250,0,0.3890,6.4530,31.90,7.3073,1,300.0,15.30,394.72,8.23,22.00
+0.01965,80.00,1.760,0,0.3850,6.2300,31.50,9.0892,1,241.0,18.20,341.60,12.93,20.10
+0.03871,52.50,5.320,0,0.4050,6.2090,31.30,7.3172,6,293.0,16.60,396.90,7.14,23.20
+0.04590,52.50,5.320,0,0.4050,6.3150,45.60,7.3172,6,293.0,16.60,396.90,7.60,22.30
+0.04297,52.50,5.320,0,0.4050,6.5650,22.90,7.3172,6,293.0,16.60,371.72,9.51,24.80
+0.03502,80.00,4.950,0,0.4110,6.8610,27.90,5.1167,4,245.0,19.20,396.90,3.33,28.50
+0.07886,80.00,4.950,0,0.4110,7.1480,27.70,5.1167,4,245.0,19.20,396.90,3.56,37.30
+0.03615,80.00,4.950,0,0.4110,6.6300,23.40,5.1167,4,245.0,19.20,396.90,4.70,27.90
+0.08265,0.00,13.920,0,0.4370,6.1270,18.40,5.5027,4,289.0,16.00,396.90,8.58,23.90
+0.08199,0.00,13.920,0,0.4370,6.0090,42.30,5.5027,4,289.0,16.00,396.90,10.40,21.70
+0.12932,0.00,13.920,0,0.4370,6.6780,31.10,5.9604,4,289.0,16.00,396.90,6.27,28.60
+0.05372,0.00,13.920,0,0.4370,6.5490,51.00,5.9604,4,289.0,16.00,392.85,7.39,27.10
+0.14103,0.00,13.920,0,0.4370,5.7900,58.00,6.3200,4,289.0,16.00,396.90,15.84,20.30
+0.06466,70.00,2.240,0,0.4000,6.3450,20.10,7.8278,5,358.0,14.80,368.24,4.97,22.50
+0.05561,70.00,2.240,0,0.4000,7.0410,10.00,7.8278,5,358.0,14.80,371.58,4.74,29.00
+0.04417,70.00,2.240,0,0.4000,6.8710,47.40,7.8278,5,358.0,14.80,390.86,6.07,24.80
+0.03537,34.00,6.090,0,0.4330,6.5900,40.40,5.4917,7,329.0,16.10,395.75,9.50,22.00
+0.09266,34.00,6.090,0,0.4330,6.4950,18.40,5.4917,7,329.0,16.10,383.61,8.67,26.40
+0.10000,34.00,6.090,0,0.4330,6.9820,17.70,5.4917,7,329.0,16.10,390.43,4.86,33.10
+0.05515,33.00,2.180,0,0.4720,7.2360,41.10,4.0220,7,222.0,18.40,393.68,6.93,36.10
+0.05479,33.00,2.180,0,0.4720,6.6160,58.10,3.3700,7,222.0,18.40,393.36,8.93,28.40
+0.07503,33.00,2.180,0,0.4720,7.4200,71.90,3.0992,7,222.0,18.40,396.90,6.47,33.40
+0.04932,33.00,2.180,0,0.4720,6.8490,70.30,3.1827,7,222.0,18.40,396.90,7.53,28.20
+0.49298,0.00,9.900,0,0.5440,6.6350,82.50,3.3175,4,304.0,18.40,396.90,4.54,22.80
+0.34940,0.00,9.900,0,0.5440,5.9720,76.70,3.1025,4,304.0,18.40,396.24,9.97,20.30
+2.63548,0.00,9.900,0,0.5440,4.9730,37.80,2.5194,4,304.0,18.40,350.45,12.64,16.10
+0.79041,0.00,9.900,0,0.5440,6.1220,52.80,2.6403,4,304.0,18.40,396.90,5.98,22.10
+0.26169,0.00,9.900,0,0.5440,6.0230,90.40,2.8340,4,304.0,18.40,396.30,11.72,19.40
+0.26938,0.00,9.900,0,0.5440,6.2660,82.80,3.2628,4,304.0,18.40,393.39,7.90,21.60
+0.36920,0.00,9.900,0,0.5440,6.5670,87.30,3.6023,4,304.0,18.40,395.69,9.28,23.80
+0.25356,0.00,9.900,0,0.5440,5.7050,77.70,3.9450,4,304.0,18.40,396.42,11.50,16.20
+0.31827,0.00,9.900,0,0.5440,5.9140,83.20,3.9986,4,304.0,18.40,390.70,18.33,17.80
+0.24522,0.00,9.900,0,0.5440,5.7820,71.70,4.0317,4,304.0,18.40,396.90,15.94,19.80
+0.40202,0.00,9.900,0,0.5440,6.3820,67.20,3.5325,4,304.0,18.40,395.21,10.36,23.10
+0.47547,0.00,9.900,0,0.5440,6.1130,58.80,4.0019,4,304.0,18.40,396.23,12.73,21.00
+0.16760,0.00,7.380,0,0.4930,6.4260,52.30,4.5404,5,287.0,19.60,396.90,7.20,23.80
+0.18159,0.00,7.380,0,0.4930,6.3760,54.30,4.5404,5,287.0,19.60,396.90,6.87,23.10
+0.35114,0.00,7.380,0,0.4930,6.0410,49.90,4.7211,5,287.0,19.60,396.90,7.70,20.40
+0.28392,0.00,7.380,0,0.4930,5.7080,74.30,4.7211,5,287.0,19.60,391.13,11.74,18.50
+0.34109,0.00,7.380,0,0.4930,6.4150,40.10,4.7211,5,287.0,19.60,396.90,6.12,25.00
+0.19186,0.00,7.380,0,0.4930,6.4310,14.70,5.4159,5,287.0,19.60,393.68,5.08,24.60
+0.30347,0.00,7.380,0,0.4930,6.3120,28.90,5.4159,5,287.0,19.60,396.90,6.15,23.00
+0.24103,0.00,7.380,0,0.4930,6.0830,43.70,5.4159,5,287.0,19.60,396.90,12.79,22.20
+0.06617,0.00,3.240,0,0.4600,5.8680,25.80,5.2146,4,430.0,16.90,382.44,9.97,19.30
+0.06724,0.00,3.240,0,0.4600,6.3330,17.20,5.2146,4,430.0,16.90,375.21,7.34,22.60
+0.04544,0.00,3.240,0,0.4600,6.1440,32.20,5.8736,4,430.0,16.90,368.57,9.09,19.80
+0.05023,35.00,6.060,0,0.4379,5.7060,28.40,6.6407,1,304.0,16.90,394.02,12.43,17.10
+0.03466,35.00,6.060,0,0.4379,6.0310,23.30,6.6407,1,304.0,16.90,362.25,7.83,19.40
+0.05083,0.00,5.190,0,0.5150,6.3160,38.10,6.4584,5,224.0,20.20,389.71,5.68,22.20
+0.03738,0.00,5.190,0,0.5150,6.3100,38.50,6.4584,5,224.0,20.20,389.40,6.75,20.70
+0.03961,0.00,5.190,0,0.5150,6.0370,34.50,5.9853,5,224.0,20.20,396.90,8.01,21.10
+0.03427,0.00,5.190,0,0.5150,5.8690,46.30,5.2311,5,224.0,20.20,396.90,9.80,19.50
+0.03041,0.00,5.190,0,0.5150,5.8950,59.60,5.6150,5,224.0,20.20,394.81,10.56,18.50
+0.03306,0.00,5.190,0,0.5150,6.0590,37.30,4.8122,5,224.0,20.20,396.14,8.51,20.60
+0.05497,0.00,5.190,0,0.5150,5.9850,45.40,4.8122,5,224.0,20.20,396.90,9.74,19.00
+0.06151,0.00,5.190,0,0.5150,5.9680,58.50,4.8122,5,224.0,20.20,396.90,9.29,18.70
+0.01301,35.00,1.520,0,0.4420,7.2410,49.30,7.0379,1,284.0,15.50,394.74,5.49,32.70
+0.02498,0.00,1.890,0,0.5180,6.5400,59.70,6.2669,1,422.0,15.90,389.96,8.65,16.50
+0.02543,55.00,3.780,0,0.4840,6.6960,56.40,5.7321,5,370.0,17.60,396.90,7.18,23.90
+0.03049,55.00,3.780,0,0.4840,6.8740,28.10,6.4654,5,370.0,17.60,387.97,4.61,31.20
+0.03113,0.00,4.390,0,0.4420,6.0140,48.50,8.0136,3,352.0,18.80,385.64,10.53,17.50
+0.06162,0.00,4.390,0,0.4420,5.8980,52.30,8.0136,3,352.0,18.80,364.61,12.67,17.20
+0.01870,85.00,4.150,0,0.4290,6.5160,27.70,8.5353,4,351.0,17.90,392.43,6.36,23.10
+0.01501,80.00,2.010,0,0.4350,6.6350,29.70,8.3440,4,280.0,17.00,390.94,5.99,24.50
+0.02899,40.00,1.250,0,0.4290,6.9390,34.50,8.7921,1,335.0,19.70,389.85,5.89,26.60
+0.06211,40.00,1.250,0,0.4290,6.4900,44.40,8.7921,1,335.0,19.70,396.90,5.98,22.90
+0.07950,60.00,1.690,0,0.4110,6.5790,35.90,10.7103,4,411.0,18.30,370.78,5.49,24.10
+0.07244,60.00,1.690,0,0.4110,5.8840,18.50,10.7103,4,411.0,18.30,392.33,7.79,18.60
+0.01709,90.00,2.020,0,0.4100,6.7280,36.10,12.1265,5,187.0,17.00,384.46,4.50,30.10
+0.04301,80.00,1.910,0,0.4130,5.6630,21.90,10.5857,4,334.0,22.00,382.80,8.05,18.20
+0.10659,80.00,1.910,0,0.4130,5.9360,19.50,10.5857,4,334.0,22.00,376.04,5.57,20.60
+8.98296,0.00,18.100,1,0.7700,6.2120,97.40,2.1222,24,666.0,20.20,377.73,17.60,17.80
+3.84970,0.00,18.100,1,0.7700,6.3950,91.00,2.5052,24,666.0,20.20,391.34,13.27,21.70
+5.20177,0.00,18.100,1,0.7700,6.1270,83.40,2.7227,24,666.0,20.20,395.43,11.48,22.70
+4.26131,0.00,18.100,0,0.7700,6.1120,81.30,2.5091,24,666.0,20.20,390.74,12.67,22.60
+4.54192,0.00,18.100,0,0.7700,6.3980,88.00,2.5182,24,666.0,20.20,374.56,7.79,25.00
+3.83684,0.00,18.100,0,0.7700,6.2510,91.10,2.2955,24,666.0,20.20,350.65,14.19,19.90
+3.67822,0.00,18.100,0,0.7700,5.3620,96.20,2.1036,24,666.0,20.20,380.79,10.19,20.80
+4.22239,0.00,18.100,1,0.7700,5.8030,89.00,1.9047,24,666.0,20.20,353.04,14.64,16.80
+3.47428,0.00,18.100,1,0.7180,8.7800,82.90,1.9047,24,666.0,20.20,354.55,5.29,21.90
+4.55587,0.00,18.100,0,0.7180,3.5610,87.90,1.6132,24,666.0,20.20,354.70,7.12,27.50
+3.69695,0.00,18.100,0,0.7180,4.9630,91.40,1.7523,24,666.0,20.20,316.03,14.00,21.90
+13.52220,0.00,18.100,0,0.6310,3.8630,100.00,1.5106,24,666.0,20.20,131.42,13.33,23.10
+4.89822,0.00,18.100,0,0.6310,4.9700,100.00,1.3325,24,666.0,20.20,375.52,3.26,50.00
+5.66998,0.00,18.100,1,0.6310,6.6830,96.80,1.3567,24,666.0,20.20,375.33,3.73,50.00
+6.53876,0.00,18.100,1,0.6310,7.0160,97.50,1.2024,24,666.0,20.20,392.05,2.96,50.00
+9.23230,0.00,18.100,0,0.6310,6.2160,100.00,1.1691,24,666.0,20.20,366.15,9.53,50.00
+8.26725,0.00,18.100,1,0.6680,5.8750,89.60,1.1296,24,666.0,20.20,347.88,8.88,50.00
+11.10810,0.00,18.100,0,0.6680,4.9060,100.00,1.1742,24,666.0,20.20,396.90,34.77,13.80
+18.49820,0.00,18.100,0,0.6680,4.1380,100.00,1.1370,24,666.0,20.20,396.90,37.97,13.80
+19.60910,0.00,18.100,0,0.6710,7.3130,97.90,1.3163,24,666.0,20.20,396.90,13.44,15.00
+15.28800,0.00,18.100,0,0.6710,6.6490,93.30,1.3449,24,666.0,20.20,363.02,23.24,13.90
+9.82349,0.00,18.100,0,0.6710,6.7940,98.80,1.3580,24,666.0,20.20,396.90,21.24,13.30
+23.64820,0.00,18.100,0,0.6710,6.3800,96.20,1.3861,24,666.0,20.20,396.90,23.69,13.10
+17.86670,0.00,18.100,0,0.6710,6.2230,100.00,1.3861,24,666.0,20.20,393.74,21.78,10.20
+88.97620,0.00,18.100,0,0.6710,6.9680,91.90,1.4165,24,666.0,20.20,396.90,17.21,10.40
+15.87440,0.00,18.100,0,0.6710,6.5450,99.10,1.5192,24,666.0,20.20,396.90,21.08,10.90
+9.18702,0.00,18.100,0,0.7000,5.5360,100.00,1.5804,24,666.0,20.20,396.90,23.60,11.30
+7.99248,0.00,18.100,0,0.7000,5.5200,100.00,1.5331,24,666.0,20.20,396.90,24.56,12.30
+20.08490,0.00,18.100,0,0.7000,4.3680,91.20,1.4395,24,666.0,20.20,285.83,30.63,8.80
+16.81180,0.00,18.100,0,0.7000,5.2770,98.10,1.4261,24,666.0,20.20,396.90,30.81,7.20
+24.39380,0.00,18.100,0,0.7000,4.6520,100.00,1.4672,24,666.0,20.20,396.90,28.28,10.50
+22.59710,0.00,18.100,0,0.7000,5.0000,89.50,1.5184,24,666.0,20.20,396.90,31.99,7.40
+14.33370,0.00,18.100,0,0.7000,4.8800,100.00,1.5895,24,666.0,20.20,372.92,30.62,10.20
+8.15174,0.00,18.100,0,0.7000,5.3900,98.90,1.7281,24,666.0,20.20,396.90,20.85,11.50
+6.96215,0.00,18.100,0,0.7000,5.7130,97.00,1.9265,24,666.0,20.20,394.43,17.11,15.10
+5.29305,0.00,18.100,0,0.7000,6.0510,82.50,2.1678,24,666.0,20.20,378.38,18.76,23.20
+11.57790,0.00,18.100,0,0.7000,5.0360,97.00,1.7700,24,666.0,20.20,396.90,25.68,9.70
+8.64476,0.00,18.100,0,0.6930,6.1930,92.60,1.7912,24,666.0,20.20,396.90,15.17,13.80
+13.35980,0.00,18.100,0,0.6930,5.8870,94.70,1.7821,24,666.0,20.20,396.90,16.35,12.70
+8.71675,0.00,18.100,0,0.6930,6.4710,98.80,1.7257,24,666.0,20.20,391.98,17.12,13.10
+5.87205,0.00,18.100,0,0.6930,6.4050,96.00,1.6768,24,666.0,20.20,396.90,19.37,12.50
+7.67202,0.00,18.100,0,0.6930,5.7470,98.90,1.6334,24,666.0,20.20,393.10,19.92,8.50
+38.35180,0.00,18.100,0,0.6930,5.4530,100.00,1.4896,24,666.0,20.20,396.90,30.59,5.00
+9.91655,0.00,18.100,0,0.6930,5.8520,77.80,1.5004,24,666.0,20.20,338.16,29.97,6.30
+25.04610,0.00,18.100,0,0.6930,5.9870,100.00,1.5888,24,666.0,20.20,396.90,26.77,5.60
+14.23620,0.00,18.100,0,0.6930,6.3430,100.00,1.5741,24,666.0,20.20,396.90,20.32,7.20
+9.59571,0.00,18.100,0,0.6930,6.4040,100.00,1.6390,24,666.0,20.20,376.11,20.31,12.10
+24.80170,0.00,18.100,0,0.6930,5.3490,96.00,1.7028,24,666.0,20.20,396.90,19.77,8.30
+41.52920,0.00,18.100,0,0.6930,5.5310,85.40,1.6074,24,666.0,20.20,329.46,27.38,8.50
+67.92080,0.00,18.100,0,0.6930,5.6830,100.00,1.4254,24,666.0,20.20,384.97,22.98,5.00
+20.71620,0.00,18.100,0,0.6590,4.1380,100.00,1.1781,24,666.0,20.20,370.22,23.34,11.90
+11.95110,0.00,18.100,0,0.6590,5.6080,100.00,1.2852,24,666.0,20.20,332.09,12.13,27.90
+7.40389,0.00,18.100,0,0.5970,5.6170,97.90,1.4547,24,666.0,20.20,314.64,26.40,17.20
+14.43830,0.00,18.100,0,0.5970,6.8520,100.00,1.4655,24,666.0,20.20,179.36,19.78,27.50
+51.13580,0.00,18.100,0,0.5970,5.7570,100.00,1.4130,24,666.0,20.20,2.60,10.11,15.00
+14.05070,0.00,18.100,0,0.5970,6.6570,100.00,1.5275,24,666.0,20.20,35.05,21.22,17.20
+18.81100,0.00,18.100,0,0.5970,4.6280,100.00,1.5539,24,666.0,20.20,28.79,34.37,17.90
+28.65580,0.00,18.100,0,0.5970,5.1550,100.00,1.5894,24,666.0,20.20,210.97,20.08,16.30
+45.74610,0.00,18.100,0,0.6930,4.5190,100.00,1.6582,24,666.0,20.20,88.27,36.98,7.00
+18.08460,0.00,18.100,0,0.6790,6.4340,100.00,1.8347,24,666.0,20.20,27.25,29.05,7.20
+10.83420,0.00,18.100,0,0.6790,6.7820,90.80,1.8195,24,666.0,20.20,21.57,25.79,7.50
+25.94060,0.00,18.100,0,0.6790,5.3040,89.10,1.6475,24,666.0,20.20,127.36,26.64,10.40
+73.53410,0.00,18.100,0,0.6790,5.9570,100.00,1.8026,24,666.0,20.20,16.45,20.62,8.80
+11.81230,0.00,18.100,0,0.7180,6.8240,76.50,1.7940,24,666.0,20.20,48.45,22.74,8.40
+11.08740,0.00,18.100,0,0.7180,6.4110,100.00,1.8589,24,666.0,20.20,318.75,15.02,16.70
+7.02259,0.00,18.100,0,0.7180,6.0060,95.30,1.8746,24,666.0,20.20,319.98,15.70,14.20
+12.04820,0.00,18.100,0,0.6140,5.6480,87.60,1.9512,24,666.0,20.20,291.55,14.10,20.80
+7.05042,0.00,18.100,0,0.6140,6.1030,85.10,2.0218,24,666.0,20.20,2.52,23.29,13.40
+8.79212,0.00,18.100,0,0.5840,5.5650,70.60,2.0635,24,666.0,20.20,3.65,17.16,11.70
+15.86030,0.00,18.100,0,0.6790,5.8960,95.40,1.9096,24,666.0,20.20,7.68,24.39,8.30
+12.24720,0.00,18.100,0,0.5840,5.8370,59.70,1.9976,24,666.0,20.20,24.65,15.69,10.20
+37.66190,0.00,18.100,0,0.6790,6.2020,78.70,1.8629,24,666.0,20.20,18.82,14.52,10.90
+7.36711,0.00,18.100,0,0.6790,6.1930,78.10,1.9356,24,666.0,20.20,96.73,21.52,11.00
+9.33889,0.00,18.100,0,0.6790,6.3800,95.60,1.9682,24,666.0,20.20,60.72,24.08,9.50
+8.49213,0.00,18.100,0,0.5840,6.3480,86.10,2.0527,24,666.0,20.20,83.45,17.64,14.50
+10.06230,0.00,18.100,0,0.5840,6.8330,94.30,2.0882,24,666.0,20.20,81.33,19.69,14.10
+6.44405,0.00,18.100,0,0.5840,6.4250,74.80,2.2004,24,666.0,20.20,97.95,12.03,16.10
+5.58107,0.00,18.100,0,0.7130,6.4360,87.90,2.3158,24,666.0,20.20,100.19,16.22,14.30
+13.91340,0.00,18.100,0,0.7130,6.2080,95.00,2.2222,24,666.0,20.20,100.63,15.17,11.70
+11.16040,0.00,18.100,0,0.7400,6.6290,94.60,2.1247,24,666.0,20.20,109.85,23.27,13.40
+14.42080,0.00,18.100,0,0.7400,6.4610,93.30,2.0026,24,666.0,20.20,27.49,18.05,9.60
+15.17720,0.00,18.100,0,0.7400,6.1520,100.00,1.9142,24,666.0,20.20,9.32,26.45,8.70
+13.67810,0.00,18.100,0,0.7400,5.9350,87.90,1.8206,24,666.0,20.20,68.95,34.02,8.40
+9.39063,0.00,18.100,0,0.7400,5.6270,93.90,1.8172,24,666.0,20.20,396.90,22.88,12.80
+22.05110,0.00,18.100,0,0.7400,5.8180,92.40,1.8662,24,666.0,20.20,391.45,22.11,10.50
+9.72418,0.00,18.100,0,0.7400,6.4060,97.20,2.0651,24,666.0,20.20,385.96,19.52,17.10
+5.66637,0.00,18.100,0,0.7400,6.2190,100.00,2.0048,24,666.0,20.20,395.69,16.59,18.40
+9.96654,0.00,18.100,0,0.7400,6.4850,100.00,1.9784,24,666.0,20.20,386.73,18.85,15.40
+12.80230,0.00,18.100,0,0.7400,5.8540,96.60,1.8956,24,666.0,20.20,240.52,23.79,10.80
+10.67180,0.00,18.100,0,0.7400,6.4590,94.80,1.9879,24,666.0,20.20,43.06,23.98,11.80
+6.28807,0.00,18.100,0,0.7400,6.3410,96.40,2.0720,24,666.0,20.20,318.01,17.79,14.90
+9.92485,0.00,18.100,0,0.7400,6.2510,96.60,2.1980,24,666.0,20.20,388.52,16.44,12.60
+9.32909,0.00,18.100,0,0.7130,6.1850,98.70,2.2616,24,666.0,20.20,396.90,18.13,14.10
+7.52601,0.00,18.100,0,0.7130,6.4170,98.30,2.1850,24,666.0,20.20,304.21,19.31,13.00
+6.71772,0.00,18.100,0,0.7130,6.7490,92.60,2.3236,24,666.0,20.20,0.32,17.44,13.40
+5.44114,0.00,18.100,0,0.7130,6.6550,98.20,2.3552,24,666.0,20.20,355.29,17.73,15.20
+5.09017,0.00,18.100,0,0.7130,6.2970,91.80,2.3682,24,666.0,20.20,385.09,17.27,16.10
+8.24809,0.00,18.100,0,0.7130,7.3930,99.30,2.4527,24,666.0,20.20,375.87,16.74,17.80
+9.51363,0.00,18.100,0,0.7130,6.7280,94.10,2.4961,24,666.0,20.20,6.68,18.71,14.90
+4.75237,0.00,18.100,0,0.7130,6.5250,86.50,2.4358,24,666.0,20.20,50.92,18.13,14.10
+4.66883,0.00,18.100,0,0.7130,5.9760,87.90,2.5806,24,666.0,20.20,10.48,19.01,12.70
+8.20058,0.00,18.100,0,0.7130,5.9360,80.30,2.7792,24,666.0,20.20,3.50,16.94,13.50
+7.75223,0.00,18.100,0,0.7130,6.3010,83.70,2.7831,24,666.0,20.20,272.21,16.23,14.90
+6.80117,0.00,18.100,0,0.7130,6.0810,84.40,2.7175,24,666.0,20.20,396.90,14.70,20.00
+4.81213,0.00,18.100,0,0.7130,6.7010,90.00,2.5975,24,666.0,20.20,255.23,16.42,16.40
+3.69311,0.00,18.100,0,0.7130,6.3760,88.40,2.5671,24,666.0,20.20,391.43,14.65,17.70
+6.65492,0.00,18.100,0,0.7130,6.3170,83.00,2.7344,24,666.0,20.20,396.90,13.99,19.50
+5.82115,0.00,18.100,0,0.7130,6.5130,89.90,2.8016,24,666.0,20.20,393.82,10.29,20.20
+7.83932,0.00,18.100,0,0.6550,6.2090,65.40,2.9634,24,666.0,20.20,396.90,13.22,21.40
+3.16360,0.00,18.100,0,0.6550,5.7590,48.20,3.0665,24,666.0,20.20,334.40,14.13,19.90
+3.77498,0.00,18.100,0,0.6550,5.9520,84.70,2.8715,24,666.0,20.20,22.01,17.15,19.00
+4.42228,0.00,18.100,0,0.5840,6.0030,94.50,2.5403,24,666.0,20.20,331.29,21.32,19.10
+15.57570,0.00,18.100,0,0.5800,5.9260,71.00,2.9084,24,666.0,20.20,368.74,18.13,19.10
+13.07510,0.00,18.100,0,0.5800,5.7130,56.70,2.8237,24,666.0,20.20,396.90,14.76,20.10
+4.34879,0.00,18.100,0,0.5800,6.1670,84.00,3.0334,24,666.0,20.20,396.90,16.29,19.90
+4.03841,0.00,18.100,0,0.5320,6.2290,90.70,3.0993,24,666.0,20.20,395.33,12.87,19.60
+3.56868,0.00,18.100,0,0.5800,6.4370,75.00,2.8965,24,666.0,20.20,393.37,14.36,23.20
+4.64689,0.00,18.100,0,0.6140,6.9800,67.60,2.5329,24,666.0,20.20,374.68,11.66,29.80
+8.05579,0.00,18.100,0,0.5840,5.4270,95.40,2.4298,24,666.0,20.20,352.58,18.14,13.80
+6.39312,0.00,18.100,0,0.5840,6.1620,97.40,2.2060,24,666.0,20.20,302.76,24.10,13.30
+4.87141,0.00,18.100,0,0.6140,6.4840,93.60,2.3053,24,666.0,20.20,396.21,18.68,16.70
+15.02340,0.00,18.100,0,0.6140,5.3040,97.30,2.1007,24,666.0,20.20,349.48,24.91,12.00
+10.23300,0.00,18.100,0,0.6140,6.1850,96.70,2.1705,24,666.0,20.20,379.70,18.03,14.60
+14.33370,0.00,18.100,0,0.6140,6.2290,88.00,1.9512,24,666.0,20.20,383.32,13.11,21.40
+5.82401,0.00,18.100,0,0.5320,6.2420,64.70,3.4242,24,666.0,20.20,396.90,10.74,23.00
+5.70818,0.00,18.100,0,0.5320,6.7500,74.90,3.3317,24,666.0,20.20,393.07,7.74,23.70
+5.73116,0.00,18.100,0,0.5320,7.0610,77.00,3.4106,24,666.0,20.20,395.28,7.01,25.00
+2.81838,0.00,18.100,0,0.5320,5.7620,40.30,4.0983,24,666.0,20.20,392.92,10.42,21.80
+2.37857,0.00,18.100,0,0.5830,5.8710,41.90,3.7240,24,666.0,20.20,370.73,13.34,20.60
+3.67367,0.00,18.100,0,0.5830,6.3120,51.90,3.9917,24,666.0,20.20,388.62,10.58,21.20
+5.69175,0.00,18.100,0,0.5830,6.1140,79.80,3.5459,24,666.0,20.20,392.68,14.98,19.10
+4.83567,0.00,18.100,0,0.5830,5.9050,53.20,3.1523,24,666.0,20.20,388.22,11.45,20.60
+0.15086,0.00,27.740,0,0.6090,5.4540,92.70,1.8209,4,711.0,20.10,395.09,18.06,15.20
+0.18337,0.00,27.740,0,0.6090,5.4140,98.30,1.7554,4,711.0,20.10,344.05,23.97,7.00
+0.20746,0.00,27.740,0,0.6090,5.0930,98.00,1.8226,4,711.0,20.10,318.43,29.68,8.10
+0.10574,0.00,27.740,0,0.6090,5.9830,98.80,1.8681,4,711.0,20.10,390.11,18.07,13.60
+0.11132,0.00,27.740,0,0.6090,5.9830,83.50,2.1099,4,711.0,20.10,396.90,13.35,20.10
+0.17331,0.00,9.690,0,0.5850,5.7070,54.00,2.3817,6,391.0,19.20,396.90,12.01,21.80
+0.27957,0.00,9.690,0,0.5850,5.9260,42.60,2.3817,6,391.0,19.20,396.90,13.59,24.50
+0.17899,0.00,9.690,0,0.5850,5.6700,28.80,2.7986,6,391.0,19.20,393.29,17.60,23.10
+0.28960,0.00,9.690,0,0.5850,5.3900,72.90,2.7986,6,391.0,19.20,396.90,21.14,19.70
+0.26838,0.00,9.690,0,0.5850,5.7940,70.60,2.8927,6,391.0,19.20,396.90,14.10,18.30
+0.23912,0.00,9.690,0,0.5850,6.0190,65.30,2.4091,6,391.0,19.20,396.90,12.92,21.20
+0.17783,0.00,9.690,0,0.5850,5.5690,73.50,2.3999,6,391.0,19.20,395.77,15.10,17.50
+0.22438,0.00,9.690,0,0.5850,6.0270,79.70,2.4982,6,391.0,19.20,396.90,14.33,16.80
+0.06263,0.00,11.930,0,0.5730,6.5930,69.10,2.4786,1,273.0,21.00,391.99,9.67,22.40
+0.04527,0.00,11.930,0,0.5730,6.1200,76.70,2.2875,1,273.0,21.00,396.90,9.08,20.60
+0.06076,0.00,11.930,0,0.5730,6.9760,91.00,2.1675,1,273.0,21.00,396.90,5.64,23.90
+0.10959,0.00,11.930,0,0.5730,6.7940,89.30,2.3889,1,273.0,21.00,393.45,6.48,22.00
+0.04741,0.00,11.930,0,0.5730,6.0300,80.80,2.5050,1,273.0,21.00,396.90,7.88,11.90

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/resources/datasets/cleared_machines.csv
----------------------------------------------------------------------
diff --git a/examples/src/main/resources/datasets/cleared_machines.csv b/examples/src/main/resources/datasets/cleared_machines.csv
new file mode 100644
index 0000000..e22aac8
--- /dev/null
+++ b/examples/src/main/resources/datasets/cleared_machines.csv
@@ -0,0 +1,209 @@
+199;125;256;6000;256;16;128
+253;29;8000;32000;32;8;32
+253;29;8000;32000;32;8;32
+253;29;8000;32000;32;8;32
+132;29;8000;16000;32;8;16
+290;26;8000;32000;64;8;32
+381;23;16000;32000;64;16;32
+381;23;16000;32000;64;16;32
+749;23;16000;64000;64;16;32
+1238;23;32000;64000;128;32;64
+23;400;1000;3000;0;1;2
+24;400;512;3500;4;1;6
+70;60;2000;8000;65;1;8
+117;50;4000;16000;65;1;8
+15;350;64;64;0;1;4
+64;200;512;16000;0;4;32
+23;167;524;2000;8;4;15
+29;143;512;5000;0;7;32
+22;143;1000;2000;0;5;16
+124;110;5000;5000;142;8;64
+35;143;1500;6300;0;5;32
+39;143;3100;6200;0;5;20
+40;143;2300;6200;0;6;64
+45;110;3100;6200;0;6;64
+28;320;128;6000;0;1;12
+21;320;512;2000;4;1;3
+28;320;256;6000;0;1;6
+22;320;256;3000;4;1;3
+28;320;512;5000;4;1;5
+27;320;256;5000;4;1;6
+102;25;1310;2620;131;12;24
+102;25;1310;2620;131;12;24
+74;50;2620;10480;30;12;24
+74;50;2620;10480;30;12;24
+138;56;5240;20970;30;12;24
+136;64;5240;20970;30;12;24
+23;50;500;2000;8;1;4
+29;50;1000;4000;8;1;5
+44;50;2000;8000;8;1;5
+30;50;1000;4000;8;3;5
+41;50;1000;8000;8;3;5
+74;50;2000;16000;8;3;5
+74;50;2000;16000;8;3;6
+74;50;2000;16000;8;3;6
+54;133;1000;12000;9;3;12
+41;133;1000;8000;9;3;12
+18;810;512;512;8;1;1
+28;810;1000;5000;0;1;1
+36;320;512;8000;4;1;5
+38;200;512;8000;8;1;8
+34;700;384;8000;0;1;1
+19;700;256;2000;0;1;1
+72;140;1000;16000;16;1;3
+36;200;1000;8000;0;1;2
+30;110;1000;4000;16;1;2
+56;110;1000;12000;16;1;2
+42;220;1000;8000;16;1;2
+34;800;256;8000;0;1;4
+34;800;256;8000;0;1;4
+34;800;256;8000;0;1;4
+34;800;256;8000;0;1;4
+34;800;256;8000;0;1;4
+19;125;512;1000;0;8;20
+75;75;2000;8000;64;1;38
+113;75;2000;16000;64;1;38
+157;75;2000;16000;128;1;38
+18;90;256;1000;0;3;10
+20;105;256;2000;0;3;10
+28;105;1000;4000;0;3;24
+33;105;2000;4000;8;3;19
+47;75;2000;8000;8;3;24
+54;75;3000;8000;8;3;48
+20;175;256;2000;0;3;24
+23;300;768;3000;0;6;24
+25;300;768;3000;6;6;24
+52;300;768;12000;6;6;24
+27;300;768;4500;0;1;24
+50;300;384;12000;6;1;24
+18;300;192;768;6;6;24
+53;180;768;12000;6;1;31
+23;330;1000;3000;0;2;4
+30;300;1000;4000;8;3;64
+73;300;1000;16000;8;2;112
+20;330;1000;2000;0;1;2
+25;330;1000;4000;0;3;6
+28;140;2000;4000;0;3;6
+29;140;2000;4000;0;4;8
+32;140;2000;4000;8;1;20
+175;140;2000;32000;32;1;20
+57;140;2000;8000;32;1;54
+181;140;2000;32000;32;1;54
+181;140;2000;32000;32;1;54
+32;140;2000;4000;8;1;20
+82;57;4000;16000;1;6;12
+171;57;4000;24000;64;12;16
+361;26;16000;32000;64;16;24
+350;26;16000;32000;64;8;24
+220;26;8000;32000;0;8;24
+113;26;8000;16000;0;8;16
+15;480;96;512;0;1;1
+21;203;1000;2000;0;1;5
+35;115;512;6000;16;1;6
+18;1100;512;1500;0;1;1
+20;1100;768;2000;0;1;1
+20;600;768;2000;0;1;1
+28;400;2000;4000;0;1;1
+45;400;4000;8000;0;1;1
+18;900;1000;1000;0;1;2
+17;900;512;1000;0;1;2
+26;900;1000;4000;4;1;2
+28;900;1000;4000;8;1;2
+28;900;2000;4000;0;3;6
+31;225;2000;4000;8;3;6
+31;225;2000;4000;8;3;6
+42;180;2000;8000;8;1;6
+76;185;2000;16000;16;1;6
+76;180;2000;16000;16;1;6
+26;225;1000;4000;2;3;6
+59;25;2000;12000;8;1;4
+65;25;2000;12000;16;3;5
+101;17;4000;16000;8;6;12
+116;17;4000;16000;32;6;12
+18;1500;768;1000;0;0;0
+20;1500;768;2000;0;0;0
+20;800;768;2000;0;0;0
+30;50;2000;4000;0;3;6
+44;50;2000;8000;8;3;6
+44;50;2000;8000;8;1;6
+82;50;2000;16000;24;1;6
+82;50;2000;16000;24;1;6
+128;50;8000;16000;48;1;10
+37;100;1000;8000;0;2;6
+46;100;1000;8000;24;2;6
+46;100;1000;8000;24;3;6
+80;50;2000;16000;12;3;16
+88;50;2000;16000;24;6;16
+88;50;2000;16000;24;6;16
+33;150;512;4000;0;8;128
+46;115;2000;8000;16;1;3
+29;115;2000;4000;2;1;5
+53;92;2000;8000;32;1;6
+53;92;2000;8000;32;1;6
+41;92;2000;8000;4;1;6
+86;75;4000;16000;16;1;6
+95;60;4000;16000;32;1;6
+107;60;2000;16000;64;5;8
+117;60;4000;16000;64;5;8
+119;50;4000;16000;64;5;10
+120;72;4000;16000;64;8;16
+48;72;2000;8000;16;6;8
+126;40;8000;16000;32;8;16
+266;40;8000;32000;64;8;24
+270;35;8000;32000;64;8;24
+426;38;16000;32000;128;16;32
+151;48;4000;24000;32;8;24
+267;38;8000;32000;64;8;24
+603;30;16000;32000;256;16;24
+19;112;1000;1000;0;1;4
+21;84;1000;2000;0;1;6
+26;56;1000;4000;0;1;6
+35;56;2000;6000;0;1;8
+41;56;2000;8000;0;1;8
+47;56;4000;8000;0;1;8
+62;56;4000;12000;0;1;8
+78;56;4000;16000;0;1;8
+80;38;4000;8000;32;16;32
+80;38;4000;8000;32;16;32
+142;38;8000;16000;64;4;8
+281;38;8000;24000;160;4;8
+190;38;4000;16000;128;16;32
+21;200;1000;2000;0;1;2
+25;200;1000;4000;0;1;4
+67;200;2000;8000;64;1;5
+24;250;512;4000;0;1;7
+24;250;512;4000;0;4;7
+64;250;1000;16000;1;1;8
+25;160;512;4000;2;1;5
+20;160;512;2000;2;3;8
+29;160;1000;4000;8;1;14
+43;160;1000;8000;16;1;14
+53;160;2000;8000;32;1;13
+19;240;512;1000;8;1;3
+22;240;512;2000;8;1;5
+31;105;2000;4000;8;3;8
+41;105;2000;6000;16;6;16
+47;105;2000;8000;16;4;14
+99;52;4000;16000;32;4;12
+67;70;4000;12000;8;6;8
+81;59;4000;12000;32;6;12
+149;59;8000;16000;64;12;24
+183;26;8000;24000;32;8;16
+275;26;8000;32000;64;12;16
+382;26;8000;32000;128;24;32
+56;116;2000;8000;32;5;28
+182;50;2000;32000;24;6;26
+227;50;2000;32000;48;26;52
+341;50;2000;32000;112;52;104
+360;50;4000;32000;112;52;104
+919;30;8000;64000;96;12;176
+978;30;8000;64000;128;12;176
+24;180;262;4000;0;1;3
+24;180;512;4000;0;1;3
+24;180;262;4000;0;1;3
+24;180;512;4000;0;1;3
+37;124;1000;8000;0;1;8
+50;98;1000;8000;32;2;8
+41;125;2000;8000;0;2;14
+47;480;512;8000;32;0;0
+25;480;1000;4000;0;0;0

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/resources/datasets/cleared_machines.txt
----------------------------------------------------------------------
diff --git a/examples/src/main/resources/datasets/cleared_machines.txt b/examples/src/main/resources/datasets/cleared_machines.txt
deleted file mode 100644
index cf8b6b0..0000000
--- a/examples/src/main/resources/datasets/cleared_machines.txt
+++ /dev/null
@@ -1,209 +0,0 @@
-199,125,256,6000,256,16,128
-253,29,8000,32000,32,8,32
-253,29,8000,32000,32,8,32
-253,29,8000,32000,32,8,32
-132,29,8000,16000,32,8,16
-290,26,8000,32000,64,8,32
-381,23,16000,32000,64,16,32
-381,23,16000,32000,64,16,32
-749,23,16000,64000,64,16,32
-1238,23,32000,64000,128,32,64
-23,400,1000,3000,0,1,2
-24,400,512,3500,4,1,6
-70,60,2000,8000,65,1,8
-117,50,4000,16000,65,1,8
-15,350,64,64,0,1,4
-64,200,512,16000,0,4,32
-23,167,524,2000,8,4,15
-29,143,512,5000,0,7,32
-22,143,1000,2000,0,5,16
-124,110,5000,5000,142,8,64
-35,143,1500,6300,0,5,32
-39,143,3100,6200,0,5,20
-40,143,2300,6200,0,6,64
-45,110,3100,6200,0,6,64
-28,320,128,6000,0,1,12
-21,320,512,2000,4,1,3
-28,320,256,6000,0,1,6
-22,320,256,3000,4,1,3
-28,320,512,5000,4,1,5
-27,320,256,5000,4,1,6
-102,25,1310,2620,131,12,24
-102,25,1310,2620,131,12,24
-74,50,2620,10480,30,12,24
-74,50,2620,10480,30,12,24
-138,56,5240,20970,30,12,24
-136,64,5240,20970,30,12,24
-23,50,500,2000,8,1,4
-29,50,1000,4000,8,1,5
-44,50,2000,8000,8,1,5
-30,50,1000,4000,8,3,5
-41,50,1000,8000,8,3,5
-74,50,2000,16000,8,3,5
-74,50,2000,16000,8,3,6
-74,50,2000,16000,8,3,6
-54,133,1000,12000,9,3,12
-41,133,1000,8000,9,3,12
-18,810,512,512,8,1,1
-28,810,1000,5000,0,1,1
-36,320,512,8000,4,1,5
-38,200,512,8000,8,1,8
-34,700,384,8000,0,1,1
-19,700,256,2000,0,1,1
-72,140,1000,16000,16,1,3
-36,200,1000,8000,0,1,2
-30,110,1000,4000,16,1,2
-56,110,1000,12000,16,1,2
-42,220,1000,8000,16,1,2
-34,800,256,8000,0,1,4
-34,800,256,8000,0,1,4
-34,800,256,8000,0,1,4
-34,800,256,8000,0,1,4
-34,800,256,8000,0,1,4
-19,125,512,1000,0,8,20
-75,75,2000,8000,64,1,38
-113,75,2000,16000,64,1,38
-157,75,2000,16000,128,1,38
-18,90,256,1000,0,3,10
-20,105,256,2000,0,3,10
-28,105,1000,4000,0,3,24
-33,105,2000,4000,8,3,19
-47,75,2000,8000,8,3,24
-54,75,3000,8000,8,3,48
-20,175,256,2000,0,3,24
-23,300,768,3000,0,6,24
-25,300,768,3000,6,6,24
-52,300,768,12000,6,6,24
-27,300,768,4500,0,1,24
-50,300,384,12000,6,1,24
-18,300,192,768,6,6,24
-53,180,768,12000,6,1,31
-23,330,1000,3000,0,2,4
-30,300,1000,4000,8,3,64
-73,300,1000,16000,8,2,112
-20,330,1000,2000,0,1,2
-25,330,1000,4000,0,3,6
-28,140,2000,4000,0,3,6
-29,140,2000,4000,0,4,8
-32,140,2000,4000,8,1,20
-175,140,2000,32000,32,1,20
-57,140,2000,8000,32,1,54
-181,140,2000,32000,32,1,54
-181,140,2000,32000,32,1,54
-32,140,2000,4000,8,1,20
-82,57,4000,16000,1,6,12
-171,57,4000,24000,64,12,16
-361,26,16000,32000,64,16,24
-350,26,16000,32000,64,8,24
-220,26,8000,32000,0,8,24
-113,26,8000,16000,0,8,16
-15,480,96,512,0,1,1
-21,203,1000,2000,0,1,5
-35,115,512,6000,16,1,6
-18,1100,512,1500,0,1,1
-20,1100,768,2000,0,1,1
-20,600,768,2000,0,1,1
-28,400,2000,4000,0,1,1
-45,400,4000,8000,0,1,1
-18,900,1000,1000,0,1,2
-17,900,512,1000,0,1,2
-26,900,1000,4000,4,1,2
-28,900,1000,4000,8,1,2
-28,900,2000,4000,0,3,6
-31,225,2000,4000,8,3,6
-31,225,2000,4000,8,3,6
-42,180,2000,8000,8,1,6
-76,185,2000,16000,16,1,6
-76,180,2000,16000,16,1,6
-26,225,1000,4000,2,3,6
-59,25,2000,12000,8,1,4
-65,25,2000,12000,16,3,5
-101,17,4000,16000,8,6,12
-116,17,4000,16000,32,6,12
-18,1500,768,1000,0,0,0
-20,1500,768,2000,0,0,0
-20,800,768,2000,0,0,0
-30,50,2000,4000,0,3,6
-44,50,2000,8000,8,3,6
-44,50,2000,8000,8,1,6
-82,50,2000,16000,24,1,6
-82,50,2000,16000,24,1,6
-128,50,8000,16000,48,1,10
-37,100,1000,8000,0,2,6
-46,100,1000,8000,24,2,6
-46,100,1000,8000,24,3,6
-80,50,2000,16000,12,3,16
-88,50,2000,16000,24,6,16
-88,50,2000,16000,24,6,16
-33,150,512,4000,0,8,128
-46,115,2000,8000,16,1,3
-29,115,2000,4000,2,1,5
-53,92,2000,8000,32,1,6
-53,92,2000,8000,32,1,6
-41,92,2000,8000,4,1,6
-86,75,4000,16000,16,1,6
-95,60,4000,16000,32,1,6
-107,60,2000,16000,64,5,8
-117,60,4000,16000,64,5,8
-119,50,4000,16000,64,5,10
-120,72,4000,16000,64,8,16
-48,72,2000,8000,16,6,8
-126,40,8000,16000,32,8,16
-266,40,8000,32000,64,8,24
-270,35,8000,32000,64,8,24
-426,38,16000,32000,128,16,32
-151,48,4000,24000,32,8,24
-267,38,8000,32000,64,8,24
-603,30,16000,32000,256,16,24
-19,112,1000,1000,0,1,4
-21,84,1000,2000,0,1,6
-26,56,1000,4000,0,1,6
-35,56,2000,6000,0,1,8
-41,56,2000,8000,0,1,8
-47,56,4000,8000,0,1,8
-62,56,4000,12000,0,1,8
-78,56,4000,16000,0,1,8
-80,38,4000,8000,32,16,32
-80,38,4000,8000,32,16,32
-142,38,8000,16000,64,4,8
-281,38,8000,24000,160,4,8
-190,38,4000,16000,128,16,32
-21,200,1000,2000,0,1,2
-25,200,1000,4000,0,1,4
-67,200,2000,8000,64,1,5
-24,250,512,4000,0,1,7
-24,250,512,4000,0,4,7
-64,250,1000,16000,1,1,8
-25,160,512,4000,2,1,5
-20,160,512,2000,2,3,8
-29,160,1000,4000,8,1,14
-43,160,1000,8000,16,1,14
-53,160,2000,8000,32,1,13
-19,240,512,1000,8,1,3
-22,240,512,2000,8,1,5
-31,105,2000,4000,8,3,8
-41,105,2000,6000,16,6,16
-47,105,2000,8000,16,4,14
-99,52,4000,16000,32,4,12
-67,70,4000,12000,8,6,8
-81,59,4000,12000,32,6,12
-149,59,8000,16000,64,12,24
-183,26,8000,24000,32,8,16
-275,26,8000,32000,64,12,16
-382,26,8000,32000,128,24,32
-56,116,2000,8000,32,5,28
-182,50,2000,32000,24,6,26
-227,50,2000,32000,48,26,52
-341,50,2000,32000,112,52,104
-360,50,4000,32000,112,52,104
-919,30,8000,64000,96,12,176
-978,30,8000,64000,128,12,176
-24,180,262,4000,0,1,3
-24,180,512,4000,0,1,3
-24,180,262,4000,0,1,3
-24,180,512,4000,0,1,3
-37,124,1000,8000,0,1,8
-50,98,1000,8000,32,2,8
-41,125,2000,8000,0,2,14
-47,480,512,8000,32,0,0
-25,480,1000,4000,0,0,0

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/resources/datasets/glass_identification.csv
----------------------------------------------------------------------
diff --git a/examples/src/main/resources/datasets/glass_identification.csv b/examples/src/main/resources/datasets/glass_identification.csv
new file mode 100644
index 0000000..ae1d6d1
--- /dev/null
+++ b/examples/src/main/resources/datasets/glass_identification.csv
@@ -0,0 +1,116 @@
+1; 1.52101; 4.49; 1.10; 0.00; 0.00
+1; 1.51761; 3.60; 1.36; 0.00; 0.00
+1; 1.51618; 3.55; 1.54; 0.00; 0.00
+1; 1.51766; 3.69; 1.29; 0.00; 0.00
+1; 1.51742; 3.62; 1.24; 0.00; 0.00
+1; 1.51596; 3.61; 1.62; 0.00; 0.26
+1; 1.51743; 3.60; 1.14; 0.00; 0.00
+1; 1.51756; 3.61; 1.05; 0.00; 0.00
+1; 1.51918; 3.58; 1.37; 0.00; 0.00
+1; 1.51755; 3.60; 1.36; 0.00; 0.11
+1; 1.51571; 3.46; 1.56; 0.00; 0.24
+1; 1.51763; 3.66; 1.27; 0.00; 0.00
+1; 1.51589; 3.43; 1.40; 0.00; 0.24
+1; 1.51748; 3.56; 1.27; 0.00; 0.17
+1; 1.51763; 3.59; 1.31; 0.00; 0.00
+1; 1.51761; 3.54; 1.23; 0.00; 0.00
+1; 1.51784; 3.67; 1.16; 0.00; 0.00
+1; 1.52196; 3.85; 0.89; 0.00; 0.00
+1; 1.51911; 3.73; 1.18; 0.00; 0.00
+1; 1.51735; 3.54; 1.69; 0.00; 0.07
+1; 1.51750; 3.55; 1.49; 0.00; 0.19
+1; 1.51966; 3.75; 0.29; 0.00; 0.00
+1; 1.51736; 3.62; 1.29; 0.00; 0.00
+1; 1.51751; 3.57; 1.35; 0.00; 0.00
+1; 1.51720; 3.50; 1.15; 0.00; 0.00
+1; 1.51764; 3.54; 1.21; 0.00; 0.00
+1; 1.51793; 3.48; 1.41; 0.00; 0.00
+1; 1.51721; 3.48; 1.33; 0.00; 0.00
+1; 1.51768; 3.52; 1.43; 0.00; 0.00
+1; 1.51784; 3.49; 1.28; 0.00; 0.00
+1; 1.51768; 3.56; 1.30; 0.00; 0.14
+1; 1.51747; 3.50; 1.14; 0.00; 0.00
+1; 1.51775; 3.48; 1.23; 0.09; 0.22
+1; 1.51753; 3.47; 1.38; 0.00; 0.06
+1; 1.51783; 3.54; 1.34; 0.00; 0.00
+1; 1.51567; 3.45; 1.21; 0.00; 0.00
+1; 1.51909; 3.53; 1.32; 0.11; 0.00
+1; 1.51797; 3.48; 1.35; 0.00; 0.00
+1; 1.52213; 3.82; 0.47; 0.00; 0.00
+1; 1.52213; 3.82; 0.47; 0.00; 0.00
+1; 1.51793; 3.50; 1.12; 0.00; 0.00
+1; 1.51755; 3.42; 1.20; 0.00; 0.00
+1; 1.51779; 3.39; 1.33; 0.00; 0.00
+1; 1.52210; 3.84; 0.72; 0.00; 0.00
+1; 1.51786; 3.43; 1.19; 0.00; 0.30
+1; 1.51900; 3.48; 1.35; 0.00; 0.00
+1; 1.51869; 3.37; 1.18; 0.00; 0.16
+1; 1.52667; 3.70; 0.71; 0.00; 0.10
+1; 1.52223; 3.77; 0.79; 0.00; 0.00
+1; 1.51898; 3.35; 1.23; 0.00; 0.00
+1; 1.52320; 3.72; 0.51; 0.00; 0.16
+1; 1.51926; 3.33; 1.28; 0.00; 0.11
+1; 1.51808; 2.87; 1.19; 0.00; 0.00
+1; 1.51837; 2.84; 1.28; 0.00; 0.00
+1; 1.51778; 2.81; 1.29; 0.00; 0.09
+1; 1.51769; 2.71; 1.29; 0.00; 0.24
+1; 1.51215; 3.47; 1.12; 0.00; 0.31
+1; 1.51824; 3.48; 1.29; 0.00; 0.00
+1; 1.51754; 3.74; 1.17; 0.00; 0.00
+1; 1.51754; 3.66; 1.19; 0.00; 0.11
+1; 1.51905; 3.62; 1.11; 0.00; 0.00
+1; 1.51977; 3.58; 1.32; 0.69; 0.00
+1; 1.52172; 3.86; 0.88; 0.00; 0.11
+1; 1.52227; 3.81; 0.78; 0.00; 0.00
+1; 1.52172; 3.74; 0.90; 0.00; 0.07
+1; 1.52099; 3.59; 1.12; 0.00; 0.00
+1; 1.52152; 3.65; 0.87; 0.00; 0.17
+1; 1.52152; 3.65; 0.87; 0.00; 0.17
+1; 1.52152; 3.58; 0.90; 0.00; 0.16
+1; 1.52300; 3.58; 0.82; 0.00; 0.03
+3; 1.51769; 3.66; 1.11; 0.00; 0.00
+3; 1.51610; 3.53; 1.34; 0.00; 0.00
+3; 1.51670; 3.57; 1.38; 0.00; 0.10
+3; 1.51643; 3.52; 1.35; 0.00; 0.00
+3; 1.51665; 3.45; 1.76; 0.00; 0.17
+3; 1.52127; 3.90; 0.83; 0.00; 0.00
+3; 1.51779; 3.65; 0.65; 0.00; 0.00
+3; 1.51610; 3.40; 1.22; 0.00; 0.00
+3; 1.51694; 3.58; 1.31; 0.00; 0.00
+3; 1.51646; 3.40; 1.26; 0.00; 0.00
+3; 1.51655; 3.39; 1.28; 0.00; 0.00
+3; 1.52121; 3.76; 0.58; 0.00; 0.00
+3; 1.51776; 3.41; 1.52; 0.00; 0.00
+3; 1.51796; 3.36; 1.63; 0.00; 0.09
+3; 1.51832; 3.34; 1.54; 0.00; 0.00
+3; 1.51934; 3.54; 0.75; 0.15; 0.24
+3; 1.52211; 3.78; 0.91; 0.00; 0.37
+7; 1.51131; 3.20; 1.81; 1.19; 0.00
+7; 1.51838; 3.26; 2.22; 1.63; 0.00
+7; 1.52315; 3.34; 1.23; 0.00; 0.00
+7; 1.52247; 2.20; 2.06; 0.00; 0.00
+7; 1.52365; 1.83; 1.31; 1.68; 0.00
+7; 1.51613; 1.78; 1.79; 0.76; 0.00
+7; 1.51602; 0.00; 2.38; 0.64; 0.09
+7; 1.51623; 0.00; 2.79; 0.40; 0.09
+7; 1.51719; 0.00; 2.00; 1.59; 0.08
+7; 1.51683; 0.00; 1.98; 1.57; 0.07
+7; 1.51545; 0.00; 2.68; 0.61; 0.05
+7; 1.51556; 0.00; 2.54; 0.81; 0.01
+7; 1.51727; 0.00; 2.34; 0.66; 0.00
+7; 1.51531; 0.00; 2.66; 0.64; 0.00
+7; 1.51609; 0.00; 2.51; 0.53; 0.00
+7; 1.51508; 0.00; 2.25; 0.63; 0.00
+7; 1.51653; 0.00; 1.19; 0.00; 0.00
+7; 1.51514; 0.00; 2.42; 0.56; 0.00
+7; 1.51658; 0.00; 1.99; 1.71; 0.00
+7; 1.51617; 0.00; 2.27; 0.67; 0.00
+7; 1.51732; 0.00; 1.80; 1.55; 0.00
+7; 1.51645; 0.00; 1.87; 1.38; 0.00
+7; 1.51831; 0.00; 1.82; 2.88; 0.00
+7; 1.51640; 0.00; 2.74; 0.54; 0.00
+7; 1.51623; 0.00; 2.88; 1.06; 0.00
+7; 1.51685; 0.00; 1.99; 1.59; 0.00
+7; 1.52065; 0.00; 2.02; 1.64; 0.00
+7; 1.51651; 0.00; 1.94; 1.57; 0.00
+7; 1.51711; 0.00; 2.08; 1.67; 0.00

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/resources/datasets/mortalitydata.csv
----------------------------------------------------------------------
diff --git a/examples/src/main/resources/datasets/mortalitydata.csv b/examples/src/main/resources/datasets/mortalitydata.csv
new file mode 100644
index 0000000..e4f3e41
--- /dev/null
+++ b/examples/src/main/resources/datasets/mortalitydata.csv
@@ -0,0 +1,53 @@
+8; 78; 284; 9.100000381; 109
+9.300000191; 68; 433; 8.699999809; 144
+7.5; 70; 739; 7.199999809; 113
+8.899999619; 96; 1792; 8.899999619; 97
+10.19999981; 74; 477; 8.300000191; 206
+8.300000191; 111; 362; 10.89999962; 124
+8.800000191; 77; 671; 10; 152
+8.800000191; 168; 636; 9.100000381; 162
+10.69999981; 82; 329; 8.699999809; 150
+11.69999981; 89; 634; 7.599999905; 134
+8.5; 149; 631; 10.80000019; 292
+8.300000191; 60; 257; 9.5; 108
+8.199999809; 96; 284; 8.800000191; 111
+7.900000095; 83; 603; 9.5; 182
+10.30000019; 130; 686; 8.699999809; 129
+7.400000095; 145; 345; 11.19999981; 158
+9.600000381; 112; 1357; 9.699999809; 186
+9.300000191; 131; 544; 9.600000381; 177
+10.60000038; 80; 205; 9.100000381; 127
+9.699999809; 130; 1264; 9.199999809; 179
+11.60000038; 140; 688; 8.300000191; 80
+8.100000381; 154; 354; 8.399999619; 103
+9.800000191; 118; 1632; 9.399999619; 101
+7.400000095; 94; 348; 9.800000191; 117
+9.399999619; 119; 370; 10.39999962; 88
+11.19999981; 153; 648; 9.899999619; 78
+9.100000381; 116; 366; 9.199999809; 102
+10.5; 97; 540; 10.30000019; 95
+11.89999962; 176; 680; 8.899999619; 80
+8.399999619; 75; 345; 9.600000381; 92
+5; 134; 525; 10.30000019; 126
+9.800000191; 161; 870; 10.39999962; 108
+9.800000191; 111; 669; 9.699999809; 77
+10.80000019; 114; 452; 9.600000381; 60
+10.10000038; 142; 430; 10.69999981; 71
+10.89999962; 238; 822; 10.30000019; 86
+9.199999809; 78; 190; 10.69999981; 93
+8.300000191; 196; 867; 9.600000381; 106
+7.300000191; 125; 969; 10.5; 162
+9.399999619; 82; 499; 7.699999809; 95
+9.399999619; 125; 925; 10.19999981; 91
+9.800000191; 129; 353; 9.899999619; 52
+3.599999905; 84; 288; 8.399999619; 110
+8.399999619; 183; 718; 10.39999962; 69
+10.80000019; 119; 540; 9.199999809; 57
+10.10000038; 180; 668; 13; 106
+9; 82; 347; 8.800000191; 40
+10; 71; 345; 9.199999809; 50
+11.30000019; 118; 463; 7.800000191; 35
+11.30000019; 121; 728; 8.199999809; 86
+12.80000019; 68; 383; 7.400000095; 57
+10; 112; 316; 10.39999962; 57
+6.699999809; 109; 388; 8.899999619; 94

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/resources/datasets/two_classed_iris.csv
----------------------------------------------------------------------
diff --git a/examples/src/main/resources/datasets/two_classed_iris.csv b/examples/src/main/resources/datasets/two_classed_iris.csv
new file mode 100644
index 0000000..872c699
--- /dev/null
+++ b/examples/src/main/resources/datasets/two_classed_iris.csv
@@ -0,0 +1,100 @@
+0	5.1	3.5	1.4	0.2
+0	4.9	3	1.4	0.2
+0	4.7	3.2	1.3	0.2
+0	4.6	3.1	1.5	0.2
+0	5	3.6	1.4	0.2
+0	5.4	3.9	1.7	0.4
+0	4.6	3.4	1.4	0.3
+0	5	3.4	1.5	0.2
+0	4.4	2.9	1.4	0.2
+0	4.9	3.1	1.5	0.1
+0	5.4	3.7	1.5	0.2
+0	4.8	3.4	1.6	0.2
+0	4.8	3	1.4	0.1
+0	4.3	3	1.1	0.1
+0	5.8	4	1.2	0.2
+0	5.7	4.4	1.5	0.4
+0	5.4	3.9	1.3	0.4
+0	5.1	3.5	1.4	0.3
+0	5.7	3.8	1.7	0.3
+0	5.1	3.8	1.5	0.3
+0	5.4	3.4	1.7	0.2
+0	5.1	3.7	1.5	0.4
+0	4.6	3.6	1	0.2
+0	5.1	3.3	1.7	0.5
+0	4.8	3.4	1.9	0.2
+0	5	3	1.6	0.2
+0	5	3.4	1.6	0.4
+0	5.2	3.5	1.5	0.2
+0	5.2	3.4	1.4	0.2
+0	4.7	3.2	1.6	0.2
+0	4.8	3.1	1.6	0.2
+0	5.4	3.4	1.5	0.4
+0	5.2	4.1	1.5	0.1
+0	5.5	4.2	1.4	0.2
+0	4.9	3.1	1.5	0.1
+0	5	3.2	1.2	0.2
+0	5.5	3.5	1.3	0.2
+0	4.9	3.1	1.5	0.1
+0	4.4	3	1.3	0.2
+0	5.1	3.4	1.5	0.2
+0	5	3.5	1.3	0.3
+0	4.5	2.3	1.3	0.3
+0	4.4	3.2	1.3	0.2
+0	5	3.5	1.6	0.6
+0	5.1	3.8	1.9	0.4
+0	4.8	3	1.4	0.3
+0	5.1	3.8	1.6	0.2
+0	4.6	3.2	1.4	0.2
+0	5.3	3.7	1.5	0.2
+0	5	3.3	1.4	0.2
+1	7	3.2	4.7	1.4
+1	6.4	3.2	4.5	1.5
+1	6.9	3.1	4.9	1.5
+1	5.5	2.3	4	1.3
+1	6.5	2.8	4.6	1.5
+1	5.7	2.8	4.5	1.3
+1	6.3	3.3	4.7	1.6
+1	4.9	2.4	3.3	1
+1	6.6	2.9	4.6	1.3
+1	5.2	2.7	3.9	1.4
+1	5	2	3.5	1
+1	5.9	3	4.2	1.5
+1	6	2.2	4	1
+1	6.1	2.9	4.7	1.4
+1	5.6	2.9	3.6	1.3
+1	6.7	3.1	4.4	1.4
+1	5.6	3	4.5	1.5
+1	5.8	2.7	4.1	1
+1	6.2	2.2	4.5	1.5
+1	5.6	2.5	3.9	1.1
+1	5.9	3.2	4.8	1.8
+1	6.1	2.8	4	1.3
+1	6.3	2.5	4.9	1.5
+1	6.1	2.8	4.7	1.2
+1	6.4	2.9	4.3	1.3
+1	6.6	3	4.4	1.4
+1	6.8	2.8	4.8	1.4
+1	6.7	3	5	1.7
+1	6	2.9	4.5	1.5
+1	5.7	2.6	3.5	1
+1	5.5	2.4	3.8	1.1
+1	5.5	2.4	3.7	1
+1	5.8	2.7	3.9	1.2
+1	6	2.7	5.1	1.6
+1	5.4	3	4.5	1.5
+1	6	3.4	4.5	1.6
+1	6.7	3.1	4.7	1.5
+1	6.3	2.3	4.4	1.3
+1	5.6	3	4.1	1.3
+1	5.5	2.5	4	1.3
+1	5.5	2.6	4.4	1.2
+1	6.1	3	4.6	1.4
+1	5.8	2.6	4	1.2
+1	5	2.3	3.3	1
+1	5.6	2.7	4.2	1.3
+1	5.7	3	4.2	1.2
+1	5.7	2.9	4.2	1.3
+1	6.2	2.9	4.3	1.3
+1	5.1	2.5	3	1.1
+1	5.7	2.8	4.1	1.3

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/resources/datasets/wine.txt
----------------------------------------------------------------------
diff --git a/examples/src/main/resources/datasets/wine.txt b/examples/src/main/resources/datasets/wine.txt
new file mode 100644
index 0000000..a0b3962
--- /dev/null
+++ b/examples/src/main/resources/datasets/wine.txt
@@ -0,0 +1,178 @@
+1,14.23,1.71,2.43,15.6,127,2.8,3.06,.28,2.29,5.64,1.04,3.92,1065
+1,13.2,1.78,2.14,11.2,100,2.65,2.76,.26,1.28,4.38,1.05,3.4,1050
+1,13.16,2.36,2.67,18.6,101,2.8,3.24,.3,2.81,5.68,1.03,3.17,1185
+1,14.37,1.95,2.5,16.8,113,3.85,3.49,.24,2.18,7.8,.86,3.45,1480
+1,13.24,2.59,2.87,21,118,2.8,2.69,.39,1.82,4.32,1.04,2.93,735
+1,14.2,1.76,2.45,15.2,112,3.27,3.39,.34,1.97,6.75,1.05,2.85,1450
+1,14.39,1.87,2.45,14.6,96,2.5,2.52,.3,1.98,5.25,1.02,3.58,1290
+1,14.06,2.15,2.61,17.6,121,2.6,2.51,.31,1.25,5.05,1.06,3.58,1295
+1,14.83,1.64,2.17,14,97,2.8,2.98,.29,1.98,5.2,1.08,2.85,1045
+1,13.86,1.35,2.27,16,98,2.98,3.15,.22,1.85,7.22,1.01,3.55,1045
+1,14.1,2.16,2.3,18,105,2.95,3.32,.22,2.38,5.75,1.25,3.17,1510
+1,14.12,1.48,2.32,16.8,95,2.2,2.43,.26,1.57,5,1.17,2.82,1280
+1,13.75,1.73,2.41,16,89,2.6,2.76,.29,1.81,5.6,1.15,2.9,1320
+1,14.75,1.73,2.39,11.4,91,3.1,3.69,.43,2.81,5.4,1.25,2.73,1150
+1,14.38,1.87,2.38,12,102,3.3,3.64,.29,2.96,7.5,1.2,3,1547
+1,13.63,1.81,2.7,17.2,112,2.85,2.91,.3,1.46,7.3,1.28,2.88,1310
+1,14.3,1.92,2.72,20,120,2.8,3.14,.33,1.97,6.2,1.07,2.65,1280
+1,13.83,1.57,2.62,20,115,2.95,3.4,.4,1.72,6.6,1.13,2.57,1130
+1,14.19,1.59,2.48,16.5,108,3.3,3.93,.32,1.86,8.7,1.23,2.82,1680
+1,13.64,3.1,2.56,15.2,116,2.7,3.03,.17,1.66,5.1,.96,3.36,845
+1,14.06,1.63,2.28,16,126,3,3.17,.24,2.1,5.65,1.09,3.71,780
+1,12.93,3.8,2.65,18.6,102,2.41,2.41,.25,1.98,4.5,1.03,3.52,770
+1,13.71,1.86,2.36,16.6,101,2.61,2.88,.27,1.69,3.8,1.11,4,1035
+1,12.85,1.6,2.52,17.8,95,2.48,2.37,.26,1.46,3.93,1.09,3.63,1015
+1,13.5,1.81,2.61,20,96,2.53,2.61,.28,1.66,3.52,1.12,3.82,845
+1,13.05,2.05,3.22,25,124,2.63,2.68,.47,1.92,3.58,1.13,3.2,830
+1,13.39,1.77,2.62,16.1,93,2.85,2.94,.34,1.45,4.8,.92,3.22,1195
+1,13.3,1.72,2.14,17,94,2.4,2.19,.27,1.35,3.95,1.02,2.77,1285
+1,13.87,1.9,2.8,19.4,107,2.95,2.97,.37,1.76,4.5,1.25,3.4,915
+1,14.02,1.68,2.21,16,96,2.65,2.33,.26,1.98,4.7,1.04,3.59,1035
+1,13.73,1.5,2.7,22.5,101,3,3.25,.29,2.38,5.7,1.19,2.71,1285
+1,13.58,1.66,2.36,19.1,106,2.86,3.19,.22,1.95,6.9,1.09,2.88,1515
+1,13.68,1.83,2.36,17.2,104,2.42,2.69,.42,1.97,3.84,1.23,2.87,990
+1,13.76,1.53,2.7,19.5,132,2.95,2.74,.5,1.35,5.4,1.25,3,1235
+1,13.51,1.8,2.65,19,110,2.35,2.53,.29,1.54,4.2,1.1,2.87,1095
+1,13.48,1.81,2.41,20.5,100,2.7,2.98,.26,1.86,5.1,1.04,3.47,920
+1,13.28,1.64,2.84,15.5,110,2.6,2.68,.34,1.36,4.6,1.09,2.78,880
+1,13.05,1.65,2.55,18,98,2.45,2.43,.29,1.44,4.25,1.12,2.51,1105
+1,13.07,1.5,2.1,15.5,98,2.4,2.64,.28,1.37,3.7,1.18,2.69,1020
+1,14.22,3.99,2.51,13.2,128,3,3.04,.2,2.08,5.1,.89,3.53,760
+1,13.56,1.71,2.31,16.2,117,3.15,3.29,.34,2.34,6.13,.95,3.38,795
+1,13.41,3.84,2.12,18.8,90,2.45,2.68,.27,1.48,4.28,.91,3,1035
+1,13.88,1.89,2.59,15,101,3.25,3.56,.17,1.7,5.43,.88,3.56,1095
+1,13.24,3.98,2.29,17.5,103,2.64,2.63,.32,1.66,4.36,.82,3,680
+1,13.05,1.77,2.1,17,107,3,3,.28,2.03,5.04,.88,3.35,885
+1,14.21,4.04,2.44,18.9,111,2.85,2.65,.3,1.25,5.24,.87,3.33,1080
+1,14.38,3.59,2.28,16,102,3.25,3.17,.27,2.19,4.9,1.04,3.44,1065
+1,13.9,1.68,2.12,16,101,3.1,3.39,.21,2.14,6.1,.91,3.33,985
+1,14.1,2.02,2.4,18.8,103,2.75,2.92,.32,2.38,6.2,1.07,2.75,1060
+1,13.94,1.73,2.27,17.4,108,2.88,3.54,.32,2.08,8.90,1.12,3.1,1260
+1,13.05,1.73,2.04,12.4,92,2.72,3.27,.17,2.91,7.2,1.12,2.91,1150
+1,13.83,1.65,2.6,17.2,94,2.45,2.99,.22,2.29,5.6,1.24,3.37,1265
+1,13.82,1.75,2.42,14,111,3.88,3.74,.32,1.87,7.05,1.01,3.26,1190
+1,13.77,1.9,2.68,17.1,115,3,2.79,.39,1.68,6.3,1.13,2.93,1375
+1,13.74,1.67,2.25,16.4,118,2.6,2.9,.21,1.62,5.85,.92,3.2,1060
+1,13.56,1.73,2.46,20.5,116,2.96,2.78,.2,2.45,6.25,.98,3.03,1120
+1,14.22,1.7,2.3,16.3,118,3.2,3,.26,2.03,6.38,.94,3.31,970
+1,13.29,1.97,2.68,16.8,102,3,3.23,.31,1.66,6,1.07,2.84,1270
+1,13.72,1.43,2.5,16.7,108,3.4,3.67,.19,2.04,6.8,.89,2.87,1285
+2,12.37,.94,1.36,10.6,88,1.98,.57,.28,.42,1.95,1.05,1.82,520
+2,12.33,1.1,2.28,16,101,2.05,1.09,.63,.41,3.27,1.25,1.67,680
+2,12.64,1.36,2.02,16.8,100,2.02,1.41,.53,.62,5.75,.98,1.59,450
+2,13.67,1.25,1.92,18,94,2.1,1.79,.32,.73,3.8,1.23,2.46,630
+2,12.37,1.13,2.16,19,87,3.5,3.1,.19,1.87,4.45,1.22,2.87,420
+2,12.17,1.45,2.53,19,104,1.89,1.75,.45,1.03,2.95,1.45,2.23,355
+2,12.37,1.21,2.56,18.1,98,2.42,2.65,.37,2.08,4.6,1.19,2.3,678
+2,13.11,1.01,1.7,15,78,2.98,3.18,.26,2.28,5.3,1.12,3.18,502
+2,12.37,1.17,1.92,19.6,78,2.11,2,.27,1.04,4.68,1.12,3.48,510
+2,13.34,.94,2.36,17,110,2.53,1.3,.55,.42,3.17,1.02,1.93,750
+2,12.21,1.19,1.75,16.8,151,1.85,1.28,.14,2.5,2.85,1.28,3.07,718
+2,12.29,1.61,2.21,20.4,103,1.1,1.02,.37,1.46,3.05,.906,1.82,870
+2,13.86,1.51,2.67,25,86,2.95,2.86,.21,1.87,3.38,1.36,3.16,410
+2,13.49,1.66,2.24,24,87,1.88,1.84,.27,1.03,3.74,.98,2.78,472
+2,12.99,1.67,2.6,30,139,3.3,2.89,.21,1.96,3.35,1.31,3.5,985
+2,11.96,1.09,2.3,21,101,3.38,2.14,.13,1.65,3.21,.99,3.13,886
+2,11.66,1.88,1.92,16,97,1.61,1.57,.34,1.15,3.8,1.23,2.14,428
+2,13.03,.9,1.71,16,86,1.95,2.03,.24,1.46,4.6,1.19,2.48,392
+2,11.84,2.89,2.23,18,112,1.72,1.32,.43,.95,2.65,.96,2.52,500
+2,12.33,.99,1.95,14.8,136,1.9,1.85,.35,2.76,3.4,1.06,2.31,750
+2,12.7,3.87,2.4,23,101,2.83,2.55,.43,1.95,2.57,1.19,3.13,463
+2,12,.92,2,19,86,2.42,2.26,.3,1.43,2.5,1.38,3.12,278
+2,12.72,1.81,2.2,18.8,86,2.2,2.53,.26,1.77,3.9,1.16,3.14,714
+2,12.08,1.13,2.51,24,78,2,1.58,.4,1.4,2.2,1.31,2.72,630
+2,13.05,3.86,2.32,22.5,85,1.65,1.59,.61,1.62,4.8,.84,2.01,515
+2,11.84,.89,2.58,18,94,2.2,2.21,.22,2.35,3.05,.79,3.08,520
+2,12.67,.98,2.24,18,99,2.2,1.94,.3,1.46,2.62,1.23,3.16,450
+2,12.16,1.61,2.31,22.8,90,1.78,1.69,.43,1.56,2.45,1.33,2.26,495
+2,11.65,1.67,2.62,26,88,1.92,1.61,.4,1.34,2.6,1.36,3.21,562
+2,11.64,2.06,2.46,21.6,84,1.95,1.69,.48,1.35,2.8,1,2.75,680
+2,12.08,1.33,2.3,23.6,70,2.2,1.59,.42,1.38,1.74,1.07,3.21,625
+2,12.08,1.83,2.32,18.5,81,1.6,1.5,.52,1.64,2.4,1.08,2.27,480
+2,12,1.51,2.42,22,86,1.45,1.25,.5,1.63,3.6,1.05,2.65,450
+2,12.69,1.53,2.26,20.7,80,1.38,1.46,.58,1.62,3.05,.96,2.06,495
+2,12.29,2.83,2.22,18,88,2.45,2.25,.25,1.99,2.15,1.15,3.3,290
+2,11.62,1.99,2.28,18,98,3.02,2.26,.17,1.35,3.25,1.16,2.96,345
+2,12.47,1.52,2.2,19,162,2.5,2.27,.32,3.28,2.6,1.16,2.63,937
+2,11.81,2.12,2.74,21.5,134,1.6,.99,.14,1.56,2.5,.95,2.26,625
+2,12.29,1.41,1.98,16,85,2.55,2.5,.29,1.77,2.9,1.23,2.74,428
+2,12.37,1.07,2.1,18.5,88,3.52,3.75,.24,1.95,4.5,1.04,2.77,660
+2,12.29,3.17,2.21,18,88,2.85,2.99,.45,2.81,2.3,1.42,2.83,406
+2,12.08,2.08,1.7,17.5,97,2.23,2.17,.26,1.4,3.3,1.27,2.96,710
+2,12.6,1.34,1.9,18.5,88,1.45,1.36,.29,1.35,2.45,1.04,2.77,562
+2,12.34,2.45,2.46,21,98,2.56,2.11,.34,1.31,2.8,.8,3.38,438
+2,11.82,1.72,1.88,19.5,86,2.5,1.64,.37,1.42,2.06,.94,2.44,415
+2,12.51,1.73,1.98,20.5,85,2.2,1.92,.32,1.48,2.94,1.04,3.57,672
+2,12.42,2.55,2.27,22,90,1.68,1.84,.66,1.42,2.7,.86,3.3,315
+2,12.25,1.73,2.12,19,80,1.65,2.03,.37,1.63,3.4,1,3.17,510
+2,12.72,1.75,2.28,22.5,84,1.38,1.76,.48,1.63,3.3,.88,2.42,488
+2,12.22,1.29,1.94,19,92,2.36,2.04,.39,2.08,2.7,.86,3.02,312
+2,11.61,1.35,2.7,20,94,2.74,2.92,.29,2.49,2.65,.96,3.26,680
+2,11.46,3.74,1.82,19.5,107,3.18,2.58,.24,3.58,2.9,.75,2.81,562
+2,12.52,2.43,2.17,21,88,2.55,2.27,.26,1.22,2,.9,2.78,325
+2,11.76,2.68,2.92,20,103,1.75,2.03,.6,1.05,3.8,1.23,2.5,607
+2,11.41,.74,2.5,21,88,2.48,2.01,.42,1.44,3.08,1.1,2.31,434
+2,12.08,1.39,2.5,22.5,84,2.56,2.29,.43,1.04,2.9,.93,3.19,385
+2,11.03,1.51,2.2,21.5,85,2.46,2.17,.52,2.01,1.9,1.71,2.87,407
+2,11.82,1.47,1.99,20.8,86,1.98,1.6,.3,1.53,1.95,.95,3.33,495
+2,12.42,1.61,2.19,22.5,108,2,2.09,.34,1.61,2.06,1.06,2.96,345
+2,12.77,3.43,1.98,16,80,1.63,1.25,.43,.83,3.4,.7,2.12,372
+2,12,3.43,2,19,87,2,1.64,.37,1.87,1.28,.93,3.05,564
+2,11.45,2.4,2.42,20,96,2.9,2.79,.32,1.83,3.25,.8,3.39,625
+2,11.56,2.05,3.23,28.5,119,3.18,5.08,.47,1.87,6,.93,3.69,465
+2,12.42,4.43,2.73,26.5,102,2.2,2.13,.43,1.71,2.08,.92,3.12,365
+2,13.05,5.8,2.13,21.5,86,2.62,2.65,.3,2.01,2.6,.73,3.1,380
+2,11.87,4.31,2.39,21,82,2.86,3.03,.21,2.91,2.8,.75,3.64,380
+2,12.07,2.16,2.17,21,85,2.6,2.65,.37,1.35,2.76,.86,3.28,378
+2,12.43,1.53,2.29,21.5,86,2.74,3.15,.39,1.77,3.94,.69,2.84,352
+2,11.79,2.13,2.78,28.5,92,2.13,2.24,.58,1.76,3,.97,2.44,466
+2,12.37,1.63,2.3,24.5,88,2.22,2.45,.4,1.9,2.12,.89,2.78,342
+2,12.04,4.3,2.38,22,80,2.1,1.75,.42,1.35,2.6,.79,2.57,580
+3,12.86,1.35,2.32,18,122,1.51,1.25,.21,.94,4.1,.76,1.29,630
+3,12.88,2.99,2.4,20,104,1.3,1.22,.24,.83,5.4,.74,1.42,530
+3,12.81,2.31,2.4,24,98,1.15,1.09,.27,.83,5.7,.66,1.36,560
+3,12.7,3.55,2.36,21.5,106,1.7,1.2,.17,.84,5,.78,1.29,600
+3,12.51,1.24,2.25,17.5,85,2,.58,.6,1.25,5.45,.75,1.51,650
+3,12.6,2.46,2.2,18.5,94,1.62,.66,.63,.94,7.1,.73,1.58,695
+3,12.25,4.72,2.54,21,89,1.38,.47,.53,.8,3.85,.75,1.27,720
+3,12.53,5.51,2.64,25,96,1.79,.6,.63,1.1,5,.82,1.69,515
+3,13.49,3.59,2.19,19.5,88,1.62,.48,.58,.88,5.7,.81,1.82,580
+3,12.84,2.96,2.61,24,101,2.32,.6,.53,.81,4.92,.89,2.15,590
+3,12.93,2.81,2.7,21,96,1.54,.5,.53,.75,4.6,.77,2.31,600
+3,13.36,2.56,2.35,20,89,1.4,.5,.37,.64,5.6,.7,2.47,780
+3,13.52,3.17,2.72,23.5,97,1.55,.52,.5,.55,4.35,.89,2.06,520
+3,13.62,4.95,2.35,20,92,2,.8,.47,1.02,4.4,.91,2.05,550
+3,12.25,3.88,2.2,18.5,112,1.38,.78,.29,1.14,8.21,.65,2,855
+3,13.16,3.57,2.15,21,102,1.5,.55,.43,1.3,4,.6,1.68,830
+3,13.88,5.04,2.23,20,80,.98,.34,.4,.68,4.9,.58,1.33,415
+3,12.87,4.61,2.48,21.5,86,1.7,.65,.47,.86,7.65,.54,1.86,625
+3,13.32,3.24,2.38,21.5,92,1.93,.76,.45,1.25,8.42,.55,1.62,650
+3,13.08,3.9,2.36,21.5,113,1.41,1.39,.34,1.14,9.40,.57,1.33,550
+3,13.5,3.12,2.62,24,123,1.4,1.57,.22,1.25,8.60,.59,1.3,500
+3,12.79,2.67,2.48,22,112,1.48,1.36,.24,1.26,10.8,.48,1.47,480
+3,13.11,1.9,2.75,25.5,116,2.2,1.28,.26,1.56,7.1,.61,1.33,425
+3,13.23,3.3,2.28,18.5,98,1.8,.83,.61,1.87,10.52,.56,1.51,675
+3,12.58,1.29,2.1,20,103,1.48,.58,.53,1.4,7.6,.58,1.55,640
+3,13.17,5.19,2.32,22,93,1.74,.63,.61,1.55,7.9,.6,1.48,725
+3,13.84,4.12,2.38,19.5,89,1.8,.83,.48,1.56,9.01,.57,1.64,480
+3,12.45,3.03,2.64,27,97,1.9,.58,.63,1.14,7.5,.67,1.73,880
+3,14.34,1.68,2.7,25,98,2.8,1.31,.53,2.7,13,.57,1.96,660
+3,13.48,1.67,2.64,22.5,89,2.6,1.1,.52,2.29,11.75,.57,1.78,620
+3,12.36,3.83,2.38,21,88,2.3,.92,.5,1.04,7.65,.56,1.58,520
+3,13.69,3.26,2.54,20,107,1.83,.56,.5,.8,5.88,.96,1.82,680
+3,12.85,3.27,2.58,22,106,1.65,.6,.6,.96,5.58,.87,2.11,570
+3,12.96,3.45,2.35,18.5,106,1.39,.7,.4,.94,5.28,.68,1.75,675
+3,13.78,2.76,2.3,22,90,1.35,.68,.41,1.03,9.58,.7,1.68,615
+3,13.73,4.36,2.26,22.5,88,1.28,.47,.52,1.15,6.62,.78,1.75,520
+3,13.45,3.7,2.6,23,111,1.7,.92,.43,1.46,10.68,.85,1.56,695
+3,12.82,3.37,2.3,19.5,88,1.48,.66,.4,.97,10.26,.72,1.75,685
+3,13.58,2.58,2.69,24.5,105,1.55,.84,.39,1.54,8.66,.74,1.8,750
+3,13.4,4.6,2.86,25,112,1.98,.96,.27,1.11,8.5,.67,1.92,630
+3,12.2,3.03,2.32,19,96,1.25,.49,.4,.73,5.5,.66,1.83,510
+3,12.77,2.39,2.28,19.5,86,1.39,.51,.48,.64,9.899999,.57,1.63,470
+3,14.16,2.51,2.48,20,91,1.68,.7,.44,1.24,9.7,.62,1.71,660
+3,13.71,5.65,2.45,20.5,95,1.68,.61,.52,1.06,7.7,.64,1.74,740
+3,13.4,3.91,2.48,23,102,1.8,.75,.43,1.41,7.3,.7,1.56,750
+3,13.27,4.28,2.26,20,120,1.59,.69,.43,1.35,10.2,.59,1.56,835
+3,13.17,2.59,2.37,20,120,1.65,.68,.53,1.46,9.3,.6,1.62,840
+3,14.13,4.1,2.74,24.5,96,2.05,.76,.56,1.35,9.2,.61,1.6,560

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/modules/ml/src/main/java/org/apache/ignite/ml/knn/regression/KNNRegressionModel.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/knn/regression/KNNRegressionModel.java b/modules/ml/src/main/java/org/apache/ignite/ml/knn/regression/KNNRegressionModel.java
index 0761ff5..f854177 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/knn/regression/KNNRegressionModel.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/knn/regression/KNNRegressionModel.java
@@ -77,6 +77,8 @@ public class KNNRegressionModel extends KNNClassificationModel {
             sum += neighbor.label() * distance;
             div += distance;
         }
+        if (div == 0.0) // when all neighbours are equal to the given point
+            return simpleRegression(neighbors);
         return sum / div;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/AbstractVector.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/AbstractVector.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/AbstractVector.java
index 343ebf1..8e544bd 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/AbstractVector.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/AbstractVector.java
@@ -841,6 +841,15 @@ public abstract class AbstractVector implements Vector {
         return like(size()).assign(this);
     }
 
+    /** {@inheritDoc} */
+    @Override public Vector copyOfRange(int from, int to) {
+        Vector copiedVector = like(to - from);
+        for (int i = from, j = 0; i < to; i++, j++)
+            copiedVector.set(j, this.get(i));
+
+        return copiedVector;
+    }
+
     /**
      * @return Result of dot with self.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/Vector.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/Vector.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/Vector.java
index f544405..c505d2f 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/Vector.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/Vector.java
@@ -127,6 +127,15 @@ public interface Vector extends MetaAttributes, Externalizable, StorageOpsMetric
     public Vector sort();
 
     /**
+     * Copies the specified range of the vector into a new vector.
+     * @param from the initial index of the range to be copied, inclusive
+     * @param to the final index of the range to be copied, exclusive.
+     *     (This index may lie outside the array.)
+     * @return A new vector containing the specified range from the original vector
+     */
+    public Vector copyOfRange(int from, int to);
+
+    /**
      * Gets element at the given index.
      *
      * NOTE: implementation can choose to reuse {@link Element} instance so you need to copy it

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/impl/DelegatingVector.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/impl/DelegatingVector.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/impl/DelegatingVector.java
index 3a44373..ff2dc7a 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/impl/DelegatingVector.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/impl/DelegatingVector.java
@@ -151,6 +151,11 @@ public class DelegatingVector implements Vector {
     }
 
     /** {@inheritDoc} */
+    @Override public Vector copyOfRange(int from, int to) {
+        return dlg.copyOfRange(from, to);
+    }
+
+    /** {@inheritDoc} */
     @Override public Spliterator<Double> allSpliterator() {
         return dlg.allSpliterator();
     }


[17/28] ignite git commit: IGNITE-9982: MVCC: Do not throw "MVCC disabled" exception for COMMIT and ROLLBACK commands. This closes #5086.

Posted by sb...@apache.org.
IGNITE-9982: MVCC: Do not throw "MVCC disabled" exception for COMMIT and ROLLBACK commands. This closes #5086.


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

Branch: refs/heads/ignite-627
Commit: 7000e6e350719fd003cce43c13ec035658143005
Parents: 1fe02df
Author: ipavlukhin <vo...@gmail.com>
Authored: Mon Oct 29 12:16:44 2018 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Oct 29 12:18:06 2018 +0300

----------------------------------------------------------------------
 .../suite/IgniteJdbcDriverMvccTestSuite.java    |  20 +--
 .../jdbc/thin/JdbcThinConnectionSelfTest.java   | 138 +++++++------------
 .../processors/query/h2/IgniteH2Indexing.java   |   8 +-
 ...sactionCommandsWithMvccDisabledSelfTest.java |  74 ++++++++++
 .../index/SqlTransactionsComandsSelfTest.java   |  83 -----------
 ...sactionsComandsWithMvccDisabledSelfTest.java |  83 -----------
 .../IgniteCacheQuerySelfTestSuite.java          |   4 +-
 7 files changed, 139 insertions(+), 271 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7000e6e3/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverMvccTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverMvccTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverMvccTestSuite.java
index 606c32d..df8054f 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverMvccTestSuite.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverMvccTestSuite.java
@@ -26,23 +26,23 @@ import org.apache.ignite.jdbc.thin.JdbcThinTransactionsServerAutoCommitComplexSe
 import org.apache.ignite.jdbc.thin.JdbcThinTransactionsServerNoAutoCommitComplexSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinTransactionsWithMvccEnabledSelfTest;
 
+/** */
 public class IgniteJdbcDriverMvccTestSuite extends TestSuite {
     /**
      * @return JDBC Driver Test Suite.
-     * @throws Exception In case of error.
      */
-    public static TestSuite suite() throws Exception {
+    public static TestSuite suite() {
         TestSuite suite = new TestSuite("Ignite JDBC Driver Test Suite");
 
-        suite.addTest(new TestSuite(JdbcThinConnectionMvccEnabledSelfTest.class));
-        suite.addTest(new TestSuite(JdbcVersionMismatchSelfTest.class));
-        
+        suite.addTestSuite(JdbcThinConnectionMvccEnabledSelfTest.class);
+        suite.addTestSuite(JdbcVersionMismatchSelfTest.class);
+
         // Transactions
-        suite.addTest(new TestSuite(JdbcThinTransactionsWithMvccEnabledSelfTest.class));
-        suite.addTest(new TestSuite(JdbcThinTransactionsClientAutoCommitComplexSelfTest.class));
-        suite.addTest(new TestSuite(JdbcThinTransactionsServerAutoCommitComplexSelfTest.class));
-        suite.addTest(new TestSuite(JdbcThinTransactionsClientNoAutoCommitComplexSelfTest.class));
-        suite.addTest(new TestSuite(JdbcThinTransactionsServerNoAutoCommitComplexSelfTest.class));
+        suite.addTestSuite(JdbcThinTransactionsWithMvccEnabledSelfTest.class);
+        suite.addTestSuite(JdbcThinTransactionsClientAutoCommitComplexSelfTest.class);
+        suite.addTestSuite(JdbcThinTransactionsServerAutoCommitComplexSelfTest.class);
+        suite.addTestSuite(JdbcThinTransactionsClientNoAutoCommitComplexSelfTest.class);
+        suite.addTestSuite(JdbcThinTransactionsServerNoAutoCommitComplexSelfTest.class);
 
         return suite;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7000e6e3/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java
index 80397e6..5e12bae 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java
@@ -66,6 +66,7 @@ import static java.sql.ResultSet.TYPE_FORWARD_ONLY;
 import static java.sql.Statement.NO_GENERATED_KEYS;
 import static java.sql.Statement.RETURN_GENERATED_KEYS;
 import static org.apache.ignite.configuration.ClientConnectorConfiguration.DFLT_PORT;
+import static org.apache.ignite.internal.processors.odbc.SqlStateCode.TRANSACTION_STATE_EXCEPTION;
 
 /**
  * Connection test.
@@ -978,29 +979,20 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
      */
     public void testGetSetAutoCommit() throws Exception {
         try (Connection conn = DriverManager.getConnection(URL)) {
-            assertTrue(conn.getAutoCommit());
-
-            // Cannot disable autocommit when MVCC is disabled.
-            GridTestUtils.assertThrows(log,
-                new Callable<Object>() {
-                    @Override public Object call() throws Exception {
-                        conn.setAutoCommit(false);
+            boolean ac0 = conn.getAutoCommit();
 
-                        return null;
-                    }
-                },
-                SQLException.class,
-                "MVCC must be enabled in order to invoke transactional operation: COMMIT"
-            );
+            conn.setAutoCommit(!ac0);
+            // assert no exception
 
-            assertTrue(conn.getAutoCommit());
+            conn.setAutoCommit(ac0);
+            // assert no exception
 
             conn.close();
 
             // Exception when called on closed connection
             checkConnectionClosed(new RunnableX() {
                 @Override public void run() throws Exception {
-                    conn.setAutoCommit(true);
+                    conn.setAutoCommit(ac0);
                 }
             });
         }
@@ -1024,19 +1016,6 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
                 "Transaction cannot be committed explicitly in auto-commit mode"
             );
 
-            // Cannot disable autocommit when MVCC is disabled.
-            GridTestUtils.assertThrows(log,
-                new Callable<Object>() {
-                    @Override public Object call() throws Exception {
-                        conn.setAutoCommit(false);
-
-                        return null;
-                    }
-                },
-                SQLException.class,
-                "MVCC must be enabled in order to invoke transactional operation: COMMIT"
-            );
-
             assertTrue(conn.getAutoCommit());
 
             // Should not be called in auto-commit mode
@@ -1081,21 +1060,6 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
                 "Transaction cannot be rolled back explicitly in auto-commit mode."
             );
 
-            // Cannot disable autocommit when MVCC is disabled.
-            GridTestUtils.assertThrows(log,
-                new Callable<Object>() {
-                    @Override public Object call() throws Exception {
-                        conn.setAutoCommit(false);
-
-                        return null;
-                    }
-                },
-                SQLException.class,
-                "MVCC must be enabled in order to invoke transactional operation: COMMIT"
-            );
-
-            assertTrue(conn.getAutoCommit());
-
             conn.close();
 
             // Exception when called on closed connection
@@ -1108,6 +1072,47 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
     }
 
     /**
+     * @throws Exception if failed.
+     */
+    public void testBeginFailsWhenMvccIsDisabled() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            conn.createStatement().execute("BEGIN");
+
+            fail("Exception is expected");
+        }
+        catch (SQLException e) {
+            assertEquals(TRANSACTION_STATE_EXCEPTION, e.getSQLState());
+        }
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testCommitIgnoredWhenMvccIsDisabled() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            conn.setAutoCommit(false);
+            conn.createStatement().execute("COMMIT");
+
+            conn.commit();
+        }
+        // assert no exception
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testRollbackIgnoredWhenMvccIsDisabled() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            conn.setAutoCommit(false);
+
+            conn.createStatement().execute("ROLLBACK");
+
+            conn.rollback();
+        }
+        // assert no exception
+    }
+
+    /**
      * @throws Exception If failed.
      */
     public void testGetMetaData() throws Exception {
@@ -1392,21 +1397,6 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
                 "Savepoint cannot be set in auto-commit mode"
             );
 
-            // Cannot disable autocommit when MVCC is disabled.
-            GridTestUtils.assertThrows(log,
-                new Callable<Object>() {
-                    @Override public Object call() throws Exception {
-                        conn.setAutoCommit(false);
-
-                        return null;
-                    }
-                },
-                SQLException.class,
-                "MVCC must be enabled in order to invoke transactional operation: COMMIT"
-            );
-
-            assertTrue(conn.getAutoCommit());
-
             conn.close();
 
             checkConnectionClosed(new RunnableX() {
@@ -1452,21 +1442,6 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
                 "Savepoint cannot be set in auto-commit mode"
             );
 
-            // Cannot disable autocommit when MVCC is disabled.
-            GridTestUtils.assertThrows(log,
-                new Callable<Object>() {
-                    @Override public Object call() throws Exception {
-                        conn.setAutoCommit(false);
-
-                        return null;
-                    }
-                },
-                SQLException.class,
-                "MVCC must be enabled in order to invoke transactional operation: COMMIT"
-            );
-
-            assertTrue(conn.getAutoCommit());
-
             conn.close();
 
             checkConnectionClosed(new RunnableX() {
@@ -1512,21 +1487,6 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
                 "Auto-commit mode"
             );
 
-            // Cannot disable autocommit when MVCC is disabled.
-            GridTestUtils.assertThrows(log,
-                new Callable<Object>() {
-                    @Override public Object call() throws Exception {
-                        conn.setAutoCommit(false);
-
-                        return null;
-                    }
-                },
-                SQLException.class,
-                "MVCC must be enabled in order to invoke transactional operation: COMMIT"
-            );
-
-            assertTrue(conn.getAutoCommit());
-
             conn.close();
 
             checkConnectionClosed(new RunnableX() {
@@ -2091,4 +2051,4 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
             }
         };
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7000e6e3/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 06868c4..3194eed 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -2012,16 +2012,16 @@ public class IgniteH2Indexing implements GridQueryIndexing {
      * @throws IgniteCheckedException if failed.
      */
     private void processTxCommand(SqlCommand cmd, SqlFieldsQuery qry) throws IgniteCheckedException {
-        if (!mvccEnabled(ctx))
-            throw new IgniteSQLException("MVCC must be enabled in order to invoke transactional operation: " +
-                qry.getSql(), IgniteQueryErrorCode.MVCC_DISABLED);
-
         NestedTxMode nestedTxMode = qry instanceof SqlFieldsQueryEx ? ((SqlFieldsQueryEx)qry).getNestedTxMode() :
             NestedTxMode.DEFAULT;
 
         GridNearTxLocal tx = tx(ctx);
 
         if (cmd instanceof SqlBeginTransactionCommand) {
+            if (!mvccEnabled(ctx))
+                throw new IgniteSQLException("MVCC must be enabled in order to start transaction.",
+                    IgniteQueryErrorCode.MVCC_DISABLED);
+
             if (tx != null) {
                 if (nestedTxMode == null)
                     nestedTxMode = NestedTxMode.DEFAULT;

http://git-wip-us.apache.org/repos/asf/ignite/blob/7000e6e3/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionCommandsWithMvccDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionCommandsWithMvccDisabledSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionCommandsWithMvccDisabledSelfTest.java
new file mode 100644
index 0000000..b8b9360
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionCommandsWithMvccDisabledSelfTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.index;
+
+import java.util.concurrent.Callable;
+import org.apache.ignite.internal.processors.query.IgniteSQLException;
+import org.apache.ignite.testframework.GridTestUtils;
+
+/**
+ *
+ */
+public class SqlTransactionCommandsWithMvccDisabledSelfTest extends AbstractSchemaSelfTest {
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        startGrid(commonConfiguration(0));
+
+        super.execute(grid(0), "CREATE TABLE INTS(k int primary key, v int) WITH \"wrap_value=false,cache_name=ints," +
+            "atomicity=transactional\"");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+
+        super.afterTestsStopped();
+    }
+
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testBeginWithMvccDisabled() throws Exception {
+        GridTestUtils.assertThrows(null, new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                execute(grid(0), "BEGIN");
+
+                return null;
+            }
+        }, IgniteSQLException.class, "MVCC must be enabled in order to start transaction.");
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testCommitWithMvccDisabled() throws Exception {
+        execute(grid(0), "COMMIT");
+        // assert no exception
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testRollbackWithMvccDisabled() throws Exception {
+        execute(grid(0), "ROLLBACK");
+        // assert no exception
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7000e6e3/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsComandsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsComandsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsComandsSelfTest.java
deleted file mode 100644
index 8b3fbe3..0000000
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsComandsSelfTest.java
+++ /dev/null
@@ -1,83 +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.index;
-
-import java.util.concurrent.Callable;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.processors.query.IgniteSQLException;
-import org.apache.ignite.testframework.GridTestUtils;
-
-/**
- *
- */
-public class SqlTransactionsComandsSelfTest extends AbstractSchemaSelfTest {
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        super.beforeTestsStarted();
-
-        startGrid(commonConfiguration(0));
-
-        super.execute(grid(0), "CREATE TABLE INTS(k int primary key, v int) WITH \"wrap_value=false,cache_name=ints," +
-            "atomicity=transactional\"");
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-
-        super.afterTestsStopped();
-    }
-
-
-    /**
-     * @throws Exception if failed.
-     */
-    public void testBeginWithMvccDisabledThrows() throws Exception {
-        checkMvccDisabledBehavior("BEGIN");
-    }
-
-    /**
-     * @throws Exception if failed.
-     */
-    public void testCommitWithMvccDisabledThrows() throws Exception {
-        checkMvccDisabledBehavior("COMMIT");
-    }
-
-    /**
-     * @throws Exception if failed.
-     */
-    public void testRollbackWithMvccDisabledThrows() throws Exception {
-        checkMvccDisabledBehavior("rollback");
-    }
-
-    /**
-     * @param sql Operation to test.
-     * @throws Exception if failed.
-     */
-    private void checkMvccDisabledBehavior(String sql) throws Exception {
-        try (IgniteEx node = startGrid(commonConfiguration(1))) {
-            GridTestUtils.assertThrows(null, new Callable<Object>() {
-                @Override public Object call() throws Exception {
-                    execute(node, sql);
-
-                    return null;
-                }
-            }, IgniteSQLException.class, "MVCC must be enabled in order to invoke transactional operation: " + sql);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7000e6e3/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsComandsWithMvccDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsComandsWithMvccDisabledSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsComandsWithMvccDisabledSelfTest.java
deleted file mode 100644
index d2931ba..0000000
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsComandsWithMvccDisabledSelfTest.java
+++ /dev/null
@@ -1,83 +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.index;
-
-import java.util.concurrent.Callable;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.processors.query.IgniteSQLException;
-import org.apache.ignite.testframework.GridTestUtils;
-
-/**
- *
- */
-public class SqlTransactionsComandsWithMvccDisabledSelfTest extends AbstractSchemaSelfTest {
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        super.beforeTestsStarted();
-
-        startGrid(commonConfiguration(0));
-
-        super.execute(grid(0), "CREATE TABLE INTS(k int primary key, v int) WITH \"wrap_value=false,cache_name=ints," +
-            "atomicity=transactional\"");
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-
-        super.afterTestsStopped();
-    }
-
-
-    /**
-     * @throws Exception if failed.
-     */
-    public void testBeginWithMvccDisabledThrows() throws Exception {
-        checkMvccDisabledBehavior("BEGIN");
-    }
-
-    /**
-     * @throws Exception if failed.
-     */
-    public void testCommitWithMvccDisabledThrows() throws Exception {
-        checkMvccDisabledBehavior("COMMIT");
-    }
-
-    /**
-     * @throws Exception if failed.
-     */
-    public void testRollbackWithMvccDisabledThrows() throws Exception {
-        checkMvccDisabledBehavior("rollback");
-    }
-
-    /**
-     * @param sql Operation to test.
-     * @throws Exception if failed.
-     */
-    private void checkMvccDisabledBehavior(String sql) throws Exception {
-        try (IgniteEx node = startGrid(commonConfiguration(1))) {
-            GridTestUtils.assertThrows(null, new Callable<Object>() {
-                @Override public Object call() throws Exception {
-                    execute(node, sql);
-
-                    return null;
-                }
-            }, IgniteSQLException.class, "MVCC must be enabled in order to invoke transactional operation: " + sql);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/7000e6e3/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index f29a79b..fd71794 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -137,7 +137,7 @@ import org.apache.ignite.internal.processors.cache.index.IgniteDecimalSelfTest;
 import org.apache.ignite.internal.processors.cache.index.LongIndexNameTest;
 import org.apache.ignite.internal.processors.cache.index.OptimizedMarshallerIndexNameTest;
 import org.apache.ignite.internal.processors.cache.index.SchemaExchangeSelfTest;
-import org.apache.ignite.internal.processors.cache.index.SqlTransactionsComandsSelfTest;
+import org.apache.ignite.internal.processors.cache.index.SqlTransactionCommandsWithMvccDisabledSelfTest;
 import org.apache.ignite.internal.processors.cache.local.IgniteCacheLocalAtomicQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.local.IgniteCacheLocalFieldsQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.local.IgniteCacheLocalQueryCancelOrTimeoutSelfTest;
@@ -456,7 +456,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
 
         suite.addTestSuite(GridIndexRebuildSelfTest.class);
 
-        suite.addTestSuite(SqlTransactionsComandsSelfTest.class);
+        suite.addTestSuite(SqlTransactionCommandsWithMvccDisabledSelfTest.class);
 
         suite.addTestSuite(IgniteSqlDefaultValueTest.class);
         suite.addTestSuite(IgniteDecimalSelfTest.class);


[08/28] ignite git commit: IGNITE-10026: [ML] Broken example: GaussianNaiveBayesTrainerExample

Posted by sb...@apache.org.
IGNITE-10026: [ML] Broken example: GaussianNaiveBayesTrainerExample

this closes #5090


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

Branch: refs/heads/ignite-627
Commit: 11e142da3730b7f61b1b66749c4a2d77631fdaf1
Parents: 370cd3e
Author: YuriBabak <y....@gmail.com>
Authored: Fri Oct 26 18:26:18 2018 +0300
Committer: Yury Babak <yb...@gridgain.com>
Committed: Fri Oct 26 18:26:18 2018 +0300

----------------------------------------------------------------------
 .../ml/naivebayes/GaussianNaiveBayesTrainerExample.java         | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/11e142da/examples/src/main/java/org/apache/ignite/examples/ml/naivebayes/GaussianNaiveBayesTrainerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/naivebayes/GaussianNaiveBayesTrainerExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/naivebayes/GaussianNaiveBayesTrainerExample.java
index cd8383e..b5e36ea 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/naivebayes/GaussianNaiveBayesTrainerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/naivebayes/GaussianNaiveBayesTrainerExample.java
@@ -24,7 +24,7 @@ import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.TestCache;
+import org.apache.ignite.examples.ml.util.SandboxMLCache;
 import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
 import org.apache.ignite.ml.naivebayes.gaussian.GaussianNaiveBayesModel;
@@ -56,7 +56,8 @@ public class GaussianNaiveBayesTrainerExample {
         try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
             System.out.println(">>> Ignite grid started.");
 
-            IgniteCache<Integer, double[]> dataCache = new TestCache(ignite).fillCacheWith(irisDatasetFirstAndSecondClasses);
+            IgniteCache<Integer, double[]> dataCache = new SandboxMLCache(ignite)
+                .fillCacheWith(irisDatasetFirstAndSecondClasses);
 
             System.out.println(">>> Create new naive Bayes classification trainer object.");
             GaussianNaiveBayesTrainer trainer = new GaussianNaiveBayesTrainer();


[24/28] ignite git commit: IGNITE-8902 Fixed rollback of GridDhtTxRemote for one-phase commit - Fixes #5089.

Posted by sb...@apache.org.
IGNITE-8902 Fixed rollback of GridDhtTxRemote for one-phase commit - Fixes #5089.

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

Branch: refs/heads/ignite-627
Commit: 996a1d5ed8af0034dd1541b206bda0ac9467f981
Parents: 8bd9575
Author: ascherbakoff <al...@gmail.com>
Authored: Mon Oct 29 16:39:44 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Oct 29 17:08:00 2018 +0300

----------------------------------------------------------------------
 .../cache/GridCacheSharedContext.java           |   1 -
 .../distributed/dht/GridDhtTxPrepareFuture.java | 140 ++++++------
 .../cache/transactions/IgniteTxHandler.java     |   1 +
 .../cache/transactions/IgniteTxManager.java     |   3 +-
 .../internal/TestRecordingCommunicationSpi.java |  20 ++
 .../TxRollbackOnTimeoutOnePhaseCommitTest.java  | 215 +++++++++++++++++++
 .../testsuites/IgniteCacheTestSuite6.java       |   2 +
 7 files changed, 302 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/996a1d5e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
index b5cd82b..6c72169 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
@@ -1149,5 +1149,4 @@ public class GridCacheSharedContext<K, V> {
     public void setTxManager(IgniteTxManager txMgr) {
         this.txMgr = txMgr;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/996a1d5e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 8d35a47..3232305 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -26,6 +26,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
@@ -216,6 +217,9 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
     /** Timeout object. */
     private final PrepareTimeoutObject timeoutObj;
 
+    /** */
+    private CountDownLatch timeoutAddedLatch;
+
     /**
      * @param cctx Context.
      * @param tx Transaction.
@@ -259,6 +263,9 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
         assert nearMap != null;
 
         timeoutObj = timeout > 0 ? new PrepareTimeoutObject(timeout) : null;
+
+        if (tx.onePhaseCommit())
+            timeoutAddedLatch = new CountDownLatch(1);
     }
 
     /** {@inheritDoc} */
@@ -691,6 +698,14 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
             if (!MAPPED_UPD.compareAndSet(this, 0, 1))
                 return false;
 
+            if (timeoutObj != null && tx.onePhaseCommit()) {
+                U.awaitQuiet(timeoutAddedLatch);
+
+                // Disable timeouts after all locks are acquired for one-phase commit or partition desync will occur.
+                if (!cctx.time().removeTimeoutObject(timeoutObj))
+                    return true; // Should not proceed with prepare if tx is already timed out.
+            }
+
             if (forceKeysFut == null || (forceKeysFut.isDone() && forceKeysFut.error() == null))
                 prepare0();
             else {
@@ -729,7 +744,7 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
             tx.clearPrepareFuture(this);
 
         // Do not commit one-phase commit transaction if originating node has near cache enabled.
-        if (tx.onePhaseCommit() && tx.commitOnPrepare()) {
+        if (tx.commitOnPrepare()) {
             assert last;
 
             Throwable prepErr = this.err;
@@ -739,61 +754,55 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
 
             onComplete(res);
 
-            if (tx.commitOnPrepare()) {
-                if (tx.markFinalizing(IgniteInternalTx.FinalizationStatus.USER_FINISH)) {
-                    CIX1<IgniteInternalFuture<IgniteInternalTx>> resClo =
-                        new CIX1<IgniteInternalFuture<IgniteInternalTx>>() {
-                            @Override public void applyx(IgniteInternalFuture<IgniteInternalTx> fut) {
-                                if(res.error() == null && fut.error() != null)
-                                    res.error(fut.error());
+            if (tx.markFinalizing(IgniteInternalTx.FinalizationStatus.USER_FINISH)) {
+                CIX1<IgniteInternalFuture<IgniteInternalTx>> resClo =
+                    new CIX1<IgniteInternalFuture<IgniteInternalTx>>() {
+                        @Override public void applyx(IgniteInternalFuture<IgniteInternalTx> fut) {
+                            if (res.error() == null && fut.error() != null)
+                                res.error(fut.error());
 
-                                if (REPLIED_UPD.compareAndSet(GridDhtTxPrepareFuture.this, 0, 1))
-                                    sendPrepareResponse(res);
-                            }
-                        };
-
-                    try {
-                        if (prepErr == null) {
-                            try {
-                                tx.commitAsync().listen(resClo);
-                            }
-                            catch (Throwable e) {
-                                res.error(e);
+                            if (REPLIED_UPD.compareAndSet(GridDhtTxPrepareFuture.this, 0, 1))
+                                sendPrepareResponse(res);
+                        }
+                    };
 
-                                tx.systemInvalidate(true);
+                try {
+                    if (prepErr == null) {
+                        try {
+                            tx.commitAsync().listen(resClo);
+                        }
+                        catch (Throwable e) {
+                            res.error(e);
 
-                                try {
-                                    tx.rollbackAsync().listen(resClo);
-                                }
-                                catch (Throwable e1) {
-                                    e.addSuppressed(e1);
-                                }
+                            tx.systemInvalidate(true);
 
-                                throw e;
-                            }
-                        }
-                        else if (!cctx.kernalContext().isStopping()) {
                             try {
                                 tx.rollbackAsync().listen(resClo);
                             }
-                            catch (Throwable e) {
-                                if (err != null)
-                                    err.addSuppressed(e);
-
-                                throw err;
+                            catch (Throwable e1) {
+                                e.addSuppressed(e1);
                             }
+
+                            throw e;
                         }
                     }
-                    catch (Throwable e){
-                        tx.logTxFinishErrorSafe(log, true, e);
+                    else if (!cctx.kernalContext().isStopping()) {
+                        try {
+                            tx.rollbackAsync().listen(resClo);
+                        }
+                        catch (Throwable e) {
+                            if (err != null)
+                                err.addSuppressed(e);
 
-                        cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));
+                            throw err;
+                        }
                     }
                 }
-            }
-            else {
-                if (REPLIED_UPD.compareAndSet(this, 0, 1))
-                    sendPrepareResponse(res);
+                catch (Throwable e) {
+                    tx.logTxFinishErrorSafe(log, true, e);
+
+                    cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));
+                }
             }
 
             return true;
@@ -1062,9 +1071,14 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
 
         readyLocks();
 
-        if (timeoutObj != null && !isDone()) {
-            // Start timeout tracking after 'readyLocks' to avoid race with timeout processing.
+        // Start timeout tracking after 'readyLocks' to avoid race with timeout processing.
+        if (timeoutObj != null) {
             cctx.time().addTimeoutObject(timeoutObj);
+
+            // Fix race with add/remove timeout object if locks are mapped from another
+            // thread before timeout object is enqueued.
+            if (tx.onePhaseCommit())
+                timeoutAddedLatch.countDown();
         }
 
         mapIfLocked();
@@ -1216,8 +1230,6 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
      *
      */
     private void prepare0() {
-        boolean skipInit = false;
-
         try {
             if (tx.serializable() && tx.optimistic()) {
                 IgniteCheckedException err0;
@@ -1252,8 +1264,6 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
                 }
             }
 
-            IgniteInternalFuture<MvccSnapshot> waitCrdCntrFut = null;
-
             if (req.requestMvccCounter()) {
                 assert last;
 
@@ -1294,37 +1304,11 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
             if (isDone())
                 return;
 
-            if (last) {
-                if (waitCrdCntrFut != null) {
-                    skipInit = true;
-
-                    waitCrdCntrFut.listen(new IgniteInClosure<IgniteInternalFuture<MvccSnapshot>>() {
-                        @Override public void apply(IgniteInternalFuture<MvccSnapshot> fut) {
-                            try {
-                                fut.get();
-
-                                sendPrepareRequests();
-
-                                markInitialized();
-                            }
-                            catch (Throwable e) {
-                                U.error(log, "Failed to get mvcc version for tx [txId=" + tx.nearXidVersion() +
-                                    ", err=" + e + ']', e);
-
-                                GridNearTxPrepareResponse res = createPrepareResponse(e);
-
-                                onDone(res, res.error());
-                            }
-                        }
-                    });
-                }
-                else
-                    sendPrepareRequests();
-            }
+            if (last)
+                sendPrepareRequests();
         }
         finally {
-            if (!skipInit)
-                markInitialized();
+            markInitialized();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/996a1d5e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index 75e2087..0c51e15 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -1685,6 +1685,7 @@ public class IgniteTxHandler {
                     single,
                     req.storeWriteThrough());
 
+                tx.onePhaseCommit(req.onePhaseCommit());
                 tx.writeVersion(req.writeVersion());
 
                 tx = ctx.tm().onCreated(null, tx);

http://git-wip-us.apache.org/repos/asf/ignite/blob/996a1d5e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index 0c2ca34..032df22 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -891,7 +891,8 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
             throw new IgniteCheckedException("Transaction is marked for rollback: " + tx);
         }
 
-        if (tx.remainingTime() == -1) {
+        // One-phase commit tx cannot timeout on prepare because it is expected to be committed.
+        if (tx.remainingTime() == -1 && !tx.onePhaseCommit()) {
             tx.setRollbackOnly();
 
             throw new IgniteTxTimeoutCheckedException("Transaction timed out: " + this);

http://git-wip-us.apache.org/repos/asf/ignite/blob/996a1d5e/modules/core/src/test/java/org/apache/ignite/internal/TestRecordingCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/TestRecordingCommunicationSpi.java b/modules/core/src/test/java/org/apache/ignite/internal/TestRecordingCommunicationSpi.java
index 7b68a6b..988395f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/TestRecordingCommunicationSpi.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/TestRecordingCommunicationSpi.java
@@ -218,6 +218,26 @@ public class TestRecordingCommunicationSpi extends TcpCommunicationSpi {
     }
 
     /**
+     * @param size Size
+     * @param timeout Timeout.
+     * @throws InterruptedException
+     */
+    public boolean waitForBlocked(int size, long timeout) throws InterruptedException {
+        long t0 = U.currentTimeMillis() + timeout;
+
+        synchronized (this) {
+            while (blockedMsgs.size() < size) {
+                wait(1000);
+
+                if (U.currentTimeMillis() >= t0)
+                    return false;
+            }
+        }
+
+        return true;
+    }
+
+    /**
      * @throws InterruptedException If interrupted.
      */
     public void waitForRecorded() throws InterruptedException {

http://git-wip-us.apache.org/repos/asf/ignite/blob/996a1d5e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutOnePhaseCommitTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutOnePhaseCommitTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutOnePhaseCommitTest.java
new file mode 100644
index 0000000..2375d9e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutOnePhaseCommitTest.java
@@ -0,0 +1,215 @@
+/*
+ * 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.transactions;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+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.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.TestRecordingCommunicationSpi;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareResponse;
+import org.apache.ignite.internal.processors.cache.verify.IdleVerifyResultV2;
+import org.apache.ignite.internal.util.typedef.X;
+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.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.TransactionTimeoutException;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.apache.ignite.testframework.GridTestUtils.runAsync;
+import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
+
+/**
+ * Tests rollback on timeout scenarios for one-phase commit protocol.
+ */
+public class TxRollbackOnTimeoutOnePhaseCommitTest extends GridCommonAbstractTest {
+    /** IP finder. */
+    private static final TcpDiscoveryVmIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private static final int GRID_CNT = 2;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
+        cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());
+
+        boolean client = igniteInstanceName.startsWith("client");
+
+        cfg.setClientMode(client);
+
+        if (!client) {
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+            ccfg.setAtomicityMode(TRANSACTIONAL);
+            ccfg.setBackups(1);
+            ccfg.setWriteSynchronizationMode(FULL_SYNC);
+            ccfg.setOnheapCacheEnabled(false);
+
+            cfg.setCacheConfiguration(ccfg);
+        }
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        startGridsMultiThreaded(GRID_CNT);
+
+        startGrid("client");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+    }
+
+    /** */
+    public void testRollbackOnTimeoutPartitionDesyncPessimistic() throws Exception {
+        doTestRollbackOnTimeoutPartitionDesync(PESSIMISTIC);
+    }
+
+    /** */
+    public void testRollbackOnTimeoutPartitionDesyncOptimistic() throws Exception {
+        doTestRollbackOnTimeoutPartitionDesync(OPTIMISTIC);
+    }
+
+    /** */
+    public void testUnlockOptimistic() throws IgniteCheckedException {
+        IgniteEx client = grid("client");
+
+        assertNotNull(client.cache(DEFAULT_CACHE_NAME));
+
+        int key = 0;
+
+        CountDownLatch lock = new CountDownLatch(1);
+        CountDownLatch finish = new CountDownLatch(1);
+
+        IgniteInternalFuture fut = runAsync(() -> {
+            try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ, 0, 1)) {
+                client.cache(DEFAULT_CACHE_NAME).put(key, key + 1);
+
+                lock.countDown();
+
+                try {
+                    assertTrue(U.await(finish, 30, TimeUnit.SECONDS));
+                }
+                catch (IgniteInterruptedCheckedException e) {
+                    fail();
+                }
+
+                tx.commit();
+            }
+        });
+
+        try (Transaction tx = client.transactions().txStart(OPTIMISTIC, REPEATABLE_READ, 200, 1)) {
+            try {
+                assertTrue(U.await(lock, 30, TimeUnit.SECONDS));
+            }
+            catch (IgniteInterruptedCheckedException e) {
+                fail();
+            }
+
+            client.cache(DEFAULT_CACHE_NAME).put(key, key);
+
+            tx.commit();
+
+            // fail(); // TODO IGNITE-10027 throw timeout exception for optimistic timeout.
+        }
+        catch (Exception e) {
+            assertTrue(e.getClass().getName(), X.hasCause(e, TransactionTimeoutException.class));
+        }
+
+        assertNull(client.cache(DEFAULT_CACHE_NAME).get(key));
+
+        finish.countDown();
+
+        fut.get();
+
+        assertEquals(1, client.cache(DEFAULT_CACHE_NAME).get(key));
+    }
+
+    /** */
+    private void doTestRollbackOnTimeoutPartitionDesync(TransactionConcurrency concurrency) throws Exception {
+        IgniteEx client = grid("client");
+
+        assertNotNull(client.cache(DEFAULT_CACHE_NAME));
+
+        int key = 0;
+
+        Ignite primary = primaryNode(key, DEFAULT_CACHE_NAME);
+        Ignite backup = backupNode(key, DEFAULT_CACHE_NAME);
+
+        TestRecordingCommunicationSpi backupSpi = TestRecordingCommunicationSpi.spi(backup);
+        backupSpi.blockMessages(GridDhtTxPrepareResponse.class, primary.name());
+
+        IgniteInternalFuture fut = runAsync(() -> {
+            try {
+                backupSpi.waitForBlocked(1, 5000);
+            }
+            catch (InterruptedException e) {
+                fail();
+            }
+
+            doSleep(500);
+
+            backupSpi.stopBlock();
+        });
+
+        try (Transaction tx = client.transactions().txStart(concurrency, REPEATABLE_READ, 500, 1)) {
+            client.cache(DEFAULT_CACHE_NAME).put(key, key);
+
+            tx.commit();
+        }
+        catch (Exception e) {
+            assertTrue(e.getClass().getName(), X.hasCause(e, TransactionTimeoutException.class));
+        }
+
+        fut.get();
+
+        IdleVerifyResultV2 res = idleVerify(client, DEFAULT_CACHE_NAME);
+
+        if (res.hasConflicts()) {
+            StringBuilder b = new StringBuilder();
+
+            res.print(b::append);
+
+            fail(b.toString());
+        }
+
+        checkFutures();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/996a1d5e/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 b69ebe4..535797c 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
@@ -45,6 +45,7 @@ import org.apache.ignite.internal.processors.cache.transactions.TxRollbackAsyncT
 import org.apache.ignite.internal.processors.cache.transactions.TxRollbackOnIncorrectParamsTest;
 import org.apache.ignite.internal.processors.cache.transactions.TxRollbackOnTimeoutNearCacheTest;
 import org.apache.ignite.internal.processors.cache.transactions.TxRollbackOnTimeoutNoDeadlockDetectionTest;
+import org.apache.ignite.internal.processors.cache.transactions.TxRollbackOnTimeoutOnePhaseCommitTest;
 import org.apache.ignite.internal.processors.cache.transactions.TxRollbackOnTimeoutTest;
 import org.apache.ignite.internal.processors.cache.transactions.TxRollbackOnTopologyChangeTest;
 import org.apache.ignite.internal.processors.cache.transactions.TxStateChangeEventTest;
@@ -79,6 +80,7 @@ public class IgniteCacheTestSuite6 extends TestSuite {
         suite.addTestSuite(TxRollbackAsyncTest.class);
         suite.addTestSuite(TxRollbackAsyncNearCacheTest.class);
         suite.addTestSuite(TxRollbackOnTopologyChangeTest.class);
+        suite.addTestSuite(TxRollbackOnTimeoutOnePhaseCommitTest.class);
 
         suite.addTestSuite(TxOptimisticPrepareOnUnstableTopologyTest.class);
 


[13/28] ignite git commit: IGNITE-9941 Web Console: Added configuration parameter to disable signup and possibility to create user accounts by administrator.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/primitives/form-field/password.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/form-field/password.pug b/modules/web-console/frontend/app/primitives/form-field/password.pug
index 6b9818b..374d768 100644
--- a/modules/web-console/frontend/app/primitives/form-field/password.pug
+++ b/modules/web-console/frontend/app/primitives/form-field/password.pug
@@ -17,9 +17,9 @@
 mixin form-field__password({ label, model, name, disabled, required, placeholder, tip })
     -var errLbl = label.substring(0, label.length - 1)
 
-    .form-field.form-field__password(
+    .form-field.form-field__password.ignite-form-field(
         password-visibility-root
-        on-password-visibility-toggle=`${form}[${name}].$setTouched()`
+        on-password-visibility-toggle=`$input1.$setTouched(); $input2.$setTouched()`
     )
         +form-field__label({ label, name, required })
             +form-field__tooltip({ title: tip, options: tipOpts })
@@ -27,16 +27,22 @@ mixin form-field__password({ label, model, name, disabled, required, placeholder
         .form-field__control
             - attributes.type='password'
             - attributes.class = 'password-visibility__password-hidden'
+            - attributes['ng-ref'] = '$input1'
             +form-field__input({ name, model, disabled, required, placeholder })(attributes=attributes)
             - attributes.class = 'password-visibility__password-visible'
             - attributes.type='text'
             - attributes.autocomplete = 'off'
+            - attributes['ng-ref'] = '$input2'
             +form-field__input({ name: name + `+"Text"`, model, disabled, required, placeholder })(attributes=attributes)
 
             password-visibility-toggle-button
 
         .form-field__errors(
-            ng-messages=`(${form}[${name}].$dirty || ${form}[${name}].$touched || ${form}[${name}].$submitted) && ${form}[${name}].$invalid ? ${form}[${name}].$error : {}`
+            ng-messages=`$input1.$error || $input2.$error`
+            ng-show=`
+                ($input1.$dirty || $input1.$touched || $input1.$submitted) && $input1.$invalid ||
+                ($input2.$dirty || $input2.$touched || $input2.$submitted) && $input2.$invalid
+            `
         )
             if block
                 block

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/primitives/form-field/phone.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/form-field/phone.pug b/modules/web-console/frontend/app/primitives/form-field/phone.pug
index 8b50301..9b60a40 100644
--- a/modules/web-console/frontend/app/primitives/form-field/phone.pug
+++ b/modules/web-console/frontend/app/primitives/form-field/phone.pug
@@ -17,7 +17,7 @@
 mixin form-field__phone({ label, model, name, disabled, required, optional, placeholder, tip })
     -var errLbl = label.substring(0, label.length - 1)
 
-    .form-field
+    .form-field.ignite-form-field
         +form-field__label({ label, name, required, optional })
             +form-field__tooltip({ title: tip, options: tipOpts })
 
@@ -26,7 +26,8 @@ mixin form-field__phone({ label, model, name, disabled, required, optional, plac
             +form-field__input({ name, model, disabled, required, placeholder })(attributes=attributes)
 
         .form-field__errors(
-            ng-messages=`(${form}[${name}].$dirty || ${form}[${name}].$touched || ${form}[${name}].$submitted) && ${form}[${name}].$invalid ? ${form}[${name}].$error : {}`
+            ng-messages=`$input.$error`
+            ng-show=`($input.$dirty || $input.$touched || $input.$submitted) && $input.$invalid`
         )
             if block
                 block

http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/utils/dialogState.ts
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/utils/dialogState.ts b/modules/web-console/frontend/app/utils/dialogState.ts
new file mode 100644
index 0000000..d83c911
--- /dev/null
+++ b/modules/web-console/frontend/app/utils/dialogState.ts
@@ -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.
+ */
+
+import {UIRouter, StateDeclaration, Transition} from '@uirouter/angularjs';
+
+export function dialogState(component: string): Partial<StateDeclaration> {
+    let dialog: mgcrea.ngStrap.modal.IModal | undefined;
+    let hide: (() => void) | undefined;
+
+    onEnter.$inject = ['$transition$'];
+
+    function onEnter(transition: Transition) {
+        const modal = transition.injector().get<mgcrea.ngStrap.modal.IModalService>('$modal');
+        const router = transition.injector().get<UIRouter>('$uiRouter');
+
+        dialog = modal({
+            template: `
+                <${component}
+                    class='modal center modal--ignite theme--ignite'
+                    tabindex='-1'
+                    role='dialog'
+                    on-hide=$hide()
+                ></${component}>
+            `,
+            onHide(modal) {
+                modal.destroy();
+            }
+        });
+
+        hide = dialog.hide;
+
+        dialog.hide = () => router.stateService.go('.^');
+    }
+
+    return {
+        onEnter,
+        onExit() {
+            if (hide) hide();
+            dialog = hide = void 0;
+        }
+    };
+}


[27/28] ignite git commit: IGNITE-10033 Update Grid(Ignite)CacheDatabaseSharedManager according to accepted coding guidelines - Fixes #5156.

Posted by sb...@apache.org.
IGNITE-10033 Update Grid(Ignite)CacheDatabaseSharedManager according to accepted coding guidelines - Fixes #5156.

Signed-off-by: Dmitriy Govorukhin <dm...@gmail.com>


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

Branch: refs/heads/ignite-627
Commit: bdb22399699a8c0288730ca9a38f177e73878322
Parents: d6154e1
Author: Maxim Muzafarov <ma...@gmail.com>
Authored: Tue Oct 30 00:12:36 2018 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Tue Oct 30 00:12:36 2018 +0300

----------------------------------------------------------------------
 .../GridCacheDatabaseSharedManager.java         | 135 ++++++-----------
 .../IgniteCacheDatabaseSharedManager.java       | 150 +++++++++++--------
 .../IgniteNoParrallelClusterIsAllowedTest.java  |   2 +-
 3 files changed, 134 insertions(+), 153 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bdb22399/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 4af1d8e..e09ad22 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
@@ -57,7 +57,6 @@ import java.util.function.Predicate;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
-import javax.management.ObjectName;
 import org.apache.ignite.DataStorageMetrics;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
@@ -324,9 +323,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     /** */
     private DataStorageMetricsImpl persStoreMetrics;
 
-    /** */
-    private ObjectName persistenceMetricsMbeanName;
-
     /** Counter for written checkpoint pages. Not null only if checkpoint is running. */
     private volatile AtomicInteger writtenPagesCntr = null;
 
@@ -438,7 +434,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
 
         addDataRegion(
             memCfg,
-            createDataRegionConfiguration(memCfg),
+            createMetastoreDataRegionConfig(memCfg),
             false
         );
 
@@ -451,7 +447,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
      * @param storageCfg Data storage configuration.
      * @return Data region configuration.
      */
-    private DataRegionConfiguration createDataRegionConfiguration(DataStorageConfiguration storageCfg) {
+    private DataRegionConfiguration createMetastoreDataRegionConfig(DataStorageConfiguration storageCfg) {
         DataRegionConfiguration cfg = new DataRegionConfiguration();
 
         cfg.setName(METASTORE_DATA_REGION_NAME);
@@ -667,7 +663,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
         try {
             DataStorageConfiguration memCfg = cctx.kernalContext().config().getDataStorageConfiguration();
 
-            DataRegionConfiguration plcCfg = createDataRegionConfiguration(memCfg);
+            DataRegionConfiguration plcCfg = createMetastoreDataRegionConfig(memCfg);
 
             File allocPath = buildAllocPath(plcCfg);
 
@@ -733,10 +729,15 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
 
         snapshotMgr = cctx.snapshot();
 
-        if (!cctx.kernalContext().clientNode()) {
-            initDataBase();
-
-            registrateMetricsMBean();
+        if (!cctx.kernalContext().clientNode() && persistenceCfg.getCheckpointThreads() > 1) {
+            asyncRunner = new IgniteThreadPoolExecutor(
+                CHECKPOINT_RUNNER_THREAD_PREFIX,
+                cctx.igniteInstanceName(),
+                persistenceCfg.getCheckpointThreads(),
+                persistenceCfg.getCheckpointThreads(),
+                30_000,
+                new LinkedBlockingQueue<>()
+            );
         }
 
         if (checkpointer == null)
@@ -759,61 +760,17 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
         stopping = false;
     }
 
-    /**
-     *
-     */
-    private void initDataBase() {
-        if (persistenceCfg.getCheckpointThreads() > 1)
-            asyncRunner = new IgniteThreadPoolExecutor(
-                CHECKPOINT_RUNNER_THREAD_PREFIX,
-                cctx.igniteInstanceName(),
-                persistenceCfg.getCheckpointThreads(),
-                persistenceCfg.getCheckpointThreads(),
-                30_000,
-                new LinkedBlockingQueue<Runnable>()
-            );
-    }
-
-    /**
-     * Try to register Metrics MBean.
-     *
-     * @throws IgniteCheckedException If failed.
-     */
-    private void registrateMetricsMBean() throws IgniteCheckedException {
-        if (U.IGNITE_MBEANS_DISABLED)
-            return;
-
-        try {
-            persistenceMetricsMbeanName = U.registerMBean(
-                cctx.kernalContext().config().getMBeanServer(),
-                cctx.kernalContext().igniteInstanceName(),
-                MBEAN_GROUP,
-                MBEAN_NAME,
-                persStoreMetrics,
-                DataStorageMetricsMXBean.class);
-        }
-        catch (Throwable e) {
-            throw new IgniteCheckedException("Failed to register " + MBEAN_NAME + " MBean.", e);
-        }
-    }
-
-    /**
-     * Unregister metrics MBean.
-     */
-    private void unRegistrateMetricsMBean() {
-        if (persistenceMetricsMbeanName == null)
-            return;
-
-        assert !U.IGNITE_MBEANS_DISABLED;
-
-        try {
-            cctx.kernalContext().config().getMBeanServer().unregisterMBean(persistenceMetricsMbeanName);
-
-            persistenceMetricsMbeanName = null;
-        }
-        catch (Throwable e) {
-            U.error(log, "Failed to unregister " + MBEAN_NAME + " MBean.", e);
-        }
+    /** {@inheritDoc} */
+    @Override protected void registerMetricsMBeans(IgniteConfiguration cfg) {
+        super.registerMetricsMBeans(cfg);
+
+        registerMetricsMBean(
+            cctx.kernalContext().config(),
+            MBEAN_GROUP,
+            MBEAN_NAME,
+            persStoreMetrics,
+            DataStorageMetricsMXBean.class
+        );
     }
 
     /** {@inheritDoc} */
@@ -926,8 +883,8 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                 cacheGrps);
 
             if (tailWalPtr == null && !status.endPtr.equals(CheckpointStatus.NULL_PTR)) {
-                throw new StorageException("Restore wal pointer = " + tailWalPtr + ", while status.endPtr = " +
-                    status.endPtr + ". Can't restore memory - critical part of WAL archive is missing.");
+                throw new StorageException("The memory cannot be restored. The critical part of WAL archive is missing " +
+                    "[tailWalPtr=" + tailWalPtr + ", endPtr=" + status.endPtr + ']');
             }
 
             nodeStart(tailWalPtr);
@@ -1053,7 +1010,11 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
 
         super.onKernalStop0(cancel);
 
-        unRegistrateMetricsMBean();
+        unregisterMetricsMBean(
+            cctx.gridConfig(),
+            MBEAN_GROUP,
+            MBEAN_NAME
+        );
     }
 
     /** {@inheritDoc} */
@@ -1228,8 +1189,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                 plc = PageMemoryImpl.ThrottlingPolicy.valueOf(throttlingPolicyOverride.toUpperCase());
             }
             catch (IllegalArgumentException e) {
-                log.error("Incorrect value of IGNITE_OVERRIDE_WRITE_THROTTLING_ENABLED property: " +
-                    throttlingPolicyOverride + ". Default throttling policy " + plc + " will be used.");
+                log.error("Incorrect value of IGNITE_OVERRIDE_WRITE_THROTTLING_ENABLED property. " +
+                    "The default throttling policy will be used [plc=" + throttlingPolicyOverride +
+                    ", defaultPlc=" + plc + ']');
             }
         }
         return plc;
@@ -1241,8 +1203,8 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
         if (!regCfg.isPersistenceEnabled())
             super.checkRegionEvictionProperties(regCfg, dbCfg);
         else if (regCfg.getPageEvictionMode() != DataPageEvictionMode.DISABLED) {
-            U.warn(log, "Page eviction mode set for [" + regCfg.getName() + "] data will have no effect" +
-                " because the oldest pages are evicted automatically if Ignite persistence is enabled.");
+            U.warn(log, "Page eviction mode will have no effect because the oldest pages are evicted automatically " +
+                "if Ignite persistence is enabled: " + regCfg.getName());
         }
     }
 
@@ -2240,7 +2202,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                     "[cpStatus=" + status + ", lastRead=" + lastReadPtr + "]");
 
             log.info("Finished applying memory changes [changesApplied=" + applied +
-                ", time=" + (U.currentTimeMillis() - start) + "ms]");
+                ", time=" + (U.currentTimeMillis() - start) + " ms]");
 
             if (applied > 0)
                 finalizeCheckpointOnRecovery(status.cpStartTs, status.cpStartId, status.startPtr);
@@ -2319,7 +2281,8 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                                             if (cacheCtx != null)
                                                 applyUpdate(cacheCtx, dataEntry);
                                             else if (log != null)
-                                                log.warning("Cache (cacheId=" + cacheId + ") is not started, can't apply updates.");
+                                                log.warning("Cache is not started. Updates cannot be applied " +
+                                                    "[cacheId=" + cacheId + ']');
                                         }
                                         finally {
                                             checkpointReadUnlock();
@@ -2491,7 +2454,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
 
         if (log.isInfoEnabled())
             log.info("Finished applying WAL changes [updatesApplied=" + applied +
-                ", time=" + (U.currentTimeMillis() - start) + "ms]");
+                ", time=" + (U.currentTimeMillis() - start) + " ms]");
     }
 
     /**
@@ -3208,7 +3171,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
             }
             finally {
                 if (err == null && !(stopping && isCancelled))
-                    err = new IllegalStateException("Thread " + name() + " is terminated unexpectedly");
+                    err = new IllegalStateException("Thread is terminated unexpectedly: " + name());
 
                 if (err instanceof OutOfMemoryError)
                     cctx.kernalContext().failure().process(new FailureContext(CRITICAL_ERROR, err));
@@ -3839,7 +3802,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                 }
                 catch (IgniteException e) {
                     U.error(log, "Failed to wait for snapshot operation initialization: " +
-                        curr.snapshotOperation + "]", e);
+                        curr.snapshotOperation, e);
                 }
             }
 
@@ -4518,9 +4481,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                         if (content == null)
                             content = readContent();
 
-                        log.warning("Failed to acquire file lock (local nodeId:" + ctx.localNodeId()
-                            + ", already locked by " + content + "), will try again in 1s: "
-                            + file.getAbsolutePath());
+                        log.warning("Failed to acquire file lock. Will try again in 1s " +
+                            "[nodeId=" + ctx.localNodeId() + ", holder=" + content +
+                            ", path=" + file.getAbsolutePath() + ']');
                     }
 
                     U.sleep(1000);
@@ -4529,8 +4492,8 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                 if (content == null)
                     content = readContent();
 
-                failMsg = "Failed to acquire file lock during " + (lockWaitTimeMillis / 1000) +
-                    " sec, (locked by " + content + "): " + file.getAbsolutePath();
+                failMsg = "Failed to acquire file lock [holder=" + content + ", time=" + (lockWaitTimeMillis / 1000) +
+                    " sec, path=" + file.getAbsolutePath() + ']';
             }
             catch (Exception e) {
                 throw new IgniteCheckedException(e);
@@ -4816,7 +4779,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                         return null;
                 }
 
-                log.error("Catch error during restore state, throwsCRCError=" + throwsCRCError, e);
+                log.error("There is an error during restore state [throwsCRCError=" + throwsCRCError + ']', e);
 
                 throw e;
             }
@@ -4907,8 +4870,8 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
          * @return Flag indicates need throws CRC exception or not.
          */
         @Override public boolean throwsCRCError() {
-            log.info("Throws CRC error check, needApplyBinaryUpdates=" + needApplyBinaryUpdates +
-                ", lastArchivedSegment=" + lastArchivedSegment + ", lastRead=" + lastRead);
+            log.info("Throws CRC error check [needApplyBinaryUpdates=" + needApplyBinaryUpdates +
+                ", lastArchivedSegment=" + lastArchivedSegment + ", lastRead=" + lastRead + ']');
 
             if (needApplyBinaryUpdates)
                 return true;

http://git-wip-us.apache.org/repos/asf/ignite/blob/bdb22399/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
index 589b495..21bd454 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
@@ -94,6 +94,9 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
     private final boolean reuseMemory = IgniteSystemProperties.getBoolean(IGNITE_REUSE_MEMORY_ON_DEACTIVATE);
 
     /** */
+    private static final String MBEAN_GROUP_NAME = "DataRegionMetrics";
+
+    /** */
     protected volatile Map<String, DataRegion> dataRegionMap;
 
     /** */
@@ -140,44 +143,88 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
     }
 
     /**
-     * Registers MBeans for all DataRegionMetrics configured in this instance.
-     */
-    private void registerMetricsMBeans() {
-        if(U.IGNITE_MBEANS_DISABLED)
+     * @param cfg Ignite configuration.
+     * @param groupName Name of group.
+     * @param dataRegionName Metrics MBean name.
+     * @param impl Metrics implementation.
+     * @param clazz Metrics class type.
+     */
+    protected <T> void registerMetricsMBean(
+        IgniteConfiguration cfg,
+        String groupName,
+        String dataRegionName,
+        T impl,
+        Class<T> clazz
+    ) {
+        if (U.IGNITE_MBEANS_DISABLED)
             return;
 
-        IgniteConfiguration cfg = cctx.gridConfig();
-
-        for (DataRegionMetrics memMetrics : memMetricsMap.values()) {
-            DataRegionConfiguration memPlcCfg = dataRegionMap.get(memMetrics.getName()).config();
-
-            registerMetricsMBean((DataRegionMetricsImpl)memMetrics, memPlcCfg, cfg);
+        try {
+            U.registerMBean(
+                cfg.getMBeanServer(),
+                cfg.getIgniteInstanceName(),
+                groupName,
+                dataRegionName,
+                impl,
+                clazz);
+        }
+        catch (Throwable e) {
+            U.error(log, "Failed to register MBean with name: " + dataRegionName, e);
         }
     }
 
     /**
-     * @param memMetrics Memory metrics.
-     * @param dataRegionCfg Data region configuration.
      * @param cfg Ignite configuration.
+     * @param groupName Name of group.
+     * @param name Name of MBean.
      */
-    private void registerMetricsMBean(
-        DataRegionMetricsImpl memMetrics,
-        DataRegionConfiguration dataRegionCfg,
-        IgniteConfiguration cfg
+    protected void unregisterMetricsMBean(
+        IgniteConfiguration cfg,
+        String groupName,
+        String name
     ) {
-        assert !U.IGNITE_MBEANS_DISABLED;
+        if (U.IGNITE_MBEANS_DISABLED)
+            return;
+
+        assert cfg != null;
 
         try {
-            U.registerMBean(
-                cfg.getMBeanServer(),
-                cfg.getIgniteInstanceName(),
-                "DataRegionMetrics",
-                dataRegionCfg.getName(),
-                new DataRegionMetricsMXBeanImpl(memMetrics, dataRegionCfg),
-                DataRegionMetricsMXBean.class);
+            cfg.getMBeanServer().unregisterMBean(
+                U.makeMBeanName(
+                    cfg.getIgniteInstanceName(),
+                    groupName,
+                    name
+                ));
+        }
+        catch (InstanceNotFoundException ignored) {
+            // We tried to unregister a non-existing MBean, not a big deal.
         }
         catch (Throwable e) {
-            U.error(log, "Failed to register MBean for DataRegionMetrics with name: '" + memMetrics.getName() + "'", e);
+            U.error(log, "Failed to unregister MBean for memory metrics: " + name, e);
+        }
+    }
+
+    /**
+     * Registers MBeans for all DataRegionMetrics configured in this instance.
+     *
+     * @param cfg Ignite configuration.
+     */
+    protected void registerMetricsMBeans(IgniteConfiguration cfg) {
+        if (U.IGNITE_MBEANS_DISABLED)
+            return;
+
+        assert cfg != null;
+
+        for (DataRegionMetrics memMetrics : memMetricsMap.values()) {
+            DataRegionConfiguration memPlcCfg = dataRegionMap.get(memMetrics.getName()).config();
+
+            registerMetricsMBean(
+                cfg,
+                MBEAN_GROUP_NAME,
+                memPlcCfg.getName(),
+                new DataRegionMetricsMXBeanImpl((DataRegionMetricsImpl)memMetrics, memPlcCfg),
+                DataRegionMetricsMXBean.class
+            );
         }
     }
 
@@ -220,17 +267,6 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
     }
 
     /**
-     *
-     */
-    private void startMemoryPolicies() {
-        for (DataRegion memPlc : dataRegionMap.values()) {
-            memPlc.pageMemory().start();
-
-            memPlc.evictionTracker().start();
-        }
-    }
-
-    /**
      * @param memCfg Database config.
      * @throws IgniteCheckedException If failed to initialize swap path.
      */
@@ -320,7 +356,7 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
             dfltDataRegion = memPlc;
         else if (dataRegionName.equals(DFLT_DATA_REG_DEFAULT_NAME))
             U.warn(log, "Data Region with name 'default' isn't used as a default. " +
-                    "Please check Memory Policies configuration.");
+                    "Please, check Data Region configuration.");
     }
 
     /**
@@ -731,32 +767,6 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
         onDeActivate(true);
     }
 
-    /**
-     * Unregister MBean.
-     * @param name Name of mbean.
-     */
-    private void unregisterMBean(String name) {
-        if(U.IGNITE_MBEANS_DISABLED)
-            return;
-
-        IgniteConfiguration cfg = cctx.gridConfig();
-
-        try {
-            cfg.getMBeanServer().unregisterMBean(
-                U.makeMBeanName(
-                    cfg.getIgniteInstanceName(),
-                    "DataRegionMetrics", name
-                    ));
-        }
-        catch (InstanceNotFoundException ignored) {
-            // We tried to unregister a non-existing MBean, not a big deal.
-        }
-        catch (Throwable e) {
-            U.error(log, "Failed to unregister MBean for memory metrics: " +
-                name, e);
-        }
-    }
-
     /** {@inheritDoc} */
     @Override public boolean checkpointLockIsHeldByThread() {
         return true;
@@ -1197,9 +1207,13 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
 
         assert cfg != null;
 
-        registerMetricsMBeans();
+        registerMetricsMBeans(cctx.gridConfig());
 
-        startMemoryPolicies();
+        for (DataRegion memPlc : dataRegionMap.values()) {
+            memPlc.pageMemory().start();
+
+            memPlc.evictionTracker().start();
+        }
 
         initPageMemoryDataStructures(cfg);
 
@@ -1226,7 +1240,11 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
 
                 memPlc.evictionTracker().stop();
 
-                unregisterMBean(memPlc.memoryMetrics().getName());
+                unregisterMetricsMBean(
+                    cctx.gridConfig(),
+                    MBEAN_GROUP_NAME,
+                    memPlc.memoryMetrics().getName()
+                );
             }
 
             dataRegionMap.clear();

http://git-wip-us.apache.org/repos/asf/ignite/blob/bdb22399/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteNoParrallelClusterIsAllowedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteNoParrallelClusterIsAllowedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteNoParrallelClusterIsAllowedTest.java
index 5c986ee..7180d7b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteNoParrallelClusterIsAllowedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteNoParrallelClusterIsAllowedTest.java
@@ -76,7 +76,7 @@ public class IgniteNoParrallelClusterIsAllowedTest extends IgniteChangeGlobalSta
             while (true) {
                 String message = e.getMessage();
 
-                if (message.contains("Failed to acquire file lock during"))
+                if (message.contains("Failed to acquire file lock ["))
                     break;
 
                 if (e.getCause() != null)


[16/28] ignite git commit: IGNITE-9753 Several optimization of validate_indexes - Fixes #5063.

Posted by sb...@apache.org.
IGNITE-9753 Several optimization of validate_indexes - Fixes #5063.

Signed-off-by: Dmitriy Govorukhin <dm...@gmail.com>


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

Branch: refs/heads/ignite-627
Commit: 1fe02df8daa94ca0761049cd41659f4ae18f580c
Parents: 594aac8
Author: Ivan Daschinskiy <iv...@gmail.com>
Authored: Mon Oct 29 12:14:54 2018 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Mon Oct 29 12:14:54 2018 +0300

----------------------------------------------------------------------
 .../internal/commandline/CommandHandler.java    |  34 ++-
 .../visor/verify/IndexIntegrityCheckIssue.java  |  74 +++++++
 .../verify/VisorValidateIndexesJobResult.java   |  30 ++-
 .../resources/META-INF/classnames.properties    |   1 +
 .../visor/verify/ValidateIndexesClosure.java    | 205 ++++++++++++++++---
 .../util/GridCommandHandlerIndexingTest.java    | 152 ++++++++------
 6 files changed, 398 insertions(+), 98 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1fe02df8/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 35981b5..c1853f8 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
@@ -95,6 +95,7 @@ import org.apache.ignite.internal.visor.tx.VisorTxSortOrder;
 import org.apache.ignite.internal.visor.tx.VisorTxTask;
 import org.apache.ignite.internal.visor.tx.VisorTxTaskArg;
 import org.apache.ignite.internal.visor.tx.VisorTxTaskResult;
+import org.apache.ignite.internal.visor.verify.IndexIntegrityCheckIssue;
 import org.apache.ignite.internal.visor.verify.IndexValidationIssue;
 import org.apache.ignite.internal.visor.verify.ValidateIndexesPartitionResult;
 import org.apache.ignite.internal.visor.verify.VisorContentionTask;
@@ -780,9 +781,20 @@ public class CommandHandler {
             }
         }
 
-        boolean errors = false;
-
         for (Map.Entry<UUID, VisorValidateIndexesJobResult> nodeEntry : taskRes.results().entrySet()) {
+            boolean errors = false;
+
+            log("validate_indexes result on node " + nodeEntry.getKey() + ":");
+
+            Collection<IndexIntegrityCheckIssue> integrityCheckFailures = nodeEntry.getValue().integrityCheckFailures();
+
+            if (!integrityCheckFailures.isEmpty()) {
+                errors = true;
+
+                for (IndexIntegrityCheckIssue is : integrityCheckFailures)
+                    log("\t" + is.toString());
+            }
+
             Map<PartitionKey, ValidateIndexesPartitionResult> partRes = nodeEntry.getValue().partitionResult();
 
             for (Map.Entry<PartitionKey, ValidateIndexesPartitionResult> e : partRes.entrySet()) {
@@ -791,10 +803,10 @@ public class CommandHandler {
                 if (!res.issues().isEmpty()) {
                     errors = true;
 
-                    log(e.getKey().toString() + " " + e.getValue().toString());
+                    log("\t" + e.getKey().toString() + " " + e.getValue().toString());
 
                     for (IndexValidationIssue is : res.issues())
-                        log(is.toString());
+                        log("\t\t" + is.toString());
                 }
             }
 
@@ -806,18 +818,18 @@ public class CommandHandler {
                 if (!res.issues().isEmpty()) {
                     errors = true;
 
-                    log("SQL Index " + e.getKey() + " " + e.getValue().toString());
+                    log("\tSQL Index " + e.getKey() + " " + e.getValue().toString());
 
                     for (IndexValidationIssue is : res.issues())
-                        log(is.toString());
+                        log("\t\t" + is.toString());
                 }
             }
-        }
 
-        if (!errors)
-            log("validate_indexes has finished, no issues found.");
-        else
-            log("validate_indexes has finished with errors (listed above).");
+            if (!errors)
+                log("no issues found.\n");
+            else
+                log("issues found (listed above).\n");
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/1fe02df8/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/IndexIntegrityCheckIssue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/IndexIntegrityCheckIssue.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/IndexIntegrityCheckIssue.java
new file mode 100644
index 0000000..ec6e5b2
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/IndexIntegrityCheckIssue.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.verify;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ *
+ */
+public class IndexIntegrityCheckIssue extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Cache group name. */
+    private String grpName;
+
+    /** T. */
+    @GridToStringExclude
+    private Throwable t;
+
+    /**
+     *
+     */
+    public IndexIntegrityCheckIssue() {
+        // Default constructor required for Externalizable.
+    }
+
+    /**
+     * @param grpName Group name.
+     * @param t Data integrity check error.
+     */
+    public IndexIntegrityCheckIssue(String grpName, Throwable t) {
+        this.grpName = grpName;
+        this.t = t;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, this.grpName);
+        out.writeObject(t);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        this.grpName = U.readString(in);
+        this.t = (Throwable)in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(IndexIntegrityCheckIssue.class, this) + ", " + t.getClass() + ": " + t.getMessage();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1fe02df8/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesJobResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesJobResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesJobResult.java
index aa74323..f84fc1a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesJobResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesJobResult.java
@@ -20,11 +20,14 @@ package org.apache.ignite.internal.visor.verify;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Map;
 import org.apache.ignite.internal.processors.cache.verify.PartitionKey;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.visor.VisorDataTransferObject;
+import org.jetbrains.annotations.NotNull;
 
 /**
  *
@@ -39,14 +42,22 @@ public class VisorValidateIndexesJobResult extends VisorDataTransferObject {
     /** Results of reverse indexes validation from node. */
     private Map<String, ValidateIndexesPartitionResult> idxRes;
 
+    /** Integrity check issues. */
+    private Collection<IndexIntegrityCheckIssue> integrityCheckFailures;
+
     /**
      * @param partRes Results of indexes validation from node.
      * @param idxRes Results of reverse indexes validation from node.
+     * @param  integrityCheckFailures Collection of indexes integrity check failures.
      */
-    public VisorValidateIndexesJobResult(Map<PartitionKey, ValidateIndexesPartitionResult> partRes,
-        Map<String, ValidateIndexesPartitionResult> idxRes) {
+    public VisorValidateIndexesJobResult(
+            @NotNull Map<PartitionKey, ValidateIndexesPartitionResult> partRes,
+            @NotNull Map<String, ValidateIndexesPartitionResult> idxRes,
+            @NotNull Collection<IndexIntegrityCheckIssue> integrityCheckFailures
+    ) {
         this.partRes = partRes;
         this.idxRes = idxRes;
+        this.integrityCheckFailures = integrityCheckFailures;
     }
 
     /**
@@ -57,7 +68,7 @@ public class VisorValidateIndexesJobResult extends VisorDataTransferObject {
 
     /** {@inheritDoc} */
     @Override public byte getProtocolVersion() {
-        return V2;
+        return V3;
     }
 
     /**
@@ -71,13 +82,21 @@ public class VisorValidateIndexesJobResult extends VisorDataTransferObject {
      * @return Results of reverse indexes validation from node.
      */
     public Map<String, ValidateIndexesPartitionResult> indexResult() {
-        return idxRes;
+        return idxRes == null ? Collections.emptyMap() : idxRes;
+    }
+
+    /**
+     * @return Collection of failed integrity checks.
+     */
+    public Collection<IndexIntegrityCheckIssue> integrityCheckFailures() {
+        return integrityCheckFailures == null ? Collections.emptyList() : integrityCheckFailures;
     }
 
     /** {@inheritDoc} */
     @Override protected void writeExternalData(ObjectOutput out) throws IOException {
         U.writeMap(out, partRes);
         U.writeMap(out, idxRes);
+        U.writeCollection(out, integrityCheckFailures);
     }
 
     /** {@inheritDoc} */
@@ -86,6 +105,9 @@ public class VisorValidateIndexesJobResult extends VisorDataTransferObject {
 
         if (protoVer >= V2)
             idxRes = U.readMap(in);
+
+        if (protoVer >= V3)
+            integrityCheckFailures = U.readCollection(in);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/1fe02df8/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index a0e2ba7..fda0fe4 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -2206,6 +2206,7 @@ org.apache.ignite.internal.visor.util.VisorEventMapper
 org.apache.ignite.internal.visor.util.VisorExceptionWrapper
 org.apache.ignite.internal.visor.util.VisorTaskUtils$4
 org.apache.ignite.internal.visor.verify.IndexValidationIssue
+org.apache.ignite.internal.visor.verify.IndexIntegrityCheckIssue
 org.apache.ignite.internal.visor.verify.ValidateIndexesPartitionResult
 org.apache.ignite.internal.visor.verify.VisorContentionJobResult
 org.apache.ignite.internal.visor.verify.VisorContentionTask

http://git-wip-us.apache.org/repos/asf/ignite/blob/1fe02df8/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 503b57c..ec02c25 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
@@ -18,6 +18,8 @@ package org.apache.ignite.internal.visor.verify;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -37,22 +39,29 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteInterruptedException;
 import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.pagemem.PageIdAllocator;
+import org.apache.ignite.internal.pagemem.PageIdUtils;
+import org.apache.ignite.internal.pagemem.store.PageStore;
 import org.apache.ignite.internal.processors.cache.CacheGroupContext;
 import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.CacheObjectContext;
 import org.apache.ignite.internal.processors.cache.CacheObjectUtils;
 import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition;
 import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState;
 import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
+import org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager;
 import org.apache.ignite.internal.processors.cache.verify.PartitionKey;
 import org.apache.ignite.internal.processors.query.GridQueryProcessor;
 import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
 import org.apache.ignite.internal.processors.query.QueryTypeDescriptorImpl;
 import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
+import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2Row;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
@@ -104,9 +113,15 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
     /** Counter of processed indexes. */
     private final AtomicInteger processedIndexes = new AtomicInteger(0);
 
+    /** Counter of integrity checked indexes. */
+    private final AtomicInteger integrityCheckedIndexes = new AtomicInteger(0);
+
     /** Total partitions. */
     private volatile int totalIndexes;
 
+    /** Total cache groups. */
+    private volatile  int totalCacheGrps;
+
     /** Last progress print timestamp. */
     private final AtomicLong lastProgressPrintTs = new AtomicLong(0);
 
@@ -182,10 +197,14 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
         List<T2<CacheGroupContext, GridDhtLocalPartition>> partArgs = new ArrayList<>();
         List<T2<GridCacheContext, Index>> idxArgs = new ArrayList<>();
 
+        totalCacheGrps = grpIds.size();
+
+        Map<Integer, IndexIntegrityCheckIssue> integrityCheckResults = integrityCheckIndexesPartitions(grpIds);
+
         for (Integer grpId : grpIds) {
             CacheGroupContext grpCtx = ignite.context().cache().cacheGroup(grpId);
 
-            if (grpCtx == null)
+            if (grpCtx == null || integrityCheckResults.containsKey(grpId))
                 continue;
 
             List<GridDhtLocalPartition> parts = grpCtx.topology().localPartitions();
@@ -210,7 +229,8 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
                         ArrayList<Index> indexes = gridH2Tbl.getIndexes();
 
                         for (Index idx : indexes)
-                            idxArgs.add(new T2<>(ctx, idx));
+                            if (idx instanceof H2TreeIndex)
+                                idxArgs.add(new T2<>(ctx, idx));
                     }
                 }
             }
@@ -220,15 +240,15 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
         Collections.shuffle(partArgs);
         Collections.shuffle(idxArgs);
 
+        totalPartitions = partArgs.size();
+        totalIndexes = idxArgs.size();
+
         for (T2<CacheGroupContext, GridDhtLocalPartition> t2 : partArgs)
             procPartFutures.add(processPartitionAsync(t2.get1(), t2.get2()));
 
         for (T2<GridCacheContext, Index> t2 : idxArgs)
             procIdxFutures.add(processIndexAsync(t2.get1(), t2.get2()));
 
-        totalPartitions = procPartFutures.size();
-        totalIndexes = procIdxFutures.size();
-
         Map<PartitionKey, ValidateIndexesPartitionResult> partResults = new HashMap<>();
         Map<String, ValidateIndexesPartitionResult> idxResults = new HashMap<>();
 
@@ -250,6 +270,9 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
 
                 idxResults.putAll(idxRes);
             }
+
+            log.warning("ValidateIndexesClosure finished: processed " + totalPartitions + " partitions and "
+                    + totalIndexes + " indexes.");
         }
         catch (InterruptedException | ExecutionException e) {
             for (int j = curPart; j < procPartFutures.size(); j++)
@@ -258,15 +281,102 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
             for (int j = curIdx; j < procIdxFutures.size(); j++)
                 procIdxFutures.get(j).cancel(false);
 
-            if (e instanceof InterruptedException)
-                throw new IgniteInterruptedException((InterruptedException)e);
-            else if (e.getCause() instanceof IgniteException)
-                throw (IgniteException)e.getCause();
-            else
-                throw new IgniteException(e.getCause());
+            throw unwrapFutureException(e);
+        }
+
+        return new VisorValidateIndexesJobResult(partResults, idxResults, integrityCheckResults.values());
+    }
+
+    /**
+     * @param grpIds Group ids.
+     */
+    private Map<Integer, IndexIntegrityCheckIssue> integrityCheckIndexesPartitions(Set<Integer> grpIds) {
+        List<Future<T2<Integer, IndexIntegrityCheckIssue>>> integrityCheckFutures = new ArrayList<>(grpIds.size());
+
+        for (Integer grpId: grpIds) {
+            final CacheGroupContext grpCtx = ignite.context().cache().cacheGroup(grpId);
+
+            if (grpCtx == null) {
+                integrityCheckedIndexes.incrementAndGet();
+
+                continue;
+            }
+
+            Future<T2<Integer, IndexIntegrityCheckIssue>> checkFut =
+                    calcExecutor.submit(new Callable<T2<Integer, IndexIntegrityCheckIssue>>() {
+                        @Override public T2<Integer, IndexIntegrityCheckIssue> call() throws Exception {
+                            IndexIntegrityCheckIssue issue = integrityCheckIndexPartition(grpCtx);
+
+                            return new T2<>(grpCtx.groupId(), issue);
+                        }
+                    });
+
+            integrityCheckFutures.add(checkFut);
+        }
+
+        Map<Integer, IndexIntegrityCheckIssue> integrityCheckResults = new HashMap<>();
+
+        int curFut = 0;
+        try {
+            for (Future<T2<Integer, IndexIntegrityCheckIssue>> fut : integrityCheckFutures) {
+                T2<Integer, IndexIntegrityCheckIssue> res = fut.get();
+
+                if (res.getValue() != null)
+                    integrityCheckResults.put(res.getKey(), res.getValue());
+            }
+        }
+        catch (InterruptedException | ExecutionException e) {
+            for (int j = curFut; j < integrityCheckFutures.size(); j++)
+                integrityCheckFutures.get(j).cancel(false);
+
+            throw unwrapFutureException(e);
+        }
+
+        return integrityCheckResults;
+    }
+
+    /**
+     * @param gctx Cache group context.
+     */
+    private IndexIntegrityCheckIssue integrityCheckIndexPartition(CacheGroupContext gctx) {
+        GridKernalContext ctx = ignite.context();
+        GridCacheSharedContext cctx = ctx.cache().context();
+
+        try {
+            FilePageStoreManager pageStoreMgr = (FilePageStoreManager)cctx.pageStore();
+
+            if (pageStoreMgr == null)
+                return null;
+
+            int pageSz = gctx.dataRegion().pageMemory().pageSize();
+
+            PageStore pageStore = pageStoreMgr.getStore(gctx.groupId(), PageIdAllocator.INDEX_PARTITION);
+
+            long pageId = PageIdUtils.pageId(PageIdAllocator.INDEX_PARTITION, PageIdAllocator.FLAG_IDX, 0);
+
+            ByteBuffer buf = ByteBuffer.allocateDirect(pageSz);
+
+            buf.order(ByteOrder.nativeOrder());
+
+            for (int pageNo = 0; pageNo < pageStore.pages(); pageId++, pageNo++) {
+                buf.clear();
+
+                pageStore.read(pageId, buf, true);
+            }
+
+            return null;
         }
+        catch (Throwable t) {
+            log.error("Integrity check of index partition of cache group " + gctx.cacheOrGroupName() + " failed", t);
+
+            return new IndexIntegrityCheckIssue(gctx.cacheOrGroupName(), t);
+        }
+        finally {
+            integrityCheckedIndexes.incrementAndGet();
 
-        return new VisorValidateIndexesJobResult(partResults, idxResults);
+            printProgressIfNeeded("Current progress of ValidateIndexesClosure: checked integrity of "
+                    + integrityCheckedIndexes.get() + " index partitions of " + totalCacheGrps + " cache groups");
+        }
     }
 
     /**
@@ -371,6 +481,19 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
                 if (cacheCtx == null)
                     throw new IgniteException("Unknown cacheId of CacheDataRow: " + cacheId);
 
+                if (row.link() == 0L) {
+                    String errMsg = "Invalid partition row, possibly deleted";
+
+                    log.error(errMsg);
+
+                    IndexValidationIssue is = new IndexValidationIssue(null, cacheCtx.name(), null,
+                            new IgniteCheckedException(errMsg));
+
+                    enoughIssues |= partRes.reportIssue(is);
+
+                    continue;
+                }
+
                 try {
                     QueryTypeDescriptorImpl res = (QueryTypeDescriptorImpl)m.invoke(
                         qryProcessor, cacheCtx.name(), cacheCtx.cacheObjectContext(), row.key(), row.value(), true);
@@ -392,6 +515,9 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
                     ArrayList<Index> indexes = gridH2Tbl.getIndexes();
 
                     for (Index idx : indexes) {
+                        if (!(idx instanceof H2TreeIndex))
+                            continue;
+
                         try {
                             Cursor cursor = idx.find((Session) null, h2Row, h2Row);
 
@@ -434,7 +560,7 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
         finally {
             part.release();
 
-            printProgressIfNeeded();
+            printProgressOfIndexValidationIfNeeded();
         }
 
         PartitionKey partKey = new PartitionKey(grpCtx.groupId(), part.id(), grpCtx.cacheOrGroupName());
@@ -447,16 +573,21 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
     /**
      *
      */
-    private void printProgressIfNeeded() {
-        long curTs = U.currentTimeMillis();
+    private void printProgressOfIndexValidationIfNeeded() {
+        printProgressIfNeeded("Current progress of ValidateIndexesClosure: processed " +
+                processedPartitions.get() + " of " + totalPartitions + " partitions, " +
+                processedIndexes.get() + " of " + totalIndexes + " SQL indexes");
+    }
 
+    /**
+     *
+     */
+    private void printProgressIfNeeded(String msg) {
+        long curTs = U.currentTimeMillis();
         long lastTs = lastProgressPrintTs.get();
 
-        if (curTs - lastTs >= 60_000 && lastProgressPrintTs.compareAndSet(lastTs, curTs)) {
-            log.warning("Current progress of ValidateIndexesClosure: processed " +
-                processedPartitions.get() + " of " + totalPartitions + " partitions, " +
-                processedIndexes.get() + " of " + totalIndexes + " SQL indexes");
-        }
+        if (curTs - lastTs >= 60_000 && lastProgressPrintTs.compareAndSet(lastTs, curTs))
+            log.warning(msg);
     }
 
     /**
@@ -546,12 +677,14 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
 
                 h2key = h2Row.key();
 
-                CacheDataRow cacheDataStoreRow = ctx.group().offheap().read(ctx, h2key);
+                if (h2Row.link() != 0L) {
+                    CacheDataRow cacheDataStoreRow = ctx.group().offheap().read(ctx, h2key);
 
-                if (cacheDataStoreRow == null)
-                    throw new IgniteCheckedException("Key is present in SQL index, but can't be found in CacheDataTree.");
-
-                previousKey = h2key;
+                    if (cacheDataStoreRow == null)
+                        throw new IgniteCheckedException("Key is present in SQL index, but can't be found in CacheDataTree.");
+                }
+                else
+                    throw new IgniteCheckedException("Invalid index row, possibly deleted " + h2Row);
             }
             catch (Throwable t) {
                 Object o = CacheObjectUtils.unwrapBinaryIfNeeded(
@@ -564,14 +697,34 @@ public class ValidateIndexesClosure implements IgniteCallable<VisorValidateIndex
 
                 enoughIssues |= idxValidationRes.reportIssue(is);
             }
+            finally {
+                previousKey = h2key;
+            }
         }
 
         String uniqueIdxName = "[cache=" + ctx.name() + ", idx=" + idx.getName() + "]";
 
         processedIndexes.incrementAndGet();
 
-        printProgressIfNeeded();
+        printProgressOfIndexValidationIfNeeded();
 
         return Collections.singletonMap(uniqueIdxName, idxValidationRes);
     }
+
+    /**
+     * @param e Future result exception.
+     * @return Unwrapped exception.
+     */
+    private IgniteException unwrapFutureException(Exception e) {
+        assert e instanceof InterruptedException || e instanceof ExecutionException : "Expecting either InterruptedException " +
+                "or ExecutionException";
+
+        if (e instanceof InterruptedException)
+            return new IgniteInterruptedException((InterruptedException)e);
+        else if (e.getCause() instanceof IgniteException)
+            return  (IgniteException)e.getCause();
+        else
+            return new IgniteException(e.getCause());
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/1fe02df8/modules/indexing/src/test/java/org/apache/ignite/util/GridCommandHandlerIndexingTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/util/GridCommandHandlerIndexingTest.java b/modules/indexing/src/test/java/org/apache/ignite/util/GridCommandHandlerIndexingTest.java
index 48e94c1..c7693d2 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/util/GridCommandHandlerIndexingTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/util/GridCommandHandlerIndexingTest.java
@@ -17,6 +17,9 @@
 
 package org.apache.ignite.util;
 
+import java.io.File;
+import java.io.IOException;
+import java.io.RandomAccessFile;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -24,8 +27,8 @@ import java.util.List;
 import java.util.concurrent.ThreadLocalRandom;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteDataStreamer;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.cache.QueryEntity;
@@ -39,6 +42,7 @@ import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManager;
 import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition;
 import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
 import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
+import org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager;
 import org.apache.ignite.internal.processors.cache.tree.SearchRow;
 import org.apache.ignite.internal.processors.query.GridQueryProcessor;
 import org.apache.ignite.internal.util.lang.GridIterator;
@@ -47,57 +51,35 @@ import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
 import static org.apache.ignite.internal.commandline.CommandHandler.EXIT_CODE_OK;
+import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.INDEX_FILE_NAME;
 
 /**
  *
  */
 public class GridCommandHandlerIndexingTest extends GridCommandHandlerTest {
+    /** Test cache name. */
+    private static final String CACHE_NAME = "persons-cache-vi";
+
     /**
      * Tests that validation doesn't fail if nothing is broken.
      */
     public void testValidateIndexesNoErrors() throws Exception {
-        Ignite ignite = startGrids(2);
-
-        ignite.cluster().active(true);
-
-        Ignite client = startGrid("client");
-
-        String cacheName = "persons-cache-vi";
-
-        IgniteCache<Integer, Person> personCache = createPersonCache(client, cacheName);
-
-        ThreadLocalRandom rand = ThreadLocalRandom.current();
-
-        for (int i = 0; i < 10_000; i++)
-            personCache.put(i, new Person(rand.nextInt(), String.valueOf(rand.nextLong())));
+        prepareGridForTest();
 
         injectTestSystemOut();
 
-        assertEquals(EXIT_CODE_OK, execute("--cache", "validate_indexes", cacheName));
+        assertEquals(EXIT_CODE_OK, execute("--cache", "validate_indexes", CACHE_NAME));
 
-        assertTrue(testOut.toString().contains("validate_indexes has finished, no issues found"));
+        assertTrue(testOut.toString().contains("no issues found"));
     }
 
     /**
      * Tests that missing rows in CacheDataTree are detected.
      */
     public void testBrokenCacheDataTreeShouldFailValidation() throws Exception {
-        Ignite ignite = startGrids(2);
+        Ignite ignite = prepareGridForTest();
 
-        ignite.cluster().active(true);
-
-        Ignite client = startGrid("client");
-
-        String cacheName = "persons-cache-vi";
-
-        IgniteCache<Integer, Person> personCache = createPersonCache(client, cacheName);
-
-        ThreadLocalRandom rand = ThreadLocalRandom.current();
-
-        for (int i = 0; i < 10_000; i++)
-            personCache.put(i, new Person(rand.nextInt(), String.valueOf(rand.nextLong())));
-
-        breakCacheDataTree(ignite, cacheName, 1);
+        breakCacheDataTree(ignite, CACHE_NAME, 1);
 
         injectTestSystemOut();
 
@@ -105,11 +87,11 @@ public class GridCommandHandlerIndexingTest extends GridCommandHandlerTest {
             execute(
                 "--cache",
                 "validate_indexes",
-                cacheName,
+                CACHE_NAME,
                 "checkFirst", "10000",
                 "checkThrough", "10"));
 
-        assertTrue(testOut.toString().contains("validate_indexes has finished with errors"));
+        assertTrue(testOut.toString().contains("issues found (listed above)"));
 
         assertTrue(testOut.toString().contains(
             "Key is present in SQL index, but is missing in corresponding data page."));
@@ -119,6 +101,46 @@ public class GridCommandHandlerIndexingTest extends GridCommandHandlerTest {
      * Tests that missing rows in H2 indexes are detected.
      */
     public void testBrokenSqlIndexShouldFailValidation() throws Exception {
+        Ignite ignite = prepareGridForTest();
+
+        breakSqlIndex(ignite, CACHE_NAME);
+
+        injectTestSystemOut();
+
+        assertEquals(EXIT_CODE_OK, execute("--cache", "validate_indexes", CACHE_NAME));
+
+        assertTrue(testOut.toString().contains("issues found (listed above)"));
+    }
+
+    /**
+     * Tests that missing rows in H2 indexes are detected.
+     */
+    public void testCorruptedIndexPartitionShouldFailValidation() throws Exception {
+        Ignite ignite = prepareGridForTest();
+
+        forceCheckpoint();
+
+        File idxPath = indexPartition(ignite, CACHE_NAME);
+
+        stopAllGrids();
+
+        corruptIndexPartition(idxPath);
+
+        startGrids(2);
+
+        awaitPartitionMapExchange();
+
+        injectTestSystemOut();
+
+        assertEquals(EXIT_CODE_OK, execute("--cache", "validate_indexes", CACHE_NAME));
+
+        assertTrue(testOut.toString().contains("issues found (listed above)"));
+    }
+
+    /**
+     *
+     */
+    private Ignite prepareGridForTest() throws Exception{
         Ignite ignite = startGrids(2);
 
         ignite.cluster().active(true);
@@ -127,20 +149,52 @@ public class GridCommandHandlerIndexingTest extends GridCommandHandlerTest {
 
         String cacheName = "persons-cache-vi";
 
-        IgniteCache<Integer, Person> personCache = createPersonCache(client, cacheName);
+        client.getOrCreateCache(new CacheConfiguration<Integer, Person>()
+                .setName(cacheName)
+                .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
+                .setAtomicityMode(CacheAtomicityMode.ATOMIC)
+                .setBackups(1)
+                .setQueryEntities(F.asList(personEntity(true, true)))
+                .setAffinity(new RendezvousAffinityFunction(false, 32)));
 
         ThreadLocalRandom rand = ThreadLocalRandom.current();
 
-        for (int i = 0; i < 10_000; i++)
-            personCache.put(i, new Person(rand.nextInt(), String.valueOf(rand.nextLong())));
+        try (IgniteDataStreamer<Integer, Person> streamer = client.dataStreamer(CACHE_NAME);) {
+            for (int i = 0; i < 10_000; i++)
+                streamer.addData(i, new Person(rand.nextInt(), String.valueOf(rand.nextLong())));
+        }
 
-        breakSqlIndex(ignite, cacheName);
+        return ignite;
+    }
 
-        injectTestSystemOut();
+    /**
+     * Get index partition file for specific node and cache.
+     */
+    private File indexPartition(Ignite ig, String cacheName) {
+        IgniteEx ig0 = (IgniteEx)ig;
 
-        assertEquals(EXIT_CODE_OK, execute("--cache", "validate_indexes", cacheName));
+        FilePageStoreManager pageStoreManager = ((FilePageStoreManager) ig0.context().cache().context().pageStore());
 
-        assertTrue(testOut.toString().contains("validate_indexes has finished with errors"));
+        return new File(pageStoreManager.cacheWorkDir(false, cacheName), INDEX_FILE_NAME);
+    }
+
+    /**
+     * Write some random trash in index partition.
+     */
+    private void corruptIndexPartition(File path) throws IOException {
+        assertTrue(path.exists());
+
+        ThreadLocalRandom rand = ThreadLocalRandom.current();
+
+        try (RandomAccessFile idx = new RandomAccessFile(path, "rw")) {
+            byte[] trash = new byte[1024];
+
+            rand.nextBytes(trash);
+
+            idx.seek(4096);
+
+            idx.write(trash);
+        }
     }
 
     /**
@@ -242,22 +296,6 @@ public class GridCommandHandlerIndexingTest extends GridCommandHandlerTest {
     }
 
     /**
-     * Dynamically creates cache with SQL indexes.
-     *
-     * @param ig Client.
-     * @param cacheName Cache name.
-     */
-    private IgniteCache<Integer, Person> createPersonCache(Ignite ig, String cacheName) {
-        return ig.getOrCreateCache(new CacheConfiguration<Integer, Person>()
-            .setName(cacheName)
-            .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
-            .setAtomicityMode(CacheAtomicityMode.ATOMIC)
-            .setBackups(1)
-            .setQueryEntities(F.asList(personEntity(true, true)))
-            .setAffinity(new RendezvousAffinityFunction(false, 32)));
-    }
-
-    /**
      * @param idxName Index name.
      * @param idxOrgId Index org id.
      */


[18/28] ignite git commit: IGNITE-9790 Fixed delayed full message handling in case of changed coordinator. - Fixes #5190.

Posted by sb...@apache.org.
IGNITE-9790 Fixed delayed full message handling in case of changed coordinator. - Fixes #5190.

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

Branch: refs/heads/ignite-627
Commit: 2906a16522279802a6002f9fba009978225afad3
Parents: 7000e6e
Author: Pavel Kovalenko <jo...@gmail.com>
Authored: Mon Oct 29 12:35:30 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Oct 29 13:01:09 2018 +0300

----------------------------------------------------------------------
 .../GridDhtPartitionsExchangeFuture.java        | 14 ++---
 .../preloader/GridDhtPartitionsFullMessage.java | 16 ++++-
 ...rtitionsExchangeCoordinatorFailoverTest.java | 64 ++++++++++++++++++++
 3 files changed, 85 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2906a165/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 23e47e5..0fc9c24 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
@@ -181,7 +181,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
     private List<ClusterNode> srvNodes;
 
     /** */
-    private ClusterNode crd;
+    private volatile ClusterNode crd;
 
     /** ExchangeFuture id. */
     private final GridDhtPartitionExchangeId exchId;
@@ -4550,12 +4550,12 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
      * @return {@code True} If partition changes triggered by receiving Single/Full messages are not finished yet.
      */
     public boolean partitionChangesInProgress() {
-        boolean isCoordinator = crd.equals(cctx.localNode());
+        ClusterNode crd0 = crd;
 
-        if (isCoordinator)
-            return !partitionsSent;
-        else
-            return !partitionsReceived;
+        if (crd0 == null)
+            return false;
+
+        return crd0.equals(cctx.localNode()) ? !partitionsSent : !partitionsReceived;
     }
 
     /**
@@ -4589,7 +4589,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
             });
         }
         else
-            delayedLatestMsg.merge(fullMsg);
+            delayedLatestMsg.merge(fullMsg, cctx.discovery());
 
         return true;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/2906a165/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
index b84dc79..a63ab70 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
@@ -25,8 +25,10 @@ import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.GridDirectMap;
 import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState;
@@ -803,7 +805,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
      *
      * @param other Other full message.
      */
-    public void merge(GridDhtPartitionsFullMessage other) {
+    public void merge(GridDhtPartitionsFullMessage other, GridDiscoveryManager discovery) {
         assert other.exchangeId() == null && exchangeId() == null :
             "Both current and merge full message must have exchangeId == null"
              + other.exchangeId() + "," + exchangeId();
@@ -814,8 +816,18 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
 
             GridDhtPartitionFullMap currMap = partitions().get(grpId);
 
-            if (currMap == null || updMap.compareTo(currMap) >= 0)
+            if (currMap == null)
                 partitions().put(grpId, updMap);
+            else {
+                ClusterNode currentMapSentBy = discovery.node(currMap.nodeId());
+                ClusterNode newMapSentBy = discovery.node(updMap.nodeId());
+
+                if (newMapSentBy == null)
+                    return;
+
+                if (currentMapSentBy == null || newMapSentBy.order() > currentMapSentBy.order() || updMap.compareTo(currMap) >= 0)
+                    partitions().put(grpId, updMap);
+            }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/2906a165/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionsExchangeCoordinatorFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionsExchangeCoordinatorFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionsExchangeCoordinatorFailoverTest.java
index a2adcf7..1c847f9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionsExchangeCoordinatorFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionsExchangeCoordinatorFailoverTest.java
@@ -152,4 +152,68 @@ public class PartitionsExchangeCoordinatorFailoverTest extends GridCommonAbstrac
             cache.put(0, 0);
         }
     }
+
+    /**
+     * Test checks that delayed full messages are processed correctly in case of changed coordinator.
+     *
+     * @throws Exception If failed.
+     */
+    public void testDelayedFullMessageReplacedIfCoordinatorChanged() throws Exception {
+        IgniteEx crd = startGrid("crd");
+
+        IgniteEx newCrd = startGrid(1);
+
+        IgniteEx problemNode = startGrid(2);
+
+        crd.cluster().active(true);
+
+        awaitPartitionMapExchange();
+
+        blockSendingFullMessage(crd, problemNode);
+
+        IgniteInternalFuture joinNextNodeFut = GridTestUtils.runAsync(() -> startGrid(3));
+
+        joinNextNodeFut.get();
+
+        U.sleep(5000);
+
+        blockSendingFullMessage(newCrd, problemNode);
+
+        IgniteInternalFuture stopCoordinatorFut = GridTestUtils.runAsync(() -> stopGrid("crd"));
+
+        stopCoordinatorFut.get();
+
+        U.sleep(5000);
+
+        TestRecordingCommunicationSpi spi = TestRecordingCommunicationSpi.spi(newCrd);
+
+        spi.stopBlock(true);
+
+        awaitPartitionMapExchange();
+    }
+
+    /**
+     * Blocks sending full message from coordinator to non-coordinator node.
+     * @param from Coordinator node.
+     * @param to Non-coordinator node.
+     */
+    private void blockSendingFullMessage(IgniteEx from, IgniteEx to) {
+        // Block FullMessage for newly joined nodes.
+        TestRecordingCommunicationSpi spi = TestRecordingCommunicationSpi.spi(from);
+
+        // Delay sending full messages (without exchange id).
+        spi.blockMessages((node, msg) -> {
+            if (msg instanceof GridDhtPartitionsFullMessage) {
+                GridDhtPartitionsFullMessage fullMsg = (GridDhtPartitionsFullMessage) msg;
+
+                if (fullMsg.exchangeId() != null && node.order() == to.localNode().order()) {
+                    log.warning("Blocked sending " + msg + " to " + to.localNode());
+
+                    return true;
+                }
+            }
+
+            return false;
+        });
+    }
 }


[06/28] ignite git commit: IGNITE-9910: [ML] Move the static copy-pasted datasets from examples to special Util class

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/svm/binary/SVMBinaryClassificationExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/svm/binary/SVMBinaryClassificationExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/svm/binary/SVMBinaryClassificationExample.java
index c219441..679bd77 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/svm/binary/SVMBinaryClassificationExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/svm/binary/SVMBinaryClassificationExample.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.examples.ml.svm.binary;
 
+import java.io.FileNotFoundException;
 import java.util.Arrays;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
@@ -24,9 +25,9 @@ import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.TestCache;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
-import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
+import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
+import org.apache.ignite.examples.ml.util.SandboxMLCache;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.svm.SVMLinearBinaryClassificationModel;
 import org.apache.ignite.ml.svm.SVMLinearBinaryClassificationTrainer;
 
@@ -46,22 +47,23 @@ import org.apache.ignite.ml.svm.SVMLinearBinaryClassificationTrainer;
  */
 public class SVMBinaryClassificationExample {
     /** Run example. */
-    public static void main(String[] args) throws InterruptedException {
+    public static void main(String[] args) throws FileNotFoundException {
         System.out.println();
         System.out.println(">>> SVM Binary classification model over cached dataset usage example started.");
         // Start ignite grid.
         try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
             System.out.println(">>> Ignite grid started.");
 
-            IgniteCache<Integer, double[]> dataCache = new TestCache(ignite).fillCacheWith(data);
+            IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
+                .fillCacheWith(MLSandboxDatasets.TWO_CLASSED_IRIS);
 
             SVMLinearBinaryClassificationTrainer trainer = new SVMLinearBinaryClassificationTrainer();
 
             SVMLinearBinaryClassificationModel mdl = trainer.fit(
                 ignite,
                 dataCache,
-                (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
-                (k, v) -> v[0]
+                (k, v) -> v.copyOfRange(1, v.size()),
+                (k, v) -> v.get(0)
             );
 
             System.out.println(">>> SVM model " + mdl);
@@ -76,13 +78,13 @@ public class SVMBinaryClassificationExample {
             // Build confusion matrix. See https://en.wikipedia.org/wiki/Confusion_matrix
             int[][] confusionMtx = {{0, 0}, {0, 0}};
 
-            try (QueryCursor<Cache.Entry<Integer, double[]>> observations = dataCache.query(new ScanQuery<>())) {
-                for (Cache.Entry<Integer, double[]> observation : observations) {
-                    double[] val = observation.getValue();
-                    double[] inputs = Arrays.copyOfRange(val, 1, val.length);
-                    double groundTruth = val[0];
+            try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(new ScanQuery<>())) {
+                for (Cache.Entry<Integer, Vector> observation : observations) {
+                    Vector val = observation.getValue();
+                    Vector inputs = val.copyOfRange(1, val.size());
+                    double groundTruth = val.get(0);
 
-                    double prediction = mdl.apply(new DenseVector(inputs));
+                    double prediction = mdl.apply(inputs);
 
                     totalAmount++;
                     if(groundTruth != prediction)
@@ -107,108 +109,4 @@ public class SVMBinaryClassificationExample {
             System.out.println(">>> Linear regression model over cache based dataset usage example completed.");
         }
     }
-
-    /** The 1st and 2nd classes from the Iris dataset. */
-    private static final double[][] data = {
-        {0, 5.1, 3.5, 1.4, 0.2},
-        {0, 4.9, 3, 1.4, 0.2},
-        {0, 4.7, 3.2, 1.3, 0.2},
-        {0, 4.6, 3.1, 1.5, 0.2},
-        {0, 5, 3.6, 1.4, 0.2},
-        {0, 5.4, 3.9, 1.7, 0.4},
-        {0, 4.6, 3.4, 1.4, 0.3},
-        {0, 5, 3.4, 1.5, 0.2},
-        {0, 4.4, 2.9, 1.4, 0.2},
-        {0, 4.9, 3.1, 1.5, 0.1},
-        {0, 5.4, 3.7, 1.5, 0.2},
-        {0, 4.8, 3.4, 1.6, 0.2},
-        {0, 4.8, 3, 1.4, 0.1},
-        {0, 4.3, 3, 1.1, 0.1},
-        {0, 5.8, 4, 1.2, 0.2},
-        {0, 5.7, 4.4, 1.5, 0.4},
-        {0, 5.4, 3.9, 1.3, 0.4},
-        {0, 5.1, 3.5, 1.4, 0.3},
-        {0, 5.7, 3.8, 1.7, 0.3},
-        {0, 5.1, 3.8, 1.5, 0.3},
-        {0, 5.4, 3.4, 1.7, 0.2},
-        {0, 5.1, 3.7, 1.5, 0.4},
-        {0, 4.6, 3.6, 1, 0.2},
-        {0, 5.1, 3.3, 1.7, 0.5},
-        {0, 4.8, 3.4, 1.9, 0.2},
-        {0, 5, 3, 1.6, 0.2},
-        {0, 5, 3.4, 1.6, 0.4},
-        {0, 5.2, 3.5, 1.5, 0.2},
-        {0, 5.2, 3.4, 1.4, 0.2},
-        {0, 4.7, 3.2, 1.6, 0.2},
-        {0, 4.8, 3.1, 1.6, 0.2},
-        {0, 5.4, 3.4, 1.5, 0.4},
-        {0, 5.2, 4.1, 1.5, 0.1},
-        {0, 5.5, 4.2, 1.4, 0.2},
-        {0, 4.9, 3.1, 1.5, 0.1},
-        {0, 5, 3.2, 1.2, 0.2},
-        {0, 5.5, 3.5, 1.3, 0.2},
-        {0, 4.9, 3.1, 1.5, 0.1},
-        {0, 4.4, 3, 1.3, 0.2},
-        {0, 5.1, 3.4, 1.5, 0.2},
-        {0, 5, 3.5, 1.3, 0.3},
-        {0, 4.5, 2.3, 1.3, 0.3},
-        {0, 4.4, 3.2, 1.3, 0.2},
-        {0, 5, 3.5, 1.6, 0.6},
-        {0, 5.1, 3.8, 1.9, 0.4},
-        {0, 4.8, 3, 1.4, 0.3},
-        {0, 5.1, 3.8, 1.6, 0.2},
-        {0, 4.6, 3.2, 1.4, 0.2},
-        {0, 5.3, 3.7, 1.5, 0.2},
-        {0, 5, 3.3, 1.4, 0.2},
-        {1, 7, 3.2, 4.7, 1.4},
-        {1, 6.4, 3.2, 4.5, 1.5},
-        {1, 6.9, 3.1, 4.9, 1.5},
-        {1, 5.5, 2.3, 4, 1.3},
-        {1, 6.5, 2.8, 4.6, 1.5},
-        {1, 5.7, 2.8, 4.5, 1.3},
-        {1, 6.3, 3.3, 4.7, 1.6},
-        {1, 4.9, 2.4, 3.3, 1},
-        {1, 6.6, 2.9, 4.6, 1.3},
-        {1, 5.2, 2.7, 3.9, 1.4},
-        {1, 5, 2, 3.5, 1},
-        {1, 5.9, 3, 4.2, 1.5},
-        {1, 6, 2.2, 4, 1},
-        {1, 6.1, 2.9, 4.7, 1.4},
-        {1, 5.6, 2.9, 3.6, 1.3},
-        {1, 6.7, 3.1, 4.4, 1.4},
-        {1, 5.6, 3, 4.5, 1.5},
-        {1, 5.8, 2.7, 4.1, 1},
-        {1, 6.2, 2.2, 4.5, 1.5},
-        {1, 5.6, 2.5, 3.9, 1.1},
-        {1, 5.9, 3.2, 4.8, 1.8},
-        {1, 6.1, 2.8, 4, 1.3},
-        {1, 6.3, 2.5, 4.9, 1.5},
-        {1, 6.1, 2.8, 4.7, 1.2},
-        {1, 6.4, 2.9, 4.3, 1.3},
-        {1, 6.6, 3, 4.4, 1.4},
-        {1, 6.8, 2.8, 4.8, 1.4},
-        {1, 6.7, 3, 5, 1.7},
-        {1, 6, 2.9, 4.5, 1.5},
-        {1, 5.7, 2.6, 3.5, 1},
-        {1, 5.5, 2.4, 3.8, 1.1},
-        {1, 5.5, 2.4, 3.7, 1},
-        {1, 5.8, 2.7, 3.9, 1.2},
-        {1, 6, 2.7, 5.1, 1.6},
-        {1, 5.4, 3, 4.5, 1.5},
-        {1, 6, 3.4, 4.5, 1.6},
-        {1, 6.7, 3.1, 4.7, 1.5},
-        {1, 6.3, 2.3, 4.4, 1.3},
-        {1, 5.6, 3, 4.1, 1.3},
-        {1, 5.5, 2.5, 4, 1.3},
-        {1, 5.5, 2.6, 4.4, 1.2},
-        {1, 6.1, 3, 4.6, 1.4},
-        {1, 5.8, 2.6, 4, 1.2},
-        {1, 5, 2.3, 3.3, 1},
-        {1, 5.6, 2.7, 4.2, 1.3},
-        {1, 5.7, 3, 4.2, 1.2},
-        {1, 5.7, 2.9, 4.2, 1.3},
-        {1, 6.2, 2.9, 4.3, 1.3},
-        {1, 5.1, 2.5, 3, 1.1},
-        {1, 5.7, 2.8, 4.1, 1.3},
-    };
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/svm/multiclass/SVMMultiClassClassificationExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/svm/multiclass/SVMMultiClassClassificationExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/svm/multiclass/SVMMultiClassClassificationExample.java
index 520b8cc..987ac41 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/svm/multiclass/SVMMultiClassClassificationExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/svm/multiclass/SVMMultiClassClassificationExample.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.examples.ml.svm.multiclass;
 
+import java.io.FileNotFoundException;
 import java.util.Arrays;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
@@ -24,11 +25,10 @@ import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.TestCache;
+import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
+import org.apache.ignite.examples.ml.util.SandboxMLCache;
 import org.apache.ignite.ml.math.functions.IgniteBiFunction;
 import org.apache.ignite.ml.math.primitives.vector.Vector;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
-import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
 import org.apache.ignite.ml.preprocessing.minmaxscaling.MinMaxScalerTrainer;
 import org.apache.ignite.ml.svm.SVMLinearMultiClassClassificationModel;
 import org.apache.ignite.ml.svm.SVMLinearMultiClassClassificationTrainer;
@@ -48,74 +48,70 @@ import org.apache.ignite.ml.svm.SVMLinearMultiClassClassificationTrainer;
  * <a href="https://en.wikipedia.org/wiki/Confusion_matrix">confusion matrix</a>.</p>
  * <p>
  * You can change the test data used in this example and re-run it to explore this algorithm further.</p>
+ * NOTE: the smallest 3rd class could be classified via linear SVM here.
  */
 public class SVMMultiClassClassificationExample {
     /** Run example. */
-    public static void main(String[] args) throws InterruptedException {
+    public static void main(String[] args) throws FileNotFoundException {
         System.out.println();
         System.out.println(">>> SVM Multi-class classification model over cached dataset usage example started.");
         // Start ignite grid.
         try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
             System.out.println(">>> Ignite grid started.");
 
-            IgniteCache<Integer, Vector> dataCache = new TestCache(ignite).getVectors(data);
+            IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
+                .fillCacheWith(MLSandboxDatasets.GLASS_IDENTIFICATION);
 
             SVMLinearMultiClassClassificationTrainer trainer = new SVMLinearMultiClassClassificationTrainer();
 
             SVMLinearMultiClassClassificationModel mdl = trainer.fit(
                 ignite,
                 dataCache,
-                (k, v) -> {
-                    double[] arr = v.asArray();
-                    return VectorUtils.of(Arrays.copyOfRange(arr, 1, arr.length));
-                },
+                (k, v) -> v.copyOfRange(1, v.size()),
                 (k, v) -> v.get(0)
             );
 
             System.out.println(">>> SVM Multi-class model");
             System.out.println(mdl.toString());
 
-            MinMaxScalerTrainer<Integer, Vector> normalizationTrainer = new MinMaxScalerTrainer<>();
+            MinMaxScalerTrainer<Integer, Vector> minMaxScalerTrainer = new MinMaxScalerTrainer<>();
 
-            IgniteBiFunction<Integer, Vector, Vector> preprocessor = normalizationTrainer.fit(
+            IgniteBiFunction<Integer, Vector, Vector> preprocessor = minMaxScalerTrainer.fit(
                 ignite,
                 dataCache,
-                (k, v) -> {
-                    double[] arr = v.asArray();
-                    return VectorUtils.of(Arrays.copyOfRange(arr, 1, arr.length));
-                }
+                (k, v) -> v.copyOfRange(1, v.size())
             );
 
-            SVMLinearMultiClassClassificationModel mdlWithNormalization = trainer.fit(
+            SVMLinearMultiClassClassificationModel mdlWithScaling = trainer.fit(
                 ignite,
                 dataCache,
                 preprocessor,
                 (k, v) -> v.get(0)
             );
 
-            System.out.println(">>> SVM Multi-class model with minmaxscaling");
-            System.out.println(mdlWithNormalization.toString());
+            System.out.println(">>> SVM Multi-class model with MinMaxScaling");
+            System.out.println(mdlWithScaling.toString());
 
             System.out.println(">>> ----------------------------------------------------------------");
-            System.out.println(">>> | Prediction\t| Prediction with Normalization\t| Ground Truth\t|");
+            System.out.println(">>> | Prediction\t| Prediction with MinMaxScaling\t| Ground Truth\t|");
             System.out.println(">>> ----------------------------------------------------------------");
 
             int amountOfErrors = 0;
-            int amountOfErrorsWithNormalization = 0;
+            int amountOfErrorsWithMinMaxScaling = 0;
             int totalAmount = 0;
 
             // Build confusion matrix. See https://en.wikipedia.org/wiki/Confusion_matrix
             int[][] confusionMtx = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
-            int[][] confusionMtxWithNormalization = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
+            int[][] confusionMtxWithMinMaxScaling = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
 
             try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(new ScanQuery<>())) {
                 for (Cache.Entry<Integer, Vector> observation : observations) {
-                    double[] val = observation.getValue().asArray();
-                    double[] inputs = Arrays.copyOfRange(val, 1, val.length);
-                    double groundTruth = val[0];
+                    Vector val = observation.getValue();
+                    Vector inputs = val.copyOfRange(1, val.size());
+                    double groundTruth = val.get(0);
 
-                    double prediction = mdl.apply(new DenseVector(inputs));
-                    double predictionWithNormalization = mdlWithNormalization.apply(new DenseVector(inputs));
+                    double prediction = mdl.apply(inputs);
+                    double predictionWithMinMaxScaling = mdlWithScaling.apply(inputs);
 
                     totalAmount++;
 
@@ -129,15 +125,15 @@ public class SVMMultiClassClassificationExample {
                     confusionMtx[idx1][idx2]++;
 
                     // Collect data for model with minmaxscaling
-                    if(groundTruth != predictionWithNormalization)
-                        amountOfErrorsWithNormalization++;
+                    if (groundTruth != predictionWithMinMaxScaling)
+                        amountOfErrorsWithMinMaxScaling++;
 
-                    idx1 = (int)predictionWithNormalization == 1 ? 0 : ((int)predictionWithNormalization == 3 ? 1 : 2);
+                    idx1 = (int)predictionWithMinMaxScaling == 1 ? 0 : ((int)predictionWithMinMaxScaling == 3 ? 1 : 2);
                     idx2 = (int)groundTruth == 1 ? 0 : ((int)groundTruth == 3 ? 1 : 2);
 
-                    confusionMtxWithNormalization[idx1][idx2]++;
+                    confusionMtxWithMinMaxScaling[idx1][idx2]++;
 
-                    System.out.printf(">>> | %.4f\t\t| %.4f\t\t\t\t\t\t| %.4f\t\t|\n", prediction, predictionWithNormalization, groundTruth);
+                    System.out.printf(">>> | %.4f\t\t| %.4f\t\t\t\t\t\t| %.4f\t\t|\n", prediction, predictionWithMinMaxScaling, groundTruth);
                 }
                 System.out.println(">>> ----------------------------------------------------------------");
                 System.out.println("\n>>> -----------------SVM model-------------");
@@ -145,136 +141,13 @@ public class SVMMultiClassClassificationExample {
                 System.out.println("\n>>> Accuracy " + (1 - amountOfErrors / (double)totalAmount));
                 System.out.println("\n>>> Confusion matrix is " + Arrays.deepToString(confusionMtx));
 
-                System.out.println("\n>>> -----------------SVM model with Normalization-------------");
-                System.out.println("\n>>> Absolute amount of errors " + amountOfErrorsWithNormalization);
-                System.out.println("\n>>> Accuracy " + (1 - amountOfErrorsWithNormalization / (double)totalAmount));
-                System.out.println("\n>>> Confusion matrix is " + Arrays.deepToString(confusionMtxWithNormalization));
+                System.out.println("\n>>> -----------------SVM model with MinMaxScaling-------------");
+                System.out.println("\n>>> Absolute amount of errors " + amountOfErrorsWithMinMaxScaling);
+                System.out.println("\n>>> Accuracy " + (1 - amountOfErrorsWithMinMaxScaling / (double)totalAmount));
+                System.out.println("\n>>> Confusion matrix is " + Arrays.deepToString(confusionMtxWithMinMaxScaling));
 
                 System.out.println(">>> Linear regression model over cache based dataset usage example completed.");
             }
         }
     }
-
-    /** The preprocessed Glass dataset from the Machine Learning Repository https://archive.ics.uci.edu/ml/datasets/Glass+Identification
-     *  There are 3 classes with labels: 1 {building_windows_float_processed}, 3 {vehicle_windows_float_processed}, 7 {headlamps}.
-     *  Feature names: 'Na-Sodium', 'Mg-Magnesium', 'Al-Aluminum', 'Ba-Barium', 'Fe-Iron'.
-     */
-    private static final double[][] data = {
-        {1, 1.52101, 4.49, 1.10, 0.00, 0.00},
-        {1, 1.51761, 3.60, 1.36, 0.00, 0.00},
-        {1, 1.51618, 3.55, 1.54, 0.00, 0.00},
-        {1, 1.51766, 3.69, 1.29, 0.00, 0.00},
-        {1, 1.51742, 3.62, 1.24, 0.00, 0.00},
-        {1, 1.51596, 3.61, 1.62, 0.00, 0.26},
-        {1, 1.51743, 3.60, 1.14, 0.00, 0.00},
-        {1, 1.51756, 3.61, 1.05, 0.00, 0.00},
-        {1, 1.51918, 3.58, 1.37, 0.00, 0.00},
-        {1, 1.51755, 3.60, 1.36, 0.00, 0.11},
-        {1, 1.51571, 3.46, 1.56, 0.00, 0.24},
-        {1, 1.51763, 3.66, 1.27, 0.00, 0.00},
-        {1, 1.51589, 3.43, 1.40, 0.00, 0.24},
-        {1, 1.51748, 3.56, 1.27, 0.00, 0.17},
-        {1, 1.51763, 3.59, 1.31, 0.00, 0.00},
-        {1, 1.51761, 3.54, 1.23, 0.00, 0.00},
-        {1, 1.51784, 3.67, 1.16, 0.00, 0.00},
-        {1, 1.52196, 3.85, 0.89, 0.00, 0.00},
-        {1, 1.51911, 3.73, 1.18, 0.00, 0.00},
-        {1, 1.51735, 3.54, 1.69, 0.00, 0.07},
-        {1, 1.51750, 3.55, 1.49, 0.00, 0.19},
-        {1, 1.51966, 3.75, 0.29, 0.00, 0.00},
-        {1, 1.51736, 3.62, 1.29, 0.00, 0.00},
-        {1, 1.51751, 3.57, 1.35, 0.00, 0.00},
-        {1, 1.51720, 3.50, 1.15, 0.00, 0.00},
-        {1, 1.51764, 3.54, 1.21, 0.00, 0.00},
-        {1, 1.51793, 3.48, 1.41, 0.00, 0.00},
-        {1, 1.51721, 3.48, 1.33, 0.00, 0.00},
-        {1, 1.51768, 3.52, 1.43, 0.00, 0.00},
-        {1, 1.51784, 3.49, 1.28, 0.00, 0.00},
-        {1, 1.51768, 3.56, 1.30, 0.00, 0.14},
-        {1, 1.51747, 3.50, 1.14, 0.00, 0.00},
-        {1, 1.51775, 3.48, 1.23, 0.09, 0.22},
-        {1, 1.51753, 3.47, 1.38, 0.00, 0.06},
-        {1, 1.51783, 3.54, 1.34, 0.00, 0.00},
-        {1, 1.51567, 3.45, 1.21, 0.00, 0.00},
-        {1, 1.51909, 3.53, 1.32, 0.11, 0.00},
-        {1, 1.51797, 3.48, 1.35, 0.00, 0.00},
-        {1, 1.52213, 3.82, 0.47, 0.00, 0.00},
-        {1, 1.52213, 3.82, 0.47, 0.00, 0.00},
-        {1, 1.51793, 3.50, 1.12, 0.00, 0.00},
-        {1, 1.51755, 3.42, 1.20, 0.00, 0.00},
-        {1, 1.51779, 3.39, 1.33, 0.00, 0.00},
-        {1, 1.52210, 3.84, 0.72, 0.00, 0.00},
-        {1, 1.51786, 3.43, 1.19, 0.00, 0.30},
-        {1, 1.51900, 3.48, 1.35, 0.00, 0.00},
-        {1, 1.51869, 3.37, 1.18, 0.00, 0.16},
-        {1, 1.52667, 3.70, 0.71, 0.00, 0.10},
-        {1, 1.52223, 3.77, 0.79, 0.00, 0.00},
-        {1, 1.51898, 3.35, 1.23, 0.00, 0.00},
-        {1, 1.52320, 3.72, 0.51, 0.00, 0.16},
-        {1, 1.51926, 3.33, 1.28, 0.00, 0.11},
-        {1, 1.51808, 2.87, 1.19, 0.00, 0.00},
-        {1, 1.51837, 2.84, 1.28, 0.00, 0.00},
-        {1, 1.51778, 2.81, 1.29, 0.00, 0.09},
-        {1, 1.51769, 2.71, 1.29, 0.00, 0.24},
-        {1, 1.51215, 3.47, 1.12, 0.00, 0.31},
-        {1, 1.51824, 3.48, 1.29, 0.00, 0.00},
-        {1, 1.51754, 3.74, 1.17, 0.00, 0.00},
-        {1, 1.51754, 3.66, 1.19, 0.00, 0.11},
-        {1, 1.51905, 3.62, 1.11, 0.00, 0.00},
-        {1, 1.51977, 3.58, 1.32, 0.69, 0.00},
-        {1, 1.52172, 3.86, 0.88, 0.00, 0.11},
-        {1, 1.52227, 3.81, 0.78, 0.00, 0.00},
-        {1, 1.52172, 3.74, 0.90, 0.00, 0.07},
-        {1, 1.52099, 3.59, 1.12, 0.00, 0.00},
-        {1, 1.52152, 3.65, 0.87, 0.00, 0.17},
-        {1, 1.52152, 3.65, 0.87, 0.00, 0.17},
-        {1, 1.52152, 3.58, 0.90, 0.00, 0.16},
-        {1, 1.52300, 3.58, 0.82, 0.00, 0.03},
-        {3, 1.51769, 3.66, 1.11, 0.00, 0.00},
-        {3, 1.51610, 3.53, 1.34, 0.00, 0.00},
-        {3, 1.51670, 3.57, 1.38, 0.00, 0.10},
-        {3, 1.51643, 3.52, 1.35, 0.00, 0.00},
-        {3, 1.51665, 3.45, 1.76, 0.00, 0.17},
-        {3, 1.52127, 3.90, 0.83, 0.00, 0.00},
-        {3, 1.51779, 3.65, 0.65, 0.00, 0.00},
-        {3, 1.51610, 3.40, 1.22, 0.00, 0.00},
-        {3, 1.51694, 3.58, 1.31, 0.00, 0.00},
-        {3, 1.51646, 3.40, 1.26, 0.00, 0.00},
-        {3, 1.51655, 3.39, 1.28, 0.00, 0.00},
-        {3, 1.52121, 3.76, 0.58, 0.00, 0.00},
-        {3, 1.51776, 3.41, 1.52, 0.00, 0.00},
-        {3, 1.51796, 3.36, 1.63, 0.00, 0.09},
-        {3, 1.51832, 3.34, 1.54, 0.00, 0.00},
-        {3, 1.51934, 3.54, 0.75, 0.15, 0.24},
-        {3, 1.52211, 3.78, 0.91, 0.00, 0.37},
-        {7, 1.51131, 3.20, 1.81, 1.19, 0.00},
-        {7, 1.51838, 3.26, 2.22, 1.63, 0.00},
-        {7, 1.52315, 3.34, 1.23, 0.00, 0.00},
-        {7, 1.52247, 2.20, 2.06, 0.00, 0.00},
-        {7, 1.52365, 1.83, 1.31, 1.68, 0.00},
-        {7, 1.51613, 1.78, 1.79, 0.76, 0.00},
-        {7, 1.51602, 0.00, 2.38, 0.64, 0.09},
-        {7, 1.51623, 0.00, 2.79, 0.40, 0.09},
-        {7, 1.51719, 0.00, 2.00, 1.59, 0.08},
-        {7, 1.51683, 0.00, 1.98, 1.57, 0.07},
-        {7, 1.51545, 0.00, 2.68, 0.61, 0.05},
-        {7, 1.51556, 0.00, 2.54, 0.81, 0.01},
-        {7, 1.51727, 0.00, 2.34, 0.66, 0.00},
-        {7, 1.51531, 0.00, 2.66, 0.64, 0.00},
-        {7, 1.51609, 0.00, 2.51, 0.53, 0.00},
-        {7, 1.51508, 0.00, 2.25, 0.63, 0.00},
-        {7, 1.51653, 0.00, 1.19, 0.00, 0.00},
-        {7, 1.51514, 0.00, 2.42, 0.56, 0.00},
-        {7, 1.51658, 0.00, 1.99, 1.71, 0.00},
-        {7, 1.51617, 0.00, 2.27, 0.67, 0.00},
-        {7, 1.51732, 0.00, 1.80, 1.55, 0.00},
-        {7, 1.51645, 0.00, 1.87, 1.38, 0.00},
-        {7, 1.51831, 0.00, 1.82, 2.88, 0.00},
-        {7, 1.51640, 0.00, 2.74, 0.54, 0.00},
-        {7, 1.51623, 0.00, 2.88, 1.06, 0.00},
-        {7, 1.51685, 0.00, 1.99, 1.59, 0.00},
-        {7, 1.52065, 0.00, 2.02, 1.64, 0.00},
-        {7, 1.51651, 0.00, 1.94, 1.57, 0.00},
-        {7, 1.51711, 0.00, 2.08, 1.67, 0.00},
-    };
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/tree/DecisionTreeClassificationTrainerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/tree/DecisionTreeClassificationTrainerExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/tree/DecisionTreeClassificationTrainerExample.java
index 652b293..cc212e6 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/tree/DecisionTreeClassificationTrainerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/tree/DecisionTreeClassificationTrainerExample.java
@@ -45,7 +45,7 @@ public class DecisionTreeClassificationTrainerExample {
      *
      * @param args Command line arguments, none required.
      */
-    public static void main(String... args) throws InterruptedException {
+    public static void main(String... args) {
         System.out.println(">>> Decision tree classification trainer example started.");
 
         // Start ignite grid.

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/tree/DecisionTreeRegressionTrainerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/tree/DecisionTreeRegressionTrainerExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/tree/DecisionTreeRegressionTrainerExample.java
index 2a89c7e..2338522 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/tree/DecisionTreeRegressionTrainerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/tree/DecisionTreeRegressionTrainerExample.java
@@ -45,7 +45,7 @@ public class DecisionTreeRegressionTrainerExample {
      *
      * @param args Command line arguments, none required.
      */
-    public static void main(String... args) throws InterruptedException {
+    public static void main(String... args) {
         System.out.println(">>> Decision tree regression trainer example started.");
 
         // Start ignite grid.

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/tree/boosting/GDBOnTreesClassificationTrainerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/tree/boosting/GDBOnTreesClassificationTrainerExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/tree/boosting/GDBOnTreesClassificationTrainerExample.java
index 5beb954..c478407 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/tree/boosting/GDBOnTreesClassificationTrainerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/tree/boosting/GDBOnTreesClassificationTrainerExample.java
@@ -42,7 +42,7 @@ public class GDBOnTreesClassificationTrainerExample {
      *
      * @param args Command line arguments, none required.
      */
-    public static void main(String... args) throws InterruptedException {
+    public static void main(String... args) {
         System.out.println();
         System.out.println(">>> GDB classification trainer example started.");
         // Start ignite grid.

http://git-wip-us.apache.org/repos/asf/ignite/blob/370cd3e1/examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestClassificationExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestClassificationExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestClassificationExample.java
index ea235ee..83a78d3 100644
--- a/examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestClassificationExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/tree/randomforest/RandomForestClassificationExample.java
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.examples.ml.tree.randomforest;
 
-import java.util.Arrays;
+import java.io.FileNotFoundException;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
@@ -27,10 +27,11 @@ import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.examples.ml.util.TestCache;
+import org.apache.ignite.examples.ml.util.MLSandboxDatasets;
+import org.apache.ignite.examples.ml.util.SandboxMLCache;
 import org.apache.ignite.ml.composition.ModelsComposition;
 import org.apache.ignite.ml.dataset.feature.FeatureMeta;
-import org.apache.ignite.ml.math.primitives.vector.VectorUtils;
+import org.apache.ignite.ml.math.primitives.vector.Vector;
 import org.apache.ignite.ml.tree.randomforest.RandomForestClassifierTrainer;
 import org.apache.ignite.ml.tree.randomforest.data.FeaturesCountSelectionStrategies;
 
@@ -54,18 +55,19 @@ public class RandomForestClassificationExample {
     /**
      * Run example.
      */
-    public static void main(String[] args) throws InterruptedException {
+    public static void main(String[] args) throws FileNotFoundException {
         System.out.println();
         System.out.println(">>> Random Forest multi-class classification algorithm over cached dataset usage example started.");
         // Start ignite grid.
         try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
             System.out.println(">>> Ignite grid started.");
 
-            IgniteCache<Integer, double[]> dataCache = new TestCache(ignite).fillCacheWith(data);
+            IgniteCache<Integer, Vector> dataCache = new SandboxMLCache(ignite)
+                .fillCacheWith(MLSandboxDatasets.WINE_RECOGNITION);
 
             AtomicInteger idx = new AtomicInteger(0);
             RandomForestClassifierTrainer classifier = new RandomForestClassifierTrainer(
-                IntStream.range(0, data[0].length - 1).mapToObj(
+                IntStream.range(0, dataCache.get(1).size() - 1).mapToObj(
                     x -> new FeatureMeta("", idx.getAndIncrement(), false)).collect(Collectors.toList())
             ).withAmountOfTrees(101)
                 .withFeaturesCountSelectionStrgy(FeaturesCountSelectionStrategies.ONE_THIRD)
@@ -76,23 +78,23 @@ public class RandomForestClassificationExample {
 
             System.out.println(">>> Configured trainer: " + classifier.getClass().getSimpleName());
 
-            ModelsComposition randomForest = classifier.fit(ignite, dataCache,
-                (k, v) -> VectorUtils.of(Arrays.copyOfRange(v, 1, v.length)),
-                (k, v) -> v[0]
+            ModelsComposition randomForestMdl = classifier.fit(ignite, dataCache,
+                (k, v) -> v.copyOfRange(1, v.size()),
+                (k, v) -> v.get(0)
             );
 
-            System.out.println(">>> Trained model: " + randomForest.toString(true));
+            System.out.println(">>> Trained model: " + randomForestMdl.toString(true));
 
             int amountOfErrors = 0;
             int totalAmount = 0;
 
-            try (QueryCursor<Cache.Entry<Integer, double[]>> observations = dataCache.query(new ScanQuery<>())) {
-                for (Cache.Entry<Integer, double[]> observation : observations) {
-                    double[] val = observation.getValue();
-                    double[] inputs = Arrays.copyOfRange(val, 1, val.length);
-                    double groundTruth = val[0];
+            try (QueryCursor<Cache.Entry<Integer, Vector>> observations = dataCache.query(new ScanQuery<>())) {
+                for (Cache.Entry<Integer, Vector> observation : observations) {
+                    Vector val = observation.getValue();
+                    Vector inputs = val.copyOfRange(1, val.size());
+                    double groundTruth = val.get(0);
 
-                    double prediction = randomForest.apply(VectorUtils.of(inputs));
+                    double prediction = randomForestMdl.apply(inputs);
 
                     totalAmount++;
                     if (groundTruth != prediction)
@@ -107,186 +109,4 @@ public class RandomForestClassificationExample {
             }
         }
     }
-
-    /** The Wine recognition dataset. */
-    private static final double[][] data = {
-        {1, 14.23, 1.71, 2.43, 15.6, 127, 2.8, 3.06, .28, 2.29, 5.64, 1.04, 3.92, 1065},
-        {1, 13.2, 1.78, 2.14, 11.2, 100, 2.65, 2.76, .26, 1.28, 4.38, 1.05, 3.4, 1050},
-        {1, 13.16, 2.36, 2.67, 18.6, 101, 2.8, 3.24, .3, 2.81, 5.68, 1.03, 3.17, 1185},
-        {1, 14.37, 1.95, 2.5, 16.8, 113, 3.85, 3.49, .24, 2.18, 7.8, .86, 3.45, 1480},
-        {1, 13.24, 2.59, 2.87, 21, 118, 2.8, 2.69, .39, 1.82, 4.32, 1.04, 2.93, 735},
-        {1, 14.2, 1.76, 2.45, 15.2, 112, 3.27, 3.39, .34, 1.97, 6.75, 1.05, 2.85, 1450},
-        {1, 14.39, 1.87, 2.45, 14.6, 96, 2.5, 2.52, .3, 1.98, 5.25, 1.02, 3.58, 1290},
-        {1, 14.06, 2.15, 2.61, 17.6, 121, 2.6, 2.51, .31, 1.25, 5.05, 1.06, 3.58, 1295},
-        {1, 14.83, 1.64, 2.17, 14, 97, 2.8, 2.98, .29, 1.98, 5.2, 1.08, 2.85, 1045},
-        {1, 13.86, 1.35, 2.27, 16, 98, 2.98, 3.15, .22, 1.85, 7.22, 1.01, 3.55, 1045},
-        {1, 14.1, 2.16, 2.3, 18, 105, 2.95, 3.32, .22, 2.38, 5.75, 1.25, 3.17, 1510},
-        {1, 14.12, 1.48, 2.32, 16.8, 95, 2.2, 2.43, .26, 1.57, 5, 1.17, 2.82, 1280},
-        {1, 13.75, 1.73, 2.41, 16, 89, 2.6, 2.76, .29, 1.81, 5.6, 1.15, 2.9, 1320},
-        {1, 14.75, 1.73, 2.39, 11.4, 91, 3.1, 3.69, .43, 2.81, 5.4, 1.25, 2.73, 1150},
-        {1, 14.38, 1.87, 2.38, 12, 102, 3.3, 3.64, .29, 2.96, 7.5, 1.2, 3, 1547},
-        {1, 13.63, 1.81, 2.7, 17.2, 112, 2.85, 2.91, .3, 1.46, 7.3, 1.28, 2.88, 1310},
-        {1, 14.3, 1.92, 2.72, 20, 120, 2.8, 3.14, .33, 1.97, 6.2, 1.07, 2.65, 1280},
-        {1, 13.83, 1.57, 2.62, 20, 115, 2.95, 3.4, .4, 1.72, 6.6, 1.13, 2.57, 1130},
-        {1, 14.19, 1.59, 2.48, 16.5, 108, 3.3, 3.93, .32, 1.86, 8.7, 1.23, 2.82, 1680},
-        {1, 13.64, 3.1, 2.56, 15.2, 116, 2.7, 3.03, .17, 1.66, 5.1, .96, 3.36, 845},
-        {1, 14.06, 1.63, 2.28, 16, 126, 3, 3.17, .24, 2.1, 5.65, 1.09, 3.71, 780},
-        {1, 12.93, 3.8, 2.65, 18.6, 102, 2.41, 2.41, .25, 1.98, 4.5, 1.03, 3.52, 770},
-        {1, 13.71, 1.86, 2.36, 16.6, 101, 2.61, 2.88, .27, 1.69, 3.8, 1.11, 4, 1035},
-        {1, 12.85, 1.6, 2.52, 17.8, 95, 2.48, 2.37, .26, 1.46, 3.93, 1.09, 3.63, 1015},
-        {1, 13.5, 1.81, 2.61, 20, 96, 2.53, 2.61, .28, 1.66, 3.52, 1.12, 3.82, 845},
-        {1, 13.05, 2.05, 3.22, 25, 124, 2.63, 2.68, .47, 1.92, 3.58, 1.13, 3.2, 830},
-        {1, 13.39, 1.77, 2.62, 16.1, 93, 2.85, 2.94, .34, 1.45, 4.8, .92, 3.22, 1195},
-        {1, 13.3, 1.72, 2.14, 17, 94, 2.4, 2.19, .27, 1.35, 3.95, 1.02, 2.77, 1285},
-        {1, 13.87, 1.9, 2.8, 19.4, 107, 2.95, 2.97, .37, 1.76, 4.5, 1.25, 3.4, 915},
-        {1, 14.02, 1.68, 2.21, 16, 96, 2.65, 2.33, .26, 1.98, 4.7, 1.04, 3.59, 1035},
-        {1, 13.73, 1.5, 2.7, 22.5, 101, 3, 3.25, .29, 2.38, 5.7, 1.19, 2.71, 1285},
-        {1, 13.58, 1.66, 2.36, 19.1, 106, 2.86, 3.19, .22, 1.95, 6.9, 1.09, 2.88, 1515},
-        {1, 13.68, 1.83, 2.36, 17.2, 104, 2.42, 2.69, .42, 1.97, 3.84, 1.23, 2.87, 990},
-        {1, 13.76, 1.53, 2.7, 19.5, 132, 2.95, 2.74, .5, 1.35, 5.4, 1.25, 3, 1235},
-        {1, 13.51, 1.8, 2.65, 19, 110, 2.35, 2.53, .29, 1.54, 4.2, 1.1, 2.87, 1095},
-        {1, 13.48, 1.81, 2.41, 20.5, 100, 2.7, 2.98, .26, 1.86, 5.1, 1.04, 3.47, 920},
-        {1, 13.28, 1.64, 2.84, 15.5, 110, 2.6, 2.68, .34, 1.36, 4.6, 1.09, 2.78, 880},
-        {1, 13.05, 1.65, 2.55, 18, 98, 2.45, 2.43, .29, 1.44, 4.25, 1.12, 2.51, 1105},
-        {1, 13.07, 1.5, 2.1, 15.5, 98, 2.4, 2.64, .28, 1.37, 3.7, 1.18, 2.69, 1020},
-        {1, 14.22, 3.99, 2.51, 13.2, 128, 3, 3.04, .2, 2.08, 5.1, .89, 3.53, 760},
-        {1, 13.56, 1.71, 2.31, 16.2, 117, 3.15, 3.29, .34, 2.34, 6.13, .95, 3.38, 795},
-        {1, 13.41, 3.84, 2.12, 18.8, 90, 2.45, 2.68, .27, 1.48, 4.28, .91, 3, 1035},
-        {1, 13.88, 1.89, 2.59, 15, 101, 3.25, 3.56, .17, 1.7, 5.43, .88, 3.56, 1095},
-        {1, 13.24, 3.98, 2.29, 17.5, 103, 2.64, 2.63, .32, 1.66, 4.36, .82, 3, 680},
-        {1, 13.05, 1.77, 2.1, 17, 107, 3, 3, .28, 2.03, 5.04, .88, 3.35, 885},
-        {1, 14.21, 4.04, 2.44, 18.9, 111, 2.85, 2.65, .3, 1.25, 5.24, .87, 3.33, 1080},
-        {1, 14.38, 3.59, 2.28, 16, 102, 3.25, 3.17, .27, 2.19, 4.9, 1.04, 3.44, 1065},
-        {1, 13.9, 1.68, 2.12, 16, 101, 3.1, 3.39, .21, 2.14, 6.1, .91, 3.33, 985},
-        {1, 14.1, 2.02, 2.4, 18.8, 103, 2.75, 2.92, .32, 2.38, 6.2, 1.07, 2.75, 1060},
-        {1, 13.94, 1.73, 2.27, 17.4, 108, 2.88, 3.54, .32, 2.08, 8.90, 1.12, 3.1, 1260},
-        {1, 13.05, 1.73, 2.04, 12.4, 92, 2.72, 3.27, .17, 2.91, 7.2, 1.12, 2.91, 1150},
-        {1, 13.83, 1.65, 2.6, 17.2, 94, 2.45, 2.99, .22, 2.29, 5.6, 1.24, 3.37, 1265},
-        {1, 13.82, 1.75, 2.42, 14, 111, 3.88, 3.74, .32, 1.87, 7.05, 1.01, 3.26, 1190},
-        {1, 13.77, 1.9, 2.68, 17.1, 115, 3, 2.79, .39, 1.68, 6.3, 1.13, 2.93, 1375},
-        {1, 13.74, 1.67, 2.25, 16.4, 118, 2.6, 2.9, .21, 1.62, 5.85, .92, 3.2, 1060},
-        {1, 13.56, 1.73, 2.46, 20.5, 116, 2.96, 2.78, .2, 2.45, 6.25, .98, 3.03, 1120},
-        {1, 14.22, 1.7, 2.3, 16.3, 118, 3.2, 3, .26, 2.03, 6.38, .94, 3.31, 970},
-        {1, 13.29, 1.97, 2.68, 16.8, 102, 3, 3.23, .31, 1.66, 6, 1.07, 2.84, 1270},
-        {1, 13.72, 1.43, 2.5, 16.7, 108, 3.4, 3.67, .19, 2.04, 6.8, .89, 2.87, 1285},
-        {2, 12.37, .94, 1.36, 10.6, 88, 1.98, .57, .28, .42, 1.95, 1.05, 1.82, 520},
-        {2, 12.33, 1.1, 2.28, 16, 101, 2.05, 1.09, .63, .41, 3.27, 1.25, 1.67, 680},
-        {2, 12.64, 1.36, 2.02, 16.8, 100, 2.02, 1.41, .53, .62, 5.75, .98, 1.59, 450},
-        {2, 13.67, 1.25, 1.92, 18, 94, 2.1, 1.79, .32, .73, 3.8, 1.23, 2.46, 630},
-        {2, 12.37, 1.13, 2.16, 19, 87, 3.5, 3.1, .19, 1.87, 4.45, 1.22, 2.87, 420},
-        {2, 12.17, 1.45, 2.53, 19, 104, 1.89, 1.75, .45, 1.03, 2.95, 1.45, 2.23, 355},
-        {2, 12.37, 1.21, 2.56, 18.1, 98, 2.42, 2.65, .37, 2.08, 4.6, 1.19, 2.3, 678},
-        {2, 13.11, 1.01, 1.7, 15, 78, 2.98, 3.18, .26, 2.28, 5.3, 1.12, 3.18, 502},
-        {2, 12.37, 1.17, 1.92, 19.6, 78, 2.11, 2, .27, 1.04, 4.68, 1.12, 3.48, 510},
-        {2, 13.34, .94, 2.36, 17, 110, 2.53, 1.3, .55, .42, 3.17, 1.02, 1.93, 750},
-        {2, 12.21, 1.19, 1.75, 16.8, 151, 1.85, 1.28, .14, 2.5, 2.85, 1.28, 3.07, 718},
-        {2, 12.29, 1.61, 2.21, 20.4, 103, 1.1, 1.02, .37, 1.46, 3.05, .906, 1.82, 870},
-        {2, 13.86, 1.51, 2.67, 25, 86, 2.95, 2.86, .21, 1.87, 3.38, 1.36, 3.16, 410},
-        {2, 13.49, 1.66, 2.24, 24, 87, 1.88, 1.84, .27, 1.03, 3.74, .98, 2.78, 472},
-        {2, 12.99, 1.67, 2.6, 30, 139, 3.3, 2.89, .21, 1.96, 3.35, 1.31, 3.5, 985},
-        {2, 11.96, 1.09, 2.3, 21, 101, 3.38, 2.14, .13, 1.65, 3.21, .99, 3.13, 886},
-        {2, 11.66, 1.88, 1.92, 16, 97, 1.61, 1.57, .34, 1.15, 3.8, 1.23, 2.14, 428},
-        {2, 13.03, .9, 1.71, 16, 86, 1.95, 2.03, .24, 1.46, 4.6, 1.19, 2.48, 392},
-        {2, 11.84, 2.89, 2.23, 18, 112, 1.72, 1.32, .43, .95, 2.65, .96, 2.52, 500},
-        {2, 12.33, .99, 1.95, 14.8, 136, 1.9, 1.85, .35, 2.76, 3.4, 1.06, 2.31, 750},
-        {2, 12.7, 3.87, 2.4, 23, 101, 2.83, 2.55, .43, 1.95, 2.57, 1.19, 3.13, 463},
-        {2, 12, .92, 2, 19, 86, 2.42, 2.26, .3, 1.43, 2.5, 1.38, 3.12, 278},
-        {2, 12.72, 1.81, 2.2, 18.8, 86, 2.2, 2.53, .26, 1.77, 3.9, 1.16, 3.14, 714},
-        {2, 12.08, 1.13, 2.51, 24, 78, 2, 1.58, .4, 1.4, 2.2, 1.31, 2.72, 630},
-        {2, 13.05, 3.86, 2.32, 22.5, 85, 1.65, 1.59, .61, 1.62, 4.8, .84, 2.01, 515},
-        {2, 11.84, .89, 2.58, 18, 94, 2.2, 2.21, .22, 2.35, 3.05, .79, 3.08, 520},
-        {2, 12.67, .98, 2.24, 18, 99, 2.2, 1.94, .3, 1.46, 2.62, 1.23, 3.16, 450},
-        {2, 12.16, 1.61, 2.31, 22.8, 90, 1.78, 1.69, .43, 1.56, 2.45, 1.33, 2.26, 495},
-        {2, 11.65, 1.67, 2.62, 26, 88, 1.92, 1.61, .4, 1.34, 2.6, 1.36, 3.21, 562},
-        {2, 11.64, 2.06, 2.46, 21.6, 84, 1.95, 1.69, .48, 1.35, 2.8, 1, 2.75, 680},
-        {2, 12.08, 1.33, 2.3, 23.6, 70, 2.2, 1.59, .42, 1.38, 1.74, 1.07, 3.21, 625},
-        {2, 12.08, 1.83, 2.32, 18.5, 81, 1.6, 1.5, .52, 1.64, 2.4, 1.08, 2.27, 480},
-        {2, 12, 1.51, 2.42, 22, 86, 1.45, 1.25, .5, 1.63, 3.6, 1.05, 2.65, 450},
-        {2, 12.69, 1.53, 2.26, 20.7, 80, 1.38, 1.46, .58, 1.62, 3.05, .96, 2.06, 495},
-        {2, 12.29, 2.83, 2.22, 18, 88, 2.45, 2.25, .25, 1.99, 2.15, 1.15, 3.3, 290},
-        {2, 11.62, 1.99, 2.28, 18, 98, 3.02, 2.26, .17, 1.35, 3.25, 1.16, 2.96, 345},
-        {2, 12.47, 1.52, 2.2, 19, 162, 2.5, 2.27, .32, 3.28, 2.6, 1.16, 2.63, 937},
-        {2, 11.81, 2.12, 2.74, 21.5, 134, 1.6, .99, .14, 1.56, 2.5, .95, 2.26, 625},
-        {2, 12.29, 1.41, 1.98, 16, 85, 2.55, 2.5, .29, 1.77, 2.9, 1.23, 2.74, 428},
-        {2, 12.37, 1.07, 2.1, 18.5, 88, 3.52, 3.75, .24, 1.95, 4.5, 1.04, 2.77, 660},
-        {2, 12.29, 3.17, 2.21, 18, 88, 2.85, 2.99, .45, 2.81, 2.3, 1.42, 2.83, 406},
-        {2, 12.08, 2.08, 1.7, 17.5, 97, 2.23, 2.17, .26, 1.4, 3.3, 1.27, 2.96, 710},
-        {2, 12.6, 1.34, 1.9, 18.5, 88, 1.45, 1.36, .29, 1.35, 2.45, 1.04, 2.77, 562},
-        {2, 12.34, 2.45, 2.46, 21, 98, 2.56, 2.11, .34, 1.31, 2.8, .8, 3.38, 438},
-        {2, 11.82, 1.72, 1.88, 19.5, 86, 2.5, 1.64, .37, 1.42, 2.06, .94, 2.44, 415},
-        {2, 12.51, 1.73, 1.98, 20.5, 85, 2.2, 1.92, .32, 1.48, 2.94, 1.04, 3.57, 672},
-        {2, 12.42, 2.55, 2.27, 22, 90, 1.68, 1.84, .66, 1.42, 2.7, .86, 3.3, 315},
-        {2, 12.25, 1.73, 2.12, 19, 80, 1.65, 2.03, .37, 1.63, 3.4, 1, 3.17, 510},
-        {2, 12.72, 1.75, 2.28, 22.5, 84, 1.38, 1.76, .48, 1.63, 3.3, .88, 2.42, 488},
-        {2, 12.22, 1.29, 1.94, 19, 92, 2.36, 2.04, .39, 2.08, 2.7, .86, 3.02, 312},
-        {2, 11.61, 1.35, 2.7, 20, 94, 2.74, 2.92, .29, 2.49, 2.65, .96, 3.26, 680},
-        {2, 11.46, 3.74, 1.82, 19.5, 107, 3.18, 2.58, .24, 3.58, 2.9, .75, 2.81, 562},
-        {2, 12.52, 2.43, 2.17, 21, 88, 2.55, 2.27, .26, 1.22, 2, .9, 2.78, 325},
-        {2, 11.76, 2.68, 2.92, 20, 103, 1.75, 2.03, .6, 1.05, 3.8, 1.23, 2.5, 607},
-        {2, 11.41, .74, 2.5, 21, 88, 2.48, 2.01, .42, 1.44, 3.08, 1.1, 2.31, 434},
-        {2, 12.08, 1.39, 2.5, 22.5, 84, 2.56, 2.29, .43, 1.04, 2.9, .93, 3.19, 385},
-        {2, 11.03, 1.51, 2.2, 21.5, 85, 2.46, 2.17, .52, 2.01, 1.9, 1.71, 2.87, 407},
-        {2, 11.82, 1.47, 1.99, 20.8, 86, 1.98, 1.6, .3, 1.53, 1.95, .95, 3.3423, 495},
-        {2, 12.42, 1.61, 2.19, 22.5, 108, 2, 2.09, .34, 1.61, 2.06, 1.06, 2.96, 345},
-        {2, 12.77, 3.43, 1.98, 16, 80, 1.63, 1.25, .43, .83, 3.4, .7, 2.12, 372},
-        {2, 12, 3.43, 2, 19, 87, 2, 1.64, .37, 1.87, 1.28, .93, 3.05, 564},
-        {2, 11.45, 2.4, 2.42, 20, 96, 2.9, 2.79, .32, 1.83, 3.25, .8, 3.39, 625},
-        {2, 11.56, 2.05, 3.23, 28.5, 119, 3.18, 5.08, .47, 1.87, 6, .93, 3.69, 465},
-        {2, 12.42, 4.43, 2.73, 26.5, 102, 2.2, 2.13, .43, 1.71, 2.08, .92, 3.12, 365},
-        {2, 13.05, 5.8, 2.13, 21.5, 86, 2.62, 2.65, .3, 2.01, 2.6, .73, 3.1, 380},
-        {2, 11.87, 4.31, 2.39, 21, 82, 2.86, 3.03, .21, 2.91, 2.8, .75, 3.64, 380},
-        {2, 12.07, 2.16, 2.17, 21, 85, 2.6, 2.65, .37, 1.35, 2.76, .86, 3.28, 378},
-        {2, 12.43, 1.53, 2.29, 21.5, 86, 2.74, 3.15, .39, 1.77, 3.94, .69, 2.84, 352},
-        {2, 11.79, 2.13, 2.78, 28.5, 92, 2.13, 2.24, .58, 1.76, 3, .97, 2.44, 466},
-        {2, 12.37, 1.63, 2.3, 24.5, 88, 2.22, 2.45, .4, 1.9, 2.12, .89, 2.78, 342},
-        {2, 12.04, 4.3, 2.38, 22, 80, 2.1, 1.75, .42, 1.35, 2.6, .79, 2.57, 580},
-        {3, 12.86, 1.35, 2.32, 18, 122, 1.51, 1.25, .21, .94, 4.1, .76, 1.29, 630},
-        {3, 12.88, 2.99, 2.4, 20, 104, 1.3, 1.22, .24, .83, 5.4, .74, 1.42, 530},
-        {3, 12.81, 2.31, 2.4, 24, 98, 1.15, 1.09, .27, .83, 5.7, .66, 1.36, 560},
-        {3, 12.7, 3.55, 2.36, 21.5, 106, 1.7, 1.2, .17, .84, 5, .78, 1.29, 600},
-        {3, 12.51, 1.24, 2.25, 17.5, 85, 2, .58, .6, 1.25, 5.45, .75, 1.51, 650},
-        {3, 12.6, 2.46, 2.2, 18.5, 94, 1.62, .66, .63, .94, 7.1, .73, 1.58, 695},
-        {3, 12.25, 4.72, 2.54, 21, 89, 1.38, .47, .53, .8, 3.85, .75, 1.27, 720},
-        {3, 12.53, 5.51, 2.64, 25, 96, 1.79, .6, .63, 1.1, 5, .82, 1.69, 515},
-        {3, 13.49, 3.59, 2.19, 19.5, 88, 1.62, .48, .58, .88, 5.7, .81, 1.82, 580},
-        {3, 12.84, 2.96, 2.61, 24, 101, 2.32, .6, .53, .81, 4.92, .89, 2.15, 590},
-        {3, 12.93, 2.81, 2.7, 21, 96, 1.54, .5, .53, .75, 4.6, .77, 2.31, 600},
-        {3, 13.36, 2.56, 2.35, 20, 89, 1.4, .5, .37, .64, 5.6, .7, 2.47, 780},
-        {3, 13.52, 3.17, 2.72, 23.5, 97, 1.55, .52, .5, .55, 4.35, .89, 2.06, 520},
-        {3, 13.62, 4.95, 2.35, 20, 92, 2, .8, .47, 1.02, 4.4, .91, 2.05, 550},
-        {3, 12.25, 3.88, 2.2, 18.5, 112, 1.38, .78, .29, 1.14, 8.21, .65, 2, 855},
-        {3, 13.16, 3.57, 2.15, 21, 102, 1.5, .55, .43, 1.3, 4, .6, 1.68, 830},
-        {3, 13.88, 5.04, 2.23, 20, 80, .98, .34, .4, .68, 4.9, .58, 1.33, 415},
-        {3, 12.87, 4.61, 2.48, 21.5, 86, 1.7, .65, .47, .86, 7.65, .54, 1.86, 625},
-        {3, 13.32, 3.24, 2.38, 21.5, 92, 1.93, .76, .45, 1.25, 8.42, .55, 1.62, 650},
-        {3, 13.08, 3.9, 2.36, 21.5, 113, 1.41, 1.39, .34, 1.14, 9.40, .57, 1.33, 550},
-        {3, 13.5, 3.12, 2.62, 24, 123, 1.4, 1.57, .22, 1.25, 8.60, .59, 1.3, 500},
-        {3, 12.79, 2.67, 2.48, 22, 112, 1.48, 1.36, .24, 1.26, 10.8, .48, 1.47, 480},
-        {3, 13.11, 1.9, 2.75, 25.5, 116, 2.2, 1.28, .26, 1.56, 7.1, .61, 1.33, 425},
-        {3, 13.23, 3.3, 2.28, 18.5, 98, 1.8, .83, .61, 1.87, 10.52, .56, 1.51, 675},
-        {3, 12.58, 1.29, 2.1, 20, 103, 1.48, .58, .53, 1.4, 7.6, .58, 1.55, 640},
-        {3, 13.17, 5.19, 2.32, 22, 93, 1.74, .63, .61, 1.55, 7.9, .6, 1.48, 725},
-        {3, 13.84, 4.12, 2.38, 19.5, 89, 1.8, .83, .48, 1.56, 9.01, .57, 1.64, 480},
-        {3, 12.45, 3.03, 2.64, 27, 97, 1.9, .58, .63, 1.14, 7.5, .67, 1.73, 880},
-        {3, 14.34, 1.68, 2.7, 25, 98, 2.8, 1.31, .53, 2.7, 13, .57, 1.96, 660},
-        {3, 13.48, 1.67, 2.64, 22.5, 89, 2.6, 1.1, .52, 2.29, 11.75, .57, 1.78, 620},
-        {3, 12.36, 3.83, 2.38, 21, 88, 2.3, .92, .5, 1.04, 7.65, .56, 1.58, 520},
-        {3, 13.69, 3.26, 2.54, 20, 107, 1.83, .56, .5, .8, 5.88, .96, 1.82, 680},
-        {3, 12.85, 3.27, 2.58, 22, 106, 1.65, .6, .6, .96, 5.58, .87, 2.11, 570},
-        {3, 12.96, 3.45, 2.35, 18.5, 106, 1.39, .7, .4, .94, 5.28, .68, 1.75, 675},
-        {3, 13.78, 2.76, 2.3, 22, 90, 1.35, .68, .41, 1.03, 9.58, .7, 1.68, 615},
-        {3, 13.73, 4.36, 2.26, 22.5, 88, 1.28, .47, .52, 1.15, 6.62, .78, 1.75, 520},
-        {3, 13.45, 3.7, 2.6, 23, 111, 1.7, .92, .43, 1.46, 10.68, .85, 1.56, 695},
-        {3, 12.82, 3.37, 2.3, 19.5, 88, 1.48, .66, .4, .97, 10.26, .72, 1.75, 685},
-        {3, 13.58, 2.58, 2.69, 24.5, 105, 1.55, .84, .39, 1.54, 8.66, .74, 1.8, 750},
-        {3, 13.4, 4.6, 2.86, 25, 112, 1.98, .96, .27, 1.11, 8.5, .67, 1.92, 630},
-        {3, 12.2, 3.03, 2.32, 19, 96, 1.25, .49, .4, .73, 5.5, .66, 1.83, 510},
-        {3, 12.77, 2.39, 2.28, 19.5, 86, 1.39, .51, .48, .64, 9.899999, .57, 1.63, 470},
-        {3, 14.16, 2.51, 2.48, 20, 91, 1.68, .7, .44, 1.24, 9.7, .62, 1.71, 660},
-        {3, 13.71, 5.65, 2.45, 20.5, 95, 1.68, .61, .52, 1.06, 7.7, .64, 1.74, 740},
-        {3, 13.4, 3.91, 2.48, 23, 102, 1.8, .75, .43, 1.41, 7.3, .7, 1.56, 750},
-        {3, 13.27, 4.28, 2.26, 20, 120, 1.59, .69, .43, 1.35, 10.2, .59, 1.56, 835},
-        {3, 13.17, 2.59, 2.37, 20, 120, 1.65, .68, .53, 1.46, 9.3, .6, 1.62, 840},
-        {3, 14.13, 4.1, 2.74, 24.5, 96, 2.05, .76, .56, 1.35, 9.2, .61, 1.6, 560}
-    };
 }


[25/28] ignite git commit: IGNITE-9941 Fixed typo.

Posted by sb...@apache.org.
IGNITE-9941 Fixed typo.


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

Branch: refs/heads/ignite-627
Commit: e0cbaec4d260c6e43fec09ed09119b9db2070d65
Parents: 996a1d5
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Mon Oct 29 23:01:41 2018 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Mon Oct 29 23:01:41 2018 +0700

----------------------------------------------------------------------
 modules/web-console/backend/config/settings.json.sample | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e0cbaec4/modules/web-console/backend/config/settings.json.sample
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/config/settings.json.sample b/modules/web-console/backend/config/settings.json.sample
index 4070163..aa20ab4 100644
--- a/modules/web-console/backend/config/settings.json.sample
+++ b/modules/web-console/backend/config/settings.json.sample
@@ -8,7 +8,8 @@
         "keyPassphrase": "password",
         "disable": {
             "signup": false
-    }    },
+        }
+    },
     "mongodb": {
         "url": "mongodb://localhost/console"
     },