You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2015/06/26 02:07:22 UTC

[01/50] incubator-ignite git commit: # review droppng of slow clients

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-621 c94c0c475 -> 45b0f0925


# review droppng of slow clients


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

Branch: refs/heads/ignite-621
Commit: 7c70267d2b4b7fc3fb7a1efda1ee785cebebcc41
Parents: 1cc0000
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Mon Jun 22 12:49:58 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Jun 22 12:49:58 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/IgniteSystemProperties.java   |  3 ++
 .../communication/tcp/TcpCommunicationSpi.java  | 49 ++++++++++----------
 .../tcp/TcpCommunicationSpiMBean.java           |  8 ++++
 3 files changed, 36 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c70267d/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index b166f39..542fa30 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -236,7 +236,10 @@ public final class IgniteSystemProperties {
     /**
      * System property to disable buffered communication if node sends less messages count than
      * specified by this property. Default value is {@code 512}.
+     *
+     * @deprecated Not used anymore.
      */
+    @Deprecated
     public static final String IGNITE_MIN_BUFFERED_COMMUNICATION_MSG_CNT = "IGNITE_MIN_BUFFERED_COMMUNICATION_MSG_CNT";
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c70267d/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 1ec2128..1035ee5 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -29,7 +29,6 @@ import org.apache.ignite.internal.util.ipc.*;
 import org.apache.ignite.internal.util.ipc.shmem.*;
 import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.nio.*;
-import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.internal.util.worker.*;
@@ -51,7 +50,6 @@ import java.util.*;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 
-import static org.apache.ignite.IgniteSystemProperties.*;
 import static org.apache.ignite.events.EventType.*;
 
 /**
@@ -657,9 +655,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
     /** Slow client queue limit. */
     private int slowClientQueueLimit;
 
-    /** Min buffered message count. */
-    private int minBufferedMsgCnt = Integer.getInteger(IGNITE_MIN_BUFFERED_COMMUNICATION_MSG_CNT, 512);
-
     /** NIO server. */
     private GridNioServer<Message> nioSrvr;
 
@@ -935,24 +930,29 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      *
      * @param connBufSize Connection buffer size.
      * @see #setConnectionBufferFlushFrequency(long)
+     * @deprecated Not used any more.
      */
+    @Deprecated
     @IgniteSpiConfiguration(optional = true)
     public void setConnectionBufferSize(int connBufSize) {
         // No-op.
     }
 
     /** {@inheritDoc} */
+    @Deprecated
     @Override public int getConnectionBufferSize() {
         return 0;
     }
 
     /** {@inheritDoc} */
+    @Deprecated
     @IgniteSpiConfiguration(optional = true)
     @Override public void setConnectionBufferFlushFrequency(long connBufFlushFreq) {
         // No-op.
     }
 
     /** {@inheritDoc} */
+    @Deprecated
     @Override public long getConnectionBufferFlushFrequency() {
         return 0;
     }
@@ -1156,13 +1156,14 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
     /**
      * Sets slow client queue limit.
      * <p/>
-     * When set to a positive number, communication SPI will monitor clients outbound queue sizes and will drop
+     * When set to a positive number, communication SPI will monitor clients outbound message queue sizes and will drop
      * those clients whose queue exceeded this limit.
      * <p/>
      * Usually this value should be set to the same value as {@link #getMessageQueueLimit()} which controls
-     * message back-pressure for server nodes. The default value for this parameter is {@link #DFLT_MSG_QUEUE_LIMIT}.
+     * message back-pressure for server nodes. The default value for this parameter is {@code 0}
+     * which means {@code unlimited}.
      *
-     * @param slowClientQueueLimit Slow cilent queue limit.
+     * @param slowClientQueueLimit Slow client queue limit.
      */
     public void setSlowClientQueueLimit(int slowClientQueueLimit) {
         this.slowClientQueueLimit = slowClientQueueLimit;
@@ -1171,20 +1172,20 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
     /**
      * Sets the minimum number of messages for this SPI, that are buffered
      * prior to sending.
-     * <p>
-     * Defaults to either {@code 512} or {@link IgniteSystemProperties#IGNITE_MIN_BUFFERED_COMMUNICATION_MSG_CNT}
-     * system property (if specified).
      *
      * @param minBufferedMsgCnt Minimum buffered message count.
+     * @deprecated Not used any more.
      */
     @IgniteSpiConfiguration(optional = true)
+    @Deprecated
     public void setMinimumBufferedMessageCount(int minBufferedMsgCnt) {
-        this.minBufferedMsgCnt = minBufferedMsgCnt;
+        // No-op.
     }
 
     /** {@inheritDoc} */
+    @Deprecated
     @Override public int getMinimumBufferedMessageCount() {
-        return minBufferedMsgCnt;
+        return 0;
     }
 
     /** {@inheritDoc} */
@@ -1248,7 +1249,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
         assertParameter(shmemPort > 0 || shmemPort == -1, "shmemPort > 0 || shmemPort == -1");
         assertParameter(reconCnt > 0, "reconnectCnt > 0");
         assertParameter(selectorsCnt > 0, "selectorsCnt > 0");
-        assertParameter(minBufferedMsgCnt >= 0, "minBufferedMsgCnt >= 0");
         assertParameter(connTimeout >= 0, "connTimeout >= 0");
         assertParameter(maxConnTimeout >= connTimeout, "maxConnTimeout >= connTimeout");
         assertParameter(sockWriteTimeout >= 0, "sockWriteTimeout >= 0");
@@ -1326,7 +1326,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
             log.debug(configInfo("sockRcvBuf", sockRcvBuf));
             log.debug(configInfo("shmemPort", shmemPort));
             log.debug(configInfo("msgQueueLimit", msgQueueLimit));
-            log.debug(configInfo("minBufferedMsgCnt", minBufferedMsgCnt));
             log.debug(configInfo("connTimeout", connTimeout));
             log.debug(configInfo("maxConnTimeout", maxConnTimeout));
             log.debug(configInfo("reconCnt", reconCnt));
@@ -1339,11 +1338,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
             U.quietAndWarn(log, "'TCP_NO_DELAY' for communication is off, which should be used with caution " +
                 "since may produce significant delays with some scenarios.");
 
-        if (slowClientQueueLimit > 0 && msgQueueLimit > 0) {
-            if (slowClientQueueLimit >= msgQueueLimit) {
-                U.quietAndWarn(log, "Slow client queue limit is set to a value greater than message queue limit. " +
-                    "Slow client queue limit will have no effect.");
-            }
+        if (slowClientQueueLimit > 0 && msgQueueLimit > 0 && slowClientQueueLimit >= msgQueueLimit) {
+            U.quietAndWarn(log, "Slow client queue limit is set to a value greater than message queue limit " +
+                "(slow client queue limit will have no effect) [msgQueueLimit=" + msgQueueLimit +
+                    ", slowClientQueueLimit=" + slowClientQueueLimit + ']');
         }
 
         registerMBean(gridName, this, TcpCommunicationSpiMBean.class);
@@ -1916,13 +1914,16 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                 ClusterNode node = getSpiContext().node(id);
 
                 if (node != null && node.isClient()) {
-                    String msg = "Client node outbound queue size exceeded slowClientQueueLimit, " +
-                        "the client will be dropped (consider changing \'slowClientQueueLimit\') [" +
-                        "srvNode=" + getSpiContext().localNode().id() +
+                    String msg = "Client node outbound message queue size exceeded slowClientQueueLimit, " +
+                        "the client will be dropped " +
+                        "(consider changing 'slowClientQueueLimit' configuration property) " +
+                        "[srvNode=" + getSpiContext().localNode().id() +
                         ", clientNode=" + node +
                         ", slowClientQueueLimit=" + slowClientQueueLimit + ']';
 
-                    LT.warn(log, null, msg);
+                    U.quietAndWarn(
+                        log,
+                        msg);
 
                     getSpiContext().failNode(id, msg);
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c70267d/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
index 1971d99..067ca41 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
@@ -168,7 +168,9 @@ public interface TcpCommunicationSpiMBean extends IgniteSpiManagementMBean {
      * connection buffer.
      *
      * @return Flush frequency.
+     * @deprecated Not used anymore.
      */
+    @Deprecated
     @MXBeanDescription("Connection buffer flush frequency.")
     public long getConnectionBufferFlushFrequency();
 
@@ -183,7 +185,9 @@ public interface TcpCommunicationSpiMBean extends IgniteSpiManagementMBean {
      *
      * @param connBufFlushFreq Flush frequency.
      * @see #getConnectionBufferSize()
+     * @deprecated Not used anymore.
      */
+    @Deprecated
     @MXBeanDescription("Sets connection buffer flush frequency.")
     public void setConnectionBufferFlushFrequency(long connBufFlushFreq);
 
@@ -193,7 +197,9 @@ public interface TcpCommunicationSpiMBean extends IgniteSpiManagementMBean {
      * If set to {@code 0} connection buffer is disabled.
      *
      * @return Connection buffer size.
+     * @deprecated Not used anymore.
      */
+    @Deprecated
     @MXBeanDescription("Connection buffer size.")
     public int getConnectionBufferSize();
 
@@ -238,7 +244,9 @@ public interface TcpCommunicationSpiMBean extends IgniteSpiManagementMBean {
      * prior to sending.
      *
      * @return Minimum buffered message count.
+     * @deprecated Not used anymore.
      */
+    @Deprecated
     @MXBeanDescription("Minimum buffered message count.")
     public int getMinimumBufferedMessageCount();
 


[09/50] incubator-ignite git commit: # ignite-sprint-6 race in tcp communication connection, retry full partition map send

Posted by ag...@apache.org.
# ignite-sprint-6 race in tcp communication connection, retry full partition map send


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

Branch: refs/heads/ignite-621
Commit: 285d790ff0ce597fde65a778c381e59a4f1c89aa
Parents: 1605996
Author: sboikov <sb...@gridgain.com>
Authored: Mon Jun 22 16:40:08 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Jun 22 16:58:01 2015 +0300

----------------------------------------------------------------------
 .../GridDhtPartitionsExchangeFuture.java        | 49 +++++++++++++++-----
 .../communication/tcp/TcpCommunicationSpi.java  | 12 +++++
 .../GridTcpCommunicationSpiConfigSelfTest.java  |  1 -
 3 files changed, 49 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/285d790f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 9f18c98..7c780b0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -1078,18 +1078,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
                 log.debug("Received message for finished future (will reply only to sender) [msg=" + msg +
                     ", fut=" + this + ']');
 
-            try {
-                ClusterNode n = cctx.node(nodeId);
-
-                if (n != null)
-                    sendAllPartitions(F.asList(n), exchId);
-            }
-            catch (IgniteCheckedException e) {
-                scheduleRecheck();
-
-                U.error(log, "Failed to send full partition map to node (will retry after timeout) [node=" + nodeId +
-                    ", exchangeId=" + exchId + ']', e);
-            }
+            sendAllPartitions(nodeId, cctx.gridConfig().getNetworkSendRetryCount());
         }
         else {
             initFut.listen(new CI1<IgniteInternalFuture<Boolean>>() {
@@ -1146,6 +1135,42 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
     }
 
     /**
+     * @param nodeId Node ID.
+     * @param retryCnt Number of retries.
+     */
+    private void sendAllPartitions(final UUID nodeId, final int retryCnt) {
+        ClusterNode n = cctx.node(nodeId);
+
+        try {
+            if (n != null)
+                sendAllPartitions(F.asList(n), exchId);
+        }
+        catch (IgniteCheckedException e) {
+            if (e instanceof ClusterTopologyCheckedException || !cctx.discovery().alive(n)) {
+                log.debug("Failed to send full partition map to node, node left grid " +
+                    "[rmtNode=" + nodeId + ", exchangeId=" + exchId + ']');
+
+                return;
+            }
+
+            if (retryCnt > 0) {
+                long timeout = cctx.gridConfig().getNetworkSendRetryDelay();
+
+                LT.error(log, e, "Failed to send full partition map to node (will retry after timeout) " +
+                    "[node=" + nodeId + ", exchangeId=" + exchId + ", timeout=" + timeout + ']');
+
+                cctx.time().addTimeoutObject(new GridTimeoutObjectAdapter(timeout) {
+                    @Override public void onTimeout() {
+                        sendAllPartitions(nodeId, retryCnt - 1);
+                    }
+                });
+            }
+            else
+                U.error(log, "Failed to send full partition map [node=" + n + ", exchangeId=" + exchId + ']', e);
+        }
+    }
+
+    /**
      * @param nodeId Sender node ID.
      * @param msg Full partition info.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/285d790f/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 1035ee5..addf243d 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -1748,6 +1748,18 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
                                 assert old == null : "Client already created " +
                                         "[node=" + node + ", client=" + client0 + ", oldClient=" + old + ']';
+
+                                if (client0 instanceof GridTcpNioCommunicationClient) {
+                                    GridTcpNioCommunicationClient tcpClient = ((GridTcpNioCommunicationClient)client0);
+
+                                    if (tcpClient.session().closeTime() > 0 && clients.remove(nodeId, client0)) {
+                                        if (log.isDebugEnabled())
+                                            log.debug("Session was closed after client creation, will retry " +
+                                                "[node=" + node + ", client=" + client0 + ']');
+
+                                        client0 = null;
+                                    }
+                                }
                             }
                             else
                                 U.sleep(200);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/285d790f/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java
index c4a0916..4062931 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java
@@ -37,7 +37,6 @@ public class GridTcpCommunicationSpiConfigSelfTest extends GridSpiAbstractConfig
         checkNegativeSpiProperty(new TcpCommunicationSpi(), "messageQueueLimit", -1);
         checkNegativeSpiProperty(new TcpCommunicationSpi(), "reconnectCount", 0);
         checkNegativeSpiProperty(new TcpCommunicationSpi(), "selectorsCount", 0);
-        checkNegativeSpiProperty(new TcpCommunicationSpi(), "minimumBufferedMessageCount", -1);
         checkNegativeSpiProperty(new TcpCommunicationSpi(), "connectTimeout", -1);
         checkNegativeSpiProperty(new TcpCommunicationSpi(), "maxConnectTimeout", -1);
         checkNegativeSpiProperty(new TcpCommunicationSpi(), "socketWriteTimeout", -1);


[12/50] incubator-ignite git commit: Merge branch 'ignite-sprint-6' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-621

Posted by ag...@apache.org.
Merge branch 'ignite-sprint-6' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-621


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

Branch: refs/heads/ignite-621
Commit: a4e31be6a018f1711ec0cb385c6b88b35c9dffed
Parents: c94c0c4 285d790
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Mon Jun 22 15:29:47 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Mon Jun 22 15:29:47 2015 -0700

----------------------------------------------------------------------
 .../apache/ignite/IgniteSystemProperties.java   |   3 +
 .../ignite/internal/MarshallerContextImpl.java  |  12 +-
 .../processors/cache/GridCacheIoManager.java    |  64 ++++--
 .../GridCachePartitionExchangeManager.java      |  70 +++----
 .../processors/cache/GridCacheSwapManager.java  |  12 +-
 .../GridDhtPartitionsExchangeFuture.java        |  49 +++--
 .../offheap/GridOffHeapProcessor.java           |  19 +-
 .../apache/ignite/internal/util/GridDebug.java  |  37 ++--
 .../communication/tcp/TcpCommunicationSpi.java  |  61 +++---
 .../tcp/TcpCommunicationSpiMBean.java           |   8 +
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  68 ++++---
 .../GridCacheAbstractFailoverSelfTest.java      |   6 +-
 .../cache/GridCacheDaemonNodeStopSelfTest.java  | 119 +++++++++++
 .../GridTcpCommunicationSpiConfigSelfTest.java  |   1 -
 .../testsuites/IgniteCacheTestSuite3.java       |   1 +
 .../processors/query/h2/IgniteH2Indexing.java   |   2 +
 .../query/h2/twostep/GridMapQueryExecutor.java  |  23 ++-
 .../cache/IgniteCacheOffheapEvictQueryTest.java | 196 +++++++++++++++++++
 .../IgniteCacheQuerySelfTestSuite.java          |   1 +
 19 files changed, 590 insertions(+), 162 deletions(-)
----------------------------------------------------------------------



[39/50] incubator-ignite git commit: Merge branch 'ignite-gg-10440' into ignite-sprint-7

Posted by ag...@apache.org.
Merge branch 'ignite-gg-10440' into ignite-sprint-7


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

Branch: refs/heads/ignite-621
Commit: 7fc5595ac58bdd628a42cf870e59fc31e89e99af
Parents: b29ff1c c528705
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu Jun 25 10:41:55 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Jun 25 10:41:55 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/internal/GridKernalContextImpl.java |  3 +++
 .../internal/processors/plugin/CachePluginManager.java    | 10 ++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[15/50] incubator-ignite git commit: ignite-1048 create/lock entries before topology read lock

Posted by ag...@apache.org.
ignite-1048 create/lock entries before topology read lock


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

Branch: refs/heads/ignite-621
Commit: be881a367ef02a724c2b84aba8f72c6effadc2b2
Parents: 1c66078
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 23 10:52:47 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 23 10:52:47 2015 +0300

----------------------------------------------------------------------
 .../cache/distributed/dht/GridDhtLocalPartition.java        | 3 ++-
 .../cache/distributed/dht/atomic/GridDhtAtomicCache.java    | 9 ++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be881a36/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index 3a577a7..87c7f0e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -236,7 +236,8 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
     void onAdded(GridDhtCacheEntry entry) {
         GridDhtPartitionState state = state();
 
-        assert state != EVICTED : "Adding entry to invalid partition: " + this;
+        if (state == EVICTED)
+            throw new GridDhtInvalidPartitionException(id, "Adding entry to invalid partition [part=" + id + ']');
 
         map.put(entry.key(), entry);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be881a36/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 8630421..7bec302 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -1028,7 +1028,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         IgniteCacheExpiryPolicy expiry = null;
 
         try {
-            List<GridDhtCacheEntry> locked = null;
+            // If batch store update is enabled, we need to lock all entries.
+            // First, need to acquire locks on cache entries, then check filter.
+            List<GridDhtCacheEntry> locked = lockEntries(keys, req.topologyVersion());
+
             Collection<IgniteBiTuple<GridDhtCacheEntry, GridCacheVersion>> deleted = null;
 
             try {
@@ -1058,10 +1061,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                             return;
                         }
 
-                        // If batch store update is enabled, we need to lock all entries.
-                        // First, need to acquire locks on cache entries, then check filter.
-                        locked = lockEntries(keys, req.topologyVersion());
-
                         boolean hasNear = ctx.discovery().cacheNearNode(node, name());
 
                         GridCacheVersion ver = req.updateVersion();


[50/50] incubator-ignite git commit: Merge branch 'ignite-sprint-7' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-621

Posted by ag...@apache.org.
Merge branch 'ignite-sprint-7' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-621


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

Branch: refs/heads/ignite-621
Commit: 45b0f0925fe1da0fb41c06a2dce6440a26490f93
Parents: c2c90b5 3e8ddb4
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Thu Jun 25 17:06:46 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Thu Jun 25 17:06:46 2015 -0700

----------------------------------------------------------------------
 .../ClientAbstractConnectivitySelfTest.java     |   4 +-
 .../org/apache/ignite/cluster/ClusterGroup.java |   9 +
 .../org/apache/ignite/cluster/ClusterNode.java  |   2 +
 .../ignite/compute/ComputeTaskSplitAdapter.java |   2 +-
 .../ignite/internal/GridKernalContextImpl.java  |   3 +
 .../internal/cluster/ClusterGroupAdapter.java   |  38 +
 .../cluster/IgniteClusterAsyncImpl.java         |   5 +
 .../processors/plugin/CachePluginManager.java   |  10 +-
 .../internal/util/GridConfigurationFinder.java  |  55 +-
 .../ignite/internal/util/IgniteUtils.java       |   6 +-
 .../internal/ClusterForHostsSelfTest.java       | 113 +++
 .../internal/ClusterGroupAbstractTest.java      | 777 ++++++++++++++++++
 .../ignite/internal/ClusterGroupSelfTest.java   | 251 ++++++
 .../internal/GridProjectionAbstractTest.java    | 784 -------------------
 .../ignite/internal/GridProjectionSelfTest.java | 251 ------
 .../apache/ignite/internal/GridSelfTest.java    |   2 +-
 .../internal/util/IgniteUtilsSelfTest.java      |  22 +
 .../ignite/testsuites/IgniteBasicTestSuite.java |   6 +-
 .../p2p/GridP2PContinuousDeploymentTask1.java   |   2 +-
 .../commands/cache/VisorCacheCommand.scala      |   7 +-
 scripts/git-patch-prop.sh                       |   2 +-
 21 files changed, 1273 insertions(+), 1078 deletions(-)
----------------------------------------------------------------------



[20/50] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-1048

Posted by ag...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-1048


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

Branch: refs/heads/ignite-621
Commit: a2d2c9b96e9bd86f2f711df5da835c95af57b612
Parents: be881a3 c7ba154
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 23 12:56:44 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 23 12:56:44 2015 +0300

----------------------------------------------------------------------
 .../replicated/GridCacheReplicatedFailoverSelfTest.java         | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------



[16/50] incubator-ignite git commit: ignite-1022 do not need to start new thread inside tx on utility cache

Posted by ag...@apache.org.
ignite-1022 do not need to start new thread inside tx on utility cache


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

Branch: refs/heads/ignite-621
Commit: 74dc6d5a23c7a40841cbb41357e1e3bb2404a93c
Parents: 1c66078
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 23 10:54:37 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 23 10:54:37 2015 +0300

----------------------------------------------------------------------
 .../datastructures/DataStructuresProcessor.java | 64 +++++++-------------
 ...GridCacheQueueMultiNodeAbstractSelfTest.java |  4 +-
 .../GridCacheSetAbstractSelfTest.java           |  8 +--
 3 files changed, 27 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/74dc6d5a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
index 473a2ac..e6335b6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
@@ -297,8 +297,8 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
 
         checkAtomicsConfiguration();
 
-        removeDataStructure(new IgniteCallable<Void>() {
-            @Override public Void call() throws Exception {
+        removeDataStructure(new IgniteOutClosureX<Void>() {
+            @Override public Void applyx() throws IgniteCheckedException {
                 dsCacheCtx.gate().enter();
 
                 try {
@@ -306,9 +306,6 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
 
                     removeInternal(key, GridCacheAtomicSequenceValue.class);
                 }
-                catch (Exception e) {
-                    throw new IgniteCheckedException("Failed to remove sequence by name: " + name, e);
-                }
                 finally {
                     dsCacheCtx.gate().leave();
                 }
@@ -429,11 +426,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
             if (err != null)
                 throw err;
 
-            dataStructure = ctx.closure().callLocalSafe(new Callable<T>() {
-                @Override public T call() throws Exception {
-                    return c.applyx();
-                }
-            }, false).get();
+            dataStructure = c.applyx();
 
             tx.commit();
         }
@@ -453,16 +446,13 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
 
         awaitInitialization();
 
-        removeDataStructure(new IgniteCallable<Void>() {
-            @Override public Void call() throws Exception {
+        removeDataStructure(new IgniteOutClosureX<Void>() {
+            @Override public Void applyx() throws IgniteCheckedException {
                 dsCacheCtx.gate().enter();
 
                 try {
                     removeInternal(new GridCacheInternalKeyImpl(name), GridCacheAtomicLongValue.class);
                 }
-                catch (Exception e) {
-                    throw new IgniteCheckedException("Failed to remove atomic long by name: " + name, e);
-                }
                 finally {
                     dsCacheCtx.gate().leave();
                 }
@@ -479,7 +469,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
      * @param afterRmv Optional closure to run after data structure removed.
      * @throws IgniteCheckedException If failed.
      */
-    private <T> void removeDataStructure(IgniteCallable<T> c,
+    private <T> void removeDataStructure(IgniteOutClosureX<T> c,
         String name,
         DataStructureType type,
         @Nullable IgniteInClosureX<T> afterRmv)
@@ -515,7 +505,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
             if (!exists)
                 return;
 
-            rmvInfo = ctx.closure().callLocalSafe(c, false).get();
+            rmvInfo = c.applyx();
 
             tx.commit();
         }
@@ -611,8 +601,8 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
 
         awaitInitialization();
 
-        removeDataStructure(new IgniteCallable<Void>() {
-            @Override public Void call() throws Exception {
+        removeDataStructure(new IgniteOutClosureX<Void>() {
+            @Override public Void applyx() throws IgniteCheckedException {
                 dsCacheCtx.gate().enter();
 
                 try {
@@ -620,9 +610,6 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
 
                     removeInternal(key, GridCacheAtomicReferenceValue.class);
                 }
-                catch (Exception e) {
-                    throw new IgniteCheckedException("Failed to remove atomic reference by name: " + name, e);
-                }
                 finally {
                     dsCacheCtx.gate().leave();
                 }
@@ -718,8 +705,8 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
 
         awaitInitialization();
 
-        removeDataStructure(new IgniteCallable<Void>() {
-            @Override public Void call() throws Exception {
+        removeDataStructure(new IgniteOutClosureX<Void>() {
+            @Override public Void applyx() throws IgniteCheckedException {
                 dsCacheCtx.gate().enter();
 
                 try {
@@ -727,9 +714,6 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
 
                     removeInternal(key, GridCacheAtomicStampedValue.class);
                 }
-                catch (Exception e) {
-                    throw new IgniteCheckedException("Failed to remove atomic stamped by name: " + name, e);
-                }
                 finally {
                     dsCacheCtx.gate().leave();
                 }
@@ -806,6 +790,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
     /**
      * @param cfg Collection configuration.
      * @return Cache name.
+     * @throws IgniteCheckedException If failed.
      */
     private String compatibleConfiguration(CollectionConfiguration cfg) throws IgniteCheckedException {
         List<CacheCollectionInfo> caches = utilityDataCache.localPeek(DATA_STRUCTURES_CACHE_KEY, null, null);
@@ -835,8 +820,8 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
 
         awaitInitialization();
 
-        IgniteCallable<GridCacheQueueHeader> rmv = new IgniteCallable<GridCacheQueueHeader>() {
-            @Override public GridCacheQueueHeader call() throws Exception {
+        IgniteOutClosureX<GridCacheQueueHeader> rmv = new IgniteOutClosureX<GridCacheQueueHeader>() {
+            @Override public GridCacheQueueHeader applyx() throws IgniteCheckedException {
                 return (GridCacheQueueHeader)retryRemove(cctx.cache(), new GridCacheQueueHeaderKey(name));
             }
         };
@@ -910,11 +895,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
 
             final GridCacheContext cacheCtx = ctx.cache().internalCache(cacheName).context();
 
-            col = ctx.closure().callLocalSafe(new Callable<T>() {
-                @Override public T call() throws Exception {
-                    return c.applyx(cacheCtx);
-                }
-            }, false).get();
+            col = c.applyx(cacheCtx);
 
             tx.commit();
         }
@@ -1055,8 +1036,8 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
 
         awaitInitialization();
 
-        removeDataStructure(new IgniteCallable<Void>() {
-            @Override public Void call() throws Exception {
+        removeDataStructure(new IgniteOutClosureX<Void>() {
+            @Override public Void applyx() throws IgniteCheckedException {
                 GridCacheInternal key = new GridCacheInternalKeyImpl(name);
 
                 dsCacheCtx.gate().enter();
@@ -1079,11 +1060,8 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
                         tx.setRollbackOnly();
 
                     return null;
-                } catch (Error | Exception e) {
-                    U.error(log, "Failed to remove data structure: " + key, e);
-
-                    throw e;
-                } finally {
+                }
+                finally {
                     dsCacheCtx.gate().leave();
                 }
             }
@@ -1257,8 +1235,8 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
 
         awaitInitialization();
 
-        IgniteCallable<GridCacheSetHeader> rmv = new IgniteCallable<GridCacheSetHeader>() {
-            @Override public GridCacheSetHeader call() throws Exception {
+        IgniteOutClosureX<GridCacheSetHeader> rmv = new IgniteOutClosureX<GridCacheSetHeader>() {
+            @Override public GridCacheSetHeader applyx() throws IgniteCheckedException {
                 return (GridCacheSetHeader)retryRemove(cctx.cache(), new GridCacheSetHeaderKey(name));
             }
         };

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/74dc6d5a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeAbstractSelfTest.java
index 33fe127..49ee641 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueMultiNodeAbstractSelfTest.java
@@ -455,11 +455,11 @@ public abstract class GridCacheQueueMultiNodeAbstractSelfTest extends IgniteColl
     }
 
     /**
-     * TODO: IGNITE-583.
-     *
      * @throws Exception If failed.
      */
     public void testIterator() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-583");
+
         final String queueName = UUID.randomUUID().toString();
 
         info("Queue name: " + queueName);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/74dc6d5a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
index 6383f91..74114d9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
@@ -553,20 +553,20 @@ public abstract class GridCacheSetAbstractSelfTest extends IgniteCollectionAbstr
     }
 
     /**
-     * TODO: IGNITE-584.
-     *  
      * @throws Exception If failed.
      */
     public void testNodeJoinsAndLeaves() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-584");
+
         testNodeJoinsAndLeaves(false);
     }
 
     /**
-     * TODO: IGNITE-584.
-     *
      * @throws Exception If failed.
      */
     public void testNodeJoinsAndLeavesCollocated() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-584");
+
         testNodeJoinsAndLeaves(true);
     }
 


[29/50] incubator-ignite git commit: # ignite-1022

Posted by ag...@apache.org.
# ignite-1022


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

Branch: refs/heads/ignite-621
Commit: de7dcfe4e4a10e5b557bf7f6c1776026ed6a845e
Parents: 78a9e69
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jun 24 09:29:56 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 24 09:29:56 2015 +0300

----------------------------------------------------------------------
 .../datastructures/GridCacheSetAbstractSelfTest.java  | 14 ++++++++------
 .../cache/distributed/IgniteCacheManyClientsTest.java |  1 +
 2 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/de7dcfe4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
index 74114d9..0494bcc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
@@ -26,7 +26,6 @@ import org.apache.ignite.internal.processors.cache.query.*;
 import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
-import org.apache.ignite.marshaller.optimized.*;
 import org.apache.ignite.testframework.*;
 
 import java.util.*;
@@ -556,6 +555,9 @@ public abstract class GridCacheSetAbstractSelfTest extends IgniteCollectionAbstr
      * @throws Exception If failed.
      */
     public void testNodeJoinsAndLeaves() throws Exception {
+        if (collectionCacheMode() == LOCAL)
+            return;
+
         fail("https://issues.apache.org/jira/browse/IGNITE-584");
 
         testNodeJoinsAndLeaves(false);
@@ -565,6 +567,9 @@ public abstract class GridCacheSetAbstractSelfTest extends IgniteCollectionAbstr
      * @throws Exception If failed.
      */
     public void testNodeJoinsAndLeavesCollocated() throws Exception {
+        if (collectionCacheMode() == LOCAL)
+            return;
+
         fail("https://issues.apache.org/jira/browse/IGNITE-584");
 
         testNodeJoinsAndLeaves(true);
@@ -575,9 +580,6 @@ public abstract class GridCacheSetAbstractSelfTest extends IgniteCollectionAbstr
      * @throws Exception If failed.
      */
     private void testNodeJoinsAndLeaves(boolean collocated) throws Exception {
-        if (collectionCacheMode() == LOCAL)
-            return;
-
         CollectionConfiguration colCfg = config(collocated);
 
         Set<Integer> set0 = grid(0).set(SET_NAME, colCfg);
@@ -751,7 +753,7 @@ public abstract class GridCacheSetAbstractSelfTest extends IgniteCollectionAbstr
         IgniteInternalFuture<?> fut;
 
         try {
-                fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+            fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
                 @Override public Object call() throws Exception {
                     try {
                         while (!stop.get()) {
@@ -781,7 +783,7 @@ public abstract class GridCacheSetAbstractSelfTest extends IgniteCollectionAbstr
 
         for (int i = 0; i < gridCount(); i++) {
             Iterator<GridCacheEntryEx> entries =
-                    ((IgniteKernal)grid(i)).context().cache().internalCache(cctx.name()).map().allEntries0().iterator();
+                (grid(i)).context().cache().internalCache(cctx.name()).map().allEntries0().iterator();
 
             while (entries.hasNext()) {
                 GridCacheEntryEx entry = entries.next();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/de7dcfe4/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 48884de..1991f01 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
@@ -66,6 +66,7 @@ public class IgniteCacheManyClientsTest extends GridCommonAbstractTest {
         ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinderCleanFrequency(10 * 60_000);
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setJoinTimeout(2 * 60_000);
 
         if (!clientDiscovery)


[14/50] incubator-ignite git commit: # ignite-1037

Posted by ag...@apache.org.
# ignite-1037


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

Branch: refs/heads/ignite-621
Commit: 65964e26a7519e77f55a0320b37782f83bef229b
Parents: 1c66078
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Jun 23 10:14:38 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Jun 23 10:14:38 2015 +0700

----------------------------------------------------------------------
 .../internal/util/GridConfigurationFinder.java  | 55 +++++++++++---------
 1 file changed, 29 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/65964e26/modules/core/src/main/java/org/apache/ignite/internal/util/GridConfigurationFinder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridConfigurationFinder.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridConfigurationFinder.java
index bc9a13f..37d8756 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridConfigurationFinder.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridConfigurationFinder.java
@@ -106,45 +106,48 @@ public final class GridConfigurationFinder {
 
         LinkedList<GridTuple3<String, Long, File>> paths = new LinkedList<>();
 
-        for (String name : dir.list()) {
-            File file = new File(dir, name);
+        String[] configs = dir.list();
 
-            if (file.isDirectory())
-                paths.addAll(listFiles(file));
-            else if (file.getName().endsWith(".xml")) {
-                try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
-                    boolean springCfg = false;
-                    boolean ggCfg = false;
+        if (configs != null)
+            for (String name : configs) {
+                File file = new File(dir, name);
 
-                    String line;
+                if (file.isDirectory())
+                    paths.addAll(listFiles(file));
+                else if (file.getName().endsWith(".xml")) {
+                    try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
+                        boolean springCfg = false;
+                        boolean ggCfg = false;
 
-                    while ((line = reader.readLine()) != null) {
-                        if (line.contains("http://www.springframework.org/schema/beans"))
-                            springCfg = true;
+                        String line;
 
-                        if (line.contains("class=\"org.apache.ignite.configuration.IgniteConfiguration\""))
-                            ggCfg = true;
+                        while ((line = reader.readLine()) != null) {
+                            if (line.contains("http://www.springframework.org/schema/beans"))
+                                springCfg = true;
 
-                        if (springCfg && ggCfg)
-                            break;
-                    }
+                            if (line.contains("class=\"org.apache.ignite.configuration.IgniteConfiguration\""))
+                                ggCfg = true;
+
+                            if (springCfg && ggCfg)
+                                break;
+                        }
 
-                    if (springCfg) {
-                        String path = file.getAbsolutePath().substring(U.getIgniteHome().length());
+                        if (springCfg) {
+                            String path = file.getAbsolutePath().substring(U.getIgniteHome().length());
 
-                        if (path.startsWith(File.separator))
-                            path = path.substring(File.separator.length());
+                            if (path.startsWith(File.separator))
+                                path = path.substring(File.separator.length());
 
-                        if (!path.equals(DFLT_CFG)) {
-                            if (!ggCfg)
-                                path = Q_PREFIX + ' ' + path;
+                            if (!path.equals(DFLT_CFG)) {
+                                if (!ggCfg)
+                                    path = Q_PREFIX + ' ' + path;
 
-                            paths.add(F.t(path, file.lastModified(), file));
+                                paths.add(F.t(path, file.lastModified(), file));
+                            }
                         }
                     }
                 }
             }
-        }
 
         return paths;
     }


[40/50] incubator-ignite git commit: # minor

Posted by ag...@apache.org.
# minor


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

Branch: refs/heads/ignite-621
Commit: 8d8d29160599e454d53244873ee67b61850fbbf2
Parents: b29ff1c
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jun 25 12:59:24 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jun 25 12:59:24 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/compute/ComputeTaskSplitAdapter.java    | 2 +-
 .../apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d8d2916/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskSplitAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskSplitAdapter.java b/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskSplitAdapter.java
index 7b3b0d6..bc4b3c2 100644
--- a/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskSplitAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskSplitAdapter.java
@@ -73,7 +73,7 @@ public abstract class ComputeTaskSplitAdapter<T, R> extends ComputeTaskAdapter<T
 
     /** Load balancer. */
     @LoadBalancerResource
-    private ComputeLoadBalancer balancer;
+    private transient ComputeLoadBalancer balancer;
 
     /**
      * This is a simplified version of {@link ComputeTask#map(List, Object)} method.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d8d2916/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java
index 725274b..e5c423c 100644
--- a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java
@@ -33,7 +33,7 @@ public class GridP2PContinuousDeploymentTask1 extends ComputeTaskSplitAdapter<Ob
     @Override protected Collection<? extends ComputeJob> split(int gridSize, Object arg) {
         return Collections.singleton(new ComputeJobAdapter() {
             @IgniteInstanceResource
-            private Ignite ignite;
+            private transient Ignite ignite;
 
             @Override public Object execute() {
                 X.println(">>> Executing GridP2PContinuousDeploymentTask1 job.");


[32/50] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-1045' into ignite-sprint-7

Posted by ag...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-1045' into ignite-sprint-7


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

Branch: refs/heads/ignite-621
Commit: c270bd812df9cdf43d55ce0f546657e2f0e8d1da
Parents: bf1ea21 a2141c6
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jun 24 12:17:57 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 24 12:17:57 2015 +0300

----------------------------------------------------------------------
 .../GridDhtPartitionsExchangeFuture.java        |  46 +-
 ...eDynamicCacheStartNoExchangeTimeoutTest.java | 466 +++++++++++++++++++
 .../distributed/IgniteCache150ClientsTest.java  | 189 ++++++++
 ...teCacheClientNodePartitionsExchangeTest.java |   1 +
 .../testsuites/IgniteCacheTestSuite4.java       |   1 +
 .../testsuites/IgniteClientTestSuite.java       |  38 ++
 6 files changed, 733 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c270bd81/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------


[49/50] incubator-ignite git commit: IGNITE-621 - Fixing remap logic.

Posted by ag...@apache.org.
IGNITE-621 - Fixing remap logic.


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

Branch: refs/heads/ignite-621
Commit: c2c90b52972bec53919d97ec07d2aeab4d0d55e8
Parents: a9d0662
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Thu Jun 25 17:06:31 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Thu Jun 25 17:06:31 2015 -0700

----------------------------------------------------------------------
 .../apache/ignite/IgniteSystemProperties.java   |  3 +
 .../processors/cache/GridCacheAdapter.java      |  2 +-
 .../processors/cache/GridCacheAtomicFuture.java | 12 ++-
 .../processors/cache/GridCacheMvccManager.java  |  8 +-
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   | 12 ++-
 .../dht/atomic/GridNearAtomicUpdateFuture.java  | 88 ++++++++++++++++++--
 .../communication/tcp/TcpCommunicationSpi.java  |  2 +-
 ...eAtomicInvalidPartitionHandlingSelfTest.java |  7 +-
 8 files changed, 110 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2c90b52/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index 542fa30..40fc873 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -343,6 +343,9 @@ public final class IgniteSystemProperties {
     /** Maximum size for affinity assignment history. */
     public static final String IGNITE_AFFINITY_HISTORY_SIZE = "IGNITE_AFFINITY_HISTORY_SIZE";
 
+    /** Number of cache operation retries in case of topology exceptions. */
+    public static final String IGNITE_CACHE_RETRIES_COUNT = "IGNITE_CACHE_RETRIES_COUNT";
+
     /**
      * Enforces singleton.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2c90b52/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index f993527..e138520 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -79,7 +79,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     public static final int CLEAR_ALL_SPLIT_THRESHOLD = 10000;
 
     /** Maximum number of retries when topology changes. */
-    public static final int MAX_RETRIES = 100;
+    public static final int MAX_RETRIES = IgniteSystemProperties.getInteger(IGNITE_CACHE_RETRIES_COUNT, 100);
 
     /** Deserialization stash. */
     private static final ThreadLocal<IgniteBiTuple<String, String>> stash = new ThreadLocal<IgniteBiTuple<String,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2c90b52/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicFuture.java
index 35d3ec5..8724d3a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicFuture.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache;
 
+import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.affinity.*;
 
 import java.util.*;
@@ -26,14 +27,17 @@ import java.util.*;
  */
 public interface GridCacheAtomicFuture<R> extends GridCacheFuture<R> {
     /**
-     * @return {@code True} if partition exchange should wait for this future to complete.
+     * @return Future topology version.
      */
-    public boolean waitForPartitionExchange();
+    public AffinityTopologyVersion topologyVersion();
 
     /**
-     * @return Future topology version.
+     * Gets future that will be completed when it is safe when update is finished on the given version of topology.
+     *
+     * @param topVer Topology version to finish.
+     * @return Future or {@code null} if no need to wait.
      */
-    public AffinityTopologyVersion topologyVersion();
+    public IgniteInternalFuture<Void> completeFuture(AffinityTopologyVersion topVer);
 
     /**
      * @return Future keys.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2c90b52/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
index c528e08..f24cf01 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
@@ -338,7 +338,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
     public void addAtomicFuture(GridCacheVersion futVer, GridCacheAtomicFuture<?> fut) {
         IgniteInternalFuture<?> old = atomicFuts.put(futVer, fut);
 
-        assert old == null;
+        assert old == null : "Old future is not null [futVer=" + futVer + ", fut=" + fut + ", old=" + old + ']';
     }
 
     /**
@@ -1002,8 +1002,10 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
         res.ignoreChildFailures(ClusterTopologyCheckedException.class, CachePartialUpdateCheckedException.class);
 
         for (GridCacheAtomicFuture<?> fut : atomicFuts.values()) {
-            if (fut.waitForPartitionExchange() && fut.topologyVersion().compareTo(topVer) < 0)
-                res.add((IgniteInternalFuture<Object>)fut);
+            IgniteInternalFuture<Void> complete = fut.completeFuture(topVer);
+
+            if (complete != null)
+                res.add((IgniteInternalFuture)complete);
         }
 
         res.markInitialized();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2c90b52/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index ff8454e..37b57e6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cluster.*;
+import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.cluster.*;
 import org.apache.ignite.internal.processors.affinity.*;
 import org.apache.ignite.internal.processors.cache.*;
@@ -170,13 +171,16 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
     }
 
     /** {@inheritDoc} */
-    @Override public boolean waitForPartitionExchange() {
-        return waitForExchange;
+    @Override public AffinityTopologyVersion topologyVersion() {
+        return updateReq.topologyVersion();
     }
 
     /** {@inheritDoc} */
-    @Override public AffinityTopologyVersion topologyVersion() {
-        return updateReq.topologyVersion();
+    @Override public IgniteInternalFuture<Void> completeFuture(AffinityTopologyVersion topVer) {
+        if (waitForExchange && topologyVersion().compareTo(topVer) < 0)
+            return this;
+
+        return null;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2c90b52/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index 536eb40..ea9b335 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@ -105,7 +105,10 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
     private final ExpiryPolicy expiryPlc;
 
     /** Future map topology version. */
-    private AffinityTopologyVersion topVer = AffinityTopologyVersion.ZERO;
+    private volatile AffinityTopologyVersion topVer = AffinityTopologyVersion.ZERO;
+
+    /** Completion future for a particular topology version. */
+    private GridFutureAdapter<Void> topCompleteFut;
 
     /** Optional filter. */
     private final CacheEntryPredicate[] filter;
@@ -246,8 +249,10 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
         return F.view(F.viewReadOnly(mappings.keySet(), U.id2Node(cctx.kernalContext())), F.notNull());
     }
 
-    /** {@inheritDoc} */
-    @Override public boolean waitForPartitionExchange() {
+    /**
+     * @return {@code True} if this future should block partition map exchange.
+     */
+    private boolean waitForPartitionExchange() {
         // Wait fast-map near atomic update futures in CLOCK mode.
         return fastMap;
     }
@@ -323,13 +328,36 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
         else {
             topLocked = true;
 
-            // Cannot remap.
-            remapCnt.set(1);
+            synchronized (this) {
+                this.topVer = topVer;
+
+                // Cannot remap.
+                remapCnt.set(1);
+            }
 
             map0(topVer, null, false, null);
         }
     }
 
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Void> completeFuture(AffinityTopologyVersion topVer) {
+        if (waitForPartitionExchange() && topologyVersion().compareTo(topVer) < 0) {
+            synchronized (this) {
+                if (this.topVer == AffinityTopologyVersion.ZERO)
+                    return null;
+
+                if (this.topVer.compareTo(topVer) < 0) {
+                    if (topCompleteFut == null)
+                        topCompleteFut = new GridFutureAdapter<>();
+
+                    return topCompleteFut;
+                }
+            }
+        }
+
+        return null;
+    }
+
     /**
      * @param failed Keys to remap.
      */
@@ -339,14 +367,20 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
 
         Collection<Object> remapKeys = new ArrayList<>(failed.size());
         Collection<Object> remapVals = vals != null ? new ArrayList<>(failed.size()) : null;
+        Collection<GridCacheDrInfo> remapConflictPutVals = conflictPutVals != null ? new ArrayList<GridCacheDrInfo>(failed.size()) : null;
+        Collection<GridCacheVersion> remapConflictRmvVals = conflictRmvVals != null ? new ArrayList<GridCacheVersion>(failed.size()) : null;
 
         Iterator<?> keyIt = keys.iterator();
         Iterator<?> valsIt = vals != null ? vals.iterator() : null;
+        Iterator<GridCacheDrInfo> conflictPutValsIt = conflictPutVals != null ? conflictPutVals.iterator() : null;
+        Iterator<GridCacheVersion> conflictRmvValsIt = conflictRmvVals != null ? conflictRmvVals.iterator() : null;
 
         for (Object key : failed) {
             while (keyIt.hasNext()) {
                 Object nextKey = keyIt.next();
                 Object nextVal = valsIt != null ? valsIt.next() : null;
+                GridCacheDrInfo nextConflictPutVal = conflictPutValsIt != null ? conflictPutValsIt.next() : null;
+                GridCacheVersion nextConflictRmvVal = conflictRmvValsIt != null ? conflictRmvValsIt.next() : null;
 
                 if (F.eq(key, nextKey)) {
                     remapKeys.add(nextKey);
@@ -354,6 +388,12 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
                     if (remapVals != null)
                         remapVals.add(nextVal);
 
+                    if (remapConflictPutVals != null)
+                        remapConflictPutVals.add(nextConflictPutVal);
+
+                    if (remapConflictRmvVals != null)
+                        remapConflictRmvVals.add(nextConflictRmvVal);
+
                     break;
                 }
             }
@@ -361,13 +401,29 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
 
         keys = remapKeys;
         vals = remapVals;
+        conflictPutVals = remapConflictPutVals;
+        conflictRmvVals = remapConflictRmvVals;
 
-        mappings = new ConcurrentHashMap8<>(keys.size(), 1.0f);
         single = null;
         futVer = null;
         err = null;
         opRes = null;
-        topVer = AffinityTopologyVersion.ZERO;
+
+        GridFutureAdapter<Void> fut0;
+
+        synchronized (this) {
+            mappings = new ConcurrentHashMap8<>(keys.size(), 1.0f);
+
+            topVer = AffinityTopologyVersion.ZERO;
+
+            fut0 = topCompleteFut;
+
+            topCompleteFut = null;
+        }
+
+        if (fut0 != null)
+            fut0.onDone();
+
         singleNodeId = null;
         singleReq = null;
         fastMapRemap = false;
@@ -405,6 +461,15 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
             if (futVer != null)
                 cctx.mvcc().removeAtomicFuture(version());
 
+            GridFutureAdapter<Void> fut0;
+
+            synchronized (this) {
+                fut0 = topCompleteFut;
+            }
+
+            if (fut0 != null)
+                fut0.onDone();
+
             return true;
         }
 
@@ -544,6 +609,10 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
 
                 return;
             }
+
+            synchronized (this) {
+                this.topVer = topVer;
+            }
         }
         finally {
             cache.topology().readUnlock();
@@ -559,7 +628,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
         boolean remap = false;
 
         synchronized (this) {
-            if ((syncMode == FULL_ASYNC && cctx.config().getAtomicWriteOrderMode() == PRIMARY) || mappings.isEmpty()) {
+            if (topVer != AffinityTopologyVersion.ZERO &&
+                ((syncMode == FULL_ASYNC && cctx.config().getAtomicWriteOrderMode() == PRIMARY) || mappings.isEmpty())) {
                 CachePartialUpdateCheckedException err0 = err;
 
                 if (err0 != null)
@@ -1040,7 +1110,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
         if (err0 == null)
             err0 = this.err = new CachePartialUpdateCheckedException("Failed to update keys (retry update if possible).");
 
-        List<Object> keys = new ArrayList<>(failedKeys.size());
+        Collection<Object> keys = new ArrayList<>(failedKeys.size());
 
         for (KeyCacheObject key : failedKeys)
             keys.add(key.value(cctx.cacheObjectContext(), false));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2c90b52/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index addf243d..4ca2995 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -210,7 +210,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
     public static final int DFLT_ACK_SND_THRESHOLD = 16;
 
     /** Default socket write timeout. */
-    public static final long DFLT_SOCK_WRITE_TIMEOUT = 200;
+    public static final long DFLT_SOCK_WRITE_TIMEOUT = 2000;
 
     /** No-op runnable. */
     private static final IgniteRunnable NOOP = new IgniteRunnable() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2c90b52/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index 054a110..b255558 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -41,6 +41,7 @@ import org.jsr166.*;
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
+import java.util.concurrent.locks.*;
 
 import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.*;
 import static org.apache.ignite.cache.CacheMode.*;
@@ -236,6 +237,8 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
 
             System.err.println("FINISHED PUTS");
 
+            GridCacheMapEntry.debug = true;
+
             // Start put threads.
             IgniteInternalFuture<?> fut = multithreadedAsync(new Callable<Object>() {
                 @Override public Object call() throws Exception {
@@ -340,12 +343,12 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
                         }
                         catch (AssertionError e) {
                             if (r == 9) {
-                                System.err.println("Failed to verify cache contents: " + e.getMessage());
+                                info("Failed to verify cache contents: " + e.getMessage());
 
                                 throw e;
                             }
 
-                            System.err.println("Failed to verify cache contents, will retry: " + e.getMessage());
+                            info("Failed to verify cache contents, will retry: " + e.getMessage());
 
                             // Give some time to finish async updates.
                             U.sleep(1000);


[47/50] incubator-ignite git commit: Merge branches 'ignite-733' and 'ignite-sprint-7' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-733

Posted by ag...@apache.org.
Merge branches 'ignite-733' and 'ignite-sprint-7' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-733


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

Branch: refs/heads/ignite-621
Commit: e1c49b75fdfe86f34d2e44aa59aaa1851b03d778
Parents: 38f5e41 20a4537
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Jun 25 22:29:06 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Jun 25 22:29:06 2015 +0700

----------------------------------------------------------------------
 .../ClientAbstractConnectivitySelfTest.java     |   4 +-
 .../org/apache/ignite/cluster/ClusterGroup.java |   9 +
 .../org/apache/ignite/cluster/ClusterNode.java  |   2 +
 .../ignite/compute/ComputeTaskSplitAdapter.java |   2 +-
 .../ignite/internal/GridKernalContextImpl.java  |   3 +
 .../internal/cluster/ClusterGroupAdapter.java   |  38 +
 .../cluster/IgniteClusterAsyncImpl.java         |   5 +
 .../processors/cache/GridCacheContext.java      |   2 +-
 .../distributed/dht/GridDhtLockFuture.java      |   2 +-
 .../GridDhtPartitionsExchangeFuture.java        |  46 +-
 .../datastructures/DataStructuresProcessor.java |  64 +-
 .../processors/plugin/CachePluginManager.java   |  10 +-
 .../internal/util/GridConfigurationFinder.java  |  55 +-
 .../ignite/internal/util/IgniteUtils.java       |   6 +-
 .../internal/ClusterForHostsSelfTest.java       | 113 +++
 .../internal/ClusterGroupAbstractTest.java      | 777 ++++++++++++++++++
 .../ignite/internal/ClusterGroupSelfTest.java   | 251 ++++++
 .../internal/GridProjectionAbstractTest.java    | 784 -------------------
 .../ignite/internal/GridProjectionSelfTest.java | 251 ------
 .../apache/ignite/internal/GridSelfTest.java    |   2 +-
 .../CacheReadThroughAtomicRestartSelfTest.java  |  32 +
 ...heReadThroughLocalAtomicRestartSelfTest.java |  32 +
 .../CacheReadThroughLocalRestartSelfTest.java   |  32 +
 ...dThroughReplicatedAtomicRestartSelfTest.java |  32 +
 ...cheReadThroughReplicatedRestartSelfTest.java |  32 +
 .../cache/CacheReadThroughRestartSelfTest.java  | 133 ++++
 .../cache/GridCacheAbstractSelfTest.java        |   2 +-
 ...eDynamicCacheStartNoExchangeTimeoutTest.java | 466 +++++++++++
 .../cache/IgniteDynamicCacheStartSelfTest.java  |  37 +
 ...GridCacheQueueMultiNodeAbstractSelfTest.java |   4 +-
 .../GridCacheSetAbstractSelfTest.java           |  22 +-
 .../IgniteDataStructureWithJobTest.java         | 111 +++
 .../distributed/IgniteCache150ClientsTest.java  | 189 +++++
 ...teCacheClientNodePartitionsExchangeTest.java |   1 +
 .../distributed/IgniteCacheManyClientsTest.java |   1 +
 ...idCacheNearOnlyMultiNodeFullApiSelfTest.java |   5 -
 ...achePartitionedMultiNodeFullApiSelfTest.java |  49 +-
 .../IgniteCacheTxStoreSessionTest.java          |   4 +
 .../internal/util/IgniteUtilsSelfTest.java      |  22 +
 .../ignite/testsuites/IgniteBasicTestSuite.java |   6 +-
 .../IgniteCacheDataStructuresSelfTestSuite.java |   1 +
 .../testsuites/IgniteCacheTestSuite4.java       |   8 +
 .../testsuites/IgniteClientTestSuite.java       |  38 +
 .../p2p/GridP2PContinuousDeploymentTask1.java   |   2 +-
 44 files changed, 2532 insertions(+), 1155 deletions(-)
----------------------------------------------------------------------



[17/50] incubator-ignite git commit: # ignite-1022 fixed test

Posted by ag...@apache.org.
# ignite-1022 fixed test


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

Branch: refs/heads/ignite-621
Commit: 627d0b5d43e78b58ac979a8cadb48ae00f7f0646
Parents: 74dc6d5
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 23 11:13:20 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 23 11:13:20 2015 +0300

----------------------------------------------------------------------
 ...idCacheNearOnlyMultiNodeFullApiSelfTest.java |  5 --
 ...achePartitionedMultiNodeFullApiSelfTest.java | 49 +++++++++++++++-----
 2 files changed, 38 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/627d0b5d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
index 8343c64..d40e9e3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
@@ -192,11 +192,6 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
         // Not needed for near-only cache.
     }
 
-    /** {@inheritDoc} */
-    @Override public void testNearDhtKeySize() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-1029");
-    }
-
     /**
      * @throws Exception If failed.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/627d0b5d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
index 84594a2..9445f9c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
@@ -299,26 +299,53 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
 
         info("Generating keys for test...");
 
-        IgniteCache<String, Integer> cache0 = jcache(0);
+        IgniteEx ignite0 = null;
+        IgniteEx ignite1 = null;
+        IgniteEx ignite2 = null;
 
-        for (int i = 0; i < 5; i++) {
-            while (true) {
-                String key = UUID.randomUUID().toString();
-
-                if (ignite(0).affinity(null).isPrimary(grid(0).localNode(), key) &&
-                    ignite(0).affinity(null).isBackup(grid(1).localNode(), key)) {
-                    keys.add(key);
+        for (int i = 0; i < gridCount(); i++) {
+            IgniteEx ignite = grid(i);
 
-                    cache0.put(key, i);
+            if (!ignite.configuration().isClientMode()) {
+                if (ignite0 == null)
+                    ignite0 = ignite;
+                else if (ignite1 == null)
+                    ignite1 = ignite;
+                else {
+                    ignite2 = ignite;
 
                     break;
                 }
+
             }
         }
 
+        assertNotNull(ignite0);
+        assertNotNull(ignite1);
+        assertNotNull(ignite2);
+
+        info("Generating keys for test [nodes=" + ignite0.name() + ", " + ignite1.name() + ", " + ignite2.name() + ']');
+
+        IgniteCache<String, Integer> cache0 = ignite0.cache(null);
+
+        int val = 0;
+
+        for (int i = 0; i < 10_000 && keys.size() < 5; i++) {
+            String key = String.valueOf(i);
+
+            if (ignite(0).affinity(null).isPrimary(ignite0.localNode(), key) &&
+                ignite(0).affinity(null).isBackup(ignite1.localNode(), key)) {
+                keys.add(key);
+
+                cache0.put(key, val++);
+            }
+        }
+
+        assertEquals(5, keys.size());
+
         info("Finished generating keys for test.");
 
-        IgniteCache<String, Integer> cache2 = jcache(2);
+        IgniteCache<String, Integer> cache2 = ignite2.cache(null);
 
         assertEquals(Integer.valueOf(0), cache2.get(keys.get(0)));
         assertEquals(Integer.valueOf(1), cache2.get(keys.get(1)));
@@ -326,7 +353,7 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
         assertEquals(0, cache0.localSize(NEAR));
         assertEquals(5, cache0.localSize(CachePeekMode.ALL) - cache0.localSize(NEAR));
 
-        IgniteCache<String, Integer> cache1 = jcache(1);
+        IgniteCache<String, Integer> cache1 = ignite1.cache(null);
 
         assertEquals(0, cache1.localSize(NEAR));
         assertEquals(5, cache1.localSize(CachePeekMode.ALL) - cache1.localSize(NEAR));


[26/50] incubator-ignite git commit: ignite-1045 properly handle flag DynamicCacheChangeRequest.clientStartOnly

Posted by ag...@apache.org.
ignite-1045 properly handle flag DynamicCacheChangeRequest.clientStartOnly


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

Branch: refs/heads/ignite-621
Commit: a6cda33a8b76925d09c21262e88467421025fa77
Parents: c7ba154
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 23 16:47:13 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 23 17:29:49 2015 +0300

----------------------------------------------------------------------
 .../GridDhtPartitionsExchangeFuture.java        |  46 +-
 ...eDynamicCacheStartNoExchangeTimeoutTest.java | 466 +++++++++++++++++++
 .../distributed/IgniteCache150ClientsTest.java  | 189 ++++++++
 ...teCacheClientNodePartitionsExchangeTest.java |   1 +
 .../testsuites/IgniteCacheTestSuite4.java       |   1 +
 .../testsuites/IgniteClientTestSuite.java       |  38 ++
 6 files changed, 733 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a6cda33a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 7c780b0..38a0d55 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -153,6 +153,9 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
     /** Skip preload flag. */
     private boolean skipPreload;
 
+    /** */
+    private boolean clientOnlyExchange;
+
     /**
      * Dummy future created to trigger reassignments if partition
      * topology changed while preloading.
@@ -524,6 +527,9 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
                         if (exchId.isLeft())
                             cctx.mvcc().removeExplicitNodeLocks(exchId.nodeId(), exchId.topologyVersion());
 
+                        rmtIds = Collections.emptyList();
+                        rmtNodes = Collections.emptyList();
+
                         onDone(exchId.topologyVersion());
 
                         skipPreload = cctx.kernalContext().clientNode();
@@ -532,8 +538,10 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
                     }
                 }
 
-                if (cctx.kernalContext().clientNode()) {
-                    skipPreload = true;
+                clientOnlyExchange = clientNodeEvt || cctx.kernalContext().clientNode();
+
+                if (clientOnlyExchange) {
+                    skipPreload = cctx.kernalContext().clientNode();
 
                     for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
                         if (cacheCtx.isLocal())
@@ -551,23 +559,45 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
                         initTopology(cacheCtx);
                     }
 
-                    if (oldestNode.get() != null) {
+                    if (oldest != null) {
                         rmtNodes = new ConcurrentLinkedQueue<>(CU.aliveRemoteServerNodesWithCaches(cctx,
                             exchId.topologyVersion()));
 
                         rmtIds = Collections.unmodifiableSet(new HashSet<>(F.nodeIds(rmtNodes)));
 
-                        ready.set(true);
-
                         initFut.onDone(true);
 
                         if (log.isDebugEnabled())
                             log.debug("Initialized future: " + this);
 
-                        sendPartitions();
+                        if (cctx.localNode().equals(oldest)) {
+                            for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
+                                boolean updateTop = !cacheCtx.isLocal() &&
+                                    exchId.topologyVersion().equals(cacheCtx.startTopologyVersion());
+
+                                if (updateTop) {
+                                    for (GridClientPartitionTopology top : cctx.exchange().clientTopologies()) {
+                                        if (top.cacheId() == cacheCtx.cacheId()) {
+                                            cacheCtx.topology().update(exchId, top.partitionMap(true));
+
+                                            break;
+                                        }
+                                    }
+
+                                }
+                            }
+
+                            onDone(exchId.topologyVersion());
+                        }
+                        else
+                            sendPartitions();
                     }
-                    else
+                    else {
+                        rmtIds = Collections.emptyList();
+                        rmtNodes = Collections.emptyList();
+
                         onDone(exchId.topologyVersion());
+                    }
 
                     return;
                 }
@@ -885,7 +915,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
      */
     private void sendLocalPartitions(ClusterNode node, @Nullable GridDhtPartitionExchangeId id) throws IgniteCheckedException {
         GridDhtPartitionsSingleMessage m = new GridDhtPartitionsSingleMessage(id,
-            cctx.kernalContext().clientNode(),
+            clientOnlyExchange,
             cctx.versions().last());
 
         for (GridCacheContext cacheCtx : cctx.cacheContexts()) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a6cda33a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java
new file mode 100644
index 0000000..5011e5f
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java
@@ -0,0 +1,466 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.affinity.fair.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.managers.communication.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.plugin.extensions.communication.*;
+import org.apache.ignite.spi.*;
+import org.apache.ignite.spi.communication.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+
+/**
+ *
+ */
+public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbstractTest {
+    /** */
+    private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private static final int NODES = 4;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+        cfg.setCommunicationSpi(new TestCommunicationSpi());
+
+        if (gridName.equals(getTestGridName(NODES - 1)))
+            cfg.setClientMode(true);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        startGrids(NODES);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testMultinodeCacheStart() throws Exception {
+        for (int i = 0; i < 10; i++) {
+            log.info("Iteration: " + i);
+
+            final String name = "cache-" + i;
+
+            final AtomicInteger idx = new AtomicInteger();
+
+            GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+                @Override public Object call() throws Exception {
+                    Ignite ignite = ignite(idx.getAndIncrement());
+
+                    CacheConfiguration ccfg = new CacheConfiguration();
+
+                    ccfg.setName(name);
+
+                    assertNotNull(ignite.getOrCreateCache(ccfg));
+
+                    return null;
+                }
+            }, 2, "create-cache").get(15_000);
+
+            awaitPartitionMapExchange();
+
+            checkCache(name);
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testOldestNotAffinityNode1() throws Exception {
+        for (CacheConfiguration ccfg : cacheConfigurations())
+            oldestNotAffinityNode1(ccfg);
+    }
+
+    /**
+     * @param ccfg Cache configuration.
+     * @throws Exception If failed.
+     */
+    private void oldestNotAffinityNode1(final CacheConfiguration ccfg) throws Exception {
+        log.info("Test with cache: " + ccfg.getName());
+
+        IgniteEx ignite = grid(0);
+
+        assertEquals(1L, ignite.localNode().order());
+
+        ccfg.setNodeFilter(new TestFilterExcludeOldest());
+
+        assertNotNull(ignite.getOrCreateCache(ccfg));
+
+        awaitPartitionMapExchange();
+
+        checkCache(ccfg.getName());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testOldestNotAffinityNode2() throws Exception {
+        for (CacheConfiguration ccfg : cacheConfigurations())
+            oldestNotAffinityNode2(ccfg);
+    }
+
+    /**
+     * @param ccfg Cache configuration.
+     * @throws Exception If failed.
+     */
+    private void oldestNotAffinityNode2(final CacheConfiguration ccfg) throws Exception {
+        log.info("Test with cache: " + ccfg.getName());
+
+        IgniteEx ignite0 = grid(0);
+        IgniteEx ignite1 = grid(1);
+
+        assertEquals(1L, ignite0.localNode().order());
+
+        ccfg.setNodeFilter(new TestFilterExcludeOldest());
+
+        assertNotNull(ignite1.getOrCreateCache(ccfg));
+
+        assertNotNull(ignite0.cache(ccfg.getName()));
+
+        awaitPartitionMapExchange();
+
+        checkCache(ccfg.getName());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNotAffinityNode1() throws Exception {
+        for (CacheConfiguration ccfg : cacheConfigurations())
+            notAffinityNode1(ccfg);
+    }
+
+    /**
+     * @param ccfg Cache configuration.
+     * @throws Exception If failed.
+     */
+    private void notAffinityNode1(final CacheConfiguration ccfg) throws Exception {
+        log.info("Test with cache: " + ccfg.getName());
+
+        IgniteEx ignite = grid(1);
+
+        assertEquals(2, ignite.localNode().order());
+
+        ccfg.setNodeFilter(new TestFilterExcludeNode(2));
+
+        assertNotNull(ignite.getOrCreateCache(ccfg));
+
+        awaitPartitionMapExchange();
+
+        checkCache(ccfg.getName());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNotAffinityNode2() throws Exception {
+        for (CacheConfiguration ccfg : cacheConfigurations())
+            notAffinityNode2(ccfg);
+    }
+
+    /**
+     * @param ccfg Cache configuration.
+     * @throws Exception If failed.
+     */
+    private void notAffinityNode2(final CacheConfiguration ccfg) throws Exception {
+        log.info("Test with cache: " + ccfg.getName());
+
+        IgniteEx ignite0 = grid(0);
+        IgniteEx ignite1 = grid(1);
+
+        assertEquals(2L, ignite1.localNode().order());
+
+        ccfg.setNodeFilter(new TestFilterExcludeNode(2));
+
+        assertNotNull(ignite0.getOrCreateCache(ccfg));
+
+        assertNotNull(ignite1.cache(ccfg.getName()));
+
+        awaitPartitionMapExchange();
+
+        checkCache(ccfg.getName());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testOldestChanged1() throws Exception {
+        IgniteEx ignite0 = grid(0);
+
+        assertEquals(1L, ignite0.localNode().order());
+
+        CacheConfiguration ccfg = new CacheConfiguration();
+
+        ccfg.setNodeFilter(new TestFilterExcludeOldest());
+
+        assertNotNull(ignite0.getOrCreateCache(ccfg));
+
+        stopGrid(0);
+
+        IgniteEx client = grid(NODES - 1);
+
+        assertTrue(client.configuration().isClientMode());
+
+        assertNotNull(client.getOrCreateCache((String)null));
+
+        awaitPartitionMapExchange();
+
+        checkCache(null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testOldestChanged2() throws Exception {
+        IgniteEx ignite0 = grid(0);
+
+        assertEquals(1L, ignite0.localNode().order());
+
+        CacheConfiguration ccfg = new CacheConfiguration();
+
+        ccfg.setNodeFilter(new TestFilterIncludeNode(3));
+
+        assertNotNull(ignite0.getOrCreateCache(ccfg));
+
+        stopGrid(0);
+
+        IgniteEx ingite1 = grid(1);
+
+        assertNotNull(ingite1.getOrCreateCache((String)null));
+
+        awaitPartitionMapExchange();
+
+        checkCache(null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testOldestChanged3() throws Exception {
+        IgniteEx ignite0 = grid(0);
+
+        CacheConfiguration ccfg = new CacheConfiguration();
+
+        ccfg.setNodeFilter(new TestFilterIncludeNode(3));
+
+        assertNotNull(ignite0.getOrCreateCache(ccfg));
+
+        stopGrid(0);
+
+        IgniteEx client = grid(NODES - 1);
+
+        assertTrue(client.configuration().isClientMode());
+
+        assertNotNull(client.getOrCreateCache((String)null));
+
+        awaitPartitionMapExchange();
+
+        checkCache(null);
+    }
+
+    /**
+     * @param name Cache name.
+     */
+    private void checkCache(@Nullable String name) {
+        int key = 0;
+
+        for (Ignite ignite : G.allGrids()) {
+            IgniteCache<Object, Object> cache = ignite.cache(name);
+
+            assertNotNull(cache);
+
+            for (int i = 0; i < 100; i++) {
+                cache.put(key, key);
+
+                assertEquals(key, cache.get(key));
+
+                key++;
+            }
+        }
+    }
+
+    /**
+     * @return Cache configurations.
+     */
+    private List<CacheConfiguration> cacheConfigurations() {
+        List<CacheConfiguration> res = new ArrayList<>();
+
+        {
+            CacheConfiguration ccfg = new CacheConfiguration();
+
+            ccfg.setName("cache-1");
+            ccfg.setAtomicityMode(ATOMIC);
+            ccfg.setBackups(0);
+
+            res.add(ccfg);
+        }
+
+        {
+            CacheConfiguration ccfg = new CacheConfiguration();
+
+            ccfg.setName("cache-2");
+            ccfg.setAtomicityMode(ATOMIC);
+            ccfg.setBackups(1);
+
+            res.add(ccfg);
+        }
+
+        {
+            CacheConfiguration ccfg = new CacheConfiguration();
+
+            ccfg.setName("cache-3");
+            ccfg.setAtomicityMode(ATOMIC);
+            ccfg.setBackups(1);
+            ccfg.setAffinity(new FairAffinityFunction());
+
+            res.add(ccfg);
+        }
+
+        {
+            CacheConfiguration ccfg = new CacheConfiguration();
+
+            ccfg.setName("cache-4");
+            ccfg.setAtomicityMode(TRANSACTIONAL);
+            ccfg.setBackups(0);
+
+            res.add(ccfg);
+        }
+
+        {
+            CacheConfiguration ccfg = new CacheConfiguration();
+
+            ccfg.setName("cache-5");
+            ccfg.setAtomicityMode(TRANSACTIONAL);
+            ccfg.setBackups(1);
+
+            res.add(ccfg);
+        }
+
+        {
+            CacheConfiguration ccfg = new CacheConfiguration();
+
+            ccfg.setName("cache-4");
+            ccfg.setAtomicityMode(TRANSACTIONAL);
+            ccfg.setBackups(1);
+            ccfg.setAffinity(new FairAffinityFunction());
+
+            res.add(ccfg);
+        }
+
+        return res;
+    }
+
+    /**
+     *
+     */
+    private static class TestFilterExcludeOldest implements IgnitePredicate<ClusterNode> {
+        /** {@inheritDoc} */
+        @Override public boolean apply(ClusterNode node) {
+            return node.order() > 1;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class TestFilterExcludeNode implements IgnitePredicate<ClusterNode> {
+        /** */
+        private final long excludeOrder;
+
+        /**
+         * @param excludeOrder Node order to exclude.
+         */
+        public TestFilterExcludeNode(long excludeOrder) {
+            this.excludeOrder = excludeOrder;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean apply(ClusterNode node) {
+            return node.order() != excludeOrder;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class TestFilterIncludeNode implements IgnitePredicate<ClusterNode> {
+        /** */
+        private final long includeOrder;
+
+        /**
+         * @param includeOrder Node order to exclude.
+         */
+        public TestFilterIncludeNode(long includeOrder) {
+            this.includeOrder = includeOrder;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean apply(ClusterNode node) {
+            return node.order() == includeOrder;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class TestCommunicationSpi extends TcpCommunicationSpi {
+        /** {@inheritDoc} */
+        @Override public void sendMessage(ClusterNode node, Message msg)
+            throws IgniteSpiException {
+            Object msg0 = ((GridIoMessage)msg).message();
+
+            if (msg0 instanceof GridDhtPartitionsSingleRequest) // Sent in case of exchange timeout.
+                fail("Unexpected message: " + msg0);
+
+            super.sendMessage(node, msg);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a6cda33a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
new file mode 100644
index 0000000..282c7c8
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
@@ -0,0 +1,189 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed;
+
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.spi.communication.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.jsr166.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+
+/**
+ *
+ */
+public class IgniteCache150ClientsTest extends GridCommonAbstractTest {
+    /** */
+    protected static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private static final int CACHES = 10;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setNetworkTimeout(30_000);
+        cfg.setConnectorConfiguration(null);
+        cfg.setPeerClassLoadingEnabled(false);
+        cfg.setTimeServerPortRange(200);
+
+        ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSocketWriteTimeout(200);
+        ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setLocalPortRange(200);
+        ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
+
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setJoinTimeout(0);
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setMaxMissedClientHeartbeats(200);
+
+        cfg.setClientMode(!gridName.equals(getTestGridName(0)));
+
+        CacheConfiguration[] ccfgs = new CacheConfiguration[CACHES];
+
+        for (int i = 0 ; i < ccfgs.length; i++) {
+            CacheConfiguration ccfg = new CacheConfiguration();
+
+            ccfg.setCacheMode(PARTITIONED);
+            ccfg.setAtomicityMode(i % 2 == 0 ? ATOMIC : TRANSACTIONAL);
+            ccfg.setWriteSynchronizationMode(PRIMARY_SYNC);
+            ccfg.setBackups(1);
+
+            ccfg.setName("cache-" + i);
+
+            ccfgs[i] = ccfg;
+        }
+
+        cfg.setCacheConfiguration(ccfgs);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long getTestTimeout() {
+        return 10 * 60_000;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void test150Clients() throws Exception {
+        Ignite srv = startGrid(0);
+
+        assertFalse(srv.configuration().isClientMode());
+
+        final int CLIENTS = 150;
+
+        final AtomicInteger idx = new AtomicInteger(1);
+
+        final CountDownLatch latch = new CountDownLatch(CLIENTS);
+
+        final List<String> cacheNames = new ArrayList<>();
+
+        for (int i = 0; i < CACHES; i++)
+            cacheNames.add("cache-" + i);
+
+        IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                boolean cnt = false;
+
+                try {
+                    Ignite ignite = startGrid(idx.getAndIncrement());
+
+                    assertTrue(ignite.configuration().isClientMode());
+                    assertTrue(ignite.cluster().localNode().isClient());
+
+                    latch.countDown();
+
+                    cnt = true;
+
+                    log.info("Started [node=" + ignite.name() + ", left=" + latch.getCount() + ']');
+
+                    ThreadLocalRandom8 rnd = ThreadLocalRandom8.current();
+
+                    while (latch.getCount() > 0) {
+                        Thread.sleep(1000);
+
+                        IgniteCache<Object, Object> cache = ignite.cache(cacheNames.get(rnd.nextInt(0, CACHES)));
+
+                        Integer key = rnd.nextInt(0, 100_000);
+
+                        cache.put(key, 0);
+
+                        assertNotNull(cache.get(key));
+                    }
+
+                    return null;
+                }
+                finally {
+                    if (!cnt)
+                        latch.countDown();
+                }
+            }
+        }, CLIENTS, "start-client");
+
+        fut.get();
+
+        log.info("Started all clients.");
+
+        checkNodes(CLIENTS + 1);
+    }
+
+    /**
+     * @param expCnt Expected number of nodes.
+     */
+    private void checkNodes(int expCnt) {
+        assertEquals(expCnt, G.allGrids().size());
+
+        long topVer = -1L;
+
+        for (Ignite ignite : G.allGrids()) {
+            log.info("Check node: " + ignite.name());
+
+            if (topVer == -1L)
+                topVer = ignite.cluster().topologyVersion();
+            else
+                assertEquals("Unexpected topology version for node: " + ignite.name(),
+                    topVer,
+                    ignite.cluster().topologyVersion());
+
+            assertEquals("Unexpected number of nodes for node: " + ignite.name(),
+                expCnt,
+                ignite.cluster().nodes().size());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a6cda33a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
index e5d30b6..d60a0c3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
@@ -464,6 +464,7 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
 
     /**
      * @param nearCache If {@code true} creates near cache on client.
+     * @param srvNode If {@code true} creates client cache on server node.
      * @throws Exception If failed.
      */
     private void clientOnlyCacheStart(boolean nearCache, boolean srvNode) throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a6cda33a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index 6295a4d..d13a99d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -102,6 +102,7 @@ public class IgniteCacheTestSuite4 extends TestSuite {
         suite.addTestSuite(IgniteCacheConfigurationTemplateTest.class);
         suite.addTestSuite(IgniteCacheConfigurationDefaultTemplateTest.class);
         suite.addTestSuite(IgniteDynamicClientCacheStartSelfTest.class);
+        suite.addTestSuite(IgniteDynamicCacheStartNoExchangeTimeoutTest.class);
 
         suite.addTestSuite(GridCacheTxLoadFromStoreOnLockSelfTest.class);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a6cda33a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteClientTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteClientTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteClientTestSuite.java
new file mode 100644
index 0000000..98f9181
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteClientTestSuite.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.testsuites;
+
+import junit.framework.*;
+import org.apache.ignite.internal.processors.cache.distributed.*;
+
+/**
+ *
+ */
+public class IgniteClientTestSuite extends TestSuite {
+    /**
+     * @return Test suite.
+     * @throws Exception If failed.
+     */
+    public static TestSuite suite() throws Exception {
+        TestSuite suite = new TestSuite("Ignite Client Test Suite");
+
+        suite.addTestSuite(IgniteCache150ClientsTest.class);
+
+        return suite;
+    }
+}


[44/50] incubator-ignite git commit: # minor (renaming)

Posted by ag...@apache.org.
# minor (renaming)


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

Branch: refs/heads/ignite-621
Commit: 6c3d97f8069c2aec66195e03b7f1062ceb91e172
Parents: fc17f07
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jun 25 17:18:33 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jun 25 17:18:33 2015 +0300

----------------------------------------------------------------------
 .../internal/ClusterGroupAbstractTest.java      | 777 ++++++++++++++++++
 .../ignite/internal/ClusterGroupSelfTest.java   | 251 ++++++
 .../internal/GridProjectionAbstractTest.java    | 784 -------------------
 .../ignite/internal/GridProjectionSelfTest.java | 251 ------
 .../apache/ignite/internal/GridSelfTest.java    |   2 +-
 .../ignite/testsuites/IgniteBasicTestSuite.java |   2 +-
 6 files changed, 1030 insertions(+), 1037 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3d97f8/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupAbstractTest.java
new file mode 100644
index 0000000..0514ad9
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupAbstractTest.java
@@ -0,0 +1,777 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.compute.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.events.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.events.EventType.*;
+
+/**
+ * Abstract test for {@link org.apache.ignite.cluster.ClusterGroup}
+ */
+@SuppressWarnings("deprecation")
+public abstract class ClusterGroupAbstractTest extends GridCommonAbstractTest implements Externalizable {
+    /** VM ip finder for TCP discovery. */
+    private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** Waiting timeout. */
+    private static final int WAIT_TIMEOUT = 30000;
+
+    /** Utility static variable. */
+    private static final AtomicInteger cnt = new AtomicInteger(0);
+
+    /** Mutex. */
+    private static final Object mux = new Object();
+
+    /** Projection. */
+    private ClusterGroup prj;
+
+    /** Runnable job. */
+    private IgniteRunnable runJob = new TestRunnable();
+
+    /** Callable job. */
+    private IgniteCallable<String> calJob = new TestCallable<>();
+
+    /** Closure job. */
+    private IgniteClosure<String, String> clrJob = new IgniteClosure<String, String>() {
+        @Override public String apply(String s) {
+            return s;
+        }
+
+        @Override public String toString() {
+            return "clrJob";
+        }
+    };
+
+    /** Reducer. */
+    private IgniteReducer<String, Object> rdc = new IgniteReducer<String, Object>() {
+        @Override public boolean collect(String e) {
+            return true;
+        }
+
+        @Nullable @Override public Object reduce() {
+            return null;
+        }
+
+        @Override public String toString() {
+            return "rdc";
+        }
+    };
+
+    /** */
+    protected ClusterGroupAbstractTest() {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setDiscoverySpi(new TcpDiscoverySpi().setForceServerMode(true).setIpFinder(ipFinder));
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        prj = projection();
+
+        cnt.set(0);
+    }
+
+    /**
+     * @return Projection.
+     */
+    protected abstract ClusterGroup projection();
+
+    /**
+     * @return Local node ID.
+     */
+    @Nullable protected abstract UUID localNodeId();
+
+    /**
+     * @return Remote nodes IDs.
+     */
+    protected Collection<UUID> remoteNodeIds() {
+        return F.nodeIds(projection().forRemotes().nodes());
+    }
+
+    /**
+     * @return Projection size.
+     */
+    private int projectionSize() {
+        int size = localNodeId() != null ? 1 : 0;
+
+        size += remoteNodeIds().size();
+
+        assert size > 0;
+
+        return size;
+    }
+
+    /**
+     * @return Collection of projection node IDs.
+     */
+    private Collection<UUID> projectionNodeIds() {
+        Collection<UUID> ids = new LinkedList<>();
+
+        UUID id = localNodeId();
+
+        if (id != null)
+            ids.add(id);
+
+        ids.addAll(remoteNodeIds());
+
+        assert !ids.isEmpty();
+
+        return ids;
+    }
+
+    /**
+     * Test for projection on not existing node IDs.
+     */
+    public void testInvalidProjection() {
+        Collection<UUID> ids = new HashSet<>();
+
+        ids.add(UUID.randomUUID());
+        ids.add(UUID.randomUUID());
+
+        ClusterGroup invalidPrj = prj.forNodeIds(ids);
+
+        assertEquals(0, invalidPrj.nodes().size());
+    }
+
+    /**
+     * @throws Exception If test failed.
+     */
+    public void testProjection() throws Exception {
+        assert prj != null;
+
+        assert prj.ignite() != null;
+        assert prj.predicate() != null;
+
+        int size = projectionSize();
+
+        assert prj.nodes().size() == size;
+
+        Collection<UUID> nodeIds = projectionNodeIds();
+
+        for (ClusterNode node : prj.nodes())
+            assert nodeIds.contains(node.id());
+    }
+
+    /**
+     * @throws Exception If test failed.
+     */
+    public void testRemoteNodes() throws Exception {
+        Collection<UUID> remoteNodeIds = remoteNodeIds();
+
+        UUID locNodeId = localNodeId();
+
+        int size = remoteNodeIds.size();
+
+        String name = "oneMoreGrid";
+
+        try {
+            Ignite g = startGrid(name);
+
+            UUID excludedId = g.cluster().localNode().id();
+
+            assertEquals(size, prj.forRemotes().nodes().size());
+
+            for (ClusterNode node : prj.forRemotes().nodes()) {
+                UUID id = node.id();
+
+                assert !id.equals(locNodeId) && remoteNodeIds.contains(id) && !excludedId.equals(id);
+            }
+        }
+        finally {
+            stopGrid(name);
+        }
+    }
+
+    /**
+     * @throws Exception If test failed.
+     */
+    public void testRemoteProjection() throws Exception {
+        Collection<UUID> remoteNodeIds = remoteNodeIds();
+
+        ClusterGroup remotePrj = projection().forRemotes();
+
+        Collection<UUID> prjNodeIds = F.nodeIds(remotePrj.nodes());
+
+        assert prjNodeIds.size() == remoteNodeIds.size();
+
+        assert prjNodeIds.containsAll(remoteNodeIds());
+
+        assert !prjNodeIds.contains(localNodeId());
+
+        String name = "oneMoreGrid";
+
+        try {
+            Ignite g = startGrid(name);
+
+            UUID excludedId = g.cluster().localNode().id();
+
+            assert !F.nodeIds(remotePrj.nodes()).contains(excludedId);
+        }
+        finally {
+            stopGrid(name);
+        }
+    }
+
+    /**
+     * @throws Exception If test failed.
+     */
+    public void testExecution() throws Exception {
+        String name = "oneMoreGrid";
+
+        Collection<IgniteBiTuple<Ignite, IgnitePredicate<Event>>> lsnrs = new LinkedList<>();
+
+        try {
+            final AtomicInteger cnt = new AtomicInteger();
+
+            Ignite g = startGrid(name);
+
+            IgnitePredicate<Event> lsnr;
+
+            if (!IgniteCluster.class.isAssignableFrom(projection().getClass())) {
+                g.events().localListen(lsnr = new IgnitePredicate<Event>() {
+                    @Override public boolean apply(Event evt) {
+                        assert evt.type() == EVT_JOB_STARTED;
+
+                        assert false;
+
+                        return true;
+                    }
+                }, EVT_JOB_STARTED);
+
+                lsnrs.add(F.t(g, lsnr));
+            }
+
+            for (ClusterNode node : prj.nodes()) {
+                g = G.ignite(node.id());
+
+                g.events().localListen(lsnr = new IgnitePredicate<Event>() {
+                    @Override public boolean apply(Event evt) {
+                        assert evt.type() == EVT_JOB_STARTED;
+
+                        synchronized (mux) {
+                            cnt.incrementAndGet();
+
+                            mux.notifyAll();
+                        }
+
+                        return true;
+                    }
+                }, EVT_JOB_STARTED);
+
+                lsnrs.add(F.t(g, lsnr));
+            }
+
+            run1(cnt);
+            run2(cnt);
+
+            call1(cnt);
+            call2(cnt);
+            call3(cnt);
+            call4(cnt);
+            call5(cnt);
+
+            forkjoin1(cnt);
+            forkjoin2(cnt);
+
+            exec1(cnt);
+            exec2(cnt);
+
+            executorService(cnt);
+
+            checkActiveFutures();
+        }
+        finally {
+            for (IgniteBiTuple<Ignite, IgnitePredicate<Event>> t : lsnrs)
+                t.get1().events().stopLocalListen(t.get2(), EVT_JOB_STARTED);
+
+            stopGrid(name);
+        }
+    }
+
+    /**
+     * @param cnt Counter.
+     * @throws Exception If failed.
+     */
+    private void run1(AtomicInteger cnt) throws Exception {
+        IgniteCompute comp = compute(prj).withAsync();
+
+        comp.broadcast(runJob);
+
+        ComputeTaskFuture fut = comp.future();
+
+        waitForExecution(fut);
+
+        cnt.set(0);
+
+        compute(prj).broadcast(runJob);
+
+        waitForValue(cnt, projectionSize());
+    }
+
+    /**
+     * @param cnt Counter.
+     * @throws Exception If failed.
+     */
+    private void run2(AtomicInteger cnt) throws Exception {
+        Collection<IgniteRunnable> jobs = F.asList(runJob);
+
+        IgniteCompute comp = compute(prj).withAsync();
+
+        comp.run(jobs);
+
+        ComputeTaskFuture fut = comp.future();
+
+        waitForExecution(fut);
+
+        cnt.set(0);
+
+        compute(prj).run(jobs);
+
+        waitForValue(cnt, jobs.size());
+    }
+
+    /**
+     * @param cnt Counter.
+     * @throws Exception If failed.
+     */
+    private void call1(AtomicInteger cnt) throws Exception {
+        IgniteCompute comp = compute(prj).withAsync();
+
+        comp.broadcast(calJob);
+
+        ComputeTaskFuture fut = comp.future();
+
+        waitForExecution(fut);
+
+        cnt.set(0);
+
+        compute(prj).broadcast(calJob);
+
+        waitForValue(cnt, projectionSize());
+    }
+
+    /**
+     * @param cnt Counter.
+     * @throws Exception If failed.
+     */
+    private void call2(AtomicInteger cnt) throws Exception {
+        IgniteCompute comp = compute(prj).withAsync();
+
+        Collection<IgniteCallable<String>> jobs = F.asList(calJob);
+
+        comp.call(jobs);
+
+        ComputeTaskFuture fut = comp.future();
+
+        waitForExecution(fut);
+
+        cnt.set(0);
+
+        compute(prj).call(jobs);
+
+        waitForValue(cnt, jobs.size());
+    }
+
+    /**
+     * @param cnt Counter.
+     * @throws Exception If failed.
+     */
+    private void call3(AtomicInteger cnt) throws Exception {
+        IgniteCompute comp = compute(prj).withAsync();
+
+        comp.apply(clrJob, (String) null);
+
+        ComputeTaskFuture fut = comp.future();
+
+        waitForExecution(fut);
+
+        cnt.set(0);
+
+        compute(prj).apply(clrJob, (String) null);
+
+        waitForValue(cnt, 1);
+    }
+
+    /**
+     * @param cnt Counter.
+     * @throws Exception If failed.
+     */
+    private void call4(AtomicInteger cnt) throws Exception {
+        Collection<String> args = F.asList("a", "b", "c");
+
+        IgniteCompute comp = compute(prj).withAsync();
+
+        comp.apply(clrJob, args);
+
+        ComputeTaskFuture fut = comp.future();
+
+        waitForExecution(fut);
+
+        cnt.set(0);
+
+        compute(prj).apply(clrJob, args);
+
+        waitForValue(cnt, args.size());
+    }
+
+    /**
+     * @param cnt Counter.
+     * @throws Exception If failed.
+     */
+    private void call5(AtomicInteger cnt) throws Exception {
+        IgniteCompute comp = compute(prj).withAsync();
+
+        comp.broadcast(new TestClosure(), "arg");
+
+        ComputeTaskFuture<Collection<String>> fut = comp.future();
+
+        waitForExecution(fut);
+
+        cnt.set(0);
+
+        Collection<String> res = compute(prj).broadcast(new TestClosure(), "arg");
+
+        assertEquals(projectionSize(), res.size());
+
+        waitForValue(cnt, projectionSize());
+
+        for (String resStr : res)
+            assertEquals("arg", resStr);
+    }
+
+    /**
+     * @param cnt Counter.
+     * @throws Exception If failed.
+     */
+    private void forkjoin1(AtomicInteger cnt) throws Exception {
+        Collection<String> args = F.asList("a", "b", "c");
+
+        IgniteCompute comp = compute(prj).withAsync();
+
+        comp.apply(clrJob, args, rdc);
+
+        ComputeTaskFuture fut = comp.future();
+
+        waitForExecution(fut);
+
+        cnt.set(0);
+
+        compute(prj).apply(clrJob, args, rdc);
+
+        waitForValue(cnt, args.size());
+    }
+
+    /**
+     * @param cnt Counter.
+     * @throws Exception If failed.
+     */
+    private void forkjoin2(AtomicInteger cnt) throws Exception {
+        Collection<IgniteCallable<String>> jobs = F.asList(calJob);
+
+        IgniteCompute comp = compute(prj).withAsync();
+
+        comp.call(jobs, rdc);
+
+        ComputeTaskFuture fut = comp.future();
+
+        waitForExecution(fut);
+
+        cnt.set(0);
+
+        compute(prj).call(jobs, rdc);
+
+        waitForValue(cnt, jobs.size());
+    }
+
+    /**
+     * @param cnt Counter.
+     * @throws Exception If failed.
+     */
+    private void exec1(AtomicInteger cnt) throws Exception {
+        cnt.set(0);
+
+        compute(prj).execute(TestTask.class.getName(), null);
+
+        waitForValue(cnt, projectionSize());
+
+        cnt.set(0);
+
+        compute(prj).execute(new TestTask(), null);
+
+        waitForValue(cnt, projectionSize());
+
+        cnt.set(0);
+
+        compute(prj).execute(TestTask.class, null);
+
+        waitForValue(cnt, projectionSize());
+    }
+
+    /**
+     * @param cnt Counter.
+     * @throws Exception If failed.
+     */
+    private void exec2(AtomicInteger cnt) throws Exception {
+        cnt.set(0);
+
+        compute(prj).withTimeout(WAIT_TIMEOUT).execute(TestTask.class.getName(), null);
+
+        waitForValue(cnt, projectionSize());
+
+        cnt.set(0);
+
+        compute(prj).withTimeout(WAIT_TIMEOUT).execute(new TestTask(), null);
+
+        waitForValue(cnt, projectionSize());
+
+        cnt.set(0);
+
+        compute(prj).withTimeout(WAIT_TIMEOUT).execute(TestTask.class, null);
+
+        waitForValue(cnt, projectionSize());
+    }
+
+    /**
+     * @param cnt Counter.
+     * @throws Exception If failed.
+     */
+    private void executorService(AtomicInteger cnt) throws Exception {
+        cnt.set(0);
+
+        ExecutorService execSrvc = prj.ignite().executorService(prj);
+
+        Future<String> fut = execSrvc.submit(new TestCallable<String>() {
+            @Override public String call() throws Exception {
+                return "submit1";
+            }
+        });
+
+        waitForValue(cnt, 1);
+
+        assertEquals("submit1", fut.get());
+
+        cnt.set(0);
+
+        fut = execSrvc.submit(new TestRunnable(), "submit2");
+
+        waitForValue(cnt, 1);
+
+        assertEquals("submit2", fut.get());
+
+        cnt.set(0);
+
+        Future<?> runFut = execSrvc.submit(new TestRunnable());
+
+        waitForValue(cnt, 1);
+
+        runFut.get();
+    }
+
+    /**
+     * @param fut Execution future.
+     * @throws InterruptedException Thrown if wait was interrupted.
+     */
+    @SuppressWarnings({"UnconditionalWait"})
+    private void waitForExecution(IgniteFuture fut) throws InterruptedException {
+        long sleep = 250;
+
+        long threshold = System.currentTimeMillis() + WAIT_TIMEOUT;
+
+        do synchronized (mux) {
+            mux.wait(sleep);
+        }
+        while (fut != null && !fut.isDone() && !fut.isCancelled() && threshold > System.currentTimeMillis());
+
+        assert fut == null || fut.isDone();
+    }
+
+    /**
+     * @param cnt Counter to check.
+     * @param val Value to check.
+     * @throws InterruptedException Thrown if wait was interrupted.
+     */
+    private void waitForValue(AtomicInteger cnt, int val) throws InterruptedException {
+        assert cnt != null;
+        assert val > 0;
+
+        long threshold = System.currentTimeMillis() + WAIT_TIMEOUT;
+
+        long time;
+
+        while (threshold > (time = System.currentTimeMillis()))
+            synchronized (mux) {
+                if (cnt.get() == val)
+                    break;
+
+                mux.wait(threshold - time);
+            }
+
+        assert cnt.get() == val;
+    }
+
+    /**
+     * @throws Exception If test failed.
+     */
+    private void checkActiveFutures() throws Exception {
+        IgniteCompute comp = compute(prj).withAsync();
+
+        assertEquals(0, comp.activeTaskFutures().size());
+
+        cnt.set(0);
+
+        Collection<ComputeTaskFuture<Object>> futsList = new ArrayList<>();
+
+        for (int i = 0; i < 10; i++) {
+            comp.call(new TestWaitCallable<>());
+
+            ComputeTaskFuture<Object> fut = comp.future();
+
+            assertFalse(fut.isDone());
+
+            Map<IgniteUuid, ComputeTaskFuture<Object>> futs = comp.activeTaskFutures();
+
+            assertEquals(i + 1, futs.size());
+
+            assertTrue(futs.containsKey(fut.getTaskSession().getId()));
+
+            futsList.add(fut);
+        }
+
+        synchronized (mux) {
+            cnt.incrementAndGet();
+
+            mux.notifyAll();
+        }
+
+        for (ComputeTaskFuture<Object> fut : futsList)
+            fut.get();
+
+        assertEquals(0, comp.activeTaskFutures().size());
+    }
+
+    /**
+     *  Test closure.
+     */
+    private static class TestClosure implements IgniteClosure<String, String> {
+        /** {@inheritDoc} */
+        @Override public String apply(String s) {
+            return s;
+        }
+    }
+
+    /**
+     * Test runnable.
+     */
+    private static class TestRunnable implements IgniteRunnable {
+        /** {@inheritDoc} */
+        @Override public void run() {
+            // No-op.
+        }
+    }
+
+    /**
+     * Test callable.
+     */
+    private static class TestCallable<T> implements IgniteCallable<T> {
+        /** {@inheritDoc} */
+        @Nullable @Override public T call() throws Exception {
+            return null;
+        }
+    }
+
+    /**
+     * Test callable.
+     */
+    private static class TestWaitCallable<T> implements IgniteCallable<T> {
+        /** {@inheritDoc} */
+        @Nullable @Override public T call() throws Exception {
+            synchronized (mux) {
+                while (cnt.get() == 0)
+                    mux.wait();
+            }
+
+            return null;
+        }
+    }
+
+    /**
+     * Test task.
+     */
+    @SuppressWarnings({"PublicInnerClass"})
+    public static class TestTask extends ComputeTaskSplitAdapter<String, Void> {
+        /** {@inheritDoc} */
+        @Override protected Collection<? extends ComputeJob> split(int gridSize, String arg) {
+            Collection<ComputeJob> jobs = new HashSet<>();
+
+            for (int i = 0; i < gridSize; i++)
+                jobs.add(new TestJob());
+
+            return jobs;
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override public Void reduce(List<ComputeJobResult> results) {
+            return null;
+        }
+    }
+
+    /**
+     * Test job.
+     */
+    @SuppressWarnings({"PublicInnerClass"})
+    public static class TestJob extends ComputeJobAdapter {
+        /** {@inheritDoc} */
+        @Nullable @Override public Object execute() {
+            return null;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        // No-op.
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3d97f8/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
new file mode 100644
index 0000000..ceb9bef
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
@@ -0,0 +1,251 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.marshaller.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.util.*;
+
+/**
+ * Test for {@link ClusterGroup}.
+ */
+@GridCommonTest(group = "Kernal Self")
+public class ClusterGroupSelfTest extends ClusterGroupAbstractTest {
+    /** Nodes count. */
+    private static final int NODES_CNT = 4;
+
+    /** Projection node IDs. */
+    private static Collection<UUID> ids;
+
+    /** */
+    private static Ignite ignite;
+
+    /** {@inheritDoc} */
+    @SuppressWarnings({"ConstantConditions"})
+    @Override protected void beforeTestsStarted() throws Exception {
+        assert NODES_CNT > 2;
+
+        ids = new LinkedList<>();
+
+        try {
+            for (int i = 0; i < NODES_CNT; i++) {
+                Ignition.setClientMode(i > 1);
+
+                Ignite g = startGrid(i);
+
+                ids.add(g.cluster().localNode().id());
+
+                if (i == 0)
+                    ignite = g;
+            }
+        }
+        finally {
+            Ignition.setClientMode(false);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        for (int i = 0; i < NODES_CNT; i++)
+            stopGrid(i);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected ClusterGroup projection() {
+        return grid(0).cluster().forPredicate(F.nodeForNodeIds(ids));
+    }
+
+    /** {@inheritDoc} */
+    @Override protected UUID localNodeId() {
+        return grid(0).localNode().id();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testRandom() throws Exception {
+        assertTrue(ignite.cluster().nodes().contains(ignite.cluster().forRandom().node()));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testOldest() throws Exception {
+        ClusterGroup oldest = ignite.cluster().forOldest();
+
+        ClusterNode node = null;
+
+        long minOrder = Long.MAX_VALUE;
+
+        for (ClusterNode n : ignite.cluster().nodes()) {
+            if (n.order() < minOrder) {
+                node = n;
+
+                minOrder = n.order();
+            }
+        }
+
+        assertEquals(oldest.node(), ignite.cluster().forNode(node).node());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testYoungest() throws Exception {
+        ClusterGroup youngest = ignite.cluster().forYoungest();
+
+        ClusterNode node = null;
+
+        long maxOrder = Long.MIN_VALUE;
+
+        for (ClusterNode n : ignite.cluster().nodes()) {
+            if (n.order() > maxOrder) {
+                node = n;
+
+                maxOrder = n.order();
+            }
+        }
+
+        assertEquals(youngest.node(), ignite.cluster().forNode(node).node());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNewNodes() throws Exception {
+        ClusterGroup youngest = ignite.cluster().forYoungest();
+        ClusterGroup oldest = ignite.cluster().forOldest();
+
+        ClusterNode old = oldest.node();
+        ClusterNode last = youngest.node();
+
+        assertNotNull(last);
+
+        try (Ignite g = startGrid(NODES_CNT)) {
+            ClusterNode n = g.cluster().localNode();
+
+            ClusterNode latest = youngest.node();
+
+            assertNotNull(latest);
+            assertEquals(latest.id(), n.id());
+            assertEquals(oldest.node(), old);
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testForPredicate() throws Exception {
+        IgnitePredicate<ClusterNode> evenP = new IgnitePredicate<ClusterNode>() {
+            @Override public boolean apply(ClusterNode node) {
+                return node.order() % 2 == 0;
+            }
+        };
+
+        IgnitePredicate<ClusterNode> oddP = new IgnitePredicate<ClusterNode>() {
+            @Override public boolean apply(ClusterNode node) {
+                return node.order() % 2 == 1;
+            }
+        };
+
+        ClusterGroup remotes = ignite.cluster().forRemotes();
+
+        ClusterGroup evenYoungest = remotes.forPredicate(evenP).forYoungest();
+        ClusterGroup evenOldest = remotes.forPredicate(evenP).forOldest();
+
+        ClusterGroup oddYoungest = remotes.forPredicate(oddP).forYoungest();
+        ClusterGroup oddOldest = remotes.forPredicate(oddP).forOldest();
+
+        int clusterSize = ignite.cluster().nodes().size();
+
+        assertEquals(grid(gridMaxOrder(clusterSize, true)).localNode().id(), evenYoungest.node().id());
+        assertEquals(grid(1).localNode().id(), evenOldest.node().id());
+
+        assertEquals(grid(gridMaxOrder(clusterSize, false)).localNode().id(), oddYoungest.node().id());
+        assertEquals(grid(2).localNode().id(), oddOldest.node().id());
+
+        try (Ignite g4 = startGrid(NODES_CNT);
+            Ignite g5 = startGrid(NODES_CNT + 1))
+        {
+            clusterSize = g4.cluster().nodes().size();
+
+            assertEquals(grid(gridMaxOrder(clusterSize, true)).localNode().id(), evenYoungest.node().id());
+            assertEquals(grid(1).localNode().id(), evenOldest.node().id());
+
+            assertEquals(grid(gridMaxOrder(clusterSize, false)).localNode().id(), oddYoungest.node().id());
+            assertEquals(grid(2).localNode().id(), oddOldest.node().id());
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testAgeClusterGroupSerialization() throws Exception {
+        Marshaller marshaller = getConfiguration().getMarshaller();
+
+        ClusterGroup grp = ignite.cluster().forYoungest();
+        ClusterNode node = grp.node();
+
+        byte[] arr = marshaller.marshal(grp);
+
+        ClusterGroup obj = marshaller.unmarshal(arr, null);
+
+        assertEquals(node.id(), obj.node().id());
+
+        try (Ignite ignore = startGrid()) {
+            obj = marshaller.unmarshal(arr, null);
+
+            assertEquals(grp.node().id(), obj.node().id());
+            assertFalse(node.id().equals(obj.node().id()));
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClientServer() throws Exception {
+        ClusterGroup srv = ignite.cluster().forServers();
+
+        assertEquals(2, srv.nodes().size());
+        assertTrue(srv.nodes().contains(ignite(0).cluster().localNode()));
+        assertTrue(srv.nodes().contains(ignite(1).cluster().localNode()));
+
+        ClusterGroup cli = ignite.cluster().forClients();
+
+        assertEquals(2, srv.nodes().size());
+        assertTrue(cli.nodes().contains(ignite(2).cluster().localNode()));
+        assertTrue(cli.nodes().contains(ignite(3).cluster().localNode()));
+    }
+
+    /**
+     * @param cnt Count.
+     * @param even Even.
+     */
+    private static int gridMaxOrder(int cnt, boolean even) {
+        assert cnt > 2;
+
+        cnt = cnt - (cnt % 2);
+
+        return even ? cnt - 1 : cnt - 2;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3d97f8/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionAbstractTest.java
deleted file mode 100644
index cb1341c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionAbstractTest.java
+++ /dev/null
@@ -1,784 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.events.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.apache.ignite.testframework.junits.common.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-
-import static org.apache.ignite.events.EventType.*;
-
-/**
- * Abstract test for {@link org.apache.ignite.cluster.ClusterGroup}
- */
-@SuppressWarnings("deprecation")
-public abstract class GridProjectionAbstractTest extends GridCommonAbstractTest implements Externalizable {
-    /** VM ip finder for TCP discovery. */
-    private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
-    /** Waiting timeout. */
-    private static final int WAIT_TIMEOUT = 30000;
-
-    /** Utility static variable. */
-    private static final AtomicInteger cnt = new AtomicInteger(0);
-
-    /** Mutex. */
-    private static final Object mux = new Object();
-
-    /** Projection. */
-    private ClusterGroup prj;
-
-    /** Runnable job. */
-    private IgniteRunnable runJob = new TestRunnable();
-
-    /** Callable job. */
-    private IgniteCallable<String> calJob = new TestCallable<>();
-
-    /** Closure job. */
-    private IgniteClosure<String, String> clrJob = new IgniteClosure<String, String>() {
-        @Override public String apply(String s) {
-            return s;
-        }
-
-        @Override public String toString() {
-            return "clrJob";
-        }
-    };
-
-    /** Reducer. */
-    private IgniteReducer<String, Object> rdc = new IgniteReducer<String, Object>() {
-        @Override public boolean collect(String e) {
-            return true;
-        }
-
-        @Nullable @Override public Object reduce() {
-            return null;
-        }
-
-        @Override public String toString() {
-            return "rdc";
-        }
-    };
-
-    /** */
-    protected GridProjectionAbstractTest() {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setDiscoverySpi(new TcpDiscoverySpi().setForceServerMode(true).setIpFinder(ipFinder));
-
-        return cfg;
-    }
-
-    /**
-     * @param startGrid Start grid flag.
-     */
-    protected GridProjectionAbstractTest(boolean startGrid) {
-        super(startGrid);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        prj = projection();
-
-        cnt.set(0);
-    }
-
-    /**
-     * @return Projection.
-     */
-    protected abstract ClusterGroup projection();
-
-    /**
-     * @return Local node ID.
-     */
-    @Nullable protected abstract UUID localNodeId();
-
-    /**
-     * @return Remote nodes IDs.
-     */
-    protected Collection<UUID> remoteNodeIds() {
-        return F.nodeIds(projection().forRemotes().nodes());
-    }
-
-    /**
-     * @return Projection size.
-     */
-    private int projectionSize() {
-        int size = localNodeId() != null ? 1 : 0;
-
-        size += remoteNodeIds().size();
-
-        assert size > 0;
-
-        return size;
-    }
-
-    /**
-     * @return Collection of projection node IDs.
-     */
-    private Collection<UUID> projectionNodeIds() {
-        Collection<UUID> ids = new LinkedList<>();
-
-        UUID id = localNodeId();
-
-        if (id != null)
-            ids.add(id);
-
-        ids.addAll(remoteNodeIds());
-
-        assert !ids.isEmpty();
-
-        return ids;
-    }
-
-    /**
-     * Test for projection on not existing node IDs.
-     */
-    public void testInvalidProjection() {
-        Collection<UUID> ids = new HashSet<>();
-
-        ids.add(UUID.randomUUID());
-        ids.add(UUID.randomUUID());
-
-        ClusterGroup invalidPrj = prj.forNodeIds(ids);
-
-        assertEquals(0, invalidPrj.nodes().size());
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testProjection() throws Exception {
-        assert prj != null;
-
-        assert prj.ignite() != null;
-        assert prj.predicate() != null;
-
-        int size = projectionSize();
-
-        assert prj.nodes().size() == size;
-
-        Collection<UUID> nodeIds = projectionNodeIds();
-
-        for (ClusterNode node : prj.nodes())
-            assert nodeIds.contains(node.id());
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testRemoteNodes() throws Exception {
-        Collection<UUID> remoteNodeIds = remoteNodeIds();
-
-        UUID locNodeId = localNodeId();
-
-        int size = remoteNodeIds.size();
-
-        String name = "oneMoreGrid";
-
-        try {
-            Ignite g = startGrid(name);
-
-            UUID excludedId = g.cluster().localNode().id();
-
-            assertEquals(size, prj.forRemotes().nodes().size());
-
-            for (ClusterNode node : prj.forRemotes().nodes()) {
-                UUID id = node.id();
-
-                assert !id.equals(locNodeId) && remoteNodeIds.contains(id) && !excludedId.equals(id);
-            }
-        }
-        finally {
-            stopGrid(name);
-        }
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testRemoteProjection() throws Exception {
-        Collection<UUID> remoteNodeIds = remoteNodeIds();
-
-        ClusterGroup remotePrj = projection().forRemotes();
-
-        Collection<UUID> prjNodeIds = F.nodeIds(remotePrj.nodes());
-
-        assert prjNodeIds.size() == remoteNodeIds.size();
-
-        assert prjNodeIds.containsAll(remoteNodeIds());
-
-        assert !prjNodeIds.contains(localNodeId());
-
-        String name = "oneMoreGrid";
-
-        try {
-            Ignite g = startGrid(name);
-
-            UUID excludedId = g.cluster().localNode().id();
-
-            assert !F.nodeIds(remotePrj.nodes()).contains(excludedId);
-        }
-        finally {
-            stopGrid(name);
-        }
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testExecution() throws Exception {
-        String name = "oneMoreGrid";
-
-        Collection<IgniteBiTuple<Ignite, IgnitePredicate<Event>>> lsnrs = new LinkedList<>();
-
-        try {
-            final AtomicInteger cnt = new AtomicInteger();
-
-            Ignite g = startGrid(name);
-
-            IgnitePredicate<Event> lsnr;
-
-            if (!IgniteCluster.class.isAssignableFrom(projection().getClass())) {
-                g.events().localListen(lsnr = new IgnitePredicate<Event>() {
-                    @Override public boolean apply(Event evt) {
-                        assert evt.type() == EVT_JOB_STARTED;
-
-                        assert false;
-
-                        return true;
-                    }
-                }, EVT_JOB_STARTED);
-
-                lsnrs.add(F.t(g, lsnr));
-            }
-
-            for (ClusterNode node : prj.nodes()) {
-                g = G.ignite(node.id());
-
-                g.events().localListen(lsnr = new IgnitePredicate<Event>() {
-                    @Override public boolean apply(Event evt) {
-                        assert evt.type() == EVT_JOB_STARTED;
-
-                        synchronized (mux) {
-                            cnt.incrementAndGet();
-
-                            mux.notifyAll();
-                        }
-
-                        return true;
-                    }
-                }, EVT_JOB_STARTED);
-
-                lsnrs.add(F.t(g, lsnr));
-            }
-
-            run1(cnt);
-            run2(cnt);
-
-            call1(cnt);
-            call2(cnt);
-            call3(cnt);
-            call4(cnt);
-            call5(cnt);
-
-            forkjoin1(cnt);
-            forkjoin2(cnt);
-
-            exec1(cnt);
-            exec2(cnt);
-
-            executorService(cnt);
-
-            checkActiveFutures();
-        }
-        finally {
-            for (IgniteBiTuple<Ignite, IgnitePredicate<Event>> t : lsnrs)
-                t.get1().events().stopLocalListen(t.get2(), EVT_JOB_STARTED);
-
-            stopGrid(name);
-        }
-    }
-
-    /**
-     * @param cnt Counter.
-     * @throws Exception If failed.
-     */
-    private void run1(AtomicInteger cnt) throws Exception {
-        IgniteCompute comp = compute(prj).withAsync();
-
-        comp.broadcast(runJob);
-
-        ComputeTaskFuture fut = comp.future();
-
-        waitForExecution(fut);
-
-        cnt.set(0);
-
-        compute(prj).broadcast(runJob);
-
-        waitForValue(cnt, projectionSize());
-    }
-
-    /**
-     * @param cnt Counter.
-     * @throws Exception If failed.
-     */
-    private void run2(AtomicInteger cnt) throws Exception {
-        Collection<IgniteRunnable> jobs = F.asList(runJob);
-
-        IgniteCompute comp = compute(prj).withAsync();
-
-        comp.run(jobs);
-
-        ComputeTaskFuture fut = comp.future();
-
-        waitForExecution(fut);
-
-        cnt.set(0);
-
-        compute(prj).run(jobs);
-
-        waitForValue(cnt, jobs.size());
-    }
-
-    /**
-     * @param cnt Counter.
-     * @throws Exception If failed.
-     */
-    private void call1(AtomicInteger cnt) throws Exception {
-        IgniteCompute comp = compute(prj).withAsync();
-
-        comp.broadcast(calJob);
-
-        ComputeTaskFuture fut = comp.future();
-
-        waitForExecution(fut);
-
-        cnt.set(0);
-
-        compute(prj).broadcast(calJob);
-
-        waitForValue(cnt, projectionSize());
-    }
-
-    /**
-     * @param cnt Counter.
-     * @throws Exception If failed.
-     */
-    private void call2(AtomicInteger cnt) throws Exception {
-        IgniteCompute comp = compute(prj).withAsync();
-
-        Collection<IgniteCallable<String>> jobs = F.asList(calJob);
-
-        comp.call(jobs);
-
-        ComputeTaskFuture fut = comp.future();
-
-        waitForExecution(fut);
-
-        cnt.set(0);
-
-        compute(prj).call(jobs);
-
-        waitForValue(cnt, jobs.size());
-    }
-
-    /**
-     * @param cnt Counter.
-     * @throws Exception If failed.
-     */
-    private void call3(AtomicInteger cnt) throws Exception {
-        IgniteCompute comp = compute(prj).withAsync();
-
-        comp.apply(clrJob, (String) null);
-
-        ComputeTaskFuture fut = comp.future();
-
-        waitForExecution(fut);
-
-        cnt.set(0);
-
-        compute(prj).apply(clrJob, (String) null);
-
-        waitForValue(cnt, 1);
-    }
-
-    /**
-     * @param cnt Counter.
-     * @throws Exception If failed.
-     */
-    private void call4(AtomicInteger cnt) throws Exception {
-        Collection<String> args = F.asList("a", "b", "c");
-
-        IgniteCompute comp = compute(prj).withAsync();
-
-        comp.apply(clrJob, args);
-
-        ComputeTaskFuture fut = comp.future();
-
-        waitForExecution(fut);
-
-        cnt.set(0);
-
-        compute(prj).apply(clrJob, args);
-
-        waitForValue(cnt, args.size());
-    }
-
-    /**
-     * @param cnt Counter.
-     * @throws Exception If failed.
-     */
-    private void call5(AtomicInteger cnt) throws Exception {
-        IgniteCompute comp = compute(prj).withAsync();
-
-        comp.broadcast(new TestClosure(), "arg");
-
-        ComputeTaskFuture<Collection<String>> fut = comp.future();
-
-        waitForExecution(fut);
-
-        cnt.set(0);
-
-        Collection<String> res = compute(prj).broadcast(new TestClosure(), "arg");
-
-        assertEquals(projectionSize(), res.size());
-
-        waitForValue(cnt, projectionSize());
-
-        for (String resStr : res)
-            assertEquals("arg", resStr);
-    }
-
-    /**
-     * @param cnt Counter.
-     * @throws Exception If failed.
-     */
-    private void forkjoin1(AtomicInteger cnt) throws Exception {
-        Collection<String> args = F.asList("a", "b", "c");
-
-        IgniteCompute comp = compute(prj).withAsync();
-
-        comp.apply(clrJob, args, rdc);
-
-        ComputeTaskFuture fut = comp.future();
-
-        waitForExecution(fut);
-
-        cnt.set(0);
-
-        compute(prj).apply(clrJob, args, rdc);
-
-        waitForValue(cnt, args.size());
-    }
-
-    /**
-     * @param cnt Counter.
-     * @throws Exception If failed.
-     */
-    private void forkjoin2(AtomicInteger cnt) throws Exception {
-        Collection<IgniteCallable<String>> jobs = F.asList(calJob);
-
-        IgniteCompute comp = compute(prj).withAsync();
-
-        comp.call(jobs, rdc);
-
-        ComputeTaskFuture fut = comp.future();
-
-        waitForExecution(fut);
-
-        cnt.set(0);
-
-        compute(prj).call(jobs, rdc);
-
-        waitForValue(cnt, jobs.size());
-    }
-
-    /**
-     * @param cnt Counter.
-     * @throws Exception If failed.
-     */
-    private void exec1(AtomicInteger cnt) throws Exception {
-        cnt.set(0);
-
-        compute(prj).execute(TestTask.class.getName(), null);
-
-        waitForValue(cnt, projectionSize());
-
-        cnt.set(0);
-
-        compute(prj).execute(new TestTask(), null);
-
-        waitForValue(cnt, projectionSize());
-
-        cnt.set(0);
-
-        compute(prj).execute(TestTask.class, null);
-
-        waitForValue(cnt, projectionSize());
-    }
-
-    /**
-     * @param cnt Counter.
-     * @throws Exception If failed.
-     */
-    private void exec2(AtomicInteger cnt) throws Exception {
-        cnt.set(0);
-
-        compute(prj).withTimeout(WAIT_TIMEOUT).execute(TestTask.class.getName(), null);
-
-        waitForValue(cnt, projectionSize());
-
-        cnt.set(0);
-
-        compute(prj).withTimeout(WAIT_TIMEOUT).execute(new TestTask(), null);
-
-        waitForValue(cnt, projectionSize());
-
-        cnt.set(0);
-
-        compute(prj).withTimeout(WAIT_TIMEOUT).execute(TestTask.class, null);
-
-        waitForValue(cnt, projectionSize());
-    }
-
-    /**
-     * @param cnt Counter.
-     * @throws Exception If failed.
-     */
-    private void executorService(AtomicInteger cnt) throws Exception {
-        cnt.set(0);
-
-        ExecutorService execSrvc = prj.ignite().executorService(prj);
-
-        Future<String> fut = execSrvc.submit(new TestCallable<String>() {
-            @Override public String call() throws Exception {
-                return "submit1";
-            }
-        });
-
-        waitForValue(cnt, 1);
-
-        assertEquals("submit1", fut.get());
-
-        cnt.set(0);
-
-        fut = execSrvc.submit(new TestRunnable(), "submit2");
-
-        waitForValue(cnt, 1);
-
-        assertEquals("submit2", fut.get());
-
-        cnt.set(0);
-
-        Future<?> runFut = execSrvc.submit(new TestRunnable());
-
-        waitForValue(cnt, 1);
-
-        runFut.get();
-    }
-
-    /**
-     * @param fut Execution future.
-     * @throws InterruptedException Thrown if wait was interrupted.
-     */
-    @SuppressWarnings({"UnconditionalWait"})
-    private void waitForExecution(IgniteFuture fut) throws InterruptedException {
-        long sleep = 250;
-
-        long threshold = System.currentTimeMillis() + WAIT_TIMEOUT;
-
-        do synchronized (mux) {
-            mux.wait(sleep);
-        }
-        while (fut != null && !fut.isDone() && !fut.isCancelled() && threshold > System.currentTimeMillis());
-
-        assert fut == null || fut.isDone();
-    }
-
-    /**
-     * @param cnt Counter to check.
-     * @param val Value to check.
-     * @throws InterruptedException Thrown if wait was interrupted.
-     */
-    private void waitForValue(AtomicInteger cnt, int val) throws InterruptedException {
-        assert cnt != null;
-        assert val > 0;
-
-        long threshold = System.currentTimeMillis() + WAIT_TIMEOUT;
-
-        long time;
-
-        while (threshold > (time = System.currentTimeMillis()))
-            synchronized (mux) {
-                if (cnt.get() == val)
-                    break;
-
-                mux.wait(threshold - time);
-            }
-
-        assert cnt.get() == val;
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    private void checkActiveFutures() throws Exception {
-        IgniteCompute comp = compute(prj).withAsync();
-
-        assertEquals(0, comp.activeTaskFutures().size());
-
-        cnt.set(0);
-
-        Collection<ComputeTaskFuture<Object>> futsList = new ArrayList<>();
-
-        for (int i = 0; i < 10; i++) {
-            comp.call(new TestWaitCallable<>());
-
-            ComputeTaskFuture<Object> fut = comp.future();
-
-            assertFalse(fut.isDone());
-
-            Map<IgniteUuid, ComputeTaskFuture<Object>> futs = comp.activeTaskFutures();
-
-            assertEquals(i + 1, futs.size());
-
-            assertTrue(futs.containsKey(fut.getTaskSession().getId()));
-
-            futsList.add(fut);
-        }
-
-        synchronized (mux) {
-            cnt.incrementAndGet();
-
-            mux.notifyAll();
-        }
-
-        for (ComputeTaskFuture<Object> fut : futsList)
-            fut.get();
-
-        assertEquals(0, comp.activeTaskFutures().size());
-    }
-
-    /**
-     *  Test closure.
-     */
-    private static class TestClosure implements IgniteClosure<String, String> {
-        /** {@inheritDoc} */
-        @Override public String apply(String s) {
-            return s;
-        }
-    }
-
-    /**
-     * Test runnable.
-     */
-    private static class TestRunnable implements IgniteRunnable {
-        /** {@inheritDoc} */
-        @Override public void run() {
-            // No-op.
-        }
-    }
-
-    /**
-     * Test callable.
-     */
-    private static class TestCallable<T> implements IgniteCallable<T> {
-        /** {@inheritDoc} */
-        @Nullable @Override public T call() throws Exception {
-            return null;
-        }
-    }
-
-    /**
-     * Test callable.
-     */
-    private static class TestWaitCallable<T> implements IgniteCallable<T> {
-        /** {@inheritDoc} */
-        @Nullable @Override public T call() throws Exception {
-            synchronized (mux) {
-                while (cnt.get() == 0)
-                    mux.wait();
-            }
-
-            return null;
-        }
-    }
-
-    /**
-     * Test task.
-     */
-    @SuppressWarnings({"PublicInnerClass"})
-    public static class TestTask extends ComputeTaskSplitAdapter<String, Void> {
-        /** {@inheritDoc} */
-        @Override protected Collection<? extends ComputeJob> split(int gridSize, String arg) {
-            Collection<ComputeJob> jobs = new HashSet<>();
-
-            for (int i = 0; i < gridSize; i++)
-                jobs.add(new TestJob());
-
-            return jobs;
-        }
-
-        /** {@inheritDoc} */
-        @Nullable @Override public Void reduce(List<ComputeJobResult> results) {
-            return null;
-        }
-    }
-
-    /**
-     * Test job.
-     */
-    @SuppressWarnings({"PublicInnerClass"})
-    public static class TestJob extends ComputeJobAdapter {
-        /** {@inheritDoc} */
-        @Nullable @Override public Object execute() {
-            return null;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        // No-op.
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3d97f8/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
deleted file mode 100644
index 9fbad80..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.marshaller.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.*;
-
-/**
- * Test for {@link ClusterGroup}.
- */
-@GridCommonTest(group = "Kernal Self")
-public class GridProjectionSelfTest extends GridProjectionAbstractTest {
-    /** Nodes count. */
-    private static final int NODES_CNT = 4;
-
-    /** Projection node IDs. */
-    private static Collection<UUID> ids;
-
-    /** */
-    private static Ignite ignite;
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"ConstantConditions"})
-    @Override protected void beforeTestsStarted() throws Exception {
-        assert NODES_CNT > 2;
-
-        ids = new LinkedList<>();
-
-        try {
-            for (int i = 0; i < NODES_CNT; i++) {
-                Ignition.setClientMode(i > 1);
-
-                Ignite g = startGrid(i);
-
-                ids.add(g.cluster().localNode().id());
-
-                if (i == 0)
-                    ignite = g;
-            }
-        }
-        finally {
-            Ignition.setClientMode(false);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        for (int i = 0; i < NODES_CNT; i++)
-            stopGrid(i);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected ClusterGroup projection() {
-        return grid(0).cluster().forPredicate(F.nodeForNodeIds(ids));
-    }
-
-    /** {@inheritDoc} */
-    @Override protected UUID localNodeId() {
-        return grid(0).localNode().id();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRandom() throws Exception {
-        assertTrue(ignite.cluster().nodes().contains(ignite.cluster().forRandom().node()));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testOldest() throws Exception {
-        ClusterGroup oldest = ignite.cluster().forOldest();
-
-        ClusterNode node = null;
-
-        long minOrder = Long.MAX_VALUE;
-
-        for (ClusterNode n : ignite.cluster().nodes()) {
-            if (n.order() < minOrder) {
-                node = n;
-
-                minOrder = n.order();
-            }
-        }
-
-        assertEquals(oldest.node(), ignite.cluster().forNode(node).node());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testYoungest() throws Exception {
-        ClusterGroup youngest = ignite.cluster().forYoungest();
-
-        ClusterNode node = null;
-
-        long maxOrder = Long.MIN_VALUE;
-
-        for (ClusterNode n : ignite.cluster().nodes()) {
-            if (n.order() > maxOrder) {
-                node = n;
-
-                maxOrder = n.order();
-            }
-        }
-
-        assertEquals(youngest.node(), ignite.cluster().forNode(node).node());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testNewNodes() throws Exception {
-        ClusterGroup youngest = ignite.cluster().forYoungest();
-        ClusterGroup oldest = ignite.cluster().forOldest();
-
-        ClusterNode old = oldest.node();
-        ClusterNode last = youngest.node();
-
-        assertNotNull(last);
-
-        try (Ignite g = startGrid(NODES_CNT)) {
-            ClusterNode n = g.cluster().localNode();
-
-            ClusterNode latest = youngest.node();
-
-            assertNotNull(latest);
-            assertEquals(latest.id(), n.id());
-            assertEquals(oldest.node(), old);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testForPredicate() throws Exception {
-        IgnitePredicate<ClusterNode> evenP = new IgnitePredicate<ClusterNode>() {
-            @Override public boolean apply(ClusterNode node) {
-                return node.order() % 2 == 0;
-            }
-        };
-
-        IgnitePredicate<ClusterNode> oddP = new IgnitePredicate<ClusterNode>() {
-            @Override public boolean apply(ClusterNode node) {
-                return node.order() % 2 == 1;
-            }
-        };
-
-        ClusterGroup remotes = ignite.cluster().forRemotes();
-
-        ClusterGroup evenYoungest = remotes.forPredicate(evenP).forYoungest();
-        ClusterGroup evenOldest = remotes.forPredicate(evenP).forOldest();
-
-        ClusterGroup oddYoungest = remotes.forPredicate(oddP).forYoungest();
-        ClusterGroup oddOldest = remotes.forPredicate(oddP).forOldest();
-
-        int clusterSize = ignite.cluster().nodes().size();
-
-        assertEquals(grid(gridMaxOrder(clusterSize, true)).localNode().id(), evenYoungest.node().id());
-        assertEquals(grid(1).localNode().id(), evenOldest.node().id());
-
-        assertEquals(grid(gridMaxOrder(clusterSize, false)).localNode().id(), oddYoungest.node().id());
-        assertEquals(grid(2).localNode().id(), oddOldest.node().id());
-
-        try (Ignite g4 = startGrid(NODES_CNT);
-            Ignite g5 = startGrid(NODES_CNT + 1))
-        {
-            clusterSize = g4.cluster().nodes().size();
-
-            assertEquals(grid(gridMaxOrder(clusterSize, true)).localNode().id(), evenYoungest.node().id());
-            assertEquals(grid(1).localNode().id(), evenOldest.node().id());
-
-            assertEquals(grid(gridMaxOrder(clusterSize, false)).localNode().id(), oddYoungest.node().id());
-            assertEquals(grid(2).localNode().id(), oddOldest.node().id());
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testAgeClusterGroupSerialization() throws Exception {
-        Marshaller marshaller = getConfiguration().getMarshaller();
-
-        ClusterGroup grp = ignite.cluster().forYoungest();
-        ClusterNode node = grp.node();
-
-        byte[] arr = marshaller.marshal(grp);
-
-        ClusterGroup obj = marshaller.unmarshal(arr, null);
-
-        assertEquals(node.id(), obj.node().id());
-
-        try (Ignite ignore = startGrid()) {
-            obj = marshaller.unmarshal(arr, null);
-
-            assertEquals(grp.node().id(), obj.node().id());
-            assertFalse(node.id().equals(obj.node().id()));
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testClientServer() throws Exception {
-        ClusterGroup srv = ignite.cluster().forServers();
-
-        assertEquals(2, srv.nodes().size());
-        assertTrue(srv.nodes().contains(ignite(0).cluster().localNode()));
-        assertTrue(srv.nodes().contains(ignite(1).cluster().localNode()));
-
-        ClusterGroup cli = ignite.cluster().forClients();
-
-        assertEquals(2, srv.nodes().size());
-        assertTrue(cli.nodes().contains(ignite(2).cluster().localNode()));
-        assertTrue(cli.nodes().contains(ignite(3).cluster().localNode()));
-    }
-
-    /**
-     * @param cnt Count.
-     * @param even Even.
-     */
-    private static int gridMaxOrder(int cnt, boolean even) {
-        assert cnt > 2;
-
-        cnt = cnt - (cnt % 2);
-
-        return even ? cnt - 1 : cnt - 2;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3d97f8/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
index 2de04b0..3ec3278 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
@@ -32,7 +32,7 @@ import java.util.concurrent.atomic.*;
  * Test for {@link org.apache.ignite.IgniteCluster}.
  */
 @GridCommonTest(group = "Kernal Self")
-public class GridSelfTest extends GridProjectionAbstractTest {
+public class GridSelfTest extends ClusterGroupAbstractTest {
     /** Nodes count. */
     private static final int NODES_CNT = 4;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3d97f8/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 2d14728..3da198c 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -65,7 +65,7 @@ public class IgniteBasicTestSuite extends TestSuite {
         suite.addTest(IgniteStreamSelfTestSuite.suite());
 
         suite.addTest(new TestSuite(GridSelfTest.class));
-        GridTestUtils.addTestIfNeeded(suite, GridProjectionSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, ClusterGroupSelfTest.class, ignoredTests);
         GridTestUtils.addTestIfNeeded(suite, GridMessagingSelfTest.class, ignoredTests);
         suite.addTest(new TestSuite(IgniteMessagingWithClientTest.class));
         GridTestUtils.addTestIfNeeded(suite, GridMessagingNoPeerClassLoadingSelfTest.class, ignoredTests);


[43/50] incubator-ignite git commit: Merge branch 'ignite-917' into ignite-sprint-7

Posted by ag...@apache.org.
Merge branch 'ignite-917' into ignite-sprint-7


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

Branch: refs/heads/ignite-621
Commit: 9f74335e0793b35bdf3e171ed98a2d5734d493a3
Parents: fc17f07 401aa12
Author: ashutak <as...@gridgain.com>
Authored: Thu Jun 25 13:13:18 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Thu Jun 25 13:13:18 2015 +0300

----------------------------------------------------------------------
 .../ClientAbstractConnectivitySelfTest.java     |   4 +-
 .../org/apache/ignite/cluster/ClusterGroup.java |   9 ++
 .../org/apache/ignite/cluster/ClusterNode.java  |   2 +
 .../internal/cluster/ClusterGroupAdapter.java   |  38 +++++++
 .../cluster/IgniteClusterAsyncImpl.java         |   5 +
 .../ignite/internal/util/IgniteUtils.java       |   6 +-
 .../internal/ClusterForHostsSelfTest.java       | 113 +++++++++++++++++++
 .../internal/util/IgniteUtilsSelfTest.java      |  22 ++++
 .../ignite/testsuites/IgniteBasicTestSuite.java |   4 +-
 9 files changed, 197 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[18/50] incubator-ignite git commit: # ignite-1022 added test

Posted by ag...@apache.org.
# ignite-1022 added test


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

Branch: refs/heads/ignite-621
Commit: 78a9e69c5779f687407faddf565fa5090d94fee9
Parents: 627d0b5
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 23 12:51:18 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 23 12:51:18 2015 +0300

----------------------------------------------------------------------
 .../IgniteDataStructureWithJobTest.java         | 111 +++++++++++++++++++
 .../IgniteCacheDataStructuresSelfTestSuite.java |   1 +
 2 files changed, 112 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/78a9e69c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteDataStructureWithJobTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteDataStructureWithJobTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteDataStructureWithJobTest.java
new file mode 100644
index 0000000..47d96be
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteDataStructureWithJobTest.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.datastructures;
+
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+/**
+ *
+ */
+public class IgniteDataStructureWithJobTest extends GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long getTestTimeout() {
+        return 2 * 60_000;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testJobWithRestart() throws Exception {
+        Ignite ignite = startGrid(0);
+
+        final AtomicBoolean stop = new AtomicBoolean();
+
+        final long endTime = System.currentTimeMillis() + 60_000;
+
+        IgniteInternalFuture<?> fut = GridTestUtils.runAsync(new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                while (!Thread.currentThread().isInterrupted() && !stop.get() && U.currentTimeMillis() < endTime) {
+                    try (Ignite ignored = startGrid(1)) {
+                        Thread.sleep(500);
+                    }
+                }
+
+                return null;
+            }
+        });
+
+        try {
+            int iter = 0;
+
+            while (System.currentTimeMillis() < endTime) {
+                try {
+                    ignite.compute().broadcast(new IgniteClosure<IgniteSet, Integer>() {
+                        @Override public Integer apply(IgniteSet set) {
+                            assertNotNull(set);
+
+                            return 1;
+                        }
+                    }, ignite.set("set", new CollectionConfiguration()));
+                }
+                catch (IgniteException ignore) {
+                    // No-op.
+                }
+
+                if (iter++ % 1000 == 0)
+                    log.info("Iteration: " + iter);
+            }
+        }
+        finally {
+            stop.set(true);
+        }
+
+        fut.get();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/78a9e69c/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
index a689abb..5cb9514 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
@@ -74,6 +74,7 @@ public class IgniteCacheDataStructuresSelfTestSuite extends TestSuite {
         suite.addTest(new TestSuite(IgnitePartitionedSetNoBackupsSelfTest.class));
         suite.addTest(new TestSuite(GridCachePartitionedAtomicSetSelfTest.class));
         suite.addTest(new TestSuite(IgnitePartitionedCountDownLatchSelfTest.class));
+        suite.addTest(new TestSuite(IgniteDataStructureWithJobTest.class));
 
         suite.addTest(new TestSuite(GridCachePartitionedSetFailoverSelfTest.class));
         suite.addTest(new TestSuite(GridCachePartitionedOffheapSetFailoverSelfTest.class));


[28/50] incubator-ignite git commit: # ignite-733 Changed node print in cache command.

Posted by ag...@apache.org.
# ignite-733 Changed node print in cache command.


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

Branch: refs/heads/ignite-621
Commit: 38f5e415362e8b7bbd520bdf6a19aebf3da61e75
Parents: 359b431
Author: Andrey <an...@gridgain.com>
Authored: Wed Jun 24 13:14:15 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Wed Jun 24 13:14:15 2015 +0700

----------------------------------------------------------------------
 .../ignite/visor/commands/cache/VisorCacheCommand.scala       | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38f5e415/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 144779c..4c005af 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -328,7 +328,7 @@ class VisorCacheCommand {
                     sumT += (
                         mkCacheName(ad.name()),
                         ad.mode(),
-                        ad.nodes.map(nid8),
+                        ad.nodes.size(),
                         (
                             "min: " + ad.minimumSize,
                             "avg: " + formatDouble(ad.averageSize),
@@ -619,9 +619,9 @@ class VisorCacheCommand {
 
         val sumT = VisorTextTable()
 
-        sumT #= ("#", "Name(@)", "Mode", "Nodes", "Size")
+        sumT #= ("#", "Name(@)", "Mode", "Size")
 
-        (0 until sortedAggrData.size) foreach (i => {
+        sortedAggrData.indices.foreach(i => {
             val ad = sortedAggrData(i)
 
             // Add cache host as visor variable.
@@ -631,7 +631,6 @@ class VisorCacheCommand {
                 i,
                 mkCacheName(ad.name()),
                 ad.mode(),
-                ad.nodes,
                 (
                     "min: " + ad.minimumSize,
                     "avg: " + formatDouble(ad.averageSize),


[06/50] incubator-ignite git commit: Merge branch 'ignite-sprint-6' into ignite-sprint-7

Posted by ag...@apache.org.
Merge branch 'ignite-sprint-6' into ignite-sprint-7

Conflicts:
	modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java


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

Branch: refs/heads/ignite-621
Commit: cd06e1d317e3f828cb0f64ef2e2903be8d1fea8b
Parents: ec9cfca 1605996
Author: ashutak <as...@gridgain.com>
Authored: Mon Jun 22 16:02:08 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Mon Jun 22 16:02:08 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/IgniteSystemProperties.java   |   3 +
 .../ignite/internal/MarshallerContextImpl.java  |  12 +-
 .../internal/managers/GridManagerAdapter.java   |   8 +-
 .../discovery/GridDiscoveryManager.java         |  30 ++-
 .../GridCachePartitionExchangeManager.java      |   1 +
 .../processors/cache/GridCacheSwapManager.java  |  12 +-
 .../continuous/CacheContinuousQueryHandler.java |   8 +
 .../offheap/GridOffHeapProcessor.java           |  19 +-
 .../apache/ignite/internal/util/GridDebug.java  |  37 ++--
 .../ignite/internal/util/nio/GridNioServer.java |  64 +++++-
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |   7 +-
 .../org/apache/ignite/spi/IgniteSpiContext.java |   9 +-
 .../communication/tcp/TcpCommunicationSpi.java  |  92 ++++++++-
 .../tcp/TcpCommunicationSpiMBean.java           |  19 ++
 .../ignite/spi/discovery/DiscoverySpi.java      |   3 +-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  80 +++++---
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  17 +-
 .../spi/discovery/tcp/TcpDiscoveryImpl.java     |   3 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   6 +-
 .../messages/TcpDiscoveryNodeFailedMessage.java |  18 ++
 ...ridFailFastNodeFailureDetectionSelfTest.java |  17 +-
 .../IgniteSlowClientDetectionSelfTest.java      | 187 ++++++++++++++++++
 .../cache/GridCacheDaemonNodeStopSelfTest.java  | 119 +++++++++++
 .../testframework/GridSpiTestContext.java       |   7 +-
 .../ignite/testsuites/IgniteBasicTestSuite.java |   1 +
 .../testsuites/IgniteCacheTestSuite3.java       |   1 +
 .../processors/query/h2/IgniteH2Indexing.java   |   2 +
 .../query/h2/twostep/GridMapQueryExecutor.java  |  23 ++-
 .../cache/IgniteCacheOffheapEvictQueryTest.java | 196 +++++++++++++++++++
 .../IgniteCacheQuerySelfTestSuite.java          |   3 +-
 .../cache/jta/GridCacheXAResource.java          |  18 +-
 .../processors/cache/GridCacheJtaSelfTest.java  |   2 +-
 32 files changed, 916 insertions(+), 108 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd06e1d3/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index ae4acc2,b9205a9..14093ba
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@@ -62,7 -62,8 +62,8 @@@ public class IgniteCacheQuerySelfTestSu
          suite.addTestSuite(IgniteCacheQueryMultiThreadedOffHeapTieredSelfTest.class);
          suite.addTestSuite(IgniteCacheQueryEvictsMultiThreadedSelfTest.class);
          suite.addTestSuite(IgniteCacheQueryOffheapMultiThreadedSelfTest.class);
-         suite.addTestSuite(IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.class);
 -        // suite.addTestSuite(IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.class); TODO IGNITE-971.
++        suite.addTestSuite(IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.class); TODO IGNITE-971.
+         suite.addTestSuite(IgniteCacheOffheapEvictQueryTest.class);
          suite.addTestSuite(IgniteCacheSqlQueryMultiThreadedSelfTest.class);
          suite.addTestSuite(IgniteCacheOffheapTieredMultithreadedSelfTest.class);
          suite.addTestSuite(IgniteCacheQueryNodeRestartSelfTest.class);


[41/50] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-7' into ignite-sprint-7

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-7' into ignite-sprint-7


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

Branch: refs/heads/ignite-621
Commit: fc17f07be91fb7851bda8cf847b5a8c4194acffe
Parents: 8d8d291 7fc5595
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jun 25 12:59:42 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jun 25 12:59:42 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/internal/GridKernalContextImpl.java |  3 +++
 .../internal/processors/plugin/CachePluginManager.java    | 10 ++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[25/50] incubator-ignite git commit: # ignite-sprint-7: IgniteReflectionFactory javadoc

Posted by ag...@apache.org.
# ignite-sprint-7: IgniteReflectionFactory javadoc


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

Branch: refs/heads/ignite-621
Commit: 359b43144046bc683f9e28794eb7e7bc9c63ebc1
Parents: dfe95bd
Author: ashutak <as...@gridgain.com>
Authored: Tue Jun 23 16:59:44 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Tue Jun 23 16:59:44 2015 +0300

----------------------------------------------------------------------
 .../configuration/IgniteReflectionFactory.java  | 81 ++++++++++++++++++--
 1 file changed, 76 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/359b4314/modules/core/src/main/java/org/apache/ignite/configuration/IgniteReflectionFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteReflectionFactory.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteReflectionFactory.java
index 3222938..af73737 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteReflectionFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteReflectionFactory.java
@@ -26,26 +26,91 @@ import java.lang.reflect.*;
 import java.util.*;
 
 /**
- * Convenience class for reflection-based object creation.
+ * Factory implementation that use reflection to create instance of given class.
+ * <p>
+ * There are 2 modes of factory: singleton and non-sigletton.
+ * <p>
+ * Class that should be created by {@link IgniteReflectionFactory} (component class) have to be
+ * public java POJO with public setters for field
+ * for which property injection will be used (see {@link #setProperties(Map)}).
+ * <p>
+ * <h1 class="header">Configuration</h1>
+ * <h2 class="header">Mandatory</h2>
+ * The following configuration parameters are mandatory:
+ * <ul>
+ * <li>Component class - class to be created (see {@link #setComponentClass(Class)}.
+ * It have to be public java POJO class with default constructor
+ * and public setters to be used by properties injection (see {@link #setProperties(Map)})</li>
+ * </ul>
+ * <h2 class="header">Optional</h2>
+ * The following configuration parameters are optional:
+ * <ul>
+ * </li>
+ * <li>Singleton mode (see {@link #setSingleton(boolean)})</li>
+ * <li>Properties map (see {@link #setProperties(Map)}</li>
+ * <li>With method (see {@link #setWithMethod(Object, String, Serializable)}</li>
+ * </ul>
+ * <h2 class="header">Java Example</h2>
+ * <pre name="code" class="java">
+ * Factory<CacheStoreSessionListener> factory =
+ *     new IgniteReflectionFactory<CacheStoreSessionListener>(MyCacheStoreSessionListener.class);
+ *
+ * CacheConfiguration cc = new CacheConfiguration()
+ *     .setCacheStoreSessionListenerFactories(factory);
+ *
+ * IgniteConfiguration cfg = new IgniteConfiguration()
+ *     .setCacheConfiguration(cc);
+ *
+ * // Start grid.
+ * Ignition.start(cfg);
+ * </pre>
+ * <h2 class="header">Spring Example</h2>
+ * TcpDiscoverySpi can be configured from Spring XML configuration file:
+ * <pre name="code" class="xml">
+ * &lt;bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"&gt;
+ *     ...
+ *     &lt;property name="cacheConfiguration"&gt;
+ *         &lt;list&gt;
+ *             &lt;bean class="org.apache.ignite.configuration.CacheConfiguration"&gt;
+ *                 ...
+ *                 &lt;property name="cacheStoreSessionListenerFactories"&gt;
+ *                     &lt;list&gt;
+ *                         &lt;bean class="org.apache.ignite.configuration.IgniteReflectionFactory"&gt;
+ *                             &lt;property name="componentClass" value="custom.project.MyCacheStoreSessionListener"/&gt;
+ *                         &lt;/bean&gt;
+ *                     &lt;/list&gt;
+ *                 &lt;/property&gt;
+ *                 ...
+ *             &lt;/bean&gt;
+ *         &lt;/list&gt;
+ *     &lt;/property&gt;
+ *     ...
+ * &lt;/bean&gt;
+ * </pre>
+ * <p>
+ * <img src="http://ignite.incubator.apache.org/images/spring-small.png">
+ * <br>
+ * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
+ * @see Factory
  */
 public class IgniteReflectionFactory<T> implements Factory<T> {
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** */
+    /** Singletom mode */
     private volatile boolean singleton;
 
-    /** */
+    /** Component class */
     private volatile Class<? extends T> cls;
 
-    /** */
+    /** Properties */
     private volatile Map<String, Serializable> props;
 
     /** */
     private transient T instance;
 
     /**
-     *
+     * Default constructor.
      */
     public IgniteReflectionFactory() {
         // No-op.
@@ -98,6 +163,9 @@ public class IgniteReflectionFactory<T> implements Factory<T> {
     }
 
     /**
+     * Gets a map of properties. Map contains entries of component class field name
+     * to value of the filed which will be used as initial value.
+     *
      * @return Properties.
      */
     public Map<String, Serializable> getProperties() {
@@ -105,6 +173,9 @@ public class IgniteReflectionFactory<T> implements Factory<T> {
     }
 
     /**
+     * Sets a map of properties. Map contains entries of component class field name
+     * to a value of the filed which will be used as initial value.
+     *
      * @param props Properties.
      */
     public void setProperties(Map<String, Serializable> props) {


[11/50] incubator-ignite git commit: #IGNITE-GG-10440 Changed tests.

Posted by ag...@apache.org.
#IGNITE-GG-10440 Changed tests.


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

Branch: refs/heads/ignite-621
Commit: 5b306e1a035c94be6dcb357635d07ce7eaba84c0
Parents: 76f5377
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Mon Jun 22 17:17:44 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Mon Jun 22 17:17:44 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/internal/GridKernalContextImpl.java     | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5b306e1a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index 7b07593..737dbee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@ -790,6 +790,8 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
 
         if (cls.equals(IgniteCacheObjectProcessor.class))
             return (T)new IgniteCacheObjectProcessorImpl(this);
+        if (cls.equals(CacheConflictResolutionManager.class))
+            return null;
 
         throw new IgniteException("Unsupported component type: " + cls);
     }


[30/50] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-1022' into ignite-sprint-7

Posted by ag...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-1022' into ignite-sprint-7


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

Branch: refs/heads/ignite-621
Commit: b3e2bd488e183adf0146f170df94eb762c3056da
Parents: 359b431 de7dcfe
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jun 24 09:31:43 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 24 09:31:43 2015 +0300

----------------------------------------------------------------------
 .../datastructures/DataStructuresProcessor.java |  64 ++++-------
 ...GridCacheQueueMultiNodeAbstractSelfTest.java |   4 +-
 .../GridCacheSetAbstractSelfTest.java           |  22 ++--
 .../IgniteDataStructureWithJobTest.java         | 111 +++++++++++++++++++
 .../distributed/IgniteCacheManyClientsTest.java |   1 +
 ...idCacheNearOnlyMultiNodeFullApiSelfTest.java |   5 -
 ...achePartitionedMultiNodeFullApiSelfTest.java |  49 ++++++--
 .../IgniteCacheDataStructuresSelfTestSuite.java |   1 +
 8 files changed, 186 insertions(+), 71 deletions(-)
----------------------------------------------------------------------



[08/50] incubator-ignite git commit: # ignite-sprint-7: fix compilation after merge.

Posted by ag...@apache.org.
# ignite-sprint-7: fix compilation after merge.


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

Branch: refs/heads/ignite-621
Commit: 5d8e404f8d871f96a11238d865c6a7c656080638
Parents: cd06e1d
Author: ashutak <as...@gridgain.com>
Authored: Mon Jun 22 16:28:29 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Mon Jun 22 16:28:29 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5d8e404f/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index 14093ba..181ff0c 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -62,7 +62,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
         suite.addTestSuite(IgniteCacheQueryMultiThreadedOffHeapTieredSelfTest.class);
         suite.addTestSuite(IgniteCacheQueryEvictsMultiThreadedSelfTest.class);
         suite.addTestSuite(IgniteCacheQueryOffheapMultiThreadedSelfTest.class);
-        suite.addTestSuite(IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.class); TODO IGNITE-971.
+        suite.addTestSuite(IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.class);
         suite.addTestSuite(IgniteCacheOffheapEvictQueryTest.class);
         suite.addTestSuite(IgniteCacheSqlQueryMultiThreadedSelfTest.class);
         suite.addTestSuite(IgniteCacheOffheapTieredMultithreadedSelfTest.class);


[45/50] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-7' into ignite-sprint-7

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-7' into ignite-sprint-7

Conflicts:
	modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java


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

Branch: refs/heads/ignite-621
Commit: 646c361323de82e0bc94a6912e838f39061fc204
Parents: 6c3d97f 9f74335
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jun 25 17:20:12 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jun 25 17:20:12 2015 +0300

----------------------------------------------------------------------
 .../ClientAbstractConnectivitySelfTest.java     |   4 +-
 .../org/apache/ignite/cluster/ClusterGroup.java |   9 ++
 .../org/apache/ignite/cluster/ClusterNode.java  |   2 +
 .../internal/cluster/ClusterGroupAdapter.java   |  38 +++++++
 .../cluster/IgniteClusterAsyncImpl.java         |   5 +
 .../ignite/internal/util/IgniteUtils.java       |   6 +-
 .../internal/ClusterForHostsSelfTest.java       | 113 +++++++++++++++++++
 .../internal/util/IgniteUtilsSelfTest.java      |  22 ++++
 .../ignite/testsuites/IgniteBasicTestSuite.java |   4 +-
 9 files changed, 197 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/646c3613/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 3da198c,9b7f392..6ff83e2
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@@ -65,9 -65,11 +65,11 @@@ public class IgniteBasicTestSuite exten
          suite.addTest(IgniteStreamSelfTestSuite.suite());
  
          suite.addTest(new TestSuite(GridSelfTest.class));
+         suite.addTest(new TestSuite(ClusterForHostsSelfTest.class));
+         suite.addTest(new TestSuite(IgniteMessagingWithClientTest.class));
 -        
 -        GridTestUtils.addTestIfNeeded(suite, GridProjectionSelfTest.class, ignoredTests);
++
 +        GridTestUtils.addTestIfNeeded(suite, ClusterGroupSelfTest.class, ignoredTests);
          GridTestUtils.addTestIfNeeded(suite, GridMessagingSelfTest.class, ignoredTests);
-         suite.addTest(new TestSuite(IgniteMessagingWithClientTest.class));
          GridTestUtils.addTestIfNeeded(suite, GridMessagingNoPeerClassLoadingSelfTest.class, ignoredTests);
  
          if (U.isLinux() || U.isMacOs())


[46/50] incubator-ignite git commit: Merge branches 'ignite-1037' and 'ignite-sprint-7' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1037

Posted by ag...@apache.org.
Merge branches 'ignite-1037' and 'ignite-sprint-7' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1037


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

Branch: refs/heads/ignite-621
Commit: 20a45375d115a38bbaa96206b689131551a15bb5
Parents: 65964e2 646c361
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Jun 25 22:26:32 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Jun 25 22:26:32 2015 +0700

----------------------------------------------------------------------
 .../ClientAbstractConnectivitySelfTest.java     |   4 +-
 .../org/apache/ignite/cluster/ClusterGroup.java |   9 +
 .../org/apache/ignite/cluster/ClusterNode.java  |   2 +
 .../ignite/compute/ComputeTaskSplitAdapter.java |   2 +-
 .../configuration/IgniteReflectionFactory.java  |  81 +-
 .../ignite/internal/GridKernalContextImpl.java  |   3 +
 .../internal/cluster/ClusterGroupAdapter.java   |  38 +
 .../cluster/IgniteClusterAsyncImpl.java         |   5 +
 .../processors/cache/GridCacheContext.java      |   2 +-
 .../distributed/dht/GridDhtLocalPartition.java  |   3 +-
 .../distributed/dht/GridDhtLockFuture.java      |   2 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   9 +-
 .../GridDhtPartitionsExchangeFuture.java        |  46 +-
 .../datastructures/DataStructuresProcessor.java |  64 +-
 .../processors/hadoop/HadoopJobInfo.java        |   4 +-
 .../hadoop/counter/HadoopCounterWriter.java     |   5 +-
 .../processors/plugin/CachePluginManager.java   |  10 +-
 .../ignite/internal/util/IgniteUtils.java       |   6 +-
 .../internal/ClusterForHostsSelfTest.java       | 113 +++
 .../internal/ClusterGroupAbstractTest.java      | 777 ++++++++++++++++++
 .../ignite/internal/ClusterGroupSelfTest.java   | 251 ++++++
 .../internal/GridProjectionAbstractTest.java    | 784 -------------------
 .../ignite/internal/GridProjectionSelfTest.java | 251 ------
 .../apache/ignite/internal/GridSelfTest.java    |   2 +-
 .../CacheReadThroughAtomicRestartSelfTest.java  |  32 +
 ...heReadThroughLocalAtomicRestartSelfTest.java |  32 +
 .../CacheReadThroughLocalRestartSelfTest.java   |  32 +
 ...dThroughReplicatedAtomicRestartSelfTest.java |  32 +
 ...cheReadThroughReplicatedRestartSelfTest.java |  32 +
 .../cache/CacheReadThroughRestartSelfTest.java  | 133 ++++
 .../cache/GridCacheAbstractSelfTest.java        |   2 +-
 ...eDynamicCacheStartNoExchangeTimeoutTest.java | 466 +++++++++++
 .../cache/IgniteDynamicCacheStartSelfTest.java  |  37 +
 ...GridCacheQueueMultiNodeAbstractSelfTest.java |   4 +-
 .../GridCacheSetAbstractSelfTest.java           |  22 +-
 .../IgniteDataStructureWithJobTest.java         | 111 +++
 .../distributed/IgniteCache150ClientsTest.java  | 189 +++++
 ...teCacheClientNodePartitionsExchangeTest.java |   1 +
 .../distributed/IgniteCacheManyClientsTest.java |   1 +
 ...idCacheNearOnlyMultiNodeFullApiSelfTest.java |   5 -
 ...achePartitionedMultiNodeFullApiSelfTest.java |  49 +-
 .../GridCacheReplicatedFailoverSelfTest.java    |   5 +
 .../IgniteCacheTxStoreSessionTest.java          |   4 +
 .../internal/util/IgniteUtilsSelfTest.java      |  22 +
 .../testframework/junits/GridAbstractTest.java  |   2 +-
 .../ignite/testsuites/IgniteBasicTestSuite.java |   6 +-
 .../IgniteCacheDataStructuresSelfTestSuite.java |   1 +
 .../testsuites/IgniteCacheTestSuite4.java       |   8 +
 .../testsuites/IgniteClientTestSuite.java       |  38 +
 .../p2p/GridP2PContinuousDeploymentTask1.java   |   2 +-
 modules/hadoop/pom.xml                          |  78 --
 .../fs/IgniteHadoopFileSystemCounterWriter.java |   9 +-
 .../processors/hadoop/HadoopClassLoader.java    |  29 +
 .../processors/hadoop/HadoopDefaultJobInfo.java |  27 +-
 .../internal/processors/hadoop/HadoopUtils.java | 237 ------
 .../hadoop/SecondaryFileSystemProvider.java     |   3 +-
 .../hadoop/fs/HadoopFileSystemCacheUtils.java   | 241 ++++++
 .../hadoop/fs/HadoopFileSystemsUtils.java       |  11 +
 .../hadoop/fs/HadoopLazyConcurrentMap.java      |   5 +
 .../hadoop/jobtracker/HadoopJobTracker.java     |  25 +-
 .../child/HadoopChildProcessRunner.java         |   3 +-
 .../processors/hadoop/v2/HadoopV2Job.java       |  84 +-
 .../hadoop/v2/HadoopV2JobResourceManager.java   |  22 +-
 .../hadoop/v2/HadoopV2TaskContext.java          |  37 +-
 .../apache/ignite/igfs/IgfsEventsTestSuite.java |   5 +-
 .../processors/hadoop/HadoopMapReduceTest.java  |   2 +-
 .../processors/hadoop/HadoopTasksV1Test.java    |   7 +-
 .../processors/hadoop/HadoopTasksV2Test.java    |   7 +-
 .../processors/hadoop/HadoopV2JobSelfTest.java  |   6 +-
 .../collections/HadoopAbstractMapTest.java      |   3 +-
 .../testsuites/IgniteHadoopTestSuite.java       |   2 +-
 .../IgniteIgfsLinuxAndMacOSTestSuite.java       |   3 +-
 72 files changed, 3069 insertions(+), 1518 deletions(-)
----------------------------------------------------------------------



[07/50] incubator-ignite git commit: Merge branch 'ignite-sprint-7' into ignite-gg-10440

Posted by ag...@apache.org.
Merge branch 'ignite-sprint-7' into ignite-gg-10440


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

Branch: refs/heads/ignite-621
Commit: 090629255360603de4b2b3828812913d16243686
Parents: 987d91e cd06e1d
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Mon Jun 22 16:23:45 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Mon Jun 22 16:23:45 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/IgniteSystemProperties.java   |   3 +
 .../ignite/internal/MarshallerContextImpl.java  |  12 +-
 .../internal/managers/GridManagerAdapter.java   |   8 +-
 .../discovery/GridDiscoveryManager.java         |  30 ++-
 .../processors/cache/GridCacheIoManager.java    |  64 ++++--
 .../GridCachePartitionExchangeManager.java      |  71 ++++---
 .../processors/cache/GridCacheSwapManager.java  |  12 +-
 .../continuous/CacheContinuousQueryHandler.java |   8 +
 .../offheap/GridOffHeapProcessor.java           |  19 +-
 .../apache/ignite/internal/util/GridDebug.java  |  37 ++--
 .../ignite/internal/util/nio/GridNioServer.java |  64 +++++-
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |   7 +-
 .../org/apache/ignite/spi/IgniteSpiContext.java |   9 +-
 .../communication/tcp/TcpCommunicationSpi.java  |  92 ++++++++-
 .../tcp/TcpCommunicationSpiMBean.java           |  19 ++
 .../ignite/spi/discovery/DiscoverySpi.java      |   3 +-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  80 +++++---
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  17 +-
 .../spi/discovery/tcp/TcpDiscoveryImpl.java     |   3 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   6 +-
 .../messages/TcpDiscoveryNodeFailedMessage.java |  18 ++
 ...ridFailFastNodeFailureDetectionSelfTest.java |  17 +-
 .../IgniteSlowClientDetectionSelfTest.java      | 187 ++++++++++++++++++
 .../GridCacheAbstractFailoverSelfTest.java      |   6 +-
 .../cache/GridCacheDaemonNodeStopSelfTest.java  | 119 +++++++++++
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java |  44 ++++-
 .../testframework/GridSpiTestContext.java       |   7 +-
 .../ignite/testsuites/IgniteBasicTestSuite.java |   1 +
 .../testsuites/IgniteCacheTestSuite3.java       |   1 +
 .../processors/query/h2/IgniteH2Indexing.java   |   2 +
 .../query/h2/twostep/GridMapQueryExecutor.java  |  23 ++-
 .../cache/IgniteCacheOffheapEvictQueryTest.java | 196 +++++++++++++++++++
 .../IgniteCacheQuerySelfTestSuite.java          |   3 +-
 .../cache/jta/GridCacheXAResource.java          |  18 +-
 .../processors/cache/GridCacheJtaSelfTest.java  |   2 +-
 35 files changed, 1036 insertions(+), 172 deletions(-)
----------------------------------------------------------------------



[31/50] incubator-ignite git commit: #ignite-1043: Add tests for read through flag.

Posted by ag...@apache.org.
#ignite-1043: Add tests for read through flag.


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

Branch: refs/heads/ignite-621
Commit: bf1ea21b2f2ff6964b8e13e821b5194243855ff4
Parents: b3e2bd4
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Jun 24 11:30:15 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Jun 24 11:30:15 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheContext.java      |   2 +-
 .../distributed/dht/GridDhtLockFuture.java      |   2 +-
 .../CacheReadThroughAtomicRestartSelfTest.java  |  32 +++++
 ...heReadThroughLocalAtomicRestartSelfTest.java |  32 +++++
 .../CacheReadThroughLocalRestartSelfTest.java   |  32 +++++
 ...dThroughReplicatedAtomicRestartSelfTest.java |  32 +++++
 ...cheReadThroughReplicatedRestartSelfTest.java |  32 +++++
 .../cache/CacheReadThroughRestartSelfTest.java  | 133 +++++++++++++++++++
 .../cache/GridCacheAbstractSelfTest.java        |   2 +-
 .../IgniteCacheTxStoreSessionTest.java          |   4 +
 .../testsuites/IgniteCacheTestSuite4.java       |   7 +
 11 files changed, 307 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 8a4e3b9..9b7801c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -1377,7 +1377,7 @@ public class GridCacheContext<K, V> implements Externalizable {
     }
 
     /**
-     * @return {@code True} if store read-through mode is enabled.
+     * @return {@code True} if {@link CacheConfiguration#isLoadPreviousValue()} flag is set.
      */
     public boolean loadPreviousValue() {
         return cacheCfg.isLoadPreviousValue();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
index bdaa552..e160529 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
@@ -958,7 +958,7 @@ public final class GridDhtLockFuture extends GridCompoundIdentityFuture<Boolean>
      *
      */
     private void loadMissingFromStore() {
-        if (!skipStore && cctx.loadPreviousValue() && cctx.readThrough() && (needReturnVal || read)) {
+        if (!skipStore && (read || cctx.loadPreviousValue()) && cctx.readThrough() && (needReturnVal || read)) {
             final Map<KeyCacheObject, GridDhtCacheEntry> loadMap = new LinkedHashMap<>();
 
             final GridCacheVersion ver = version();

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

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

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

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

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

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
new file mode 100644
index 0000000..7d0cd4c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.transactions.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * Test for read through store.
+ */
+public class CacheReadThroughRestartSelfTest extends GridCacheAbstractSelfTest {
+    /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 2;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        TransactionConfiguration txCfg = new TransactionConfiguration();
+
+        txCfg.setTxSerializableEnabled(true);
+
+        cfg.setTransactionConfiguration(txCfg);
+
+        CacheConfiguration cc = cacheConfiguration(gridName);
+
+        cc.setLoadPreviousValue(false);
+
+        cfg.setCacheConfiguration(cc);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(disco);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return TRANSACTIONAL;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return PARTITIONED;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReadThroughInTx() throws Exception {
+        IgniteCache<String, Integer> cache = grid(1).cache(null);
+
+        for (int k = 0; k < 1000; k++)
+            cache.put("key" + k, k);
+
+        stopAllGrids();
+
+        startGrids(2);
+
+        Ignite ignite = grid(1);
+
+        cache = ignite.cache(null);
+
+        for (TransactionConcurrency txConcurrency : TransactionConcurrency.values()) {
+            for (TransactionIsolation txIsolation : TransactionIsolation.values()) {
+                try (Transaction tx = ignite.transactions().txStart(txConcurrency, txIsolation, 100000, 1000)) {
+                    for (int k = 0; k < 1000; k++) {
+                        String key = "key" + k;
+
+                        assertNotNull("Null value for key: " + key, cache.get(key));
+                    }
+
+                    tx.commit();
+                }
+            }
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReadThrough() throws Exception {
+        IgniteCache<String, Integer> cache = grid(1).cache(null);
+
+        for (int k = 0; k < 1000; k++)
+            cache.put("key" + k, k);
+
+        stopAllGrids();
+
+        startGrids(2);
+
+        Ignite ignite = grid(1);
+
+        cache = ignite.cache(null);
+
+        for (int k = 0; k < 1000; k++) {
+            String key = "key" + k;
+
+            assertNotNull("Null value for key: " + key, cache.get(key));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
index 3f14f49..468aec1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
@@ -531,7 +531,7 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest {
     /**
      * Serializable factory.
      */
-    private static class TestStoreFactory implements Factory<CacheStore> {
+    protected static class TestStoreFactory implements Factory<CacheStore> {
         @Override public CacheStore create() {
             return cacheStore();
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
index 269b9ae..c97fe29 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
@@ -135,9 +135,13 @@ public class IgniteCacheTxStoreSessionTest extends IgniteCacheStoreSessionAbstra
 
         try (Transaction tx = startTx(concurrency, isolation)) {
             log.info("Do tx get.");
+            expData.add(new ExpectedData(false, "load", new HashMap(), cache.getName()));
+            expData.add(new ExpectedData(true, "sessionEnd", F.<Object, Object>asMap(0, "load"), cache.getName()));
 
             cache.get(key1);
 
+            expData.clear();
+
             log.info("Do tx put.");
 
             cache.put(key1, key1);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index 6295a4d..682965a 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -145,6 +145,13 @@ public class IgniteCacheTestSuite4 extends TestSuite {
 
         suite.addTestSuite(IgniteCacheManyClientsTest.class);
 
+        suite.addTestSuite(CacheReadThroughRestartSelfTest.class);
+        suite.addTestSuite(CacheReadThroughReplicatedRestartSelfTest.class);
+        suite.addTestSuite(CacheReadThroughReplicatedAtomicRestartSelfTest.class);
+        suite.addTestSuite(CacheReadThroughLocalRestartSelfTest.class);
+        suite.addTestSuite(CacheReadThroughLocalAtomicRestartSelfTest.class);
+        suite.addTestSuite(CacheReadThroughAtomicRestartSelfTest.class);
+
         return suite;
     }
 }


[19/50] incubator-ignite git commit: # ignite-sprint-7 disabled hanging test

Posted by ag...@apache.org.
# ignite-sprint-7 disabled hanging test


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

Branch: refs/heads/ignite-621
Commit: c7ba1541959b78451e81fb701550894b09fe6eb9
Parents: 1c66078
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 23 12:55:17 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 23 12:55:17 2015 +0300

----------------------------------------------------------------------
 .../replicated/GridCacheReplicatedFailoverSelfTest.java         | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c7ba1541/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFailoverSelfTest.java
index 3461dd4..4269ea6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFailoverSelfTest.java
@@ -28,6 +28,11 @@ import static org.apache.ignite.cache.CacheMode.*;
  */
 public class GridCacheReplicatedFailoverSelfTest extends GridCacheAbstractFailoverTxSelfTest {
     /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-882");
+    }
+
+    /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return REPLICATED;
     }


[27/50] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-1045

Posted by ag...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-1045


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

Branch: refs/heads/ignite-621
Commit: a2141c6a7012f10e8f8003160752047046ffdf0d
Parents: a6cda33 359b431
Author: sboikov <se...@inria.fr>
Authored: Tue Jun 23 22:14:51 2015 +0300
Committer: sboikov <se...@inria.fr>
Committed: Tue Jun 23 22:14:51 2015 +0300

----------------------------------------------------------------------
 .../configuration/IgniteReflectionFactory.java  |  81 ++++++-
 .../distributed/dht/GridDhtLocalPartition.java  |   3 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   9 +-
 .../processors/hadoop/HadoopJobInfo.java        |   4 +-
 .../hadoop/counter/HadoopCounterWriter.java     |   5 +-
 .../testframework/junits/GridAbstractTest.java  |   2 +-
 modules/hadoop/pom.xml                          |  78 ------
 .../fs/IgniteHadoopFileSystemCounterWriter.java |   9 +-
 .../processors/hadoop/HadoopClassLoader.java    |  29 +++
 .../processors/hadoop/HadoopDefaultJobInfo.java |  27 +--
 .../internal/processors/hadoop/HadoopUtils.java | 237 ------------------
 .../hadoop/SecondaryFileSystemProvider.java     |   3 +-
 .../hadoop/fs/HadoopFileSystemCacheUtils.java   | 241 +++++++++++++++++++
 .../hadoop/fs/HadoopFileSystemsUtils.java       |  11 +
 .../hadoop/fs/HadoopLazyConcurrentMap.java      |   5 +
 .../hadoop/jobtracker/HadoopJobTracker.java     |  25 +-
 .../child/HadoopChildProcessRunner.java         |   3 +-
 .../processors/hadoop/v2/HadoopV2Job.java       |  84 ++++++-
 .../hadoop/v2/HadoopV2JobResourceManager.java   |  22 +-
 .../hadoop/v2/HadoopV2TaskContext.java          |  37 ++-
 .../apache/ignite/igfs/IgfsEventsTestSuite.java |   5 +-
 .../processors/hadoop/HadoopMapReduceTest.java  |   2 +-
 .../processors/hadoop/HadoopTasksV1Test.java    |   7 +-
 .../processors/hadoop/HadoopTasksV2Test.java    |   7 +-
 .../processors/hadoop/HadoopV2JobSelfTest.java  |   6 +-
 .../collections/HadoopAbstractMapTest.java      |   3 +-
 .../testsuites/IgniteHadoopTestSuite.java       |   2 +-
 .../IgniteIgfsLinuxAndMacOSTestSuite.java       |   3 +-
 28 files changed, 561 insertions(+), 389 deletions(-)
----------------------------------------------------------------------



[48/50] incubator-ignite git commit: # ignite-sprint-7: update sprint version at git-patch-prop.sh

Posted by ag...@apache.org.
# ignite-sprint-7: update sprint version at git-patch-prop.sh


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

Branch: refs/heads/ignite-621
Commit: 3e8ddb47dcef245596e9b7028a3f37a43e568185
Parents: e1c49b7
Author: ashutak <as...@gridgain.com>
Authored: Thu Jun 25 21:04:11 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Thu Jun 25 21:04:11 2015 +0300

----------------------------------------------------------------------
 scripts/git-patch-prop.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3e8ddb47/scripts/git-patch-prop.sh
----------------------------------------------------------------------
diff --git a/scripts/git-patch-prop.sh b/scripts/git-patch-prop.sh
index c856fb4..16f907e 100644
--- a/scripts/git-patch-prop.sh
+++ b/scripts/git-patch-prop.sh
@@ -19,6 +19,6 @@
 #
 # Git patch-file maker/applier properties.
 #
-IGNITE_DEFAULT_BRANCH='ignite-sprint-5'
+IGNITE_DEFAULT_BRANCH='ignite-sprint-7'
 
 PATCHES_HOME=${IGNITE_HOME}


[42/50] incubator-ignite git commit: # ignite-917: review 2.

Posted by ag...@apache.org.
# ignite-917: review 2.


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

Branch: refs/heads/ignite-621
Commit: 401aa1223f99838bd8c841045f7c8614f4113c52
Parents: 532a98f
Author: ashutak <as...@gridgain.com>
Authored: Thu Jun 25 13:09:45 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Thu Jun 25 13:09:45 2015 +0300

----------------------------------------------------------------------
 .../src/main/java/org/apache/ignite/cluster/ClusterNode.java    | 4 ++--
 .../java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/401aa122/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
index bb792d5..62c1deb 100644
--- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
@@ -188,8 +188,8 @@ public interface ClusterNode {
      * <p>
      * If {@link IgniteConfiguration#getLocalHost()} value is {@code null} then local wildcard address will be used,
      * and this method returns host names of all addresses of that node.
-     * <p/
-     * Note: the loopback address will skipped from the results.
+     * <p>
+     * Note: the loopback address will be omitted in results.
      *
      * @return Collection of host names.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/401aa122/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 8be9f31..9b7f392 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -65,10 +65,11 @@ public class IgniteBasicTestSuite extends TestSuite {
         suite.addTest(IgniteStreamSelfTestSuite.suite());
 
         suite.addTest(new TestSuite(GridSelfTest.class));
-        GridTestUtils.addTestIfNeeded(suite, GridProjectionSelfTest.class, ignoredTests);
         suite.addTest(new TestSuite(ClusterForHostsSelfTest.class));
-        GridTestUtils.addTestIfNeeded(suite, GridMessagingSelfTest.class, ignoredTests);
         suite.addTest(new TestSuite(IgniteMessagingWithClientTest.class));
+        
+        GridTestUtils.addTestIfNeeded(suite, GridProjectionSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, GridMessagingSelfTest.class, ignoredTests);
         GridTestUtils.addTestIfNeeded(suite, GridMessagingNoPeerClassLoadingSelfTest.class, ignoredTests);
 
         if (U.isLinux() || U.isMacOs())


[24/50] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-1048' into ignite-sprint-7

Posted by ag...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-1048' into ignite-sprint-7


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

Branch: refs/heads/ignite-621
Commit: dfe95bdfb98663134809ca456f63e100fb1e7c26
Parents: 2bb6e0f a2d2c9b
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 23 16:38:38 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 23 16:38:38 2015 +0300

----------------------------------------------------------------------
 .../cache/distributed/dht/GridDhtLocalPartition.java        | 3 ++-
 .../cache/distributed/dht/atomic/GridDhtAtomicCache.java    | 9 ++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[03/50] incubator-ignite git commit: #IGNITE-GG-10449 Fixed license.

Posted by ag...@apache.org.
#IGNITE-GG-10449 Fixed license.


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

Branch: refs/heads/ignite-621
Commit: 7c1ecc3dd2e240e48958c8fb1fd812a6df7e92b5
Parents: a3d8e60
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Mon Jun 22 13:15:55 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Mon Jun 22 13:15:55 2015 +0300

----------------------------------------------------------------------
 .../cache/IgniteCacheOffheapEvictQueryTest.java    | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c1ecc3d/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
index 72bfcaa..45d744e 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.*;


[23/50] incubator-ignite git commit: [IGNITE-980]: added missing file

Posted by ag...@apache.org.
[IGNITE-980]: added missing file


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

Branch: refs/heads/ignite-621
Commit: 2bb6e0f887c99de70e479c48992f5a0a86cbf5ec
Parents: 3b49184
Author: iveselovskiy <iv...@gridgain.com>
Authored: Tue Jun 23 15:02:23 2015 +0300
Committer: iveselovskiy <iv...@gridgain.com>
Committed: Tue Jun 23 15:02:23 2015 +0300

----------------------------------------------------------------------
 .../hadoop/fs/HadoopFileSystemCacheUtils.java   | 241 +++++++++++++++++++
 1 file changed, 241 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2bb6e0f8/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopFileSystemCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopFileSystemCacheUtils.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopFileSystemCacheUtils.java
new file mode 100644
index 0000000..f94b932
--- /dev/null
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopFileSystemCacheUtils.java
@@ -0,0 +1,241 @@
+/*
+ * 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.hadoop.fs;
+
+import org.apache.hadoop.conf.*;
+import org.apache.hadoop.fs.*;
+import org.apache.hadoop.mapreduce.*;
+import org.apache.ignite.*;
+import org.apache.ignite.hadoop.fs.v1.*;
+import org.apache.ignite.internal.util.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+import java.net.*;
+
+/**
+ * File system cache utility methods used by Map-Reduce tasks and jobs.
+ */
+public class HadoopFileSystemCacheUtils {
+    /**
+     * A common static factory method. Creates new HadoopLazyConcurrentMap.
+     * @return a new HadoopLazyConcurrentMap.
+     */
+    public static HadoopLazyConcurrentMap<FsCacheKey, FileSystem> createHadoopLazyConcurrentMap() {
+        return new HadoopLazyConcurrentMap<>(
+            new HadoopLazyConcurrentMap.ValueFactory<FsCacheKey, FileSystem>() {
+                @Override public FileSystem createValue(FsCacheKey key) {
+                    try {
+                        assert key != null;
+
+                        // Explicitly disable FileSystem caching:
+                        URI uri = key.uri();
+
+                        String scheme = uri.getScheme();
+
+                        // Copy the configuration to avoid altering the external object.
+                        Configuration cfg = new Configuration(key.configuration());
+
+                        String prop = HadoopFileSystemsUtils.disableFsCachePropertyName(scheme);
+
+                        cfg.setBoolean(prop, true);
+
+                        return FileSystem.get(uri, cfg, key.user());
+                    }
+                    catch (IOException | InterruptedException ioe) {
+                        throw new IgniteException(ioe);
+                    }
+                }
+            }
+        );
+    }
+
+    /**
+     * Gets non-null user name as per the Hadoop viewpoint.
+     * @param cfg the Hadoop job configuration, may be null.
+     * @return the user name, never null.
+     */
+    private static String getMrHadoopUser(Configuration cfg) throws IOException {
+        String user = cfg.get(MRJobConfig.USER_NAME);
+
+        if (user == null)
+            user = IgniteHadoopFileSystem.getFsHadoopUser();
+
+        return user;
+    }
+
+    /**
+     * Common method to get the V1 file system in MapRed engine.
+     * It gets the filesystem for the user specified in the
+     * configuration with {@link MRJobConfig#USER_NAME} property.
+     * The file systems are created and cached in the given map upon first request.
+     *
+     * @param uri The file system uri.
+     * @param cfg The configuration.
+     * @param map The caching map.
+     * @return The file system.
+     * @throws IOException On error.
+     */
+    public static FileSystem fileSystemForMrUserWithCaching(@Nullable URI uri, Configuration cfg,
+        HadoopLazyConcurrentMap<FsCacheKey, FileSystem> map)
+            throws IOException {
+        assert map != null;
+        assert cfg != null;
+
+        final String usr = getMrHadoopUser(cfg);
+
+        assert usr != null;
+
+        if (uri == null)
+            uri = FileSystem.getDefaultUri(cfg);
+
+        final FileSystem fs;
+
+        try {
+            final FsCacheKey key = new FsCacheKey(uri, usr, cfg);
+
+            fs = map.getOrCreate(key);
+        }
+        catch (IgniteException ie) {
+            throw new IOException(ie);
+        }
+
+        assert fs != null;
+        assert !(fs instanceof IgniteHadoopFileSystem) || F.eq(usr, ((IgniteHadoopFileSystem)fs).user());
+
+        return fs;
+    }
+
+    /**
+     * Takes Fs URI using logic similar to that used in FileSystem#get(1,2,3).
+     * @param uri0 The uri.
+     * @param cfg The cfg.
+     * @return Correct URI.
+     */
+    private static URI fixUri(URI uri0, Configuration cfg) {
+        if (uri0 == null)
+            return FileSystem.getDefaultUri(cfg);
+
+        String scheme = uri0.getScheme();
+        String authority = uri0.getAuthority();
+
+        if (authority == null) {
+            URI dfltUri = FileSystem.getDefaultUri(cfg);
+
+            if (scheme == null || (scheme.equals(dfltUri.getScheme()) && dfltUri.getAuthority() != null))
+                return dfltUri;
+        }
+
+        return uri0;
+    }
+
+    /**
+     * Note that configuration is not a part of the key.
+     * It is used solely to initialize the first instance
+     * that is created for the key.
+     */
+    public static final class FsCacheKey {
+        /** */
+        private final URI uri;
+
+        /** */
+        private final String usr;
+
+        /** */
+        private final String equalityKey;
+
+        /** */
+        private final Configuration cfg;
+
+        /**
+         * Constructor
+         */
+        public FsCacheKey(URI uri, String usr, Configuration cfg) {
+            assert uri != null;
+            assert usr != null;
+            assert cfg != null;
+
+            this.uri = fixUri(uri, cfg);
+            this.usr = usr;
+            this.cfg = cfg;
+
+            this.equalityKey = createEqualityKey();
+        }
+
+        /**
+         * Creates String key used for equality and hashing.
+         */
+        private String createEqualityKey() {
+            GridStringBuilder sb = new GridStringBuilder("(").a(usr).a(")@");
+
+            if (uri.getScheme() != null)
+                sb.a(uri.getScheme().toLowerCase());
+
+            sb.a("://");
+
+            if (uri.getAuthority() != null)
+                sb.a(uri.getAuthority().toLowerCase());
+
+            return sb.toString();
+        }
+
+        /**
+         * The URI.
+         */
+        public URI uri() {
+            return uri;
+        }
+
+        /**
+         * The User.
+         */
+        public String user() {
+            return usr;
+        }
+
+        /**
+         * The Configuration.
+         */
+        public Configuration configuration() {
+            return cfg;
+        }
+
+        /** {@inheritDoc} */
+        @SuppressWarnings("SimplifiableIfStatement")
+        @Override public boolean equals(Object obj) {
+            if (obj == this)
+                return true;
+
+            if (obj == null || getClass() != obj.getClass())
+                return false;
+
+            return equalityKey.equals(((FsCacheKey)obj).equalityKey);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return equalityKey.hashCode();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return equalityKey;
+        }
+    }
+}


[38/50] incubator-ignite git commit: #IGNITE-GG-10440 Fixed review notes.

Posted by ag...@apache.org.
#IGNITE-GG-10440 Fixed review notes.


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

Branch: refs/heads/ignite-621
Commit: c5287050d47e97a8ae817879d7d7f2797f164348
Parents: b2e8fea
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu Jun 25 10:39:01 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Jun 25 10:39:01 2015 +0300

----------------------------------------------------------------------
 .../main/java/org/apache/ignite/internal/GridKernalContextImpl.java | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5287050/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index 737dbee..65107a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@ -790,6 +790,7 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
 
         if (cls.equals(IgniteCacheObjectProcessor.class))
             return (T)new IgniteCacheObjectProcessorImpl(this);
+
         if (cls.equals(CacheConflictResolutionManager.class))
             return null;
 


[02/50] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-6' into ignite-sprint-6

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-6' into ignite-sprint-6


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

Branch: refs/heads/ignite-621
Commit: a4ce455bbff7dbbf1084a7e9cc60424b53396471
Parents: 7c70267 6f5e676
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Mon Jun 22 12:50:21 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Jun 22 12:50:21 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ClientImpl.java    | 45 ++++++++++----------
 1 file changed, 23 insertions(+), 22 deletions(-)
----------------------------------------------------------------------



[36/50] incubator-ignite git commit: Merge branch 'ignite-sprint-7' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-621

Posted by ag...@apache.org.
Merge branch 'ignite-sprint-7' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-621


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

Branch: refs/heads/ignite-621
Commit: a9d0662b1d084a770b1364295c48aa61e2c0dcfa
Parents: a4e31be b29ff1c
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Wed Jun 24 15:25:40 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Wed Jun 24 15:25:40 2015 -0700

----------------------------------------------------------------------
 examples/pom.xml                                |   2 +-
 modules/aop/pom.xml                             |   2 +-
 modules/aws/pom.xml                             |   2 +-
 modules/clients/pom.xml                         |   2 +-
 modules/cloud/pom.xml                           |   2 +-
 modules/codegen/pom.xml                         |   2 +-
 modules/core/pom.xml                            |   2 +-
 .../configuration/IgniteReflectionFactory.java  |  81 +++-
 .../processors/cache/GridCacheContext.java      |   2 +-
 .../distributed/dht/GridDhtLocalPartition.java  |   3 +-
 .../distributed/dht/GridDhtLockFuture.java      |   2 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   9 +-
 .../GridDhtPartitionsExchangeFuture.java        |  46 +-
 .../datastructures/DataStructuresProcessor.java |  64 +--
 .../processors/hadoop/HadoopJobInfo.java        |   4 +-
 .../hadoop/counter/HadoopCounterWriter.java     |   5 +-
 .../processors/task/GridTaskProcessor.java      |  23 +-
 .../core/src/main/resources/ignite.properties   |   2 +-
 .../GridTaskFailoverAffinityRunTest.java        | 170 +++++++
 .../CacheReadThroughAtomicRestartSelfTest.java  |  32 ++
 ...heReadThroughLocalAtomicRestartSelfTest.java |  32 ++
 .../CacheReadThroughLocalRestartSelfTest.java   |  32 ++
 ...dThroughReplicatedAtomicRestartSelfTest.java |  32 ++
 ...cheReadThroughReplicatedRestartSelfTest.java |  32 ++
 .../cache/CacheReadThroughRestartSelfTest.java  | 133 ++++++
 .../cache/GridCacheAbstractSelfTest.java        |   2 +-
 ...eDynamicCacheStartNoExchangeTimeoutTest.java | 466 +++++++++++++++++++
 .../cache/IgniteDynamicCacheStartSelfTest.java  |  37 ++
 ...GridCacheQueueMultiNodeAbstractSelfTest.java |   4 +-
 .../GridCacheSetAbstractSelfTest.java           |  22 +-
 .../IgniteDataStructureWithJobTest.java         | 111 +++++
 ...ridCachePartitionNotLoadedEventSelfTest.java |  82 ++++
 .../distributed/IgniteCache150ClientsTest.java  | 189 ++++++++
 ...teCacheClientNodePartitionsExchangeTest.java |   1 +
 .../distributed/IgniteCacheManyClientsTest.java |   2 +
 .../IgniteCacheTxMessageRecoveryTest.java       |   5 +
 ...idCacheNearOnlyMultiNodeFullApiSelfTest.java |   5 -
 ...achePartitionedMultiNodeFullApiSelfTest.java |  49 +-
 .../GridCacheReplicatedFailoverSelfTest.java    |   5 +
 .../IgniteCacheTxStoreSessionTest.java          |   4 +
 .../testframework/junits/GridAbstractTest.java  |   2 +-
 .../IgniteCacheDataStructuresSelfTestSuite.java |   1 +
 .../ignite/testsuites/IgniteCacheTestSuite.java |   4 +-
 .../testsuites/IgniteCacheTestSuite4.java       |   8 +
 .../testsuites/IgniteClientTestSuite.java       |  38 ++
 .../testsuites/IgniteComputeGridTestSuite.java  |   1 +
 .../ignite/util/TestTcpCommunicationSpi.java    |  21 +
 modules/extdata/p2p/pom.xml                     |   2 +-
 modules/extdata/uri/pom.xml                     |   2 +-
 modules/gce/pom.xml                             |   2 +-
 modules/geospatial/pom.xml                      |   2 +-
 modules/hadoop/pom.xml                          |  80 +---
 .../fs/IgniteHadoopFileSystemCounterWriter.java |   9 +-
 .../processors/hadoop/HadoopClassLoader.java    |  29 ++
 .../processors/hadoop/HadoopDefaultJobInfo.java |  27 +-
 .../internal/processors/hadoop/HadoopUtils.java | 237 ----------
 .../hadoop/SecondaryFileSystemProvider.java     |   3 +-
 .../hadoop/fs/HadoopFileSystemCacheUtils.java   | 241 ++++++++++
 .../hadoop/fs/HadoopFileSystemsUtils.java       |  11 +
 .../hadoop/fs/HadoopLazyConcurrentMap.java      |   5 +
 .../hadoop/jobtracker/HadoopJobTracker.java     |  25 +-
 .../child/HadoopChildProcessRunner.java         |   3 +-
 .../processors/hadoop/v2/HadoopV2Job.java       |  84 +++-
 .../hadoop/v2/HadoopV2JobResourceManager.java   |  22 +-
 .../hadoop/v2/HadoopV2TaskContext.java          |  37 +-
 .../apache/ignite/igfs/IgfsEventsTestSuite.java |   5 +-
 .../processors/hadoop/HadoopMapReduceTest.java  |   2 +-
 .../processors/hadoop/HadoopTasksV1Test.java    |   7 +-
 .../processors/hadoop/HadoopTasksV2Test.java    |   7 +-
 .../processors/hadoop/HadoopV2JobSelfTest.java  |   6 +-
 .../collections/HadoopAbstractMapTest.java      |   3 +-
 .../testsuites/IgniteHadoopTestSuite.java       |   2 +-
 .../IgniteIgfsLinuxAndMacOSTestSuite.java       |   3 +-
 modules/hibernate/pom.xml                       |   2 +-
 modules/indexing/pom.xml                        |   2 +-
 ...QueryOffheapEvictsMultiThreadedSelfTest.java |   5 +
 .../IgniteCacheQuerySelfTestSuite.java          |   2 +-
 modules/jcl/pom.xml                             |   2 +-
 modules/jta/pom.xml                             |   2 +-
 modules/log4j/pom.xml                           |   2 +-
 modules/mesos/pom.xml                           |   2 +-
 modules/rest-http/pom.xml                       |   2 +-
 modules/scalar-2.10/pom.xml                     |   2 +-
 modules/scalar/pom.xml                          |   2 +-
 modules/schedule/pom.xml                        |   2 +-
 modules/schema-import/pom.xml                   |   2 +-
 modules/slf4j/pom.xml                           |   2 +-
 modules/spark-2.10/pom.xml                      |   2 +-
 modules/spark/pom.xml                           |   2 +-
 modules/spring/pom.xml                          |   2 +-
 modules/ssh/pom.xml                             |   2 +-
 modules/tools/pom.xml                           |   2 +-
 modules/urideploy/pom.xml                       |   2 +-
 modules/visor-console-2.10/pom.xml              |   2 +-
 modules/visor-console/pom.xml                   |   2 +-
 modules/visor-plugins/pom.xml                   |   2 +-
 modules/web/pom.xml                             |   2 +-
 .../IgniteWebSessionSelfTestSuite.java          |   2 +-
 modules/yardstick/pom.xml                       |   2 +-
 pom.xml                                         |   2 +-
 100 files changed, 2169 insertions(+), 521 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a9d0662b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------


[22/50] incubator-ignite git commit: [IGNITE-980]: Investigate if we should close() the FileSystems in MapRed task implementations.

Posted by ag...@apache.org.
[IGNITE-980]: Investigate if we should close() the FileSystems in MapRed task implementations.


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

Branch: refs/heads/ignite-621
Commit: 3b49184b48ca55d5cf4dcdd7485ab8aba1bb9cff
Parents: 36433bc
Author: iveselovskiy <iv...@gridgain.com>
Authored: Tue Jun 23 13:58:06 2015 +0300
Committer: iveselovskiy <iv...@gridgain.com>
Committed: Tue Jun 23 13:58:06 2015 +0300

----------------------------------------------------------------------
 .../processors/hadoop/HadoopJobInfo.java        |   4 +-
 .../hadoop/counter/HadoopCounterWriter.java     |   5 +-
 modules/hadoop/pom.xml                          |  78 ------
 .../fs/IgniteHadoopFileSystemCounterWriter.java |   9 +-
 .../processors/hadoop/HadoopClassLoader.java    |  29 +++
 .../processors/hadoop/HadoopDefaultJobInfo.java |  27 +--
 .../internal/processors/hadoop/HadoopUtils.java | 237 -------------------
 .../hadoop/SecondaryFileSystemProvider.java     |   3 +-
 .../hadoop/fs/HadoopFileSystemsUtils.java       |  11 +
 .../hadoop/fs/HadoopLazyConcurrentMap.java      |   5 +
 .../hadoop/jobtracker/HadoopJobTracker.java     |  25 +-
 .../child/HadoopChildProcessRunner.java         |   3 +-
 .../processors/hadoop/v2/HadoopV2Job.java       |  84 ++++++-
 .../hadoop/v2/HadoopV2JobResourceManager.java   |  22 +-
 .../hadoop/v2/HadoopV2TaskContext.java          |  37 ++-
 .../apache/ignite/igfs/IgfsEventsTestSuite.java |   5 +-
 .../processors/hadoop/HadoopMapReduceTest.java  |   2 +-
 .../processors/hadoop/HadoopTasksV1Test.java    |   7 +-
 .../processors/hadoop/HadoopTasksV2Test.java    |   7 +-
 .../processors/hadoop/HadoopV2JobSelfTest.java  |   6 +-
 .../collections/HadoopAbstractMapTest.java      |   3 +-
 .../testsuites/IgniteHadoopTestSuite.java       |   2 +-
 .../IgniteIgfsLinuxAndMacOSTestSuite.java       |   3 +-
 23 files changed, 237 insertions(+), 377 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobInfo.java
index 51faf5d..d3735d5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopJobInfo.java
@@ -55,12 +55,14 @@ public interface HadoopJobInfo extends Serializable {
      * This method will be called once for the same ID on one node, though it can be called on the same host
      * multiple times from different processes (in case of multiple nodes on the same host or external execution).
      *
+     * @param jobCls The job class.
      * @param jobId Job ID.
      * @param log Logger.
      * @return Job.
      * @throws IgniteCheckedException If failed.
      */
-    HadoopJob createJob(HadoopJobId jobId, IgniteLogger log) throws IgniteCheckedException;
+    public HadoopJob createJob(Class<? extends HadoopJob> jobCls,
+        HadoopJobId jobId, IgniteLogger log) throws IgniteCheckedException;
 
     /**
      * @return Number of reducers configured for job.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/counter/HadoopCounterWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/counter/HadoopCounterWriter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/counter/HadoopCounterWriter.java
index ce67c57..f21a1e6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/counter/HadoopCounterWriter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/counter/HadoopCounterWriter.java
@@ -28,10 +28,9 @@ public interface HadoopCounterWriter {
     /**
      * Writes counters of given job to some statistics storage.
      *
-     * @param jobInfo Job info.
-     * @param jobId Job id.
+     * @param job The job.
      * @param cntrs Counters.
      * @throws IgniteCheckedException If failed.
      */
-    public void write(HadoopJobInfo jobInfo, HadoopJobId jobId, HadoopCounters cntrs) throws IgniteCheckedException;
+    public void write(HadoopJob job, HadoopCounters cntrs) throws IgniteCheckedException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hadoop/pom.xml b/modules/hadoop/pom.xml
index 637f097..e300ba0 100644
--- a/modules/hadoop/pom.xml
+++ b/modules/hadoop/pom.xml
@@ -143,84 +143,6 @@
                 <artifactId>maven-surefire-plugin</artifactId>
                 <version>2.17</version>
                 <configuration>
-                    <classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.apache.hadoop:hadoop-annotations</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.apache.hadoop:hadoop-auth</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>commons-codec:commons-codec</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.apache.httpcomponents:httpclient</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.apache.httpcomponents:httpcore</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.apache.hadoop:hadoop-common</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>com.google.guava:guava</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>commons-cli:commons-cli</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.apache.commons:commons-math3</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>xmlenc:xmlenc</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>commons-httpclient:commons-httpclient</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>commons-net:commons-net</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>javax.servlet:servlet-api</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.mortbay.jetty:jetty</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.mortbay.jetty:jetty-util</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>com.sun.jersey:jersey-core</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>com.sun.jersey:jersey-json</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.codehaus.jettison:jettison</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>com.sun.xml.bind:jaxb-impl</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.codehaus.jackson:jackson-jaxrs</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.codehaus.jackson:jackson-xc</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>com.sun.jersey:jersey-server</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>asm:asm</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>tomcat:jasper-compiler</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>tomcat:jasper-runtime</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>javax.servlet.jsp:jsp-api</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>commons-el:commons-el</classpathDependencyExcludes>
-                        <!--<classpathDependencyExcludes>commons-logging:commons-logging</classpathDependencyExcludes>-->
-                        <classpathDependencyExcludes>net.java.dev.jets3t:jets3t</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>com.jamesmurty.utils:java-xmlbuilder</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.codehaus.jackson:jackson-core-asl</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.codehaus.jackson:jackson-mapper-asl
-                        </classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.apache.avro:avro</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>com.thoughtworks.paranamer:paranamer</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.xerial.snappy:snappy-java</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>com.google.protobuf:protobuf-java</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>com.jcraft:jsch</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>com.google.code.findbugs:jsr305</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.apache.zookeeper:zookeeper</classpathDependencyExcludes>
-                        <!--<classpathDependencyExcludes>org.apache.commons:commons-compress</classpathDependencyExcludes>-->
-                        <classpathDependencyExcludes>org.tukaani:xz</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.apache.hadoop:hadoop-hdfs</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>commons-daemon:commons-daemon</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.apache.hadoop:hadoop-mapreduce-client-common
-                        </classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.apache.hadoop:hadoop-yarn-common</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.apache.hadoop:hadoop-yarn-api</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>javax.xml.bind:jaxb-api</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>javax.xml.stream:stax-api</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>javax.activation:activation</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>com.google.inject:guice</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>javax.inject:javax.inject</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>com.sun.jersey.contribs:jersey-guice</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.apache.hadoop:hadoop-yarn-client</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>com.sun.jersey:jersey-client</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.apache.hadoop:hadoop-yarn-server-common
-                        </classpathDependencyExcludes>
-                        <classpathDependencyExcludes>com.google.inject.extensions:guice-servlet
-                        </classpathDependencyExcludes>
-                        <classpathDependencyExcludes>io.netty:netty</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.apache.hadoop:hadoop-mapreduce-client-core
-                        </classpathDependencyExcludes>
-                        <!--<classpathDependencyExcludes>commons-beanutils:commons-beanutils</classpathDependencyExcludes>-->
-                        <classpathDependencyExcludes>org.hamcrest:hamcrest-core</classpathDependencyExcludes>
-                        <!--<classpathDependencyExcludes>commons-collections:commons-collections</classpathDependencyExcludes>-->
-                        <classpathDependencyExcludes>org.eclipse.jetty:jetty-http</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>commons-io:commons-io</classpathDependencyExcludes>
-                        <!--<classpathDependencyExcludes>commons-lang:commons-lang</classpathDependencyExcludes>-->
-                        <classpathDependencyExcludes>commons-configuration:commons-configuration
-                        </classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.eclipse.jetty:jetty-server</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.eclipse.jetty:jetty-util</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>org.eclipse.jetty:jetty-io</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>aopalliance:aopalliance</classpathDependencyExcludes>
-                        <classpathDependencyExcludes>com.beust:jcommander</classpathDependencyExcludes>
-                    </classpathDependencyExcludes>
                 </configuration>
             </plugin>
         </plugins>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopFileSystemCounterWriter.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopFileSystemCounterWriter.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopFileSystemCounterWriter.java
index d910507..f76b354 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopFileSystemCounterWriter.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopFileSystemCounterWriter.java
@@ -25,6 +25,7 @@ import org.apache.ignite.*;
 import org.apache.ignite.internal.processors.hadoop.*;
 import org.apache.ignite.internal.processors.hadoop.counter.*;
 import org.apache.ignite.internal.processors.hadoop.counter.HadoopCounters;
+import org.apache.ignite.internal.processors.hadoop.v2.*;
 import org.apache.ignite.internal.processors.igfs.*;
 import org.apache.ignite.internal.util.typedef.*;
 
@@ -48,11 +49,15 @@ public class IgniteHadoopFileSystemCounterWriter implements HadoopCounterWriter
     private static final String DEFAULT_COUNTER_WRITER_DIR = "/user/" + USER_MACRO;
 
     /** {@inheritDoc} */
-    @Override public void write(HadoopJobInfo jobInfo, HadoopJobId jobId, HadoopCounters cntrs)
+    @Override public void write(HadoopJob job, HadoopCounters cntrs)
         throws IgniteCheckedException {
 
         Configuration hadoopCfg = HadoopUtils.safeCreateConfiguration();
 
+        final HadoopJobInfo jobInfo = job.info();
+
+        final HadoopJobId jobId = job.id();
+
         for (Map.Entry<String, String> e : ((HadoopDefaultJobInfo)jobInfo).properties().entrySet())
             hadoopCfg.set(e.getKey(), e.getValue());
 
@@ -72,7 +77,7 @@ public class IgniteHadoopFileSystemCounterWriter implements HadoopCounterWriter
         try {
             hadoopCfg.set(MRJobConfig.USER_NAME, user);
 
-            FileSystem fs = HadoopUtils.fileSystemForMrUser(jobStatPath.toUri(), hadoopCfg, true);
+            FileSystem fs = ((HadoopV2Job)job).fileSystem(jobStatPath.toUri(), hadoopCfg);
 
             fs.mkdirs(jobStatPath);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
index eb98ff9..0988fe0 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
@@ -67,6 +67,28 @@ public class HadoopClassLoader extends URLClassLoader {
     private final String name;
 
     /**
+     * Gets name for Job class loader. The name is specific for local node id.
+     * @param locNodeId The local node id.
+     * @return The class loader name.
+     */
+    public static String nameForJob(UUID locNodeId) {
+        return "hadoop-job-node-" + locNodeId.toString();
+    }
+
+    /**
+     * Gets name for the task class loader. Task class loader
+     * @param info The task info.
+     * @param prefix Get only prefix (without task type and number)
+     * @return The class loader name.
+     */
+    public static String nameForTask(HadoopTaskInfo info, boolean prefix) {
+        if (prefix)
+            return "hadoop-task-" + info.jobId() + "-";
+        else
+            return "hadoop-task-" + info.jobId() + "-" + info.type() + "-" + info.taskNumber();
+    }
+
+    /**
      * @param urls Urls.
      */
     public HadoopClassLoader(URL[] urls, String name) {
@@ -568,4 +590,11 @@ public class HadoopClassLoader extends URLClassLoader {
     @Override public String toString() {
         return S.toString(HadoopClassLoader.class, this);
     }
+
+    /**
+     * Getter for name field.
+     */
+    public String name() {
+        return name;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultJobInfo.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultJobInfo.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultJobInfo.java
index 2e855d0..95e03c8 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultJobInfo.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultJobInfo.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.hadoop;
 
 import org.apache.ignite.*;
-import org.apache.ignite.internal.processors.hadoop.v2.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.jetbrains.annotations.*;
 
@@ -48,9 +47,6 @@ public class HadoopDefaultJobInfo implements HadoopJobInfo, Externalizable {
     /** User name. */
     private String user;
 
-    /** */
-    private static volatile Class<?> jobCls;
-
     /**
      * Default constructor required by {@link Externalizable}.
      */
@@ -82,24 +78,15 @@ public class HadoopDefaultJobInfo implements HadoopJobInfo, Externalizable {
     }
 
     /** {@inheritDoc} */
-    @Override public HadoopJob createJob(HadoopJobId jobId, IgniteLogger log) throws IgniteCheckedException {
-        try {
-            Class<?> jobCls0 = jobCls;
+    @Override public HadoopJob createJob(Class<? extends HadoopJob> jobCls,
+            HadoopJobId jobId, IgniteLogger log) throws IgniteCheckedException {
+        assert jobCls != null;
 
-            if (jobCls0 == null) { // It is enough to have only one class loader with only Hadoop classes.
-                synchronized (HadoopDefaultJobInfo.class) {
-                    if ((jobCls0 = jobCls) == null) {
-                        HadoopClassLoader ldr = new HadoopClassLoader(null, "hadoop-job");
-
-                        jobCls = jobCls0 = ldr.loadClass(HadoopV2Job.class.getName());
-                    }
-                }
-            }
-
-            Constructor<?> constructor = jobCls0.getConstructor(HadoopJobId.class, HadoopDefaultJobInfo.class,
-                IgniteLogger.class);
+        try {
+            Constructor<? extends HadoopJob> constructor = jobCls.getConstructor(HadoopJobId.class,
+                HadoopDefaultJobInfo.class, IgniteLogger.class);
 
-            return (HadoopJob)constructor.newInstance(jobId, this, log);
+            return constructor.newInstance(jobId, this, log);
         }
         // NB: java.lang.NoClassDefFoundError may be thrown from Class#getConstructor() call.
         catch (Throwable t) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopUtils.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopUtils.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopUtils.java
index 68a9ef6..f87e610 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopUtils.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopUtils.java
@@ -26,16 +26,10 @@ import org.apache.hadoop.mapreduce.JobPriority;
 import org.apache.hadoop.mapreduce.JobStatus;
 import org.apache.hadoop.mapreduce.*;
 import org.apache.ignite.*;
-import org.apache.ignite.hadoop.fs.v1.*;
-import org.apache.ignite.internal.processors.hadoop.fs.*;
 import org.apache.ignite.internal.processors.hadoop.v2.*;
-import org.apache.ignite.internal.util.*;
-import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
-import org.jetbrains.annotations.*;
 
 import java.io.*;
-import java.net.*;
 import java.util.*;
 
 /**
@@ -63,34 +57,6 @@ public class HadoopUtils {
     /** Old reducer class attribute. */
     private static final String OLD_REDUCE_CLASS_ATTR = "mapred.reducer.class";
 
-    /** Lazy per-user cache for the file systems. It is cleared and nulled in #close() method. */
-    private static final HadoopLazyConcurrentMap<FsCacheKey, FileSystem> fileSysLazyMap = new HadoopLazyConcurrentMap<>(
-        new HadoopLazyConcurrentMap.ValueFactory<FsCacheKey, FileSystem>() {
-            @Override public FileSystem createValue(FsCacheKey key) {
-                try {
-                    assert key != null;
-
-                    // Explicitly disable FileSystem caching:
-                    URI uri = key.uri();
-
-                    String scheme = uri.getScheme();
-
-                    // Copy the configuration to avoid altering the external object.
-                    Configuration cfg = new Configuration(key.configuration());
-
-                    String prop = HadoopUtils.disableFsCachePropertyName(scheme);
-
-                    cfg.setBoolean(prop, true);
-
-                    return FileSystem.get(uri, cfg, key.user());
-                }
-                catch (IOException | InterruptedException ioe) {
-                    throw new IgniteException(ioe);
-                }
-            }
-        }
-    );
-
     /**
      * Constructor.
      */
@@ -378,207 +344,4 @@ public class HadoopUtils {
         }
     }
 
-    /**
-     * Gets non-null user name as per the Hadoop viewpoint.
-     * @param cfg the Hadoop job configuration, may be null.
-     * @return the user name, never null.
-     */
-    private static String getMrHadoopUser(Configuration cfg) throws IOException {
-        String user = cfg.get(MRJobConfig.USER_NAME);
-
-        if (user == null)
-            user = IgniteHadoopFileSystem.getFsHadoopUser();
-
-        return user;
-    }
-
-    /**
-     * Common method to get the V1 file system in MapRed engine.
-     * It creates the filesystem for the user specified in the
-     * configuration with {@link MRJobConfig#USER_NAME} property.
-     * @param uri the file system uri.
-     * @param cfg the configuration.
-     * @return the file system
-     * @throws IOException
-     */
-    public static FileSystem fileSystemForMrUser(@Nullable URI uri, Configuration cfg, boolean doCacheFs) throws IOException {
-        final String usr = getMrHadoopUser(cfg);
-
-        assert usr != null;
-
-        if (uri == null)
-            uri = FileSystem.getDefaultUri(cfg);
-
-        final FileSystem fs;
-
-        if (doCacheFs) {
-            try {
-                fs = getWithCaching(uri, cfg, usr);
-            }
-            catch (IgniteException ie) {
-                throw new IOException(ie);
-            }
-        }
-        else {
-            try {
-                fs = FileSystem.get(uri, cfg, usr);
-            }
-            catch (InterruptedException ie) {
-                Thread.currentThread().interrupt();
-
-                throw new IOException(ie);
-            }
-        }
-
-        assert fs != null;
-        assert !(fs instanceof IgniteHadoopFileSystem) || F.eq(usr, ((IgniteHadoopFileSystem)fs).user());
-
-        return fs;
-    }
-
-    /**
-     * Note that configuration is not a part of the key.
-     * It is used solely to initialize the first instance
-     * that is created for the key.
-     */
-    public static final class FsCacheKey {
-        /** */
-        private final URI uri;
-
-        /** */
-        private final String usr;
-
-        /** */
-        private final String equalityKey;
-
-        /** */
-        private final Configuration cfg;
-
-        /**
-         * Constructor
-         */
-        public FsCacheKey(URI uri, String usr, Configuration cfg) {
-            assert uri != null;
-            assert usr != null;
-            assert cfg != null;
-
-            this.uri = fixUri(uri, cfg);
-            this.usr = usr;
-            this.cfg = cfg;
-
-            this.equalityKey = createEqualityKey();
-        }
-
-        /**
-         * Creates String key used for equality and hashing.
-         */
-        private String createEqualityKey() {
-            GridStringBuilder sb = new GridStringBuilder("(").a(usr).a(")@");
-
-            if (uri.getScheme() != null)
-                sb.a(uri.getScheme().toLowerCase());
-
-            sb.a("://");
-
-            if (uri.getAuthority() != null)
-                sb.a(uri.getAuthority().toLowerCase());
-
-            return sb.toString();
-        }
-
-        /**
-         * The URI.
-         */
-        public URI uri() {
-            return uri;
-        }
-
-        /**
-         * The User.
-         */
-        public String user() {
-            return usr;
-        }
-
-        /**
-         * The Configuration.
-         */
-        public Configuration configuration() {
-            return cfg;
-        }
-
-        /** {@inheritDoc} */
-        @SuppressWarnings("SimplifiableIfStatement")
-        @Override public boolean equals(Object obj) {
-            if (obj == this)
-                return true;
-
-            if (obj == null || getClass() != obj.getClass())
-                return false;
-
-            return equalityKey.equals(((FsCacheKey)obj).equalityKey);
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return equalityKey.hashCode();
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return equalityKey;
-        }
-    }
-
-    /**
-     * Gets FileSystem caching it in static Ignite cache. The cache is a singleton
-     * for each class loader.
-     *
-     * <p/>Note that the file systems in the cache are keyed by a triplet {scheme, authority, user}.
-     * The Configuration is not a part of the key. This means that for the given key file system is
-     * initialized only once with the Configuration passed in upon the file system creation.
-     *
-     * @param uri The file system URI.
-     * @param cfg The configuration.
-     * @param usr The user to create file system for.
-     * @return The file system: either created, or taken from the cache.
-     */
-    private static FileSystem getWithCaching(URI uri, Configuration cfg, String usr) {
-        FsCacheKey key = new FsCacheKey(uri, usr, cfg);
-
-        return fileSysLazyMap.getOrCreate(key);
-    }
-
-    /**
-     * Gets the property name to disable file system cache.
-     * @param scheme The file system URI scheme.
-     * @return The property name. If scheme is null,
-     * returns "fs.null.impl.disable.cache".
-     */
-    public static String disableFsCachePropertyName(@Nullable String scheme) {
-        return String.format("fs.%s.impl.disable.cache", scheme);
-    }
-
-    /**
-     * Takes Fs URI using logic similar to that used in FileSystem#get(1,2,3).
-     * @param uri0 The uri.
-     * @param cfg The cfg.
-     * @return Correct URI.
-     */
-    public static URI fixUri(URI uri0, Configuration cfg) {
-        if (uri0 == null)
-            return FileSystem.getDefaultUri(cfg);
-
-        String scheme = uri0.getScheme();
-        String authority = uri0.getAuthority();
-
-        if (authority == null) {
-            URI dfltUri = FileSystem.getDefaultUri(cfg);
-
-            if (scheme == null || (scheme.equals(dfltUri.getScheme()) && dfltUri.getAuthority() != null))
-                return dfltUri;
-        }
-
-        return uri0;
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/SecondaryFileSystemProvider.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/SecondaryFileSystemProvider.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/SecondaryFileSystemProvider.java
index dd679de..ef04b0f 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/SecondaryFileSystemProvider.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/SecondaryFileSystemProvider.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.hadoop;
 import org.apache.hadoop.conf.*;
 import org.apache.hadoop.fs.*;
 import org.apache.hadoop.security.*;
+import org.apache.ignite.internal.processors.hadoop.fs.*;
 import org.apache.ignite.internal.processors.igfs.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
@@ -76,7 +77,7 @@ public class SecondaryFileSystemProvider {
         }
 
         // Disable caching:
-        String prop = HadoopUtils.disableFsCachePropertyName(uri.getScheme());
+        String prop = HadoopFileSystemsUtils.disableFsCachePropertyName(uri.getScheme());
 
         cfg.setBoolean(prop, true);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopFileSystemsUtils.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopFileSystemsUtils.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopFileSystemsUtils.java
index d90bc28..382bbd0 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopFileSystemsUtils.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopFileSystemsUtils.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.hadoop.fs;
 
 import org.apache.hadoop.conf.*;
 import org.apache.hadoop.fs.*;
+import org.jetbrains.annotations.*;
 
 /**
  * Utilities for configuring file systems to support the separate working directory per each thread.
@@ -37,4 +38,14 @@ public class HadoopFileSystemsUtils {
         cfg.set("fs.AbstractFileSystem." + FsConstants.LOCAL_FS_URI.getScheme() + ".impl",
                 HadoopLocalFileSystemV2.class.getName());
     }
+
+    /**
+     * Gets the property name to disable file system cache.
+     * @param scheme The file system URI scheme.
+     * @return The property name. If scheme is null,
+     * returns "fs.null.impl.disable.cache".
+     */
+    public static String disableFsCachePropertyName(@Nullable String scheme) {
+        return String.format("fs.%s.impl.disable.cache", scheme);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopLazyConcurrentMap.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopLazyConcurrentMap.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopLazyConcurrentMap.java
index 71b38c4..c7565d3 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopLazyConcurrentMap.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/HadoopLazyConcurrentMap.java
@@ -51,6 +51,8 @@ public class HadoopLazyConcurrentMap<K, V extends Closeable> {
      */
     public HadoopLazyConcurrentMap(ValueFactory<K, V> factory) {
         this.factory = factory;
+
+        assert getClass().getClassLoader() == Ignite.class.getClassLoader();
     }
 
     /**
@@ -105,6 +107,9 @@ public class HadoopLazyConcurrentMap<K, V extends Closeable> {
         closeLock.writeLock().lock();
 
         try {
+            if (closed)
+                return;
+
             closed = true;
 
             Exception err = null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java
index 2f07817..194ae33 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java
@@ -28,6 +28,7 @@ import org.apache.ignite.internal.processors.hadoop.counter.*;
 import org.apache.ignite.internal.processors.hadoop.counter.HadoopCounters;
 import org.apache.ignite.internal.processors.hadoop.taskexecutor.*;
 import org.apache.ignite.internal.processors.hadoop.taskexecutor.external.*;
+import org.apache.ignite.internal.processors.hadoop.v2.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.future.*;
 import org.apache.ignite.internal.util.typedef.*;
@@ -82,6 +83,9 @@ public class HadoopJobTracker extends HadoopComponent {
     /** Component busy lock. */
     private GridSpinReadWriteLock busyLock;
 
+    /** Class to create HadoopJob instances from. */
+    private Class<? extends HadoopJob> jobCls;
+
     /** Closure to check result of async transform of system cache. */
     private final IgniteInClosure<IgniteInternalFuture<?>> failsLog = new CI1<IgniteInternalFuture<?>>() {
         @Override public void apply(IgniteInternalFuture<?> gridFut) {
@@ -95,12 +99,27 @@ public class HadoopJobTracker extends HadoopComponent {
     };
 
     /** {@inheritDoc} */
-    @Override public void start(HadoopContext ctx) throws IgniteCheckedException {
+    @SuppressWarnings("unchecked")
+    @Override public void start(final HadoopContext ctx) throws IgniteCheckedException {
         super.start(ctx);
 
         busyLock = new GridSpinReadWriteLock();
 
         evtProcSvc = Executors.newFixedThreadPool(1);
+
+        UUID nodeId = ctx.localNodeId();
+
+        assert jobCls == null;
+
+        HadoopClassLoader ldr = new HadoopClassLoader(null, HadoopClassLoader.nameForJob(nodeId));
+
+        try {
+            jobCls = (Class<HadoopV2Job>)ldr.loadClass(HadoopV2Job.class.getName());
+        }
+        catch (Exception ioe) {
+            throw new IgniteCheckedException("Failed to load job class [class="
+                + HadoopV2Job.class.getName() + ']', ioe);
+        }
     }
 
     /**
@@ -838,7 +857,7 @@ public class HadoopJobTracker extends HadoopComponent {
 
                             HadoopCounters cntrs = meta.counters();
 
-                            writer.write(job.info(), jobId, cntrs);
+                            writer.write(job, cntrs);
                         }
                     }
                     catch (Exception e) {
@@ -986,7 +1005,7 @@ public class HadoopJobTracker extends HadoopComponent {
                 jobInfo = meta.jobInfo();
             }
 
-            job = jobInfo.createJob(jobId, log);
+            job = jobInfo.createJob(jobCls, jobId, log);
 
             job.initialize(false, ctx.localNodeId());
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/child/HadoopChildProcessRunner.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/child/HadoopChildProcessRunner.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/child/HadoopChildProcessRunner.java
index 040552a..b0b0b8c 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/child/HadoopChildProcessRunner.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/child/HadoopChildProcessRunner.java
@@ -25,6 +25,7 @@ import org.apache.ignite.internal.processors.hadoop.shuffle.*;
 import org.apache.ignite.internal.processors.hadoop.taskexecutor.*;
 import org.apache.ignite.internal.processors.hadoop.taskexecutor.external.*;
 import org.apache.ignite.internal.processors.hadoop.taskexecutor.external.communication.*;
+import org.apache.ignite.internal.processors.hadoop.v2.*;
 import org.apache.ignite.internal.util.future.*;
 import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.offheap.unsafe.*;
@@ -115,7 +116,7 @@ public class HadoopChildProcessRunner {
 
                 assert job == null;
 
-                job = req.jobInfo().createJob(req.jobId(), log);
+                job = req.jobInfo().createJob(HadoopV2Job.class, req.jobId(), log);
 
                 job.initialize(true, nodeDesc.processId());
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2Job.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2Job.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2Job.java
index d754039..33a218d 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2Job.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2Job.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.hadoop.v2;
 
+import org.apache.hadoop.conf.*;
 import org.apache.hadoop.fs.*;
 import org.apache.hadoop.io.*;
 import org.apache.hadoop.mapred.*;
@@ -30,15 +31,18 @@ import org.apache.ignite.internal.processors.hadoop.v1.*;
 import org.apache.ignite.internal.util.future.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
+import org.jetbrains.annotations.*;
 import org.jsr166.*;
 
 import java.io.*;
 import java.lang.reflect.*;
+import java.net.*;
 import java.util.*;
 import java.util.Queue;
 import java.util.concurrent.*;
 
 import static org.apache.ignite.internal.processors.hadoop.HadoopUtils.*;
+import static org.apache.ignite.internal.processors.hadoop.fs.HadoopFileSystemCacheUtils.*;
 
 /**
  * Hadoop job implementation for v2 API.
@@ -70,7 +74,10 @@ public class HadoopV2Job implements HadoopJob {
     private final Queue<Class<? extends HadoopTaskContext>> taskCtxClsPool = new ConcurrentLinkedQueue<>();
 
     /** All created contexts. */
-    private final Queue<Class<?>> fullCtxClsQueue = new ConcurrentLinkedDeque<>();
+    private final Queue<Class<? extends HadoopTaskContext>> fullCtxClsQueue = new ConcurrentLinkedDeque<>();
+
+    /** File system cache map. */
+    private final HadoopLazyConcurrentMap<FsCacheKey, FileSystem> fsMap = createHadoopLazyConcurrentMap();
 
     /** Local node ID */
     private volatile UUID locNodeId;
@@ -103,7 +110,7 @@ public class HadoopV2Job implements HadoopJob {
 
         jobCtx = new JobContextImpl(jobConf, hadoopJobID);
 
-        rsrcMgr = new HadoopV2JobResourceManager(jobId, jobCtx, log);
+        rsrcMgr = new HadoopV2JobResourceManager(jobId, jobCtx, log, this);
     }
 
     /** {@inheritDoc} */
@@ -134,7 +141,7 @@ public class HadoopV2Job implements HadoopJob {
             Path jobDir = new Path(jobDirPath);
 
             try {
-                FileSystem fs = fileSystemForMrUser(jobDir.toUri(), jobConf, true);
+                FileSystem fs = fileSystem(jobDir.toUri(), jobConf);
 
                 JobSplit.TaskSplitMetaInfo[] metaInfos = SplitMetaInfoReader.readSplitMetaInfo(hadoopJobID, fs, jobConf,
                     jobDir);
@@ -180,6 +187,7 @@ public class HadoopV2Job implements HadoopJob {
     }
 
     /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
     @Override public HadoopTaskContext getTaskContext(HadoopTaskInfo info) throws IgniteCheckedException {
         T2<HadoopTaskType, Integer> locTaskId = new T2<>(info.type(),  info.taskNumber());
 
@@ -201,7 +209,7 @@ public class HadoopV2Job implements HadoopJob {
                 // Note that the classloader identified by the task it was initially created for,
                 // but later it may be reused for other tasks.
                 HadoopClassLoader ldr = new HadoopClassLoader(rsrcMgr.classPath(),
-                    "hadoop-task-" + info.jobId() + "-" + info.type() + "-" + info.taskNumber());
+                    HadoopClassLoader.nameForTask(info, false));
 
                 cls = (Class<? extends HadoopTaskContext>)ldr.loadClass(HadoopV2TaskContext.class.getName());
 
@@ -243,8 +251,13 @@ public class HadoopV2Job implements HadoopJob {
 
     /** {@inheritDoc} */
     @Override public void initialize(boolean external, UUID locNodeId) throws IgniteCheckedException {
+        assert locNodeId != null;
+
         this.locNodeId = locNodeId;
 
+        assert ((HadoopClassLoader)getClass().getClassLoader()).name()
+            .equals(HadoopClassLoader.nameForJob(this.locNodeId));
+
         Thread.currentThread().setContextClassLoader(jobConf.getClassLoader());
 
         try {
@@ -274,17 +287,26 @@ public class HadoopV2Job implements HadoopJob {
             // Stop the daemon threads that have been created
             // with the task class loaders:
             while (true) {
-                Class<?> cls = fullCtxClsQueue.poll();
+                Class<? extends HadoopTaskContext> cls = fullCtxClsQueue.poll();
 
                 if (cls == null)
                     break;
 
                 try {
-                    Class<?> daemonCls = cls.getClassLoader().loadClass(HadoopClassLoader.HADOOP_DAEMON_CLASS_NAME);
+                    final ClassLoader ldr = cls.getClassLoader();
 
-                    Method m = daemonCls.getMethod("dequeueAndStopAll");
+                    try {
+                        // Stop Hadoop daemons for this *task*:
+                        stopHadoopFsDaemons(ldr);
+                    }
+                    catch (Exception e) {
+                        if (err == null)
+                            err = e;
+                    }
 
-                    m.invoke(null);
+                    // Also close all the FileSystems cached in
+                    // HadoopLazyConcurrentMap for this *task* class loader:
+                    closeCachedTaskFileSystems(ldr);
                 }
                 catch (Throwable e) {
                     if (err == null)
@@ -297,11 +319,46 @@ public class HadoopV2Job implements HadoopJob {
 
             assert fullCtxClsQueue.isEmpty();
 
+            try {
+                // Close all cached file systems for this *Job*:
+                fsMap.close();
+            }
+            catch (Exception e) {
+                if (err == null)
+                    err = e;
+            }
+
             if (err != null)
                 throw U.cast(err);
         }
     }
 
+    /**
+     * Stops Hadoop Fs daemon threads.
+     * @param ldr The task ClassLoader to stop the daemons for.
+     * @throws Exception On error.
+     */
+    private void stopHadoopFsDaemons(ClassLoader ldr) throws Exception {
+        Class<?> daemonCls = ldr.loadClass(HadoopClassLoader.HADOOP_DAEMON_CLASS_NAME);
+
+        Method m = daemonCls.getMethod("dequeueAndStopAll");
+
+        m.invoke(null);
+    }
+
+    /**
+     * Closes all the file systems user by task
+     * @param ldr The task class loader.
+     * @throws Exception On error.
+     */
+    private void closeCachedTaskFileSystems(ClassLoader ldr) throws Exception {
+        Class<?> clazz = ldr.loadClass(HadoopV2TaskContext.class.getName());
+
+        Method m = clazz.getMethod("close");
+
+        m.invoke(null);
+    }
+
     /** {@inheritDoc} */
     @Override public void prepareTaskEnvironment(HadoopTaskInfo info) throws IgniteCheckedException {
         rsrcMgr.prepareTaskWorkDir(taskLocalDir(locNodeId, info));
@@ -331,4 +388,15 @@ public class HadoopV2Job implements HadoopJob {
     public JobConf jobConf() {
         return jobConf;
     }
+
+    /**
+     * Gets file system for this job.
+     * @param uri The uri.
+     * @param cfg The configuration.
+     * @return The file system.
+     * @throws IOException On error.
+     */
+    public FileSystem fileSystem(@Nullable URI uri, Configuration cfg) throws IOException {
+        return fileSystemForMrUserWithCaching(uri, cfg, fsMap);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2JobResourceManager.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2JobResourceManager.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2JobResourceManager.java
index 2f64e77..912cc3f 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2JobResourceManager.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2JobResourceManager.java
@@ -39,9 +39,10 @@ import java.util.*;
  * Provides all resources are needed to the job execution. Downloads the main jar, the configuration and additional
  * files are needed to be placed on local files system.
  */
-public class HadoopV2JobResourceManager {
+class HadoopV2JobResourceManager {
     /** File type Fs disable caching property name. */
-    private static final String FILE_DISABLE_CACHING_PROPERTY_NAME = HadoopUtils.disableFsCachePropertyName("file");
+    private static final String FILE_DISABLE_CACHING_PROPERTY_NAME =
+        HadoopFileSystemsUtils.disableFsCachePropertyName("file");
 
     /** Hadoop job context. */
     private final JobContextImpl ctx;
@@ -61,16 +62,20 @@ public class HadoopV2JobResourceManager {
     /** Staging directory to delivery job jar and config to the work nodes. */
     private Path stagingDir;
 
+    /** The job. */
+    private final HadoopV2Job job;
+
     /**
      * Creates new instance.
      * @param jobId Job ID.
      * @param ctx Hadoop job context.
      * @param log Logger.
      */
-    public HadoopV2JobResourceManager(HadoopJobId jobId, JobContextImpl ctx, IgniteLogger log) {
+    public HadoopV2JobResourceManager(HadoopJobId jobId, JobContextImpl ctx, IgniteLogger log, HadoopV2Job job) {
         this.jobId = jobId;
         this.ctx = ctx;
         this.log = log.getLogger(HadoopV2JobResourceManager.class);
+        this.job = job;
     }
 
     /**
@@ -115,7 +120,7 @@ public class HadoopV2JobResourceManager {
                 stagingDir = new Path(new URI(mrDir));
 
                 if (download) {
-                    FileSystem fs = HadoopUtils.fileSystemForMrUser(stagingDir.toUri(), cfg, true);
+                    FileSystem fs = job.fileSystem(stagingDir.toUri(), cfg);
 
                     if (!fs.exists(stagingDir))
                         throw new IgniteCheckedException("Failed to find map-reduce submission " +
@@ -210,7 +215,7 @@ public class HadoopV2JobResourceManager {
 
             FileSystem dstFs = FileSystem.getLocal(cfg);
 
-            FileSystem srcFs = HadoopUtils.fileSystemForMrUser(srcPath.toUri(), cfg, true);
+            FileSystem srcFs = job.fileSystem(srcPath.toUri(), cfg);
 
             if (extract) {
                 File archivesPath = new File(jobLocDir.getAbsolutePath(), ".cached-archives");
@@ -292,8 +297,11 @@ public class HadoopV2JobResourceManager {
      */
     public void cleanupStagingDirectory() {
         try {
-            if (stagingDir != null)
-                HadoopUtils.fileSystemForMrUser(stagingDir.toUri(), ctx.getJobConf(), true).delete(stagingDir, true);
+            if (stagingDir != null) {
+                FileSystem fs = job.fileSystem(stagingDir.toUri(), ctx.getJobConf());
+
+                fs.delete(stagingDir, true);
+            }
         }
         catch (Exception e) {
             log.error("Failed to remove job staging directory [path=" + stagingDir + ", jobId=" + jobId + ']' , e);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2TaskContext.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2TaskContext.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2TaskContext.java
index e89feba..6eff475 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2TaskContext.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2TaskContext.java
@@ -33,6 +33,7 @@ import org.apache.ignite.*;
 import org.apache.ignite.internal.processors.hadoop.*;
 import org.apache.ignite.internal.processors.hadoop.counter.*;
 import org.apache.ignite.internal.processors.hadoop.counter.HadoopCounters;
+import org.apache.ignite.internal.processors.hadoop.fs.*;
 import org.apache.ignite.internal.processors.hadoop.v1.*;
 import org.apache.ignite.internal.processors.igfs.*;
 import org.apache.ignite.internal.util.typedef.*;
@@ -44,6 +45,7 @@ import java.security.*;
 import java.util.*;
 import java.util.concurrent.*;
 
+import static org.apache.ignite.internal.processors.hadoop.fs.HadoopFileSystemCacheUtils.*;
 import static org.apache.ignite.internal.processors.hadoop.fs.HadoopParameters.*;
 import static org.apache.ignite.internal.processors.hadoop.HadoopUtils.*;
 
@@ -54,6 +56,22 @@ public class HadoopV2TaskContext extends HadoopTaskContext {
     /** */
     private static final boolean COMBINE_KEY_GROUPING_SUPPORTED;
 
+    /** Lazy per-user file system cache used by the Hadoop task. */
+    private static final HadoopLazyConcurrentMap<FsCacheKey, FileSystem> fsMap
+        = createHadoopLazyConcurrentMap();
+
+    /**
+     * This method is called with reflection upon Job finish with class loader of each task.
+     * This will clean up all the Fs created for specific task.
+     * Each class loader sees uses its own instance of <code>fsMap<code/> since the class loaders
+     * are different.
+     *
+     * @throws IgniteCheckedException On error.
+     */
+    public static void close() throws IgniteCheckedException {
+        fsMap.close();
+    }
+
     /**
      * Check for combiner grouping support (available since Hadoop 2.3).
      */
@@ -91,7 +109,7 @@ public class HadoopV2TaskContext extends HadoopTaskContext {
     private volatile HadoopTask task;
 
     /** Local node ID */
-    private UUID locNodeId;
+    private final UUID locNodeId;
 
     /** Counters for task. */
     private final HadoopCounters cntrs = new HadoopCountersImpl();
@@ -423,7 +441,22 @@ public class HadoopV2TaskContext extends HadoopTaskContext {
     private Object readExternalSplit(HadoopExternalSplit split) throws IgniteCheckedException {
         Path jobDir = new Path(jobConf().get(MRJobConfig.MAPREDUCE_JOB_DIR));
 
-        try (FileSystem fs = fileSystemForMrUser(jobDir.toUri(), jobConf(), false);
+        FileSystem fs;
+
+        try {
+            // This assertion uses .startsWith() instead of .equals() because task class loaders may
+            // be reused between tasks of the same job.
+            assert ((HadoopClassLoader)getClass().getClassLoader()).name()
+                .startsWith(HadoopClassLoader.nameForTask(taskInfo(), true));
+
+            // We also cache Fs there, all them will be cleared explicitly upon the Job end.
+            fs = fileSystemForMrUserWithCaching(jobDir.toUri(), jobConf(), fsMap);
+        }
+        catch (IOException e) {
+            throw new IgniteCheckedException(e);
+        }
+
+        try (
             FSDataInputStream in = fs.open(JobSubmissionFiles.getJobSplitFile(jobDir))) {
 
             in.seek(split.offset());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/test/java/org/apache/ignite/igfs/IgfsEventsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/igfs/IgfsEventsTestSuite.java b/modules/hadoop/src/test/java/org/apache/ignite/igfs/IgfsEventsTestSuite.java
index fb21e2d..e7c7f8a 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/igfs/IgfsEventsTestSuite.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/igfs/IgfsEventsTestSuite.java
@@ -21,7 +21,6 @@ import junit.framework.*;
 import org.apache.ignite.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.hadoop.fs.*;
-import org.apache.ignite.internal.processors.hadoop.*;
 import org.apache.ignite.internal.util.ipc.shmem.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.jetbrains.annotations.*;
@@ -38,7 +37,7 @@ public class IgfsEventsTestSuite extends TestSuite {
      * @throws Exception Thrown in case of the failure.
      */
     public static TestSuite suite() throws Exception {
-        HadoopClassLoader ldr = new HadoopClassLoader(null, "test");
+        ClassLoader ldr = TestSuite.class.getClassLoader();
 
         TestSuite suite = new TestSuite("Ignite FS Events Test Suite");
 
@@ -58,7 +57,7 @@ public class IgfsEventsTestSuite extends TestSuite {
      * @throws Exception Thrown in case of the failure.
      */
     public static TestSuite suiteNoarchOnly() throws Exception {
-        HadoopClassLoader ldr = new HadoopClassLoader(null, "test");
+        ClassLoader ldr = TestSuite.class.getClassLoader();
 
         TestSuite suite = new TestSuite("Ignite IGFS Events Test Suite Noarch Only");
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReduceTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReduceTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReduceTest.java
index 66c14b5..da6f9c7 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReduceTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReduceTest.java
@@ -272,7 +272,7 @@ public class HadoopMapReduceTest extends HadoopAbstractWordCountTest {
             @Override public boolean apply() {
                 return igfs.exists(statPath);
             }
-        }, 10000);
+        }, 20_000);
 
         final long apiEvtCnt0 = apiEvtCnt;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopTasksV1Test.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopTasksV1Test.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopTasksV1Test.java
index 48e83cc..f59be19 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopTasksV1Test.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopTasksV1Test.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.hadoop;
 
 import org.apache.hadoop.mapred.*;
 import org.apache.ignite.internal.processors.hadoop.examples.*;
+import org.apache.ignite.internal.processors.hadoop.v2.*;
 
 import java.io.*;
 import java.util.*;
@@ -44,9 +45,11 @@ public class HadoopTasksV1Test extends HadoopTasksAllVersionsTest {
 
         HadoopDefaultJobInfo jobInfo = createJobInfo(jobConf);
 
-        HadoopJobId jobId = new HadoopJobId(new UUID(0, 0), 0);
+        UUID uuid = new UUID(0, 0);
 
-        return jobInfo.createJob(jobId, log);
+        HadoopJobId jobId = new HadoopJobId(uuid, 0);
+
+        return jobInfo.createJob(HadoopV2Job.class, jobId, log);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopTasksV2Test.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopTasksV2Test.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopTasksV2Test.java
index e73fae3..1570807 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopTasksV2Test.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopTasksV2Test.java
@@ -24,6 +24,7 @@ import org.apache.hadoop.mapreduce.*;
 import org.apache.hadoop.mapreduce.lib.input.*;
 import org.apache.hadoop.mapreduce.lib.output.*;
 import org.apache.ignite.internal.processors.hadoop.examples.*;
+import org.apache.ignite.internal.processors.hadoop.v2.*;
 
 import java.util.*;
 
@@ -62,9 +63,11 @@ public class HadoopTasksV2Test extends HadoopTasksAllVersionsTest {
 
         HadoopDefaultJobInfo jobInfo = createJobInfo(hadoopJob.getConfiguration());
 
-        HadoopJobId jobId = new HadoopJobId(new UUID(0, 0), 0);
+        UUID uuid = new UUID(0, 0);
 
-        return jobInfo.createJob(jobId, log);
+        HadoopJobId jobId = new HadoopJobId(uuid, 0);
+
+        return jobInfo.createJob(HadoopV2Job.class, jobId, log);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopV2JobSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopV2JobSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopV2JobSelfTest.java
index f3b9307..b8f62e6 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopV2JobSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopV2JobSelfTest.java
@@ -68,9 +68,11 @@ public class HadoopV2JobSelfTest extends HadoopAbstractSelfTest {
 
         HadoopDefaultJobInfo info = createJobInfo(cfg);
 
-        HadoopJobId id = new HadoopJobId(UUID.randomUUID(), 1);
+        final UUID uuid = UUID.randomUUID();
 
-        HadoopJob job = info.createJob(id, log);
+        HadoopJobId id = new HadoopJobId(uuid, 1);
+
+        HadoopJob job = info.createJob(HadoopV2Job.class, id, log);
 
         HadoopTaskContext taskCtx = job.getTaskContext(new HadoopTaskInfo(HadoopTaskType.MAP, null, 0, 0,
             null));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/shuffle/collections/HadoopAbstractMapTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/shuffle/collections/HadoopAbstractMapTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/shuffle/collections/HadoopAbstractMapTest.java
index 9395c5e..b5e2ab5 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/shuffle/collections/HadoopAbstractMapTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/shuffle/collections/HadoopAbstractMapTest.java
@@ -136,7 +136,8 @@ public abstract class HadoopAbstractMapTest extends GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
-        @Override public HadoopJob createJob(HadoopJobId jobId, IgniteLogger log) throws IgniteCheckedException {
+        @Override public HadoopJob createJob(Class<? extends HadoopJob> jobCls,
+                HadoopJobId jobId, IgniteLogger log) throws IgniteCheckedException {
             assert false;
 
             return null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java b/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java
index 4be5d72..2ab3e8c 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java
@@ -50,7 +50,7 @@ public class IgniteHadoopTestSuite extends TestSuite {
         downloadHadoop();
         downloadHive();
 
-        HadoopClassLoader ldr = new HadoopClassLoader(null, "test");
+        final ClassLoader ldr = TestSuite.class.getClassLoader();
 
         TestSuite suite = new TestSuite("Ignite Hadoop MR Test Suite");
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3b49184b/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteIgfsLinuxAndMacOSTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteIgfsLinuxAndMacOSTestSuite.java b/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteIgfsLinuxAndMacOSTestSuite.java
index 8982d83..22beea6 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteIgfsLinuxAndMacOSTestSuite.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteIgfsLinuxAndMacOSTestSuite.java
@@ -20,7 +20,6 @@ package org.apache.ignite.testsuites;
 import junit.framework.*;
 import org.apache.ignite.igfs.*;
 import org.apache.ignite.internal.processors.igfs.*;
-import org.apache.ignite.internal.processors.hadoop.*;
 
 import static org.apache.ignite.testsuites.IgniteHadoopTestSuite.*;
 
@@ -36,7 +35,7 @@ public class IgniteIgfsLinuxAndMacOSTestSuite extends TestSuite {
     public static TestSuite suite() throws Exception {
         downloadHadoop();
 
-        HadoopClassLoader ldr = new HadoopClassLoader(null, "test");
+        ClassLoader ldr = TestSuite.class.getClassLoader();
 
         TestSuite suite = new TestSuite("Ignite IGFS Test Suite For Linux And Mac OS");
 


[21/50] incubator-ignite git commit: # ignite-sprint-7 minor

Posted by ag...@apache.org.
# ignite-sprint-7 minor


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

Branch: refs/heads/ignite-621
Commit: 36433bc3d96a67975ce99a0774e608ccf50c2a21
Parents: c7ba154
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 23 13:31:34 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 23 13:31:34 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/testframework/junits/GridAbstractTest.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/36433bc3/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index 9c42920..9a63b3a 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -606,7 +606,7 @@ public abstract class GridAbstractTest extends TestCase {
                 Thread.sleep(1000);
         }
 
-        throw new Exception("Failed to wait for proper topology.");
+        throw new Exception("Failed to wait for proper topology: " + cnt);
     }
 
     /** */


[10/50] incubator-ignite git commit: Merge branch 'ignite-sprint-7' into ignite-gg-10440

Posted by ag...@apache.org.
Merge branch 'ignite-sprint-7' into ignite-gg-10440


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

Branch: refs/heads/ignite-621
Commit: 76f53772fb5b99c5dd126814764ae468d3b31be0
Parents: 0906292 5d8e404
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Mon Jun 22 17:07:28 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Mon Jun 22 17:07:28 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------



[34/50] incubator-ignite git commit: # ignite-917

Posted by ag...@apache.org.
# ignite-917


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

Branch: refs/heads/ignite-621
Commit: 2ad4fe121184ce3bb38e899df826208da83c5b0d
Parents: b29ff1c
Author: Atri <at...@gmail.com>
Authored: Wed Jun 10 15:47:00 2015 +0530
Committer: ashutak <as...@gridgain.com>
Committed: Wed Jun 24 16:15:58 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/cluster/ClusterGroup.java |  9 +++++
 .../internal/cluster/ClusterGroupAdapter.java   | 42 ++++++++++++++++++++
 .../cluster/IgniteClusterAsyncImpl.java         |  5 +++
 .../ignite/internal/GridProjectionSelfTest.java | 19 +++++++++
 4 files changed, 75 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2ad4fe12/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java
index 06854d4..2f43fc6 100644
--- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java
+++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java
@@ -193,6 +193,15 @@ public interface ClusterGroup {
     public ClusterGroup forHost(ClusterNode node);
 
     /**
+     * Gets cluster group consisting from the nodes running on the hosts specified.
+     *
+     * @param host Host name to get nodes to put in cluster
+     * @param hosts Host names to get nodes to put in cluster.
+     * @return Cluster group for nodes residing on the hosts specified.
+     */
+    public ClusterGroup forHost(String host, String... hosts);
+
+    /**
      * Gets a cluster group consisting from the daemon nodes.
      * <p>
      * Daemon nodes are the usual grid nodes that participate in topology but not

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2ad4fe12/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
index bb82c3b..1831321 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
@@ -577,6 +577,11 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
     }
 
     /** {@inheritDoc} */
+    @Override public final ClusterGroup forHost(String host, String... hosts) {
+	return forPredicate(new HostsFilter(host, hosts));
+    }
+
+    /** {@inheritDoc} */
     @Override public final ClusterGroup forDaemons() {
         return forPredicate(new DaemonFilter());
     }
@@ -762,6 +767,43 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
 
     /**
      */
+    private static class HostsFilter implements IgnitePredicate<ClusterNode> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** Hosts Names. */
+        private final HashSet hashInputHostNames;
+
+        /**
+         * @param name  First host name.
+	  * @param names Host names
+         */
+        private HostsFilter(String name, String[] names) {
+            hashInputHostNames = new HashSet();
+
+            if (name != null)
+                hashInputHostNames.add(name);
+
+            if (names != null && (names.length > 0)) {
+                for (String currentInputHostName : names)
+                    hashInputHostNames.add(currentInputHostName);
+	    }
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean apply(ClusterNode n) {
+	    for (String currentHostName : n.hostNames()) {
+                if (hashInputHostNames.contains(currentHostName)) {
+		    return true;
+		}
+            }
+
+            return false;
+        }
+    }
+
+    /**
+     */
     private static class DaemonFilter implements IgnitePredicate<ClusterNode> {
         /** */
         private static final long serialVersionUID = 0L;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2ad4fe12/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
index 7f67b4f..ca6cf32 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
@@ -232,6 +232,11 @@ public class IgniteClusterAsyncImpl extends AsyncSupportAdapter<IgniteCluster>
     }
 
     /** {@inheritDoc} */
+    @Override public ClusterGroup forHost(String host, String... hosts) {
+	return cluster.forHost(host, hosts);
+    }
+
+    /** {@inheritDoc} */
     @Override public ClusterGroup forDaemons() {
         return cluster.forDaemons();
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2ad4fe12/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
index 9fbad80..bd625d9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
@@ -248,4 +248,23 @@ public class GridProjectionSelfTest extends GridProjectionAbstractTest {
 
         return even ? cnt - 1 : cnt - 2;
     }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testForHost() throws Exception {
+        Collection<ClusterNode> allNodes = ignite.cluster().nodes();
+        ClusterNode localNode = ignite.cluster().localNode();
+        ArrayList<String> inputHostNames = new ArrayList<String> ();
+
+        for (ClusterNode currentNode : allNodes)
+            Collections.addAll(inputHostNames, currentNode.hostNames().toArray(new String[0]));
+
+        String[] inputHostNamesArray = inputHostNames.toArray(new String[] {});
+        ClusterGroup resultGroup = ignite.cluster().forHost(inputHostNamesArray[0], inputHostNamesArray);
+	ClusterGroup nullTestGroup = ignite.cluster().forHost(null, null);
+
+        assert((resultGroup.node(localNode.id())) != null);
+        assert((nullTestGroup.node(localNode.id())) == null);
+    }
 }


[33/50] incubator-ignite git commit: # ignite-sprint-7 added test

Posted by ag...@apache.org.
# ignite-sprint-7 added test


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

Branch: refs/heads/ignite-621
Commit: b29ff1cb24ff344fb624a803cf210cae9f9001d2
Parents: c270bd8
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jun 24 15:40:56 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 24 15:40:56 2015 +0300

----------------------------------------------------------------------
 .../cache/IgniteDynamicCacheStartSelfTest.java  | 37 ++++++++++++++++++++
 1 file changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b29ff1cb/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
index 7905565..9c483ef 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
@@ -1105,4 +1105,41 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
 
         fut.get();
     }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testStartStopSameCacheMultinode() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-993");
+
+        final AtomicInteger idx = new AtomicInteger();
+
+        IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                int node = idx.getAndIncrement();
+
+                Ignite ignite = ignite(node);
+
+                Thread.currentThread().setName("start-stop-" + ignite.name());
+
+                CacheConfiguration ccfg = new CacheConfiguration();
+
+                ccfg.setName("testStartStop");
+
+                for (int i = 0; i < 1000; i++) {
+                    log.info("Start cache: " + i);
+
+                    try (IgniteCache<Object, Object> cache = ignite.getOrCreateCache(ccfg)) {
+                        // No-op.
+                    }
+
+                    log.info("Stopped cache: " + i);
+                }
+
+                return null;
+            }
+        }, nodeCount(), "start-stop-cache");
+
+        fut.get();
+    }
 }


[13/50] incubator-ignite git commit: Merge branch 'ignite-sprint-6' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-sprint-7

Posted by ag...@apache.org.
Merge branch 'ignite-sprint-6' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-sprint-7


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

Branch: refs/heads/ignite-621
Commit: 1c660781355f870271760dd6dc0392741fdb15f6
Parents: 5d8e404 285d790
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Jun 23 10:00:32 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Jun 23 10:00:32 2015 +0700

----------------------------------------------------------------------
 .../GridDhtPartitionsExchangeFuture.java        | 49 +++++++++++++++-----
 .../communication/tcp/TcpCommunicationSpi.java  | 12 +++++
 .../GridTcpCommunicationSpiConfigSelfTest.java  |  1 -
 3 files changed, 49 insertions(+), 13 deletions(-)
----------------------------------------------------------------------



[04/50] incubator-ignite git commit: Merge branch 'ignite-gg-10449' into ignite-sprint-6

Posted by ag...@apache.org.
Merge branch 'ignite-gg-10449' into ignite-sprint-6


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

Branch: refs/heads/ignite-621
Commit: de0930d3b92141a360ea6a2cc346035158572dcf
Parents: a4ce455 7c1ecc3
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Mon Jun 22 14:05:28 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Mon Jun 22 14:05:28 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ClientImpl.java    | 23 ++++++++++++++++++++
 .../cache/IgniteCacheOffheapEvictQueryTest.java | 17 +++++++++++++++
 2 files changed, 40 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/de0930d3/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------


[37/50] incubator-ignite git commit: Merge branch 'ignite-sprint-7' into ignite-gg-10440

Posted by ag...@apache.org.
Merge branch 'ignite-sprint-7' into ignite-gg-10440


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

Branch: refs/heads/ignite-621
Commit: b2e8fea0e9d3154f8cdde8ac4fed7d6ede1e7ace
Parents: 5b306e1 b29ff1c
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu Jun 25 10:13:10 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Jun 25 10:13:10 2015 +0300

----------------------------------------------------------------------
 .../configuration/IgniteReflectionFactory.java  |  81 +++-
 .../processors/cache/GridCacheContext.java      |   2 +-
 .../distributed/dht/GridDhtLocalPartition.java  |   3 +-
 .../distributed/dht/GridDhtLockFuture.java      |   2 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   9 +-
 .../GridDhtPartitionsExchangeFuture.java        |  95 +++-
 .../datastructures/DataStructuresProcessor.java |  64 +--
 .../processors/hadoop/HadoopJobInfo.java        |   4 +-
 .../hadoop/counter/HadoopCounterWriter.java     |   5 +-
 .../communication/tcp/TcpCommunicationSpi.java  |  12 +
 .../CacheReadThroughAtomicRestartSelfTest.java  |  32 ++
 ...heReadThroughLocalAtomicRestartSelfTest.java |  32 ++
 .../CacheReadThroughLocalRestartSelfTest.java   |  32 ++
 ...dThroughReplicatedAtomicRestartSelfTest.java |  32 ++
 ...cheReadThroughReplicatedRestartSelfTest.java |  32 ++
 .../cache/CacheReadThroughRestartSelfTest.java  | 133 ++++++
 .../cache/GridCacheAbstractSelfTest.java        |   2 +-
 ...eDynamicCacheStartNoExchangeTimeoutTest.java | 466 +++++++++++++++++++
 .../cache/IgniteDynamicCacheStartSelfTest.java  |  37 ++
 ...GridCacheQueueMultiNodeAbstractSelfTest.java |   4 +-
 .../GridCacheSetAbstractSelfTest.java           |  22 +-
 .../IgniteDataStructureWithJobTest.java         | 111 +++++
 .../distributed/IgniteCache150ClientsTest.java  | 189 ++++++++
 ...teCacheClientNodePartitionsExchangeTest.java |   1 +
 .../distributed/IgniteCacheManyClientsTest.java |   1 +
 ...idCacheNearOnlyMultiNodeFullApiSelfTest.java |   5 -
 ...achePartitionedMultiNodeFullApiSelfTest.java |  49 +-
 .../GridCacheReplicatedFailoverSelfTest.java    |   5 +
 .../IgniteCacheTxStoreSessionTest.java          |   4 +
 .../GridTcpCommunicationSpiConfigSelfTest.java  |   1 -
 .../testframework/junits/GridAbstractTest.java  |   2 +-
 .../IgniteCacheDataStructuresSelfTestSuite.java |   1 +
 .../testsuites/IgniteCacheTestSuite4.java       |   8 +
 .../testsuites/IgniteClientTestSuite.java       |  38 ++
 modules/hadoop/pom.xml                          |  78 ----
 .../fs/IgniteHadoopFileSystemCounterWriter.java |   9 +-
 .../processors/hadoop/HadoopClassLoader.java    |  29 ++
 .../processors/hadoop/HadoopDefaultJobInfo.java |  27 +-
 .../internal/processors/hadoop/HadoopUtils.java | 237 ----------
 .../hadoop/SecondaryFileSystemProvider.java     |   3 +-
 .../hadoop/fs/HadoopFileSystemCacheUtils.java   | 241 ++++++++++
 .../hadoop/fs/HadoopFileSystemsUtils.java       |  11 +
 .../hadoop/fs/HadoopLazyConcurrentMap.java      |   5 +
 .../hadoop/jobtracker/HadoopJobTracker.java     |  25 +-
 .../child/HadoopChildProcessRunner.java         |   3 +-
 .../processors/hadoop/v2/HadoopV2Job.java       |  84 +++-
 .../hadoop/v2/HadoopV2JobResourceManager.java   |  22 +-
 .../hadoop/v2/HadoopV2TaskContext.java          |  37 +-
 .../apache/ignite/igfs/IgfsEventsTestSuite.java |   5 +-
 .../processors/hadoop/HadoopMapReduceTest.java  |   2 +-
 .../processors/hadoop/HadoopTasksV1Test.java    |   7 +-
 .../processors/hadoop/HadoopTasksV2Test.java    |   7 +-
 .../processors/hadoop/HadoopV2JobSelfTest.java  |   6 +-
 .../collections/HadoopAbstractMapTest.java      |   3 +-
 .../testsuites/IgniteHadoopTestSuite.java       |   2 +-
 .../IgniteIgfsLinuxAndMacOSTestSuite.java       |   3 +-
 56 files changed, 1878 insertions(+), 484 deletions(-)
----------------------------------------------------------------------



[05/50] incubator-ignite git commit: #IGNITE Added message on init stop.

Posted by ag...@apache.org.
#IGNITE Added message on init stop.


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

Branch: refs/heads/ignite-621
Commit: 16059962e303f7580c6524b1e0f93c2dcce9eaa4
Parents: de0930d
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Mon Jun 22 15:30:48 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Mon Jun 22 15:30:48 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/MarshallerContextImpl.java  |  12 +-
 .../cache/GridCacheDaemonNodeStopSelfTest.java  | 119 +++++++++++++++++++
 .../testsuites/IgniteCacheTestSuite3.java       |   1 +
 3 files changed, 130 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/16059962/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
index 48f24ac..9f7c983 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
@@ -124,10 +124,18 @@ public class MarshallerContextImpl extends MarshallerContextAdapter {
 
     /** {@inheritDoc} */
     @Override protected String className(int id) throws IgniteCheckedException {
-        if (cache == null)
+        GridCacheAdapter<Integer, String> cache0 = cache;
+
+        if (cache0 == null) {
             U.awaitQuiet(latch);
 
-        String clsName = cache.get(id);
+            cache0 = cache;
+
+            if (cache0 == null)
+                throw new IllegalStateException("Failed to initialize marshaller context (grid is stopping).");
+        }
+
+        String clsName = cache0.get(id);
 
         if (clsName == null) {
             File file = new File(workDir, id + ".classname");

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/16059962/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeStopSelfTest.java
new file mode 100644
index 0000000..c56ad1c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeStopSelfTest.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.util.concurrent.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * Test cache operations with daemon node.
+ */
+public class GridCacheDaemonNodeStopSelfTest extends GridCommonAbstractTest {
+    /** */
+    private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** Daemon flag. */
+    protected boolean daemon;
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        daemon = false;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration c = super.getConfiguration(gridName);
+
+        c.setDaemon(daemon);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(ipFinder);
+
+        c.setDiscoverySpi(disco);
+
+        c.setConnectorConfiguration(null);
+
+        CacheConfiguration cc = defaultCacheConfiguration();
+
+        cc.setCacheMode(LOCAL);
+        cc.setAtomicityMode(ATOMIC);
+
+        TransactionConfiguration cfg = new TransactionConfiguration();
+
+        c.setTransactionConfiguration(cfg);
+
+        c.setCacheConfiguration(cc);
+
+        return c;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testStartStop() throws Exception {
+        try {
+            daemon = true;
+
+            final IgniteEx daemonNode = startGrid(0);
+
+            final IgniteInternalFuture<Object> f = GridTestUtils.runAsync(new Callable<Object>() {
+                @Override public Object call() throws Exception {
+                    daemonNode.context().marshallerContext().getClass(1,
+                        GridCacheDaemonNodeStopSelfTest.class.getClassLoader());
+
+                    return null;
+                }
+            });
+
+            GridTestUtils.assertThrowsWithCause(new Callable<Object>() {
+                @Override public Object call() throws Exception {
+                    f.get(300);
+
+                    return null;
+                }
+            }, IgniteFutureTimeoutCheckedException.class);
+
+            // Stop grid.
+            stopGrid(0);
+
+            GridTestUtils.assertThrowsWithCause(new Callable<Object>() {
+                @Override public Object call() throws Exception {
+                    f.get(5, TimeUnit.SECONDS);
+
+                    return null;
+                }
+            }, IllegalStateException.class);
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/16059962/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
index 5947d33..b83f50f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
@@ -100,6 +100,7 @@ public class IgniteCacheTestSuite3 extends TestSuite {
         suite.addTestSuite(GridCacheDaemonNodeLocalSelfTest.class);
         suite.addTestSuite(GridCacheDaemonNodePartitionedSelfTest.class);
         suite.addTestSuite(GridCacheDaemonNodeReplicatedSelfTest.class);
+        suite.addTestSuite(GridCacheDaemonNodeStopSelfTest.class);
 
         // Write-behind.
         suite.addTest(IgniteCacheWriteBehindTestSuite.suite());


[35/50] incubator-ignite git commit: # ignite-917: review (ignite-1033 fixed).

Posted by ag...@apache.org.
# ignite-917: review (ignite-1033 fixed).


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

Branch: refs/heads/ignite-621
Commit: 532a98f13933ce34168b64854a735f4f9ee4b8bd
Parents: 2ad4fe1
Author: ashutak <as...@gridgain.com>
Authored: Wed Jun 24 16:19:27 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Wed Jun 24 16:19:27 2015 +0300

----------------------------------------------------------------------
 .../ClientAbstractConnectivitySelfTest.java     |   4 +-
 .../org/apache/ignite/cluster/ClusterNode.java  |   2 +
 .../internal/cluster/ClusterGroupAdapter.java   |  30 +++--
 .../cluster/IgniteClusterAsyncImpl.java         |   2 +-
 .../ignite/internal/util/IgniteUtils.java       |   6 +-
 .../internal/ClusterForHostsSelfTest.java       | 113 +++++++++++++++++++
 .../ignite/internal/GridProjectionSelfTest.java |  19 ----
 .../internal/util/IgniteUtilsSelfTest.java      |  22 ++++
 .../ignite/testsuites/IgniteBasicTestSuite.java |   1 +
 9 files changed, 157 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
index 5aec7e5..a2e7c38 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
@@ -20,9 +20,9 @@ package org.apache.ignite.internal.client.integration;
 import org.apache.ignite.*;
 import org.apache.ignite.internal.client.*;
 import org.apache.ignite.internal.util.*;
-import org.apache.ignite.lang.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
 import org.apache.ignite.testframework.*;
 import org.apache.ignite.testframework.junits.common.*;
 import org.jetbrains.annotations.*;
@@ -146,7 +146,7 @@ public abstract class ClientAbstractConnectivitySelfTest extends GridCommonAbstr
         startRestNode("grid1", LOOPBACK_IP, defaultRestPort());
 
         checkConnectivityByIp(LOOPBACK_IP, F.t((Collection<String>)Collections.singleton(LOOPBACK_IP),
-            (Collection<String>)Collections.singleton("")));
+            (Collection<String>)Collections.<String>emptySet()));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
index 85fd08a..bb792d5 100644
--- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
@@ -188,6 +188,8 @@ public interface ClusterNode {
      * <p>
      * If {@link IgniteConfiguration#getLocalHost()} value is {@code null} then local wildcard address will be used,
      * and this method returns host names of all addresses of that node.
+     * <p/
+     * Note: the loopback address will skipped from the results.
      *
      * @return Collection of host names.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
index 1831321..b940017 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
@@ -578,7 +578,9 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
 
     /** {@inheritDoc} */
     @Override public final ClusterGroup forHost(String host, String... hosts) {
-	return forPredicate(new HostsFilter(host, hosts));
+        A.notNull(host, "host");
+
+        return forPredicate(new HostsFilter(host, hosts));
     }
 
     /** {@inheritDoc} */
@@ -772,30 +774,24 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
         private static final long serialVersionUID = 0L;
 
         /** Hosts Names. */
-        private final HashSet hashInputHostNames;
+        private final Collection<String> validHostNames = new HashSet<>();
 
         /**
-         * @param name  First host name.
-	  * @param names Host names
+         * @param name First host name.
+         * @param names Host names
          */
-        private HostsFilter(String name, String[] names) {
-            hashInputHostNames = new HashSet();
-
-            if (name != null)
-                hashInputHostNames.add(name);
+        private HostsFilter(String name, String... names) {
+            validHostNames.add(name);
 
-            if (names != null && (names.length > 0)) {
-                for (String currentInputHostName : names)
-                    hashInputHostNames.add(currentInputHostName);
-	    }
+            if (names != null && (names.length > 0))
+                Collections.addAll(validHostNames, names);
         }
 
         /** {@inheritDoc} */
         @Override public boolean apply(ClusterNode n) {
-	    for (String currentHostName : n.hostNames()) {
-                if (hashInputHostNames.contains(currentHostName)) {
-		    return true;
-		}
+            for (String hostName : n.hostNames()) {
+                if (validHostNames.contains(hostName))
+                    return true;
             }
 
             return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
index ca6cf32..6e68527 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
@@ -233,7 +233,7 @@ public class IgniteClusterAsyncImpl extends AsyncSupportAdapter<IgniteCluster>
 
     /** {@inheritDoc} */
     @Override public ClusterGroup forHost(String host, String... hosts) {
-	return cluster.forHost(host, hosts);
+        return cluster.forHost(host, hosts);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 6623e85..f457d6c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -1658,10 +1658,10 @@ public abstract class IgniteUtils {
 
         String ipAddr = addr.getHostAddress();
 
-        hostName = F.isEmpty(hostName) || hostName.equals(ipAddr) || addr.isLoopbackAddress() ? "" : hostName;
-
         addrs.add(ipAddr);
-        hostNames.add(hostName);
+
+        if (!F.isEmpty(hostName) && !addr.isLoopbackAddress())
+            hostNames.add(hostName);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/core/src/test/java/org/apache/ignite/internal/ClusterForHostsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ClusterForHostsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/ClusterForHostsSelfTest.java
new file mode 100644
index 0000000..59c3db9
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/ClusterForHostsSelfTest.java
@@ -0,0 +1,113 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.lang.reflect.*;
+import java.util.*;
+
+/**
+ * Test for {@link ClusterGroup#forHost(String, String...)}.
+ *
+ * @see GridProjectionSelfTest
+ */
+@GridCommonTest(group = "Kernal Self")
+public class ClusterForHostsSelfTest extends GridCommonAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        Collection<String> hostNames = null;
+
+        if ("forHostTest".equals(gridName))
+            hostNames = Arrays.asList("h_1", "h_2", "h_3");
+
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        if (hostNames != null) {
+            TcpDiscoverySpi disco = (TcpDiscoverySpi)cfg.getDiscoverySpi();
+
+            cfg.setDiscoverySpi(new CustomHostsTcpDiscoverySpi(hostNames).setIpFinder(disco.getIpFinder()));
+        }
+
+        return cfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testForHosts() throws Exception {
+        Ignite ignite = startGrid("forHostTest");
+
+        assertEquals(1, ignite.cluster().forHost("h_1").nodes().size());
+        assertEquals(1, ignite.cluster().forHost("h_1", "h_3").nodes().size());
+        assertEquals(1, ignite.cluster().forHost("unknown_host", "h_2").nodes().size());
+        assertEquals(1, ignite.cluster().forHost("h_1", "h_3", "unknown_host", "h_2").nodes().size());
+
+        assertEquals(0, ignite.cluster().forHost("unknown_host").nodes().size());
+
+        boolean gotNpe = false;
+
+        try {
+            assertEquals(0, ignite.cluster().forHost(null, null, null).nodes().size());
+        }
+        catch (NullPointerException e) {
+            gotNpe = true;
+        }
+
+        assertTrue(gotNpe);
+    }
+
+    /**
+     * Tcp discovery spi that allow to customise hostNames of created local node.
+     */
+    private static class CustomHostsTcpDiscoverySpi extends TcpDiscoverySpi {
+        /** Hosts. */
+        private final Collection<String> hosts;
+
+        /**
+         * @param hosts Host names which will be retuned by {@link ClusterNode#hostNames()} of created local node.
+         */
+        CustomHostsTcpDiscoverySpi(Collection<String> hosts) {
+            this.hosts = hosts;
+        }
+
+        /**
+         * @param srvPort Server port.
+         */
+        @Override protected void initLocalNode(int srvPort, boolean addExtAddrAttr) {
+            super.initLocalNode(srvPort, addExtAddrAttr);
+
+            try {
+                Field hostNamesField = locNode.getClass().getDeclaredField("hostNames");
+
+                hostNamesField.setAccessible(true);
+
+                hostNamesField.set(locNode, hosts);
+            }
+            catch (IllegalAccessException | NoSuchFieldException e) {
+                U.error(log, "Looks like implementation of " + locNode.getClass()
+                    + " class was changed. Need to update test.", e);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
index bd625d9..9fbad80 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
@@ -248,23 +248,4 @@ public class GridProjectionSelfTest extends GridProjectionAbstractTest {
 
         return even ? cnt - 1 : cnt - 2;
     }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testForHost() throws Exception {
-        Collection<ClusterNode> allNodes = ignite.cluster().nodes();
-        ClusterNode localNode = ignite.cluster().localNode();
-        ArrayList<String> inputHostNames = new ArrayList<String> ();
-
-        for (ClusterNode currentNode : allNodes)
-            Collections.addAll(inputHostNames, currentNode.hostNames().toArray(new String[0]));
-
-        String[] inputHostNamesArray = inputHostNames.toArray(new String[] {});
-        ClusterGroup resultGroup = ignite.cluster().forHost(inputHostNamesArray[0], inputHostNamesArray);
-	ClusterGroup nullTestGroup = ignite.cluster().forHost(null, null);
-
-        assert((resultGroup.node(localNode.id())) != null);
-        assert((nullTestGroup.node(localNode.id())) == null);
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
index 6e3e0e2..4762001 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
@@ -23,6 +23,7 @@ import org.apache.ignite.compute.*;
 import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
 import org.apache.ignite.testframework.*;
 import org.apache.ignite.testframework.http.*;
 import org.apache.ignite.testframework.junits.*;
@@ -698,6 +699,27 @@ public class IgniteUtilsSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testResolveLocalAddresses() throws Exception {
+        InetAddress inetAddress = InetAddress.getByName("0.0.0.0");
+
+        IgniteBiTuple<Collection<String>, Collection<String>> addrs = U.resolveLocalAddresses(inetAddress);
+
+        Collection<String> hostNames = addrs.get2();
+
+        assertFalse(hostNames.contains(null));
+        assertFalse(hostNames.contains(""));
+        assertFalse(hostNames.contains("127.0.0.1"));
+
+        assertFalse(F.exist(hostNames, new IgnitePredicate<String>() {
+            @Override public boolean apply(String hostName) {
+                return hostName.contains("localhost") || hostName.contains("0:0:0:0:0:0:0:1");
+            }
+        }));
+    }
+
+    /**
      * Test enum.
      */
     private enum TestEnum {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 2d14728..8be9f31 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -66,6 +66,7 @@ public class IgniteBasicTestSuite extends TestSuite {
 
         suite.addTest(new TestSuite(GridSelfTest.class));
         GridTestUtils.addTestIfNeeded(suite, GridProjectionSelfTest.class, ignoredTests);
+        suite.addTest(new TestSuite(ClusterForHostsSelfTest.class));
         GridTestUtils.addTestIfNeeded(suite, GridMessagingSelfTest.class, ignoredTests);
         suite.addTest(new TestSuite(IgniteMessagingWithClientTest.class));
         GridTestUtils.addTestIfNeeded(suite, GridMessagingNoPeerClassLoadingSelfTest.class, ignoredTests);