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 2016/03/24 14:14:02 UTC

[01/11] ignite git commit: Reproducer.

Repository: ignite
Updated Branches:
  refs/heads/ignite-2004 116c6ce36 -> d0c7b5107


Reproducer.


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

Branch: refs/heads/ignite-2004
Commit: b189bb2e15e7a54a890395b344bc7355e2f6d147
Parents: fc9730a
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Mar 23 18:01:01 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Mar 23 18:01:01 2016 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/cache/GridCacheMapEntry.java  | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b189bb2e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index fb6aeef..6677c6a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -2453,10 +2453,12 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
 
                 recordNodeId(affNodeId, topVer);
 
-                updateCntr0 = nextPartCounter(topVer);
+                if (hadVal) {
+                    updateCntr0 = nextPartCounter(topVer);
 
-                if (updateCntr != null)
-                    updateCntr0 = updateCntr;
+                    if (updateCntr != null)
+                        updateCntr0 = updateCntr;
+                }
 
                 drReplicate(drType, null, newVer, topVer);
 


[09/11] ignite git commit: IGNITE-2883: IGFS: Now IPC messages are handled in a dedicated thread pool.

Posted by sb...@apache.org.
IGNITE-2883: IGFS: Now IPC messages are handled in a dedicated thread pool.


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

Branch: refs/heads/ignite-2004
Commit: cfc7d4eec255d0fe720398882d0c058f6821611a
Parents: bc14c80
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Mar 24 14:29:35 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Mar 24 14:29:35 2016 +0300

----------------------------------------------------------------------
 .../igfs/IgfsIpcEndpointConfiguration.java      | 28 +++++++
 .../processors/igfs/IgfsIpcHandler.java         | 81 +++++++++++++++-----
 .../internal/processors/igfs/IgfsProcessor.java | 11 ++-
 .../internal/processors/igfs/IgfsServer.java    |  2 +-
 .../igfs/IgfsProcessorValidationSelfTest.java   | 16 ++++
 5 files changed, 117 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc7d4ee/modules/core/src/main/java/org/apache/ignite/igfs/IgfsIpcEndpointConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsIpcEndpointConfiguration.java b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsIpcEndpointConfiguration.java
index 23993a6..1c68d0f 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsIpcEndpointConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsIpcEndpointConfiguration.java
@@ -49,6 +49,9 @@ public class IgfsIpcEndpointConfiguration {
      */
     public static final String DFLT_TOKEN_DIR_PATH = "ipc/shmem";
 
+    /** Default threads count. */
+    public static final int DFLT_THREAD_CNT = IgniteConfiguration.AVAILABLE_PROC_CNT;
+
     /** Endpoint type. */
     private IgfsIpcEndpointType type = DFLT_TYPE;
 
@@ -64,6 +67,9 @@ public class IgfsIpcEndpointConfiguration {
     /** Token directory path. */
     private String tokenDirPath = DFLT_TOKEN_DIR_PATH;
 
+    /** Thread count. */
+    private int threadCnt = DFLT_THREAD_CNT;
+
     /**
      * Default constructor.
      */
@@ -236,6 +242,28 @@ public class IgfsIpcEndpointConfiguration {
         this.tokenDirPath = tokenDirPath;
     }
 
+    /**
+     * Get number of threads used by this endpoint to process incoming requests.
+     * <p>
+     * Defaults to {@link #DFLT_THREAD_CNT}.
+     *
+     * @return Number of threads used by this endpoint to process incoming requests.
+     */
+    public int getThreadCount() {
+        return threadCnt;
+    }
+
+    /**
+     * Set number of threads used by this endpoint to process incoming requests.
+     * <p>
+     * See {@link #getThreadCount()} for more information.
+     *
+     * @param threadCnt Number of threads used by this endpoint to process incoming requests.
+     */
+    public void setThreadCount(int threadCnt) {
+        this.threadCnt = threadCnt;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(IgfsIpcEndpointConfiguration.class, this);

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc7d4ee/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsIpcHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsIpcHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsIpcHandler.java
index eadbdb2..bf87384 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsIpcHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsIpcHandler.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.igfs;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.igfs.IgfsIpcEndpointConfiguration;
 import org.apache.ignite.igfs.IgfsOutOfSpaceException;
 import org.apache.ignite.igfs.IgfsOutputStream;
 import org.apache.ignite.igfs.IgfsUserContext;
@@ -31,20 +32,22 @@ import org.apache.ignite.internal.igfs.common.IgfsIpcCommand;
 import org.apache.ignite.internal.igfs.common.IgfsMessage;
 import org.apache.ignite.internal.igfs.common.IgfsPathControlRequest;
 import org.apache.ignite.internal.igfs.common.IgfsStreamControlRequest;
-import org.apache.ignite.internal.processors.closure.GridClosurePolicy;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
-import org.apache.ignite.internal.util.lang.GridPlainCallable;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteOutClosure;
 import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.thread.IgniteThreadPoolExecutor;
 import org.jetbrains.annotations.Nullable;
 
 import java.io.Closeable;
 import java.io.DataInput;
 import java.io.IOException;
 import java.util.Iterator;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.atomic.AtomicLong;
 
 /**
@@ -70,6 +73,9 @@ class IgfsIpcHandler implements IgfsServerHandler {
     /** Resource ID generator. */
     private final AtomicLong rsrcIdGen = new AtomicLong();
 
+    /** Thread pool. */
+    private volatile IgniteThreadPoolExecutor pool;
+
     /** Stopping flag. */
     private volatile boolean stopping;
 
@@ -77,8 +83,10 @@ class IgfsIpcHandler implements IgfsServerHandler {
      * Constructs IGFS IPC handler.
      *
      * @param igfsCtx Context.
+     * @param endpointCfg Endpoint configuration.
+     * @param mgmt Management flag.
      */
-    IgfsIpcHandler(IgfsContext igfsCtx) {
+    IgfsIpcHandler(IgfsContext igfsCtx, IgfsIpcEndpointConfiguration endpointCfg, boolean mgmt) {
         assert igfsCtx != null;
 
         ctx = igfsCtx.kernalContext();
@@ -87,12 +95,24 @@ class IgfsIpcHandler implements IgfsServerHandler {
         // Keep buffer size multiple of block size so no extra byte array copies is performed.
         bufSize = igfsCtx.configuration().getBlockSize() * 2;
 
+        // Create thread pool for request handling.
+        int threadCnt = endpointCfg.getThreadCount();
+
+        String prefix = "igfs-" + igfsCtx.igfs().name() + (mgmt ? "mgmt-" : "") + "-ipc";
+
+        pool = new IgniteThreadPoolExecutor(prefix, igfsCtx.kernalContext().gridName(), threadCnt, threadCnt,
+            Long.MAX_VALUE, new LinkedBlockingQueue<Runnable>());
+
         log = ctx.log(IgfsIpcHandler.class);
     }
 
     /** {@inheritDoc} */
     @Override public void stop() throws IgniteCheckedException {
         stopping = true;
+
+        U.shutdownNow(getClass(), pool, log);
+
+        pool = null;
     }
 
     /** {@inheritDoc} */
@@ -114,7 +134,7 @@ class IgfsIpcHandler implements IgfsServerHandler {
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<IgfsMessage> handleAsync(final IgfsClientSession ses,
-        final IgfsMessage msg, DataInput in) {
+        final IgfsMessage msg, final DataInput in) {
         try {
             // Even if will be closed right after this call, response write error will be ignored.
             if (stopping)
@@ -130,21 +150,32 @@ class IgfsIpcHandler implements IgfsServerHandler {
                 case MAKE_DIRECTORIES:
                 case LIST_FILES:
                 case LIST_PATHS: {
-                    IgfsMessage res = execute(ses, cmd, msg, in);
-
-                    fut = res == null ? null : new GridFinishedFuture<>(res);
+                    fut = executeSynchronously(ses, cmd, msg, in);
 
                     break;
                 }
 
-                // Execute command asynchronously in user's pool.
+                // Execute command asynchronously in pool.
                 default: {
-                    fut = ctx.closure().callLocalSafe(new GridPlainCallable<IgfsMessage>() {
-                        @Override public IgfsMessage call() throws Exception {
-                            // No need to pass data input for non-write-block commands.
-                            return execute(ses, cmd, msg, null);
-                        }
-                    }, GridClosurePolicy.IGFS_POOL);
+                    try {
+                        final GridFutureAdapter<IgfsMessage> fut0 = new GridFutureAdapter<>();
+
+                        pool.execute(new Runnable() {
+                            @Override public void run()  {
+                                try {
+                                    fut0.onDone(execute(ses, cmd, msg, in));
+                                }
+                                catch (Exception e) {
+                                    fut0.onDone(e);
+                                }
+                            }
+                        });
+
+                        fut = fut0;
+                    }
+                    catch (RejectedExecutionException ignored) {
+                        fut = executeSynchronously(ses, cmd, msg, in);
+                    }
                 }
             }
 
@@ -157,6 +188,23 @@ class IgfsIpcHandler implements IgfsServerHandler {
     }
 
     /**
+     * Execute operation synchronously.
+     *
+     * @param ses Session.
+     * @param cmd Command.
+     * @param msg Message.
+     * @param in Input.
+     * @return Result.
+     * @throws Exception If failed.
+     */
+    @Nullable private IgniteInternalFuture<IgfsMessage> executeSynchronously(IgfsClientSession ses,
+        IgfsIpcCommand cmd, IgfsMessage msg, DataInput in) throws Exception {
+        IgfsMessage res = execute(ses, cmd, msg, in);
+
+        return res == null ? null : new GridFinishedFuture<>(res);
+    }
+
+    /**
      * Execute IGFS command.
      *
      * @param ses Client connection session.
@@ -167,8 +215,7 @@ class IgfsIpcHandler implements IgfsServerHandler {
      * @throws Exception If failed.
      */
     private IgfsMessage execute(IgfsClientSession ses, IgfsIpcCommand cmd, IgfsMessage msg,
-        @Nullable DataInput in)
-        throws Exception {
+        @Nullable DataInput in) throws Exception {
         switch (cmd) {
             case HANDSHAKE:
                 return processHandshakeRequest((IgfsHandshakeRequest)msg);
@@ -495,8 +542,6 @@ class IgfsIpcHandler implements IgfsServerHandler {
             }
 
             case WRITE_BLOCK: {
-                assert rsrcId != null : "Missing stream ID";
-
                 IgfsOutputStream out = (IgfsOutputStream)resource(ses, rsrcId);
 
                 if (out == null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc7d4ee/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
index 44f6e44..778de99 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
@@ -26,6 +26,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.FileSystemConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper;
+import org.apache.ignite.igfs.IgfsIpcEndpointConfiguration;
 import org.apache.ignite.igfs.IgfsMode;
 import org.apache.ignite.igfs.IgfsPath;
 import org.apache.ignite.igfs.mapreduce.IgfsJob;
@@ -316,12 +317,18 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
                 throw new IgniteCheckedException("Invalid IGFS data cache configuration (key affinity mapper class should be " +
                     IgfsGroupDataBlocksKeyMapper.class.getSimpleName() + "): " + cfg);
 
-            if (cfg.getIpcEndpointConfiguration() != null) {
-                final int tcpPort = cfg.getIpcEndpointConfiguration().getPort();
+            IgfsIpcEndpointConfiguration ipcCfg = cfg.getIpcEndpointConfiguration();
+
+            if (ipcCfg != null) {
+                final int tcpPort = ipcCfg.getPort();
 
                 if (!(tcpPort >= MIN_TCP_PORT && tcpPort <= MAX_TCP_PORT))
                     throw new IgniteCheckedException("IGFS endpoint TCP port is out of range [" + MIN_TCP_PORT +
                         ".." + MAX_TCP_PORT + "]: " + tcpPort);
+
+                if (ipcCfg.getThreadCount() <= 0)
+                    throw new IgniteCheckedException("IGFS endpoint thread count must be positive: " +
+                        ipcCfg.getThreadCount());
             }
 
             long maxSpaceSize = cfg.getMaxSpaceSize();

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc7d4ee/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsServer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsServer.java
index 314baac..aa4b115 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsServer.java
@@ -139,7 +139,7 @@ public class IgfsServer {
         if (srvEndpoint.getPort() >= 0)
             igfsCtx.kernalContext().ports().registerPort(srvEndpoint.getPort(), TCP, srvEndpoint.getClass());
 
-        hnd = new IgfsIpcHandler(igfsCtx);
+        hnd = new IgfsIpcHandler(igfsCtx, endpointCfg, mgmt);
 
         // Start client accept worker.
         acceptWorker = new AcceptWorker();

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc7d4ee/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
index 27f47e8..0ce1036 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
@@ -469,6 +469,22 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest {
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testInvalidEndpointThreadCount() throws Exception {
+        final String failMsg = "IGFS endpoint thread count must be positive";
+        g1Cfg.setCacheConfiguration(concat(dataCaches(1024), metaCaches(), CacheConfiguration.class));
+
+        final String igfsCfgName = "igfs-cfg";
+        final IgfsIpcEndpointConfiguration igfsEndpointCfg = new IgfsIpcEndpointConfiguration();
+        igfsEndpointCfg.setThreadCount(0);
+        g1IgfsCfg1.setName(igfsCfgName);
+        g1IgfsCfg1.setIpcEndpointConfiguration(igfsEndpointCfg);
+
+        checkGridStartFails(g1Cfg, failMsg, true);
+    }
+
+    /**
      * Checks that the given grid configuration will lead to {@link IgniteCheckedException} upon grid startup.
      *
      * @param cfg Grid configuration to check.


[08/11] ignite git commit: IGNITE-2876: Fixed possible starvation in system pool caused by IgfsBlockMessage. This closes #575.

Posted by sb...@apache.org.
IGNITE-2876: Fixed possible starvation in system pool caused by IgfsBlockMessage. This closes #575.


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

Branch: refs/heads/ignite-2004
Commit: bc14c802f8d404392901abb7fb2da6088d638d36
Parents: 88c65b8
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Mar 24 13:28:30 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Mar 24 13:28:30 2016 +0300

----------------------------------------------------------------------
 .../managers/communication/GridIoManager.java   |  11 +
 .../managers/communication/GridIoPolicy.java    |   3 +
 .../processors/igfs/IgfsDataManager.java        |  29 +-
 .../processors/igfs/IgfsDeleteWorker.java       |   2 +-
 .../igfs/IgfsFragmentizerManager.java           |   4 +-
 ...lockMessageSystemPoolStarvationSelfTest.java | 299 +++++++++++++++++++
 .../ignite/testsuites/IgniteIgfsTestSuite.java  |   3 +
 7 files changed, 329 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bc14c802/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
index 9ffbf4e..4577dc8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
@@ -88,6 +88,7 @@ import static org.apache.ignite.events.EventType.EVT_NODE_JOINED;
 import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
 import static org.apache.ignite.internal.GridTopic.TOPIC_COMM_USER;
 import static org.apache.ignite.internal.managers.communication.GridIoPolicy.AFFINITY_POOL;
+import static org.apache.ignite.internal.managers.communication.GridIoPolicy.IGFS_POOL;
 import static org.apache.ignite.internal.managers.communication.GridIoPolicy.MANAGEMENT_POOL;
 import static org.apache.ignite.internal.managers.communication.GridIoPolicy.MARSH_CACHE_POOL;
 import static org.apache.ignite.internal.managers.communication.GridIoPolicy.P2P_POOL;
@@ -150,6 +151,9 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
     /** Marshaller cache pool. */
     private ExecutorService marshCachePool;
 
+    /** IGFS pool. */
+    private ExecutorService igfsPool;
+
     /** Discovery listener. */
     private GridLocalEventListener discoLsnr;
 
@@ -252,6 +256,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
         mgmtPool = ctx.getManagementExecutorService();
         utilityCachePool = ctx.utilityCachePool();
         marshCachePool = ctx.marshallerCachePool();
+        igfsPool = ctx.getIgfsExecutorService();
         affPool = new IgniteThreadPoolExecutor(
             "aff",
             ctx.gridName(),
@@ -643,6 +648,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
                 case AFFINITY_POOL:
                 case UTILITY_CACHE_POOL:
                 case MARSH_CACHE_POOL:
+                case IGFS_POOL:
                 {
                     if (msg.isOrdered())
                         processOrderedMessage(nodeId, msg, plc, msgC);
@@ -703,6 +709,11 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
 
                 return marshCachePool;
 
+            case IGFS_POOL:
+                assert igfsPool != null : "IGFS pool is not configured.";
+
+                return igfsPool;
+
             default: {
                 assert plc >= 0 : "Negative policy: " + plc;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/bc14c802/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoPolicy.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoPolicy.java
index 57622c9..00590ba 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoPolicy.java
@@ -43,6 +43,9 @@ public class GridIoPolicy {
     /** Marshaller cache execution pool. */
     public static final byte MARSH_CACHE_POOL = 6;
 
+    /** Marshaller cache execution pool. */
+    public static final byte IGFS_POOL = 7;
+
     /**
      * Defines the range of reserved pools that are not available for plugins.
      * @param key The key.

http://git-wip-us.apache.org/repos/asf/ignite/blob/bc14c802/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
index 3825086..16fbeb8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
@@ -91,7 +91,7 @@ import java.util.concurrent.locks.ReentrantLock;
 import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
 import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
 import static org.apache.ignite.internal.GridTopic.TOPIC_IGFS;
-import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL;
+import static org.apache.ignite.internal.managers.communication.GridIoPolicy.IGFS_POOL;
 import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
 import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
 
@@ -1014,26 +1014,18 @@ public class IgfsDataManager extends IgfsManager {
         if (!node.isLocal()) {
             final IgfsBlocksMessage msg = new IgfsBlocksMessage(fileId, batchId, blocks);
 
-            callIgfsLocalSafe(new GridPlainCallable<Object>() {
-                @Override @Nullable public Object call() throws Exception {
-                    try {
-                        igfsCtx.send(nodeId, topic, msg, SYSTEM_POOL);
-                    } catch (IgniteCheckedException e) {
-                        completionFut.onError(nodeId, e);
-                    }
-
-                    return null;
-                }
-            });
+            try {
+                igfsCtx.send(nodeId, topic, msg, IGFS_POOL);
+            }
+            catch (IgniteCheckedException e) {
+                completionFut.onError(nodeId, e);
+            }
         }
         else {
             callIgfsLocalSafe(new GridPlainCallable<Object>() {
-                @Override
-                @Nullable
-                public Object call() throws Exception {
+                @Override @Nullable public Object call() throws Exception {
                     storeBlocksAsync(blocks).listen(new CI1<IgniteInternalFuture<?>>() {
-                        @Override
-                        public void apply(IgniteInternalFuture<?> fut) {
+                        @Override public void apply(IgniteInternalFuture<?> fut) {
                             try {
                                 fut.get();
 
@@ -1276,8 +1268,7 @@ public class IgfsDataManager extends IgfsManager {
 
                 try {
                     // Send reply back to node.
-                    igfsCtx.send(nodeId, topic, new IgfsAckMessage(blocksMsg.fileId(), blocksMsg.id(), err),
-                        SYSTEM_POOL);
+                    igfsCtx.send(nodeId, topic, new IgfsAckMessage(blocksMsg.fileId(), blocksMsg.id(), err), IGFS_POOL);
                 }
                 catch (IgniteCheckedException e) {
                     U.warn(log, "Failed to send batch acknowledgement (did node leave the grid?) [nodeId=" + nodeId +

http://git-wip-us.apache.org/repos/asf/ignite/blob/bc14c802/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
index 7e4dac8..e5914e0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
@@ -357,7 +357,7 @@ public class IgfsDeleteWorker extends IgfsThread {
 
         for (ClusterNode node : nodes) {
             try {
-                igfsCtx.send(node, topic, msg, GridIoPolicy.SYSTEM_POOL);
+                igfsCtx.send(node, topic, msg, GridIoPolicy.IGFS_POOL);
             }
             catch (IgniteCheckedException e) {
                 U.warn(log, "Failed to send IGFS delete message to node [nodeId=" + node.id() +

http://git-wip-us.apache.org/repos/asf/ignite/blob/bc14c802/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java
index 99e7cd6..d64c64a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java
@@ -59,7 +59,7 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
 import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
 import static org.apache.ignite.internal.GridTopic.TOPIC_IGFS;
-import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL;
+import static org.apache.ignite.internal.managers.communication.GridIoPolicy.IGFS_POOL;
 import static org.apache.ignite.internal.processors.igfs.IgfsFileAffinityRange.RANGE_STATUS_INITIAL;
 import static org.apache.ignite.internal.processors.igfs.IgfsFileAffinityRange.RANGE_STATUS_MOVED;
 import static org.apache.ignite.internal.processors.igfs.IgfsFileAffinityRange.RANGE_STATUS_MOVING;
@@ -186,7 +186,7 @@ public class IgfsFragmentizerManager extends IgfsManager {
     private void sendWithRetries(UUID nodeId, IgfsCommunicationMessage msg) throws IgniteCheckedException {
         for (int i = 0; i < MESSAGE_SEND_RETRY_COUNT; i++) {
             try {
-                igfsCtx.send(nodeId, topic, msg, SYSTEM_POOL);
+                igfsCtx.send(nodeId, topic, msg, IGFS_POOL);
 
                 return;
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/bc14c802/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java
new file mode 100644
index 0000000..ec3b808
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java
@@ -0,0 +1,299 @@
+/*
+ * 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.igfs;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteFileSystem;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.FileSystemConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper;
+import org.apache.ignite.igfs.IgfsMode;
+import org.apache.ignite.igfs.IgfsOutputStream;
+import org.apache.ignite.igfs.IgfsPath;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
+import org.apache.ignite.internal.util.lang.GridAbsPredicateX;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Test to check for system pool starvation due to {@link IgfsBlocksMessage}.
+ */
+public class IgfsBlockMessageSystemPoolStarvationSelfTest extends IgfsCommonAbstractTest {
+    /** First node name. */
+    private static final String NODE_1_NAME = "node1";
+
+    /** Second node name. */
+    private static final String NODE_2_NAME = "node2";
+
+    /** Data cache name. */
+    private static final String DATA_CACHE_NAME = "data";
+
+    /** Meta cache name. */
+    private static final String META_CACHE_NAME = "meta";
+
+    /** Key in data caceh we will use to reproduce the issue. */
+    private static final Integer DATA_KEY = 1;
+
+    /** First node. */
+    private Ignite victim;
+
+    /** Second node. */
+    private Ignite attacker;
+
+    /** {@inheritDoc} */
+    @SuppressWarnings({"unchecked", "ConstantConditions"})
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        // Start nodes.
+        TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+        victim = Ignition.start(config(NODE_1_NAME, ipFinder));
+        attacker = Ignition.start(config(NODE_2_NAME, ipFinder));
+
+        // Check if we selected victim correctly.
+        if (F.eq(dataCache(victim).affinity().mapKeyToNode(DATA_KEY).id(), attacker.cluster().localNode().id())) {
+            Ignite tmp = victim;
+
+            victim = attacker;
+
+            attacker = tmp;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        G.stopAll(true);
+
+        victim = null;
+        attacker = null;
+
+        super.afterTest();
+    }
+
+    /**
+     * Test starvation.
+     *
+     * @throws Exception If failed.
+     */
+    @SuppressWarnings("unchecked")
+    public void testStarvation() throws Exception {
+        // 1. Create two IGFS file to make all system threads busy.
+        CountDownLatch fileWriteLatch = new CountDownLatch(1);
+
+        final IgniteInternalFuture fileFut1 = createFileAsync(new IgfsPath("/file1"), fileWriteLatch);
+        final IgniteInternalFuture fileFut2 = createFileAsync(new IgfsPath("/file2"), fileWriteLatch);
+
+        // 2. Start transaction and keep it opened.
+        final CountDownLatch txStartLatch = new CountDownLatch(1);
+        final CountDownLatch txCommitLatch = new CountDownLatch(1);
+
+        IgniteInternalFuture<Void> txFut = GridTestUtils.runAsync(new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                GridCacheAdapter dataCache = dataCache(attacker);
+
+                try (IgniteInternalTx tx =
+                         dataCache.txStartEx(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) {
+                    dataCache.put(DATA_KEY, 0);
+
+                    txStartLatch.countDown();
+
+                    txCommitLatch.await();
+
+                    tx.commit();
+                }
+
+                return null;
+            }
+        });
+
+        txStartLatch.await();
+
+        // 3. Start async operation to drain semaphore permits.
+        final IgniteInternalFuture putFut = dataCache(victim).putAsync(DATA_KEY, 1);
+
+        assert !awaitFuture(putFut);
+
+        // 4. Write data to files and ensure we stuck.
+        fileWriteLatch.countDown();
+
+        assert !awaitFuture(fileFut1);
+        assert !awaitFuture(fileFut2);
+
+        // 5. Finish transaction.
+        txCommitLatch.countDown();
+
+        assert awaitFuture(txFut);
+
+        // 6. Async put must succeed.
+        assert awaitFuture(putFut);
+
+        // 7. Writes must succeed.
+        assert awaitFuture(fileFut1);
+        assert awaitFuture(fileFut2);
+    }
+
+    /**
+     * Await future completion.
+     *
+     * @param fut Future.
+     * @return {@code True} if future completed.
+     * @throws Exception If failed.
+     */
+    private static boolean awaitFuture(final IgniteInternalFuture fut) throws Exception {
+        return GridTestUtils.waitForCondition(new GridAbsPredicateX() {
+            @Override public boolean applyx() throws IgniteCheckedException {
+                return fut.isDone();
+            }
+        }, 1000);
+    }
+
+    /**
+     * Create IGFS file asynchronously.
+     *
+     * @param path Path.
+     * @return Future.
+     */
+    private IgniteInternalFuture<Void> createFileAsync(final IgfsPath path, final CountDownLatch writeStartLatch) {
+        return GridTestUtils.runAsync(new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                IgniteFileSystem igfs = attacker.fileSystem(null);
+
+                try (IgfsOutputStream out = igfs.create(path, true)) {
+                    writeStartLatch.await();
+
+                    out.write(new byte[1024]);
+
+                    out.flush();
+                }
+
+                return null;
+            }
+        });
+    }
+
+    /**
+     * Get data cache for node.
+     *
+     * @param node Node.
+     * @return Data cache.
+     * @throws Exception If failed.
+     */
+    private GridCacheAdapter dataCache(Ignite node) throws Exception  {
+        return ((IgniteKernal)node).internalCache(DATA_CACHE_NAME);
+    }
+
+    /**
+     * Create node configuration.
+     *
+     * @param name Node name.
+     * @return Configuration.
+     * @throws Exception If failed.
+     */
+    private IgniteConfiguration config(String name, TcpDiscoveryVmIpFinder ipFinder) throws Exception {
+        // Data cache configuration.
+        CacheConfiguration dataCcfg = new CacheConfiguration();
+
+        dataCcfg.setName(DATA_CACHE_NAME);
+        dataCcfg.setCacheMode(CacheMode.REPLICATED);
+        dataCcfg.setAtomicityMode(TRANSACTIONAL);
+        dataCcfg.setWriteSynchronizationMode(FULL_SYNC);
+        dataCcfg.setAffinityMapper(new DummyAffinityMapper(1));
+        dataCcfg.setMaxConcurrentAsyncOperations(1);
+
+        // Meta cache configuration.
+        CacheConfiguration metaCcfg = new CacheConfiguration();
+
+        metaCcfg.setName(META_CACHE_NAME);
+        metaCcfg.setCacheMode(CacheMode.REPLICATED);
+        metaCcfg.setAtomicityMode(TRANSACTIONAL);
+        metaCcfg.setWriteSynchronizationMode(FULL_SYNC);
+
+        // File system configuration.
+        FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
+
+        igfsCfg.setDefaultMode(IgfsMode.PRIMARY);
+        igfsCfg.setDataCacheName(DATA_CACHE_NAME);
+        igfsCfg.setMetaCacheName(META_CACHE_NAME);
+        igfsCfg.setFragmentizerEnabled(false);
+        igfsCfg.setBlockSize(1024);
+
+        // Ignite configuration.
+        IgniteConfiguration cfg = getConfiguration(name);
+
+        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+        discoSpi.setIpFinder(ipFinder);
+
+        cfg.setDiscoverySpi(discoSpi);
+        cfg.setCacheConfiguration(dataCcfg, metaCcfg);
+        cfg.setFileSystemConfiguration(igfsCfg);
+
+        cfg.setLocalHost("127.0.0.1");
+        cfg.setConnectorConfiguration(null);
+
+        cfg.setSystemThreadPoolSize(2);
+        cfg.setRebalanceThreadPoolSize(1);
+        cfg.setPublicThreadPoolSize(1);
+
+        return cfg;
+    }
+
+    /**
+     * Dimmy affinity mapper.
+     */
+    private static class DummyAffinityMapper extends IgfsGroupDataBlocksKeyMapper {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** Dummy affinity key. */
+        private static final Integer KEY = 1;
+
+        /**
+         * Constructor.
+         *
+         * @param grpSize Group size.
+         */
+        public DummyAffinityMapper(int grpSize) {
+            super(grpSize);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object affinityKey(Object key) {
+            return KEY;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bc14c802/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
index aff3ad7..25c54e4 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.processors.igfs.IgfsAttributesSelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsBackupsDualAsyncSelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsBackupsDualSyncSelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsBackupsPrimarySelfTest;
+import org.apache.ignite.internal.processors.igfs.IgfsBlockMessageSystemPoolStarvationSelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsCachePerBlockLruEvictionPolicySelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsCacheSelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsClientCacheSelfTest;
@@ -118,6 +119,8 @@ public class IgniteIgfsTestSuite extends TestSuite {
         suite.addTestSuite(IgfsBackupsDualSyncSelfTest.class);
         suite.addTestSuite(IgfsBackupsDualAsyncSelfTest.class);
 
+        suite.addTestSuite(IgfsBlockMessageSystemPoolStarvationSelfTest.class);
+
         // TODO: Enable when IGFS failover is fixed.
         //suite.addTestSuite(IgfsBackupFailoverSelfTest.class);
 


[04/11] ignite git commit: Added remove() method for Iterator in Java 7.

Posted by sb...@apache.org.
Added remove() method for Iterator in Java 7.


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

Branch: refs/heads/ignite-2004
Commit: 3bf5f46b19d7f142bb04917d812e7336e86c085a
Parents: 2f64ab0
Author: shtykh_roman <rs...@yahoo.com>
Authored: Thu Mar 24 14:44:04 2016 +0900
Committer: shtykh_roman <rs...@yahoo.com>
Committed: Thu Mar 24 14:44:04 2016 +0900

----------------------------------------------------------------------
 .../examples/datagrid/store/CacheLoadOnlyStoreExample.java      | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3bf5f46b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java
index 4635c16..ac3d27b 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java
@@ -153,6 +153,11 @@ public class CacheLoadOnlyStoreExample {
 
                     return scanner.next();
                 }
+
+                /** {@inheritDoc} */
+                @Override public void remove() {
+                    throw new UnsupportedOperationException();
+                }
             };
         }
 


[02/11] ignite git commit: Fixed tests.

Posted by sb...@apache.org.
Fixed tests.


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

Branch: refs/heads/ignite-2004
Commit: 66f9a34bfc13eb54822581aefcd2c687c5bc9245
Parents: b189bb2
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Wed Mar 23 19:45:51 2016 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Wed Mar 23 19:46:16 2016 +0300

----------------------------------------------------------------------
 .../continuous/CacheContinuousQueryManager.java     | 13 +++++++++----
 .../continuous/GridContinuousProcessor.java         |  2 +-
 .../processors/cache/IgniteCacheAbstractTest.java   |  6 ++++++
 .../cache/IgniteCacheEntryListenerAbstractTest.java | 16 +++++++++++++++-
 .../distributed/IgniteCacheManyClientsTest.java     |  6 ++++++
 ...acheContinuousQueryFailoverAbstractSelfTest.java |  6 ++++++
 6 files changed, 43 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/66f9a34b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
index 869a51b..c01f636 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
@@ -489,7 +489,8 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
             false,
             false,
             loc,
-            keepBinary);
+            keepBinary,
+            false);
     }
 
     /**
@@ -528,6 +529,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
             true,
             notifyExisting,
             loc,
+            false,
             false);
     }
 
@@ -608,6 +610,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
      * @param internal Internal flag.
      * @param notifyExisting Notify existing flag.
      * @param loc Local flag.
+     * @param onStart Waiting topology exchange.
      * @return Continuous routine ID.
      * @throws IgniteCheckedException In case of error.
      */
@@ -619,7 +622,8 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
         boolean internal,
         boolean notifyExisting,
         boolean loc,
-        final boolean keepBinary) throws IgniteCheckedException
+        final boolean keepBinary,
+        boolean onStart) throws IgniteCheckedException
     {
         cctx.checkSecurity(SecurityPermission.CACHE_READ);
 
@@ -650,7 +654,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
             pred).get();
 
         try {
-            if (hnd.isQuery() && cctx.userCache())
+            if (hnd.isQuery() && cctx.userCache() && !onStart)
                 hnd.waitTopologyFuture(cctx.kernalContext());
         }
         catch (IgniteCheckedException e) {
@@ -905,7 +909,8 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
                 false,
                 false,
                 false,
-                keepBinary
+                keepBinary,
+                onStart
             );
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/66f9a34b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
index f2d6e1e..99e0bb5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
@@ -915,7 +915,7 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
             if (proc != null) {
                 GridCacheAdapter cache = ctx.cache().internalCache(hnd0.cacheName());
 
-                if (cache != null && !cache.isLocal())
+                if (cache != null && !cache.isLocal() && cache.context().userCache())
                     req.addUpdateCounters(ctx.localNodeId(), cache.context().topology().updateCounters());
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/66f9a34b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
index 7df72f0..ce60232 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
@@ -37,6 +37,7 @@ import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jsr166.ConcurrentHashMap8;
 
@@ -100,6 +101,11 @@ public abstract class IgniteCacheAbstractTest extends GridCommonAbstractTest {
         if (isDebug())
             disco.setAckTimeout(Integer.MAX_VALUE);
 
+        MemoryEventStorageSpi eventSpi = new MemoryEventStorageSpi();
+        eventSpi.setExpireCount(100);
+
+        cfg.setEventStorageSpi(eventSpi);
+
         cfg.setDiscoverySpi(disco);
 
         cfg.setCacheConfiguration(cacheConfiguration(gridName));

http://git-wip-us.apache.org/repos/asf/ignite/blob/66f9a34b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
index 35fbbd5..1f58765 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
@@ -60,11 +60,13 @@ import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
 import org.apache.ignite.cache.CacheMemoryMode;
 import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.continuous.GridContinuousProcessor;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.jetbrains.annotations.Nullable;
 
@@ -118,6 +120,18 @@ public abstract class IgniteCacheEntryListenerAbstractTest extends IgniteCacheAb
         return cfg;
     }
 
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        MemoryEventStorageSpi eventSpi = new MemoryEventStorageSpi();
+        eventSpi.setExpireCount(50);
+
+        cfg.setEventStorageSpi(eventSpi);
+
+        return cfg;
+    }
+
     /**
      * @return Cache memory mode.
      */
@@ -421,7 +435,7 @@ public abstract class IgniteCacheEntryListenerAbstractTest extends IgniteCacheAb
 
                 barrier.await();
 
-                for (int i = 0; i < 200; i++) {
+                for (int i = 0; i < 100; i++) {
                     cache.registerCacheEntryListener(cfg);
 
                     cache.deregisterCacheEntryListener(cfg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/66f9a34b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheManyClientsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheManyClientsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheManyClientsTest.java
index 8d4af19..ddc75ba 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheManyClientsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheManyClientsTest.java
@@ -38,6 +38,7 @@ import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
@@ -71,6 +72,11 @@ public class IgniteCacheManyClientsTest extends GridCommonAbstractTest {
         cfg.setPeerClassLoadingEnabled(false);
         cfg.setTimeServerPortRange(200);
 
+        MemoryEventStorageSpi eventSpi = new MemoryEventStorageSpi();
+        eventSpi.setExpireCount(100);
+
+        cfg.setEventStorageSpi(eventSpi);
+
         ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setLocalPortRange(200);
         ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/66f9a34b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
index f104f21..4454379 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
@@ -90,6 +90,7 @@ import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
@@ -136,6 +137,11 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         cfg.setCommunicationSpi(commSpi);
 
+        MemoryEventStorageSpi eventSpi = new MemoryEventStorageSpi();
+        eventSpi.setExpireCount(50);
+
+        cfg.setEventStorageSpi(eventSpi);
+
         CacheConfiguration ccfg = new CacheConfiguration();
 
         ccfg.setCacheMode(cacheMode());


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

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


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

Branch: refs/heads/ignite-2004
Commit: d0c7b51070a49ac6bebd666349cdd9914e0fd846
Parents: 116c6ce 34a9b66
Author: sboikov <sb...@gridgain.com>
Authored: Thu Mar 24 16:10:01 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Mar 24 16:10:01 2016 +0300

----------------------------------------------------------------------
 .../store/CacheLoadOnlyStoreExample.java        | 171 +++++++++++
 examples/src/main/resources/person.csv          |  20 ++
 .../ignite/examples/CacheExamplesSelfTest.java  |   8 +
 .../igfs/IgfsIpcEndpointConfiguration.java      |  28 ++
 .../ignite/internal/binary/BinaryContext.java   |   2 +
 .../managers/communication/GridIoManager.java   |  11 +
 .../managers/communication/GridIoPolicy.java    |   3 +
 .../continuous/GridContinuousProcessor.java     |   2 +-
 .../internal/processors/igfs/IgfsBlockKey.java  |  30 +-
 .../processors/igfs/IgfsDataManager.java        |  29 +-
 .../processors/igfs/IgfsDeleteWorker.java       |   2 +-
 .../processors/igfs/IgfsDirectoryInfo.java      |  33 +-
 .../internal/processors/igfs/IgfsEntryInfo.java |   8 +-
 .../igfs/IgfsFragmentizerManager.java           |   4 +-
 .../processors/igfs/IgfsIpcHandler.java         |  81 +++--
 .../internal/processors/igfs/IgfsProcessor.java |  11 +-
 .../internal/processors/igfs/IgfsServer.java    |   2 +-
 .../internal/processors/igfs/IgfsUtils.java     | 127 ++++++++
 .../meta/IgfsMetaDirectoryCreateProcessor.java  |  24 +-
 .../IgfsMetaDirectoryListingAddProcessor.java   |   6 +-
 ...gfsMetaDirectoryListingReplaceProcessor.java |   4 +-
 .../igfs/meta/IgfsMetaFileCreateProcessor.java  |  16 +-
 .../meta/IgfsMetaUpdatePropertiesProcessor.java |   5 +-
 .../cache/IgniteCacheAbstractTest.java          |   6 +
 .../IgniteCacheEntryListenerAbstractTest.java   |  16 +-
 .../distributed/IgniteCacheManyClientsTest.java |   6 +
 ...ContinuousQueryFailoverAbstractSelfTest.java |  13 +-
 .../processors/igfs/IgfsAbstractSelfTest.java   |  11 +
 ...lockMessageSystemPoolStarvationSelfTest.java | 299 +++++++++++++++++++
 .../IgfsPrimaryOptimziedMarshallerSelfTest.java |  28 ++
 .../igfs/IgfsProcessorValidationSelfTest.java   |  16 +
 .../ignite/testsuites/IgniteIgfsTestSuite.java  |   5 +
 32 files changed, 941 insertions(+), 86 deletions(-)
----------------------------------------------------------------------



[07/11] ignite git commit: Reverted accidental change to GridCacheMapEntry (commit b189bb2e15e7a54).

Posted by sb...@apache.org.
Reverted accidental change to GridCacheMapEntry (commit  b189bb2e15e7a54).


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

Branch: refs/heads/ignite-2004
Commit: 88c65b84847244401eb6a7c520bbbcb2158685c0
Parents: 90a5bbe
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Mar 24 10:40:15 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Mar 24 10:40:15 2016 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/cache/GridCacheMapEntry.java  | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/88c65b84/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 6677c6a..fb6aeef 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -2453,12 +2453,10 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
 
                 recordNodeId(affNodeId, topVer);
 
-                if (hadVal) {
-                    updateCntr0 = nextPartCounter(topVer);
+                updateCntr0 = nextPartCounter(topVer);
 
-                    if (updateCntr != null)
-                        updateCntr0 = updateCntr;
-                }
+                if (updateCntr != null)
+                    updateCntr0 = updateCntr;
 
                 drReplicate(drType, null, newVer, topVer);
 


[10/11] ignite git commit: Removed debug from tests.

Posted by sb...@apache.org.
Removed debug from tests.


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

Branch: refs/heads/ignite-2004
Commit: 34a9b6655faa3283c8641d7091a569e3f6fc810d
Parents: cfc7d4e
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu Mar 24 14:45:25 2016 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Mar 24 14:45:25 2016 +0300

----------------------------------------------------------------------
 .../CacheContinuousQueryFailoverAbstractSelfTest.java         | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/34a9b665/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
index 4454379..32add4f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
@@ -175,7 +175,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
     /** {@inheritDoc} */
     @Override protected long getTestTimeout() {
-        return 5 * 60_000;
+        return 8 * 60_000;
     }
 
     /** {@inheritDoc} */
@@ -815,11 +815,6 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
         checkBackupQueue(3, false);
     }
 
-    /** {@inheritDoc} */
-    @Override public boolean isDebug() {
-        return true;
-    }
-
     /**
      * @param backups Number of backups.
      * @param updateFromClient If {@code true} executes cache update from client node.


[06/11] ignite git commit: Merge remote-tracking branch 'origin/master'

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


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

Branch: refs/heads/ignite-2004
Commit: 90a5bbec4978da35d43c1c121d880cbba5c8dea4
Parents: 29806af 3bf5f46
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Mar 24 10:35:55 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Mar 24 10:35:55 2016 +0300

----------------------------------------------------------------------
 .../examples/datagrid/store/CacheLoadOnlyStoreExample.java      | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------



[05/11] ignite git commit: IGNITE-2878: IGFS: Optimzied serialization of IgfsListingEntry and properties map.

Posted by sb...@apache.org.
IGNITE-2878: IGFS: Optimzied serialization of IgfsListingEntry and properties map.


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

Branch: refs/heads/ignite-2004
Commit: 29806af4ec2a0a9ab6b19f9a08c1fd17ea7a0694
Parents: 2f64ab0
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Mar 24 10:35:43 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Mar 24 10:35:43 2016 +0300

----------------------------------------------------------------------
 .../ignite/internal/binary/BinaryContext.java   |   2 +
 .../internal/processors/igfs/IgfsBlockKey.java  |  30 ++++-
 .../processors/igfs/IgfsDirectoryInfo.java      |  33 ++++-
 .../internal/processors/igfs/IgfsEntryInfo.java |   8 +-
 .../internal/processors/igfs/IgfsUtils.java     | 127 +++++++++++++++++++
 .../meta/IgfsMetaDirectoryCreateProcessor.java  |  24 ++--
 .../IgfsMetaDirectoryListingAddProcessor.java   |   6 +-
 ...gfsMetaDirectoryListingReplaceProcessor.java |   4 +-
 .../igfs/meta/IgfsMetaFileCreateProcessor.java  |  16 ++-
 .../meta/IgfsMetaUpdatePropertiesProcessor.java |   5 +-
 .../processors/igfs/IgfsAbstractSelfTest.java   |  11 ++
 .../IgfsPrimaryOptimziedMarshallerSelfTest.java |  28 ++++
 .../ignite/testsuites/IgniteIgfsTestSuite.java  |   2 +
 13 files changed, 261 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index b357345..4d8c293 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -65,6 +65,7 @@ import org.apache.ignite.internal.processors.cache.binary.BinaryMetadataKey;
 import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
 import org.apache.ignite.internal.processors.datastructures.CollocatedQueueItemKey;
 import org.apache.ignite.internal.processors.datastructures.CollocatedSetItemKey;
+import org.apache.ignite.internal.processors.igfs.IgfsBlockKey;
 import org.apache.ignite.internal.processors.igfs.IgfsDirectoryInfo;
 import org.apache.ignite.internal.processors.igfs.IgfsFileAffinityRange;
 import org.apache.ignite.internal.processors.igfs.IgfsFileInfo;
@@ -118,6 +119,7 @@ public class BinaryContext {
         // IGFS classes.
         sysClss.add(IgfsPath.class.getName());
 
+        sysClss.add(IgfsBlockKey.class.getName());
         sysClss.add(IgfsDirectoryInfo.class.getName());
         sysClss.add(IgfsFileAffinityRange.class.getName());
         sysClss.add(IgfsFileInfo.class.getName());

http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlockKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlockKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlockKey.java
index 06a2e1c..c366ae3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlockKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlockKey.java
@@ -22,6 +22,14 @@ import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.nio.ByteBuffer;
+
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.binary.BinaryRawWriter;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.internal.binary.BinaryUtils;
 import org.apache.ignite.internal.processors.task.GridInternal;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -37,7 +45,7 @@ import org.jetbrains.annotations.Nullable;
  * File's binary data block key.
  */
 @GridInternal
-public final class IgfsBlockKey implements Message, Externalizable, Comparable<IgfsBlockKey> {
+public final class IgfsBlockKey implements Message, Externalizable, Binarylizable, Comparable<IgfsBlockKey> {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -150,6 +158,26 @@ public final class IgfsBlockKey implements Message, Externalizable, Comparable<I
     }
 
     /** {@inheritDoc} */
+    @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
+        BinaryRawWriter out = writer.rawWriter();
+
+        BinaryUtils.writeIgniteUuid(out, fileId);
+        BinaryUtils.writeIgniteUuid(out, affKey);
+        out.writeBoolean(evictExclude);
+        out.writeLong(blockId);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
+        BinaryRawReader in = reader.rawReader();
+
+        fileId = BinaryUtils.readIgniteUuid(in);
+        affKey = BinaryUtils.readIgniteUuid(in);
+        evictExclude = in.readBoolean();
+        blockId = in.readLong();
+    }
+
+    /** {@inheritDoc} */
     @Override public int hashCode() {
         return fileId.hashCode() + (int)(blockId ^ (blockId >>> 32));
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDirectoryInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDirectoryInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDirectoryInfo.java
index a426e8c..269098b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDirectoryInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDirectoryInfo.java
@@ -26,6 +26,7 @@ import org.apache.ignite.binary.Binarylizable;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
@@ -181,7 +182,19 @@ public class IgfsDirectoryInfo extends IgfsEntryInfo implements Binarylizable {
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         super.writeExternal(out);
 
-        out.writeObject(listing);
+        if (listing != null) {
+            out.writeBoolean(true);
+
+            out.writeInt(listing.size());
+
+            for (Map.Entry<String, IgfsListingEntry> entry : listing.entrySet()) {
+                U.writeString(out, entry.getKey());
+
+                IgfsUtils.writeListingEntry(out, entry.getValue());
+            }
+        }
+        else
+            out.writeBoolean(false);
     }
 
     /** {@inheritDoc} */
@@ -189,7 +202,19 @@ public class IgfsDirectoryInfo extends IgfsEntryInfo implements Binarylizable {
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
         super.readExternal(in);
 
-        listing = (Map<String, IgfsListingEntry>)in.readObject();
+        if (in.readBoolean()) {
+            int listingSize = in.readInt();
+
+            listing = new HashMap<>(listingSize);
+
+            for (int i = 0; i < listingSize; i++) {
+                String key = U.readString(in);
+
+                IgfsListingEntry val = IgfsUtils.readListingEntry(in);
+
+                listing.put(key, val);
+            }
+        }
     }
 
     /** {@inheritDoc} */
@@ -211,8 +236,6 @@ public class IgfsDirectoryInfo extends IgfsEntryInfo implements Binarylizable {
         }
         else
             out.writeBoolean(false);
-
-        out.writeMap(listing);
     }
 
     /** {@inheritDoc} */
@@ -234,8 +257,6 @@ public class IgfsDirectoryInfo extends IgfsEntryInfo implements Binarylizable {
                 listing.put(key, val);
             }
         }
-
-        listing = in.readMap();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
index 9ff65da..4df8b34 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
@@ -267,7 +267,9 @@ public abstract class IgfsEntryInfo implements Externalizable {
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         U.writeGridUuid(out, id);
-        U.writeStringMap(out, props);
+
+        IgfsUtils.writeProperties(out, props);
+
         out.writeLong(accessTime);
         out.writeLong(modificationTime);
     }
@@ -275,7 +277,9 @@ public abstract class IgfsEntryInfo implements Externalizable {
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
         id = U.readGridUuid(in);
-        props = U.readStringMap(in);
+
+        props = IgfsUtils.readProperties(in);
+
         accessTime = in.readLong();
         modificationTime = in.readLong();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
index c6b7ad3..1b97565 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
@@ -36,6 +36,7 @@ import org.apache.ignite.internal.binary.BinaryUtils;
 import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
 import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager;
 import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.internal.util.IgniteUtils;
 import org.apache.ignite.internal.util.future.IgniteFutureImpl;
 import org.apache.ignite.internal.util.lang.IgniteOutClosureX;
 import org.apache.ignite.internal.util.typedef.F;
@@ -45,6 +46,9 @@ import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.transactions.Transaction;
 import org.jetbrains.annotations.Nullable;
 
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
 import java.lang.reflect.Constructor;
 import java.util.HashMap;
 import java.util.Map;
@@ -471,6 +475,42 @@ public class IgfsUtils {
     }
 
     /**
+     * Write listing entry.
+     *
+     * @param out Writer.
+     * @param entry Entry.
+     * @throws IOException If failed.
+     */
+    public static void writeListingEntry(DataOutput out, @Nullable IgfsListingEntry entry) throws IOException {
+        if (entry != null) {
+            out.writeBoolean(true);
+
+            IgniteUtils.writeGridUuid(out, entry.fileId());
+
+            out.writeBoolean(entry.isDirectory());
+        }
+        else
+            out.writeBoolean(false);
+    }
+
+    /**
+     * Read listing entry.
+     *
+     * @param in Reader.
+     * @return Entry.
+     */
+    @Nullable public static IgfsListingEntry readListingEntry(DataInput in) throws IOException {
+        if (in.readBoolean()) {
+            IgniteUuid id = IgniteUtils.readGridUuid(in);
+            boolean dir = in.readBoolean();
+
+            return new IgfsListingEntry(id, dir);
+        }
+        else
+            return null;
+    }
+
+    /**
      * Write entry properties. Rely on reference equality for well-known properties.
      *
      * @param out Writer.
@@ -554,4 +594,91 @@ public class IgfsUtils {
         else
             return null;
     }
+
+    /**
+     * Write entry properties. Rely on reference equality for well-known properties.
+     *
+     * @param out Writer.
+     * @param props Properties.
+     * @throws IOException If failed.
+     */
+    @SuppressWarnings("StringEquality")
+    public static void writeProperties(DataOutput out, @Nullable Map<String, String> props) throws IOException {
+        if (props != null) {
+            out.writeInt(props.size());
+
+            for (Map.Entry<String, String> entry : props.entrySet()) {
+                String key = entry.getKey();
+
+                if (key == PROP_PERMISSION)
+                    out.writeByte(PROP_PERMISSION_IDX);
+                else if (key == PROP_PREFER_LOCAL_WRITES)
+                    out.writeByte(PROP_PREFER_LOCAL_WRITES_IDX);
+                else if (key == PROP_USER_NAME)
+                    out.writeByte(PROP_USER_NAME_IDX);
+                else if (key == PROP_GROUP_NAME)
+                    out.writeByte(PROP_GROUP_NAME_IDX);
+                else {
+                    out.writeByte(PROP_IDX);
+                    U.writeString(out, key);
+                }
+
+                U.writeString(out, entry.getValue());
+            }
+        }
+        else
+            out.writeInt(-1);
+    }
+
+    /**
+     * Read entry properties.
+     *
+     * @param in Reader.
+     * @return Properties.
+     * @throws IOException If failed.
+     */
+    @Nullable public static Map<String, String> readProperties(DataInput in) throws IOException {
+        int size = in.readInt();
+
+        if (size >= 0) {
+            Map<String, String> props = new HashMap<>(size);
+
+            for (int i = 0; i < size; i++) {
+                byte idx = in.readByte();
+
+                String key;
+
+                switch (idx) {
+                    case PROP_PERMISSION_IDX:
+                        key = PROP_PERMISSION;
+
+                        break;
+
+                    case PROP_PREFER_LOCAL_WRITES_IDX:
+                        key = PROP_PREFER_LOCAL_WRITES;
+
+                        break;
+
+                    case PROP_USER_NAME_IDX:
+                        key = PROP_USER_NAME;
+
+                        break;
+
+                    case PROP_GROUP_NAME_IDX:
+                        key = PROP_GROUP_NAME;
+
+                        break;
+
+                    default:
+                        key = U.readString(in);
+                }
+
+                props.put(key, U.readString(in));
+            }
+
+            return props;
+        }
+        else
+            return null;
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java
index 5f4fe73..eee9300 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java
@@ -116,27 +116,25 @@ public class IgfsMetaDirectoryCreateProcessor implements EntryProcessor<IgniteUu
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         out.writeLong(createTime);
-        U.writeStringMap(out, props);
 
-        if (childName != null) {
-            out.writeBoolean(true);
+        IgfsUtils.writeProperties(out, props);
+
+        U.writeString(out, childName);
 
-            U.writeString(out, childName);
-            out.writeObject(childEntry);
-        }
-        else
-            out.writeBoolean(false);
+        if (childName != null)
+            IgfsUtils.writeListingEntry(out, childEntry);
     }
 
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
         createTime = in.readLong();
-        props = U.readStringMap(in);
 
-        if (in.readBoolean()) {
-            childName = U.readString(in);
-            childEntry = (IgfsListingEntry)in.readObject();
-        }
+        props = IgfsUtils.readProperties(in);
+
+        childName = U.readString(in);
+
+        if (childName != null)
+            childEntry = IgfsUtils.readListingEntry(in);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingAddProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingAddProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingAddProcessor.java
index e9fa867..380d997 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingAddProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingAddProcessor.java
@@ -100,13 +100,15 @@ public final class IgfsMetaDirectoryListingAddProcessor implements EntryProcesso
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         U.writeString(out, fileName);
-        out.writeObject(entry);
+
+        IgfsUtils.writeListingEntry(out, entry);
     }
 
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
         fileName = U.readString(in);
-        entry = (IgfsListingEntry)in.readObject();
+
+        entry = IgfsUtils.readListingEntry(in);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingReplaceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingReplaceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingReplaceProcessor.java
index dfc9bfc..e230f05 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingReplaceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingReplaceProcessor.java
@@ -98,13 +98,13 @@ public final class IgfsMetaDirectoryListingReplaceProcessor implements EntryProc
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         U.writeString(out, name);
-        out.writeObject(id);
+        U.writeGridUuid(out, id);
     }
 
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
         name = U.readString(in);
-        id = (IgniteUuid)in.readObject();
+        id = U.readGridUuid(in);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java
index 9fd16aa..8c4c296 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java
@@ -116,20 +116,24 @@ public class IgfsMetaFileCreateProcessor implements EntryProcessor<IgniteUuid, I
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         out.writeLong(createTime);
-        U.writeStringMap(out, props);
+
+        IgfsUtils.writeProperties(out, props);
+
         out.writeInt(blockSize);
-        out.writeObject(affKey);
-        out.writeObject(lockId);
+        U.writeGridUuid(out, affKey);
+        U.writeGridUuid(out, lockId);
         out.writeBoolean(evictExclude);
     }
 
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
         createTime = in.readLong();
-        props = U.readStringMap(in);
+
+        props = IgfsUtils.readProperties(in);
+
         blockSize = in.readInt();
-        affKey = (IgniteUuid)in.readObject();
-        lockId = (IgniteUuid)in.readObject();
+        affKey = U.readGridUuid(in);
+        lockId = U.readGridUuid(in);
         evictExclude = in.readBoolean();
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePropertiesProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePropertiesProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePropertiesProcessor.java
index e0d5b8b..af79332 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePropertiesProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePropertiesProcessor.java
@@ -27,7 +27,6 @@ import org.apache.ignite.internal.processors.igfs.IgfsEntryInfo;
 import org.apache.ignite.internal.processors.igfs.IgfsUtils;
 import org.apache.ignite.internal.util.GridLeanMap;
 import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteUuid;
 
 import javax.cache.processor.EntryProcessor;
@@ -93,12 +92,12 @@ public class IgfsMetaUpdatePropertiesProcessor implements EntryProcessor<IgniteU
 
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
-        U.writeStringMap(out, props);
+        IgfsUtils.writeProperties(out, props);
     }
 
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        props = U.readStringMap(in);
+        props = IgfsUtils.readProperties(in);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
index ec3878c..2f6c7bf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
@@ -53,6 +53,7 @@ import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
@@ -232,6 +233,13 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
     }
 
     /**
+     * @return Use optimzied marshaller flag.
+     */
+    protected boolean useOptimizedMarshaller() {
+        return false;
+    }
+
+    /**
      * Data chunk.
      *
      * @param len Length.
@@ -332,6 +340,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
 
         IgniteConfiguration cfg = new IgniteConfiguration();
 
+        if (useOptimizedMarshaller())
+            cfg.setMarshaller(new OptimizedMarshaller());
+
         cfg.setGridName(gridName);
 
         TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();

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

http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
index 038cb54..aff3ad7 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
@@ -40,6 +40,7 @@ import org.apache.ignite.internal.processors.igfs.IgfsModesSelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsOneClientNodeTest;
 import org.apache.ignite.internal.processors.igfs.IgfsPrimaryOffheapTieredSelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsPrimaryOffheapValuesSelfTest;
+import org.apache.ignite.internal.processors.igfs.IgfsPrimaryOptimziedMarshallerSelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsPrimaryRelaxedSelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsPrimarySelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsProcessorSelfTest;
@@ -69,6 +70,7 @@ public class IgniteIgfsTestSuite extends TestSuite {
 
         suite.addTest(new TestSuite(IgfsPrimarySelfTest.class));
         suite.addTest(new TestSuite(IgfsPrimaryRelaxedSelfTest.class));
+        suite.addTest(new TestSuite(IgfsPrimaryOptimziedMarshallerSelfTest.class));
         suite.addTest(new TestSuite(IgfsPrimaryOffheapTieredSelfTest.class));
         suite.addTest(new TestSuite(IgfsPrimaryOffheapValuesSelfTest.class));
         suite.addTest(new TestSuite(IgfsDualSyncSelfTest.class));


[03/11] ignite git commit: IGNITE-2415: CacheLoadOnlyStoreAdapter use example. - Fixes #569.

Posted by sb...@apache.org.
IGNITE-2415: CacheLoadOnlyStoreAdapter use example. - Fixes #569.

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


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

Branch: refs/heads/ignite-2004
Commit: 2f64ab0b4739a646dfb2c3b1fb2ed5b8039b43b4
Parents: 66f9a34
Author: shtykh_roman <rs...@yahoo.com>
Authored: Thu Mar 24 11:00:21 2016 +0900
Committer: shtykh_roman <rs...@yahoo.com>
Committed: Thu Mar 24 11:00:21 2016 +0900

----------------------------------------------------------------------
 .../store/CacheLoadOnlyStoreExample.java        | 166 +++++++++++++++++++
 examples/src/main/resources/person.csv          |  20 +++
 .../ignite/examples/CacheExamplesSelfTest.java  |   8 +
 3 files changed, 194 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2f64ab0b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java
new file mode 100644
index 0000000..4635c16
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java
@@ -0,0 +1,166 @@
+/*
+ * 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.datagrid.store;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Scanner;
+import javax.cache.configuration.FactoryBuilder;
+import javax.cache.integration.CacheLoaderException;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CachePeekMode;
+import org.apache.ignite.cache.store.CacheLoadOnlyStoreAdapter;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.examples.model.Person;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.lang.IgniteBiTuple;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Example of how to load data from CSV file using {@link CacheLoadOnlyStoreAdapter}.
+ * <p>
+ * The adapter is intended to be used in cases when you need to pre-load a cache from text or file of any other format.
+ * <p>
+ * Remote nodes can be started with {@link ExampleNodeStartup} in another JVM which will
+ * start node with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class CacheLoadOnlyStoreExample {
+    /** Cache name. */
+    private static final String CACHE_NAME = CacheLoadOnlyStoreExample.class.getSimpleName();
+
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws IgniteException If example execution failed.
+     */
+    public static void main(String[] args) throws IgniteException {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println();
+            System.out.println(">>> CacheLoadOnlyStoreExample started.");
+
+            ProductLoader productLoader = new ProductLoader("examples/src/main/resources/person.csv");
+
+            productLoader.setThreadsCount(2);
+            productLoader.setBatchSize(10);
+            productLoader.setBatchQueueSize(1);
+
+            try (IgniteCache<Long, Person> cache = ignite.getOrCreateCache(cacheConfiguration(productLoader))) {
+                // load data.
+                cache.loadCache(null);
+
+                System.out.println(">>> Loaded number of items: " + cache.size(CachePeekMode.PRIMARY));
+
+                System.out.println(">>> Data for the person by id1: " + cache.get(1L));
+            }
+            finally {
+                // Distributed cache could be removed from cluster only by #destroyCache() call.
+                ignite.destroyCache(CACHE_NAME);
+            }
+        }
+    }
+
+    /**
+     * Creates cache configurations for the loader.
+     *
+     * @return {@link CacheConfiguration}.
+     */
+    private static CacheConfiguration cacheConfiguration(ProductLoader productLoader) {
+        CacheConfiguration cacheCfg = new CacheConfiguration();
+
+        cacheCfg.setCacheMode(CacheMode.PARTITIONED);
+        cacheCfg.setName(CACHE_NAME);
+
+        // provide the loader.
+        cacheCfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(productLoader));
+
+        return cacheCfg;
+    }
+
+    /**
+     * Csv data loader for product data.
+     */
+    private static class ProductLoader extends CacheLoadOnlyStoreAdapter<Long, Person, String> implements Serializable {
+        /** Csv file name. */
+        final String csvFileName;
+
+        /** Constructor. */
+        ProductLoader(String csvFileName) {
+            this.csvFileName = csvFileName;
+        }
+
+        /** {@inheritDoc} */
+        @Override protected Iterator<String> inputIterator(@Nullable Object... args) throws CacheLoaderException {
+            final Scanner scanner;
+
+            try {
+                File path = IgniteUtils.resolveIgnitePath(csvFileName);
+
+                if (path == null)
+                    throw new CacheLoaderException("Failed to open the source file: " + csvFileName);
+
+                scanner = new Scanner(path);
+
+                scanner.useDelimiter("\\n");
+            }
+            catch (FileNotFoundException e) {
+                throw new CacheLoaderException("Failed to open the source file " + csvFileName, e);
+            }
+
+            /**
+             * Iterator for text input. The scanner is implicitly closed when there's nothing to scan.
+             */
+            return new Iterator<String>() {
+                /** {@inheritDoc} */
+                @Override public boolean hasNext() {
+                    if (!scanner.hasNext()) {
+                        scanner.close();
+
+                        return false;
+                    }
+
+                    return true;
+                }
+
+                /** {@inheritDoc} */
+                @Override public String next() {
+                    if (!hasNext())
+                        throw new NoSuchElementException();
+
+                    return scanner.next();
+                }
+            };
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override protected IgniteBiTuple<Long, Person> parse(String rec, @Nullable Object... args) {
+            String[] p = rec.split("\\s*,\\s*");
+            return new T2<>(Long.valueOf(p[0]), new Person(Long.valueOf(p[0]), Long.valueOf(p[1]),
+                p[2], p[3], Double.valueOf(p[4]), p[5].trim()));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/2f64ab0b/examples/src/main/resources/person.csv
----------------------------------------------------------------------
diff --git a/examples/src/main/resources/person.csv b/examples/src/main/resources/person.csv
new file mode 100644
index 0000000..6f45854
--- /dev/null
+++ b/examples/src/main/resources/person.csv
@@ -0,0 +1,20 @@
+1,201,name1,surname1,1000,r1
+2,202,name2,surname2,2000,r2
+3,203,name3,surname3,3000,r3
+4,204,name4,surname4,4000,r4
+5,205,name5,surname5,5000,r5
+6,206,name6,surname6,6000,r6
+7,207,name7,surname7,7000,r7
+8,208,name8,surname8,8000,r8
+9,209,name9,surname9,9000,r9
+10,210,name10,surname10,10000,r10
+11,211,name11,surname11,11000,r11
+12,212,name12,surname12,12000,r12
+13,213,name13,surname13,13000,r13
+14,214,name14,surname14,14000,r14
+15,215,name15,surname15,15000,r15
+16,216,name16,surname16,16000,r16
+17,217,name17,surname17,17000,r17
+18,218,name18,surname18,18000,r18
+19,219,name19,surname19,19000,r19
+20,220,name20,surname20,20000,r20
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/2f64ab0b/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
index 39c2ea6..541291b 100644
--- a/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
+++ b/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
@@ -26,6 +26,7 @@ import org.apache.ignite.examples.datagrid.CachePutGetExample;
 import org.apache.ignite.examples.datagrid.CacheQueryExample;
 import org.apache.ignite.examples.datagrid.CacheTransactionExample;
 import org.apache.ignite.examples.datagrid.starschema.CacheStarSchemaExample;
+import org.apache.ignite.examples.datagrid.store.CacheLoadOnlyStoreExample;
 import org.apache.ignite.examples.datastructures.IgniteAtomicLongExample;
 import org.apache.ignite.examples.datastructures.IgniteAtomicReferenceExample;
 import org.apache.ignite.examples.datastructures.IgniteAtomicSequenceExample;
@@ -158,4 +159,11 @@ public class CacheExamplesSelfTest extends GridAbstractExamplesTest {
     public void testCacheContinuousQueryExample() throws Exception {
         CacheContinuousQueryExample.main(EMPTY_ARGS);
     }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCacheLoadOnlyStoreExample() throws Exception {
+        CacheLoadOnlyStoreExample.main(EMPTY_ARGS);
+    }
 }