You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/05/04 11:06:50 UTC

[01/18] incubator-ignite git commit: timeouts for faster failure detection

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-844 175aee2c3 -> e7f3f96db


timeouts for faster failure detection


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

Branch: refs/heads/ignite-844
Commit: 11f4957f90edde2369afe0db8e221f27b53d11b5
Parents: 51dc6aa
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Tue Apr 28 13:56:06 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Tue Apr 28 13:56:06 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java      | 4 ----
 .../org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java | 4 ----
 .../ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java     | 8 ++++----
 3 files changed, 4 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/11f4957f/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
index e3182c4..4196306 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
@@ -226,10 +226,6 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
         if (netTimeout < 3000)
             U.warn(log, "Network timeout is too low (at least 3000 ms recommended): " + netTimeout);
 
-        // Warn on odd heartbeat frequency.
-        if (hbFreq < 2000)
-            U.warn(log, "Heartbeat frequency is too high (at least 2000 ms recommended): " + hbFreq);
-
         registerMBean(gridName, this, TcpClientDiscoverySpiMBean.class);
 
         try {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/11f4957f/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 6a5eb25..5bc9184 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -853,10 +853,6 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
         if (netTimeout < 3000)
             U.warn(log, "Network timeout is too low (at least 3000 ms recommended): " + netTimeout);
 
-        // Warn on odd heartbeat frequency.
-        if (hbFreq < 2000)
-            U.warn(log, "Heartbeat frequency is too high (at least 2000 ms recommended): " + hbFreq);
-
         registerMBean(gridName, this, TcpDiscoverySpiMBean.class);
 
         if (ipFinder instanceof TcpDiscoveryMulticastIpFinder) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/11f4957f/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
index 98e048d..6f41cb0 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
@@ -51,8 +51,8 @@ abstract class TcpDiscoverySpiAdapter extends IgniteSpiAdapter implements Discov
     /** Default port to listen (value is <tt>47500</tt>). */
     public static final int DFLT_PORT = 47500;
 
-    /** Default socket operations timeout in milliseconds (value is <tt>2,000ms</tt>). */
-    public static final long DFLT_SOCK_TIMEOUT = 2000;
+    /** Default socket operations timeout in milliseconds (value is <tt>200ms</tt>). */
+    public static final long DFLT_SOCK_TIMEOUT = 200;
 
     /** Default timeout for receiving message acknowledgement in milliseconds (value is <tt>5,000ms</tt>). */
     public static final long DFLT_ACK_TIMEOUT = 5000;
@@ -63,8 +63,8 @@ abstract class TcpDiscoverySpiAdapter extends IgniteSpiAdapter implements Discov
     /** Default value for thread priority (value is <tt>10</tt>). */
     public static final int DFLT_THREAD_PRI = 10;
 
-    /** Default heartbeat messages issuing frequency (value is <tt>2,000ms</tt>). */
-    public static final long DFLT_HEARTBEAT_FREQ = 2000;
+    /** Default heartbeat messages issuing frequency (value is <tt>500ms</tt>). */
+    public static final long DFLT_HEARTBEAT_FREQ = 500;
 
     /** Default size of topology snapshots history. */
     public static final int DFLT_TOP_HISTORY_SIZE = 1000;


[16/18] incubator-ignite git commit: Revert "#ignite-732: IgniteCache.size() should not fail in case of topology changes."

Posted by ak...@apache.org.
Revert "#ignite-732: IgniteCache.size() should not fail in case of topology changes."

This reverts commit 139aa270ae61494c0757867f2dc531ec7251b1da.


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

Branch: refs/heads/ignite-844
Commit: c4bc92974bace5e4cdb3ac9dc80790193e46d203
Parents: 281f4ef
Author: ivasilinets <iv...@gridgain.com>
Authored: Sat May 2 10:05:35 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Sat May 2 10:05:35 2015 +0300

----------------------------------------------------------------------
 .../ignite/compute/ComputeTaskAdapter.java      |  14 +-
 .../processors/cache/GridCacheAdapter.java      | 503 +++++++++----------
 .../processors/cache/GridCacheProcessor.java    | 109 ++--
 3 files changed, 277 insertions(+), 349 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c4bc9297/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskAdapter.java b/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskAdapter.java
index 87081fc..c2ad198 100644
--- a/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskAdapter.java
@@ -24,16 +24,15 @@ import java.util.*;
 
 /**
  * Convenience adapter for {@link ComputeTask} interface. Here is an example of
- * how {@code ComputeTaskAdapter} can be used:
+ * how {@code GridComputeTaskAdapter} can be used:
  * <pre name="code" class="java">
- * public class MyFooBarTask extends ComputeTaskAdapter&lt;String, String&gt; {
+ * public class MyFooBarTask extends GridComputeTaskAdapter&lt;String, String&gt; {
  *     // Inject load balancer.
  *     &#64;LoadBalancerResource
  *     ComputeLoadBalancer balancer;
  *
  *     // Map jobs to grid nodes.
- *     public Map&lt;? extends ComputeJob, GridNode&gt; map(List&lt;GridNode&gt; subgrid, String arg)
- *         throws IgniteCheckedException {
+ *     public Map&lt;? extends ComputeJob, GridNode&gt; map(List&lt;GridNode&gt; subgrid, String arg) throws IgniteCheckedException {
  *         Map&lt;MyFooBarJob, GridNode&gt; jobs = new HashMap&lt;MyFooBarJob, GridNode&gt;(subgrid.size());
  *
  *         // In more complex cases, you can actually do
@@ -77,8 +76,8 @@ public abstract class ComputeTaskAdapter<T, R> implements ComputeTask<T, R> {
      * <p>
      * If remote job resulted in exception ({@link ComputeJobResult#getException()} is not {@code null}),
      * then {@link ComputeJobResultPolicy#FAILOVER} policy will be returned if the exception is instance
-     * of {@link org.apache.ignite.cluster.ClusterTopologyException} or {@link ComputeExecutionRejectedException},
-     * which means that remote node either failed or job execution was rejected before it got a chance to start. In all
+     * of {@link org.apache.ignite.cluster.ClusterTopologyException} or {@link ComputeExecutionRejectedException}, which means that
+     * remote node either failed or job execution was rejected before it got a chance to start. In all
      * other cases the exception will be rethrown which will ultimately cause task to fail.
      *
      * @param res Received remote grid executable result.
@@ -88,8 +87,7 @@ public abstract class ComputeTaskAdapter<T, R> implements ComputeTask<T, R> {
      * @throws IgniteException If handling a job result caused an error effectively rejecting
      *      a failover. This exception will be thrown out of {@link ComputeTaskFuture#get()} method.
      */
-    @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd)
-        throws IgniteException {
+    @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) throws IgniteException {
         IgniteException e = res.getException();
 
         // Try to failover if result is failed.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c4bc9297/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 39f19b1..3f4e97b 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
@@ -75,9 +75,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** Failed result. */
-    private static final Object FAIL = new Integer(-1);
-
     /** clearLocally() split threshold. */
     public static final int CLEAR_ALL_SPLIT_THRESHOLD = 10000;
 
@@ -885,7 +882,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
     /** {@inheritDoc} */
     @Override public Set<Cache.Entry<K, V>> entrySet() {
-        return entrySet((CacheEntryPredicate[])null);
+        return entrySet((CacheEntryPredicate[]) null);
     }
 
     /** {@inheritDoc} */
@@ -900,17 +897,17 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
     /** {@inheritDoc} */
     @Override public Set<K> keySet() {
-        return keySet((CacheEntryPredicate[])null);
+        return keySet((CacheEntryPredicate[]) null);
     }
 
     /** {@inheritDoc} */
     @Override public Set<K> primaryKeySet() {
-        return primaryKeySet((CacheEntryPredicate[])null);
+        return primaryKeySet((CacheEntryPredicate[]) null);
     }
 
     /** {@inheritDoc} */
     @Override public Collection<V> values() {
-        return values((CacheEntryPredicate[])null);
+        return values((CacheEntryPredicate[]) null);
     }
 
     /**
@@ -1083,31 +1080,36 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
     /** {@inheritDoc} */
     @Override public void clear() throws IgniteCheckedException {
-        clearAll(0, new GlobalClearAllCallable(name(), ctx.affinity().affinityTopologyVersion()));
+        // Clear local cache synchronously.
+        clearLocally();
+
+        clearRemotes(0, new GlobalClearAllCallable(name()));
     }
 
     /** {@inheritDoc} */
     @Override public void clear(K key) throws IgniteCheckedException {
-        clearAll(0, new GlobalClearKeySetCallable<K, V>(name(), ctx.affinity().affinityTopologyVersion(),
-            Collections.singleton(key)));
+        // Clear local cache synchronously.
+        clearLocally(key);
+
+        clearRemotes(0, new GlobalClearKeySetCallable<K, V>(name(), Collections.singleton(key)));
     }
 
     /** {@inheritDoc} */
     @Override public void clearAll(Set<? extends K> keys) throws IgniteCheckedException {
-        clearAll(0, new GlobalClearKeySetCallable<K, V>(name(), ctx.affinity().affinityTopologyVersion(),
-            keys));
+        // Clear local cache synchronously.
+        clearLocallyAll(keys);
+
+        clearRemotes(0, new GlobalClearKeySetCallable<K, V>(name(), keys));
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<?> clearAsync(K key) {
-        return clearAsync(new GlobalClearKeySetCallable<K, V>(name(), ctx.affinity().affinityTopologyVersion(),
-            Collections.singleton(key)));
+        return clearAsync(new GlobalClearKeySetCallable<K, V>(name(), Collections.singleton(key)));
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<?> clearAsync(Set<? extends K> keys) {
-        return clearAsync(new GlobalClearKeySetCallable<K, V>(name(), ctx.affinity().affinityTopologyVersion(),
-            keys));
+        return clearAsync(new GlobalClearKeySetCallable<K, V>(name(), keys));
     }
 
     /**
@@ -1116,13 +1118,19 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
      * @param clearCall Global clear callable object.
      * @throws IgniteCheckedException In case of cache could not be cleared on any of the nodes.
      */
-    private void clearAll(long timeout, TopologyVersionAwareCallable clearCall) throws IgniteCheckedException {
+    private void clearRemotes(long timeout, GlobalClearCallable clearCall) throws IgniteCheckedException {
         try {
+            // Send job to remote nodes only.
+            Collection<ClusterNode> nodes =
+                ctx.grid().cluster().forCacheNodes(name(), true, true, false).forRemotes().nodes();
+
             IgniteInternalFuture<Object> fut = null;
 
-            ctx.kernalContext().task().setThreadContext(TC_TIMEOUT, timeout);
+            if (!nodes.isEmpty()) {
+                ctx.kernalContext().task().setThreadContext(TC_TIMEOUT, timeout);
 
-            fut = new ClearFuture(ctx, clearCall);
+                fut = ctx.closures().callAsyncNoFailover(BROADCAST, clearCall, nodes, true);
+            }
 
             if (fut != null)
                 fut.get();
@@ -1141,18 +1149,19 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<?> clearAsync() {
-        return clearAsync(new GlobalClearAllCallable(name(), ctx.affinity().affinityTopologyVersion()));
+        return clearAsync(new GlobalClearAllCallable(name()));
     }
 
     /**
      * @param clearCall Global clear callable object.
      * @return Future.
      */
-    private IgniteInternalFuture<?> clearAsync(TopologyVersionAwareCallable clearCall) {
+    private IgniteInternalFuture<?> clearAsync(GlobalClearCallable clearCall) {
         Collection<ClusterNode> nodes = ctx.grid().cluster().forCacheNodes(name(), true, true, false).nodes();
 
         if (!nodes.isEmpty()) {
-            IgniteInternalFuture<Object> fut = new ClearFuture(ctx, clearCall);
+            IgniteInternalFuture<Object> fut =
+                ctx.closures().callAsyncNoFailover(BROADCAST, clearCall, nodes, true);
 
             return fut.chain(new CX1<IgniteInternalFuture<Object>, Object>() {
                 @Override public Object applyx(IgniteInternalFuture<Object> fut) throws IgniteCheckedException {
@@ -2108,7 +2117,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                 throws IgniteCheckedException {
                 Map<? extends K, EntryProcessor<K, V, Object>> invokeMap = F.viewAsMap(keys,
                     new C1<K, EntryProcessor<K, V, Object>>() {
-                        @Override public EntryProcessor apply(K k) {
+                            @Override public EntryProcessor apply(K k) {
                             return entryProcessor;
                         }
                     });
@@ -2136,7 +2145,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         IgniteInternalFuture<?> fut = asyncOp(new AsyncInOp() {
             @Override public IgniteInternalFuture<GridCacheReturn> inOp(IgniteTxLocalAdapter tx) {
                 Map<? extends K, EntryProcessor<K, V, Object>> invokeMap =
-                    Collections.singletonMap(key, (EntryProcessor<K, V, Object>)entryProcessor);
+                    Collections.singletonMap(key, (EntryProcessor<K, V, Object>) entryProcessor);
 
                 return tx.invokeAsync(ctx, invokeMap, args);
             }
@@ -2362,7 +2371,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         IgniteInternalFuture<V> fut = asyncOp(new AsyncOp<V>() {
             @Override public IgniteInternalFuture<V> op(IgniteTxLocalAdapter tx) {
                 return tx.putAllAsync(ctx, F.t(key, val), true, null, -1, ctx.noValArray())
-                    .chain((IgniteClosure<IgniteInternalFuture<GridCacheReturn>, V>)RET2VAL);
+                    .chain((IgniteClosure<IgniteInternalFuture<GridCacheReturn>, V>) RET2VAL);
             }
 
             @Override public String toString() {
@@ -2517,7 +2526,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         return asyncOp(new AsyncOp<Boolean>() {
             @Override public IgniteInternalFuture<Boolean> op(IgniteTxLocalAdapter tx) {
                 return tx.putAllAsync(ctx, F.t(key, val), false, null, -1, ctx.hasValArray()).chain(
-                    (IgniteClosure<IgniteInternalFuture<GridCacheReturn>, Boolean>)RET2FLAG);
+                    (IgniteClosure<IgniteInternalFuture<GridCacheReturn>, Boolean>) RET2FLAG);
             }
 
             @Override public String toString() {
@@ -2906,7 +2915,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                 if (ctx.deploymentEnabled())
                     ctx.deploy().registerClass(oldVal);
 
-                return tx.putAllAsync(ctx,
+                return (GridCacheReturn) tx.putAllAsync(ctx,
                         F.t(key, newVal),
                         true,
                         null,
@@ -3008,7 +3017,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                     ctx.deploy().registerClass(val);
 
                 return tx.removeAllAsync(ctx, Collections.singletonList(key), null, false,
-                    ctx.equalsValArray(val)).get().success();
+                        ctx.equalsValArray(val)).get().success();
             }
 
             @Override public String toString() {
@@ -3221,10 +3230,10 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         TransactionConfiguration cfg = ctx.gridConfig().getTransactionConfiguration();
 
         return txStart(
-            concurrency,
-            isolation,
-            cfg.getDefaultTxTimeout(),
-            0
+                concurrency,
+                isolation,
+                cfg.getDefaultTxTimeout(),
+                0
         );
     }
 
@@ -3567,7 +3576,22 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         if (nodes.isEmpty())
             return new GridFinishedFuture<>(0);
 
-        return new SizeFuture(peekModes, ctx, modes.near);
+        IgniteInternalFuture<Collection<Integer>> fut =
+            ctx.closures().broadcastNoFailover(new SizeCallable(ctx.name(), peekModes), null, nodes);
+
+        return fut.chain(new CX1<IgniteInternalFuture<Collection<Integer>>, Integer>() {
+            @Override public Integer applyx(IgniteInternalFuture<Collection<Integer>> fut)
+            throws IgniteCheckedException {
+                Collection<Integer> res = fut.get();
+
+                int totalSize = 0;
+
+                for (Integer size : res)
+                    totalSize += size;
+
+                return totalSize;
+            }
+        });
     }
 
     /** {@inheritDoc} */
@@ -3651,7 +3675,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         return F.iterator(iterator(),
             new IgniteClosure<Cache.Entry<K, V>, Cache.Entry<K, V>>() {
                 private IgniteCacheExpiryPolicy expiryPlc =
-                    ctx.cache().expiryPolicy(opCtx != null ? opCtx.expiry() : null);
+                        ctx.cache().expiryPolicy(opCtx != null ? opCtx.expiry() : null);
 
                 @Override public Cache.Entry<K, V> apply(Cache.Entry<K, V> lazyEntry) {
                     CacheOperationContext prev = ctx.gate().enter(opCtx);
@@ -3885,6 +3909,50 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     }
 
     /**
+     * Gets cache global size (with or without backups).
+     *
+     * @param primaryOnly {@code True} if only primary sizes should be included.
+     * @return Global size.
+     * @throws IgniteCheckedException If internal task execution failed.
+     */
+    private int globalSize(boolean primaryOnly) throws IgniteCheckedException {
+        try {
+            // Send job to remote nodes only.
+            Collection<ClusterNode> nodes = ctx.grid().cluster().forCacheNodes(name()).forRemotes().nodes();
+
+            IgniteInternalFuture<Collection<Integer>> fut = null;
+
+            if (!nodes.isEmpty()) {
+                ctx.kernalContext().task().setThreadContext(TC_TIMEOUT, gridCfg.getNetworkTimeout());
+
+                fut = ctx.closures().broadcastNoFailover(new GlobalSizeCallable(name(), primaryOnly), null, nodes);
+            }
+
+            // Get local value.
+            int globalSize = primaryOnly ? primarySize() : size();
+
+            if (fut != null) {
+                for (Integer i : fut.get())
+                    globalSize += i;
+            }
+
+            return globalSize;
+        }
+        catch (ClusterGroupEmptyCheckedException ignore) {
+            if (log.isDebugEnabled())
+                log.debug("All remote nodes left while cache clearLocally [cacheName=" + name() + "]");
+
+            return primaryOnly ? primarySize() : size();
+        }
+        catch (ComputeTaskTimeoutCheckedException e) {
+            U.warn(log, "Timed out waiting for remote nodes to finish cache clear (consider increasing " +
+                "'networkTimeout' configuration property) [cacheName=" + name() + "]");
+
+            throw e;
+        }
+    }
+
+    /**
      * @param op Cache operation.
      * @param <T> Return type.
      * @return Operation result.
@@ -4825,10 +4893,47 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     }
 
     /**
+     * Internal callable which performs clear operation on a cache with the given name.
+     */
+    @GridInternal
+    private static abstract class GlobalClearCallable implements Callable<Object>, Externalizable {
+        /** Cache name. */
+        protected String cacheName;
+
+        /** Injected grid instance. */
+        @IgniteInstanceResource
+        protected Ignite ignite;
+
+        /**
+         * Empty constructor for serialization.
+         */
+        public GlobalClearCallable() {
+            // No-op.
+        }
+
+        /**
+         * @param cacheName Cache name.
+         */
+        protected GlobalClearCallable(String cacheName) {
+            this.cacheName = cacheName;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void writeExternal(ObjectOutput out) throws IOException {
+            U.writeString(out, cacheName);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+            cacheName = U.readString(in);
+        }
+    }
+
+    /**
      * Global clear all.
      */
     @GridInternal
-    private static class GlobalClearAllCallable extends TopologyVersionAwareCallable {
+    private static class GlobalClearAllCallable extends GlobalClearCallable {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -4841,30 +4946,24 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         /**
          * @param cacheName Cache name.
-         * @param topVer Affinity topology version.
          */
-        private GlobalClearAllCallable(String cacheName, AffinityTopologyVersion topVer) {
-            super(cacheName, topVer);
+        private GlobalClearAllCallable(String cacheName) {
+            super(cacheName);
         }
 
         /** {@inheritDoc} */
-        @Override protected Object callLocal() {
+        @Override public Object call() throws Exception {
             ((IgniteEx)ignite).cachex(cacheName).clearLocally();
 
             return null;
         }
-
-        /** {@inheritDoc} */
-        @Override protected Collection<ClusterNode> nodes(GridCacheContext ctx) {
-            return ctx.grid().cluster().forCacheNodes(ctx.name(), true, true, false).nodes();
-        }
     }
 
     /**
      * Global clear keys.
      */
     @GridInternal
-    private static class GlobalClearKeySetCallable<K, V> extends TopologyVersionAwareCallable {
+    private static class GlobalClearKeySetCallable<K, V> extends GlobalClearCallable {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -4880,25 +4979,33 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         /**
          * @param cacheName Cache name.
-         * @param topVer Affinity topology version.
          * @param keys Keys to clear.
          */
-        protected GlobalClearKeySetCallable(String cacheName, AffinityTopologyVersion topVer, Set<? extends K> keys) {
-            super(cacheName, topVer);
+        private GlobalClearKeySetCallable(String cacheName, Set<? extends K> keys) {
+            super(cacheName);
 
             this.keys = keys;
         }
 
         /** {@inheritDoc} */
-        @Override protected Collection<ClusterNode> nodes(GridCacheContext ctx) {
-            return ctx.grid().cluster().forCacheNodes(ctx.name(), true, true, false).nodes();
+        @Override public Object call() throws Exception {
+            ((IgniteEx)ignite).<K, V>cachex(cacheName).clearLocallyAll(keys);
+
+            return null;
         }
 
         /** {@inheritDoc} */
-        @Override protected Object callLocal() {
-            ((IgniteEx)ignite).<K, V>cachex(cacheName).clearLocallyAll(keys);
+        @Override public void writeExternal(ObjectOutput out) throws IOException {
+            super.writeExternal(out);
 
-            return null;
+            out.writeObject(keys);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+            super.readExternal(in);
+
+            keys = (Set<K>) in.readObject();
         }
     }
 
@@ -4906,202 +5013,127 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
      * Internal callable for global size calculation.
      */
     @GridInternal
-    private static class GlobalSizeCallable extends TopologyVersionAwareCallable {
+    private static class SizeCallable extends IgniteClosureX<Object, Integer> implements Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
+        /** Cache name. */
+        private String cacheName;
+
         /** Peek modes. */
         private CachePeekMode[] peekModes;
 
-        /** Near enable. */
-        private boolean nearEnable;
+        /** Injected grid instance. */
+        @IgniteInstanceResource
+        private Ignite ignite;
 
         /**
          * Required by {@link Externalizable}.
          */
-        public GlobalSizeCallable() {
+        public SizeCallable() {
             // No-op.
         }
 
         /**
          * @param cacheName Cache name.
-         * @param topVer Affinity topology version.
          * @param peekModes Cache peek modes.
          */
-        private GlobalSizeCallable(String cacheName, AffinityTopologyVersion topVer, CachePeekMode[] peekModes, boolean nearEnable) {
-            super(cacheName, topVer);
-
+        private SizeCallable(String cacheName, CachePeekMode[] peekModes) {
+            this.cacheName = cacheName;
             this.peekModes = peekModes;
-            this.nearEnable = nearEnable;
-        }
-
-        /** {@inheritDoc} */
-        @Override protected Object callLocal() {
-            try {
-                IgniteInternalCache<Object, Object> cache = ((IgniteEx)ignite).cachex(cacheName);
-
-                return cache == null ? 0 : cache.localSize(peekModes);
-            }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
         }
 
         /** {@inheritDoc} */
-        @Override protected Collection<ClusterNode> nodes(GridCacheContext ctx) {
-            IgniteClusterEx cluster = ctx.grid().cluster();
+        @Override public Integer applyx(Object o) throws IgniteCheckedException {
+            IgniteInternalCache<Object, Object> cache = ((IgniteEx)ignite).cachex(cacheName);
 
-            ClusterGroup grp = nearEnable ? cluster.forCacheNodes(ctx.name(), true, true, false) : cluster.forDataNodes(ctx.name());
+            assert cache != null : cacheName;
 
-            return grp.nodes();
+            return cache.localSize(peekModes);
         }
 
         /** {@inheritDoc} */
-        public String toString() {
-            return S.toString(GlobalSizeCallable.class, this);
-        }
-    }
-
-    /**
-     * Cache size future.
-     */
-    private static class SizeFuture extends RetryFuture {
-        /** Size. */
-        private int size = 0;
-
-        /**
-         * @param peekModes Peek modes.
-         */
-        public SizeFuture(CachePeekMode[] peekModes, GridCacheContext ctx, boolean near) {
-            super(ctx, new GlobalSizeCallable(ctx.name(), ctx.affinity().affinityTopologyVersion(), peekModes, near));
-        }
+        @SuppressWarnings("ForLoopReplaceableByForEach")
+        @Override public void writeExternal(ObjectOutput out) throws IOException {
+            U.writeString(out, cacheName);
 
-        /** {@inheritDoc} */
-        @Override protected void onInit() {
-            size = 0;
-        }
+            out.writeInt(peekModes.length);
 
-        /** {@inheritDoc} */
-        @Override protected void onLocal(Object localRes) {
-            size += (Integer)localRes;
+            for (int i = 0; i < peekModes.length; i++)
+                U.writeEnum(out, peekModes[i]);
         }
 
         /** {@inheritDoc} */
-        @Override protected void allDone() {
-            onDone(size);
-        }
-    }
+        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+            cacheName = U.readString(in);
 
-    /**
-     * Cache clear future.
-     */
-    private static class ClearFuture extends RetryFuture {
-        /**
-         */
-        public ClearFuture(GridCacheContext ctx, TopologyVersionAwareCallable clearCall) {
-            super(ctx, clearCall);
-        }
+            int len = in.readInt();
 
-        /** {@inheritDoc} */
-        @Override protected void onInit() {
-           // No-op.
-        }
+            peekModes = new CachePeekMode[len];
 
-        /** {@inheritDoc} */
-        @Override protected void onLocal(Object localRes) {
-            // No-op.
+            for (int i = 0; i < len; i++)
+                peekModes[i] = CachePeekMode.fromOrdinal(in.readByte());
         }
 
         /** {@inheritDoc} */
-        @Override protected void allDone() {
-            onDone();
+        public String toString() {
+            return S.toString(SizeCallable.class, this);
         }
     }
 
     /**
-     * Retry future.
+     * Internal callable which performs {@link IgniteInternalCache#size()} or {@link IgniteInternalCache#primarySize()}
+     * operation on a cache with the given name.
      */
-    protected static abstract class RetryFuture<T> extends GridFutureAdapter<T> {
-        /** Context. */
-        private final GridCacheContext ctx;
+    @GridInternal
+    private static class GlobalSizeCallable implements IgniteClosure<Object, Integer>, Externalizable {
+        /** */
+        private static final long serialVersionUID = 0L;
 
-        /** Callable. */
-        private final TopologyVersionAwareCallable call;
+        /** Cache name. */
+        private String cacheName;
 
-        /** Max retries count before issuing an error. */
-        private volatile int retries = 32;
+        /** Primary only flag. */
+        private boolean primaryOnly;
+
+        /** Injected grid instance. */
+        @IgniteInstanceResource
+        private Ignite ignite;
 
         /**
+         * Empty constructor for serialization.
          */
-        public RetryFuture(GridCacheContext ctx, TopologyVersionAwareCallable call) {
-            this.ctx = ctx;
-            this.call = call;
-
-            init();
+        public GlobalSizeCallable() {
+            // No-op.
         }
 
         /**
-         * Init.
+         * @param cacheName Cache name.
+         * @param primaryOnly Primary only flag.
          */
-        private void init() {
-            Collection<ClusterNode> nodes = call.nodes(ctx);
-
-            call.topologyVersion(ctx.affinity().affinityTopologyVersion());
-
-            IgniteInternalFuture<Collection<Object>> fut = ctx.closures().callAsyncNoFailover(BROADCAST,
-                F.asSet((Callable<Object>)call), nodes, true);
-
-            fut.listen(new IgniteInClosure<IgniteInternalFuture<Collection<Object>>>() {
-                @Override public void apply(IgniteInternalFuture<Collection<Object>> fut) {
-                    try {
-                        Collection<Object> res = fut.get();
-
-                        onInit();
-
-                        for (Object locRes : res) {
-                            if (locRes == FAIL) {
-                                if (retries-- > 0)
-                                    init();
-                                else {
-                                    onDone(new ClusterTopologyException("Failed to wait topology."));
-
-                                    return;
-                                }
-                            }
+        private GlobalSizeCallable(String cacheName, boolean primaryOnly) {
+            this.cacheName = cacheName;
+            this.primaryOnly = primaryOnly;
+        }
 
-                            onLocal(locRes);
-                        }
+        /** {@inheritDoc} */
+        @Override public Integer apply(Object o) {
+            IgniteInternalCache<Object, Object> cache = ((IgniteEx)ignite).cachex(cacheName);
 
-                        allDone();
-                    }
-                    catch (IgniteCheckedException e) {
-                        if (X.hasCause(e, ClusterTopologyException.class)) {
-                            if (retries-- > 0)
-                                init();
-                            else
-                                onDone(e);
-                        }
-                        else
-                            onDone(e);
-                    }
-                }
-            });
+            return primaryOnly ? cache.primarySize() : cache.size();
         }
 
-        /**
-         * Init reducer.
-         */
-        protected abstract void onInit();
-
-        /**
-         * @param localRes Add local result to global result.
-         */
-        protected abstract void onLocal(Object localRes);
+        /** {@inheritDoc} */
+        @Override public void writeExternal(ObjectOutput out) throws IOException {
+            U.writeString(out, cacheName);
+            out.writeBoolean(primaryOnly);
+        }
 
-        /**
-         * On done.
-         */
-        protected abstract void allDone();
+        /** {@inheritDoc} */
+        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+            cacheName = U.readString(in);
+            primaryOnly = in.readBoolean();
+        }
     }
 
     /**
@@ -5665,89 +5697,4 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             metrics.addPutAndGetTimeNanos(System.nanoTime() - start);
         }
     }
-
-    /**
-     * Delayed callable class.
-     */
-    protected static abstract class TopologyVersionAwareCallable<K, V> implements Serializable, Callable<Object> {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** Injected grid instance. */
-        @IgniteInstanceResource
-        protected Ignite ignite;
-
-        /** Affinity topology version. */
-        protected AffinityTopologyVersion topVer;
-
-        /** Cache name. */
-        protected String cacheName;
-
-        /**
-         * Empty constructor for serialization.
-         */
-        public TopologyVersionAwareCallable() {
-            // No-op.
-        }
-
-        /**
-         * @param topVer Affinity topology version.
-         */
-        public TopologyVersionAwareCallable(String cacheName, AffinityTopologyVersion topVer) {
-            this.cacheName = cacheName;
-            this.topVer = topVer;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object call() throws Exception {
-            if (!compareTopologyVersions())
-                return FAIL;
-
-            Object res = callLocal();
-
-            if (!compareTopologyVersions())
-                return FAIL;
-            else
-                return res;
-        }
-
-        /**
-         * Call local.
-         *
-         * @return Local result.
-         * @throws IgniteCheckedException If failed.
-         */
-        protected abstract Object callLocal() throws IgniteCheckedException;
-
-        /**
-         * @param ctx Grid cache context.
-         * @return Nodes to call.
-         */
-        protected abstract Collection<ClusterNode> nodes(GridCacheContext ctx);
-
-        /**
-         * Compare topology versions.
-         */
-        public boolean compareTopologyVersions() {
-            GridCacheProcessor cacheProc = ((IgniteKernal) ignite).context().cache();
-
-            GridCacheAdapter<K, V> cacheAdapter = cacheProc.internalCache(cacheName);
-
-            if (cacheAdapter == null)
-                return false;
-
-            final GridCacheContext<K, V> ctx = cacheAdapter.context();
-
-            AffinityTopologyVersion locTopVer = ctx.affinity().affinityTopologyVersion();
-
-            return locTopVer.compareTo(topVer) == 0;
-        }
-
-        /**
-         * @param topVer Affinity topology version.
-         */
-        public void topologyVersion(AffinityTopologyVersion topVer) {
-            this.topVer = topVer;
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c4bc9297/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 77fa104..c0026ab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -124,9 +124,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     /** Must use JDK marshaller since it is used by discovery to fire custom events. */
     private Marshaller marshaller = new JdkMarshaller();
 
-    /** Count down latch for caches. */
-    private CountDownLatch cacheStartedLatch = new CountDownLatch(1);
-
     /**
      * @param ctx Kernal context.
      */
@@ -660,92 +657,87 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public void onKernalStart() throws IgniteCheckedException {
-        try {
-            if (ctx.config().isDaemon())
-                return;
+        if (ctx.config().isDaemon())
+            return;
 
-            ClusterNode locNode = ctx.discovery().localNode();
+        ClusterNode locNode = ctx.discovery().localNode();
 
-            // Init cache plugin managers.
-            final Map<String, CachePluginManager> cache2PluginMgr = new HashMap<>();
+        // Init cache plugin managers.
+        final Map<String, CachePluginManager> cache2PluginMgr = new HashMap<>();
 
-            for (DynamicCacheDescriptor desc : registeredCaches.values()) {
-                CacheConfiguration locCcfg = desc.cacheConfiguration();
+        for (DynamicCacheDescriptor desc : registeredCaches.values()) {
+            CacheConfiguration locCcfg = desc.cacheConfiguration();
 
-                CachePluginManager pluginMgr = new CachePluginManager(ctx, locCcfg);
+            CachePluginManager pluginMgr = new CachePluginManager(ctx, locCcfg);
 
-                cache2PluginMgr.put(locCcfg.getName(), pluginMgr);
-            }
+            cache2PluginMgr.put(locCcfg.getName(), pluginMgr);
+        }
 
-            if (!getBoolean(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK)) {
-                for (ClusterNode n : ctx.discovery().remoteNodes()) {
-                    checkTransactionConfiguration(n);
+        if (!getBoolean(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK)) {
+            for (ClusterNode n : ctx.discovery().remoteNodes()) {
+                checkTransactionConfiguration(n);
 
-                    DeploymentMode locDepMode = ctx.config().getDeploymentMode();
-                    DeploymentMode rmtDepMode = n.attribute(IgniteNodeAttributes.ATTR_DEPLOYMENT_MODE);
+                DeploymentMode locDepMode = ctx.config().getDeploymentMode();
+                DeploymentMode rmtDepMode = n.attribute(IgniteNodeAttributes.ATTR_DEPLOYMENT_MODE);
 
-                    CU.checkAttributeMismatch(log, null, n.id(), "deploymentMode", "Deployment mode",
-                        locDepMode, rmtDepMode, true);
+                CU.checkAttributeMismatch(log, null, n.id(), "deploymentMode", "Deployment mode",
+                    locDepMode, rmtDepMode, true);
 
-                    for (DynamicCacheDescriptor desc : registeredCaches.values()) {
-                        CacheConfiguration rmtCfg = desc.remoteConfiguration(n.id());
+                for (DynamicCacheDescriptor desc : registeredCaches.values()) {
+                    CacheConfiguration rmtCfg = desc.remoteConfiguration(n.id());
 
-                        if (rmtCfg != null) {
-                            CacheConfiguration locCfg = desc.cacheConfiguration();
+                    if (rmtCfg != null) {
+                        CacheConfiguration locCfg = desc.cacheConfiguration();
 
-                            checkCache(locCfg, rmtCfg, n);
+                        checkCache(locCfg, rmtCfg, n);
 
-                            // Check plugin cache configurations.
-                            CachePluginManager pluginMgr = cache2PluginMgr.get(locCfg.getName());
+                        // Check plugin cache configurations.
+                        CachePluginManager pluginMgr = cache2PluginMgr.get(locCfg.getName());
 
-                            assert pluginMgr != null : " Map=" + cache2PluginMgr;
+                        assert pluginMgr != null : " Map=" + cache2PluginMgr;
 
-                            pluginMgr.validateRemotes(rmtCfg, n);
-                        }
+                        pluginMgr.validateRemotes(rmtCfg, n);
                     }
                 }
             }
+        }
 
-            // Start dynamic caches received from collect discovery data.
-            for (DynamicCacheDescriptor desc : registeredCaches.values()) {
-                boolean started = desc.onStart();
+        // Start dynamic caches received from collect discovery data.
+        for (DynamicCacheDescriptor desc : registeredCaches.values()) {
+            boolean started = desc.onStart();
 
-                assert started : "Failed to change started flag for locally configured cache: " + desc;
+            assert started : "Failed to change started flag for locally configured cache: " + desc;
 
-                desc.clearRemoteConfigurations();
+            desc.clearRemoteConfigurations();
 
-                CacheConfiguration ccfg = desc.cacheConfiguration();
+            CacheConfiguration ccfg = desc.cacheConfiguration();
 
-                IgnitePredicate filter = ccfg.getNodeFilter();
+            IgnitePredicate filter = ccfg.getNodeFilter();
 
-                if (filter.apply(locNode)) {
-                    CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(ccfg);
+            if (filter.apply(locNode)) {
+                CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(ccfg);
 
-                    CachePluginManager pluginMgr = cache2PluginMgr.get(ccfg.getName());
+                CachePluginManager pluginMgr = cache2PluginMgr.get(ccfg.getName());
 
-                    assert pluginMgr != null : " Map=" + cache2PluginMgr;
+                assert pluginMgr != null : " Map=" + cache2PluginMgr;
 
-                    GridCacheContext ctx = createCache(ccfg, pluginMgr, desc.cacheType(), cacheObjCtx);
+                GridCacheContext ctx = createCache(ccfg, pluginMgr, desc.cacheType(), cacheObjCtx);
 
-                    ctx.dynamicDeploymentId(desc.deploymentId());
+                ctx.dynamicDeploymentId(desc.deploymentId());
 
-                    sharedCtx.addCacheContext(ctx);
+                sharedCtx.addCacheContext(ctx);
 
-                    GridCacheAdapter cache = ctx.cache();
+                GridCacheAdapter cache = ctx.cache();
 
-                    String name = ccfg.getName();
+                String name = ccfg.getName();
 
-                    caches.put(maskNull(name), cache);
+                caches.put(maskNull(name), cache);
 
-                    startCache(cache);
+                startCache(cache);
 
-                    jCacheProxies.put(maskNull(name), new IgniteCacheProxy(ctx, cache, null, false));
-                }
+                jCacheProxies.put(maskNull(name), new IgniteCacheProxy(ctx, cache, null, false));
             }
         }
-        finally {
-            cacheStartedLatch.countDown();
-        }
 
         ctx.marshallerContext().onMarshallerCacheStarted(ctx);
 
@@ -843,8 +835,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public void onKernalStop(boolean cancel) {
-        cacheStartedLatch.countDown();
-
         if (ctx.config().isDaemon())
             return;
 
@@ -2696,13 +2686,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         if (log.isDebugEnabled())
             log.debug("Getting internal cache adapter: " + name);
 
-        try {
-            cacheStartedLatch.await();
-        }
-        catch (InterruptedException e) {
-            throw new IgniteException("Failed to wait starting caches.");
-        }
-
         return (GridCacheAdapter<K, V>)caches.get(maskNull(name));
     }
 


[02/18] incubator-ignite git commit: timeouts for faster failure detection

Posted by ak...@apache.org.
timeouts for faster failure detection


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

Branch: refs/heads/ignite-844
Commit: da85b1136f6d2ef47f2a4f3e91a2aa6ba746b1b4
Parents: 11f4957
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Tue Apr 28 13:57:05 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Tue Apr 28 13:57:05 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/da85b113/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
index 6f41cb0..b0d8927 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
@@ -63,8 +63,8 @@ abstract class TcpDiscoverySpiAdapter extends IgniteSpiAdapter implements Discov
     /** Default value for thread priority (value is <tt>10</tt>). */
     public static final int DFLT_THREAD_PRI = 10;
 
-    /** Default heartbeat messages issuing frequency (value is <tt>500ms</tt>). */
-    public static final long DFLT_HEARTBEAT_FREQ = 500;
+    /** Default heartbeat messages issuing frequency (value is <tt>300ms</tt>). */
+    public static final long DFLT_HEARTBEAT_FREQ = 300;
 
     /** Default size of topology snapshots history. */
     public static final int DFLT_TOP_HISTORY_SIZE = 1000;


[17/18] incubator-ignite git commit: Merge branches 'ignite-844' and 'ignite-sprint-4' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-844

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


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

Branch: refs/heads/ignite-844
Commit: 0ad9b1b14151b1b92cf8499b309e668a36cfed59
Parents: 175aee2 c4bc929
Author: AKuznetsov <ak...@gridgain.com>
Authored: Mon May 4 15:36:46 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Mon May 4 15:36:46 2015 +0700

----------------------------------------------------------------------
 .../streaming/wordcount/CacheConfig.java        |  5 ---
 .../java/org/apache/ignite/IgniteCache.java     |  5 +++
 .../apache/ignite/lang/IgniteAsyncSupport.java  |  4 +-
 .../discovery/tcp/TcpClientDiscoverySpi.java    |  4 --
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  4 --
 .../discovery/tcp/TcpDiscoverySpiAdapter.java   |  8 ++--
 .../tcp/TcpClientDiscoverySelfTest.java         |  8 ++++
 pom.xml                                         | 39 +++++++++++++++++---
 8 files changed, 53 insertions(+), 24 deletions(-)
----------------------------------------------------------------------



[14/18] incubator-ignite git commit: # sprint-4 - Added javadoc for the withAsync method.

Posted by ak...@apache.org.
# sprint-4 - Added javadoc for the withAsync method.


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

Branch: refs/heads/ignite-844
Commit: 2cb73176d3a671cb2ac784310a4d36b2d03bad29
Parents: 601cf09
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Thu Apr 30 18:45:38 2015 -0700
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Thu Apr 30 18:45:38 2015 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2cb73176/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java b/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java
index 76ebcee..f5b5153 100644
--- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java
+++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java
@@ -22,7 +22,7 @@ package org.apache.ignite.lang;
  */
 public interface IgniteAsyncSupport {
     /**
-     * Gets component with asynchronous mode enabled.
+     * Gets instance of this component with asynchronous mode enabled.
      *
      * @return Component with asynchronous mode enabled.
      */


[05/18] incubator-ignite git commit: Merge branches 'ignite-752' and 'ignite-sprint-4' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-sprint-4

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


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

Branch: refs/heads/ignite-844
Commit: 49a992339a34e28b29dbbd84aa5dede1614eebb5
Parents: 7121619 e0648d6
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Apr 30 17:22:06 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Apr 30 17:22:06 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java      | 4 ----
 .../org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java | 4 ----
 .../ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java     | 8 ++++----
 .../ignite/spi/discovery/tcp/TcpClientDiscoverySelfTest.java | 8 ++++++++
 4 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------



[15/18] incubator-ignite git commit: # sprint-4 - Added javadoc for the withAsync method.

Posted by ak...@apache.org.
# sprint-4 - Added javadoc for the withAsync method.


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

Branch: refs/heads/ignite-844
Commit: 281f4ef208e7928c8514992458f34ab96781f671
Parents: 2cb7317
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Thu Apr 30 18:50:18 2015 -0700
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Thu Apr 30 18:50:18 2015 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/281f4ef2/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java b/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java
index f5b5153..be05a38 100644
--- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java
+++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupport.java
@@ -24,7 +24,7 @@ public interface IgniteAsyncSupport {
     /**
      * Gets instance of this component with asynchronous mode enabled.
      *
-     * @return Component with asynchronous mode enabled.
+     * @return Instance of this component with asynchronous mode enabled.
      */
     public IgniteAsyncSupport withAsync();
 


[12/18] incubator-ignite git commit: # sprint-4 - Added javadoc for the close method.

Posted by ak...@apache.org.
# sprint-4 - Added javadoc for the close method.


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

Branch: refs/heads/ignite-844
Commit: f298d7216a81b0416c1cf123efd99fcff2d41e19
Parents: 09a33fe
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Thu Apr 30 18:28:44 2015 -0700
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Thu Apr 30 18:28:44 2015 -0700

----------------------------------------------------------------------
 .../apache/ignite/examples/streaming/wordcount/CacheConfig.java | 5 -----
 modules/core/src/main/java/org/apache/ignite/IgniteCache.java   | 5 +++++
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f298d721/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/CacheConfig.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/CacheConfig.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/CacheConfig.java
index bb2a18e..58704ca 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/CacheConfig.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/CacheConfig.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.examples.streaming.wordcount;
 
 import org.apache.ignite.cache.affinity.*;
-import org.apache.ignite.cache.eviction.fifo.*;
 import org.apache.ignite.configuration.*;
 
 import javax.cache.configuration.*;
@@ -44,10 +43,6 @@ public class CacheConfig {
         // Sliding window of 1 seconds.
         cfg.setExpiryPolicyFactory(FactoryBuilder.factoryOf(new CreatedExpiryPolicy(new Duration(SECONDS, 1))));
 
-        // Do not allow more than 1 million entries.
-        // Allows to run this example with smaller available memory.
-        cfg.setEvictionPolicy(new FifoEvictionPolicy<>(1_000_000));
-
         return cfg;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f298d721/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index d99902a..bf4080a 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -499,6 +499,11 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
         CacheEntryProcessor<K, V, T> entryProcessor, Object... args);
 
     /**
+     * Completely deletes the cache with all its data from the system.
+     */
+    @Override void close();
+
+    /**
      * This cache node to re-balance its partitions. This method is usually used when
      * {@link CacheConfiguration#getRebalanceDelay()} configuration parameter has non-zero value.
      * When many nodes are started or stopped almost concurrently, it is more efficient to delay


[06/18] incubator-ignite git commit: deploy to site disabled

Posted by ak...@apache.org.
deploy to site disabled


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

Branch: refs/heads/ignite-844
Commit: ea91d220928a0ebb215500141d298059d5547320
Parents: 7121619
Author: avinogradov <av...@gridgain.com>
Authored: Thu Apr 30 18:10:29 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Thu Apr 30 18:10:29 2015 +0300

----------------------------------------------------------------------
 pom.xml | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea91d220/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 98541ef..181540b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -577,29 +577,29 @@
                         </executions>
                     </plugin>
 
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-site-plugin</artifactId>
-                        <version>3.4</version>
-                        <dependencies>
-                            <dependency>
-                                <groupId>org.apache.maven.wagon</groupId>
-                                <artifactId>wagon-ssh</artifactId>
-                                <version>2.8</version>
-                            </dependency>
-                        </dependencies>
-                        <executions>
-                            <execution>
-                                <goals>
-                                    <goal>deploy</goal>
-                                </goals>
-                                <phase>deploy</phase>
-                                <configuration>
-                                    <inputDirectory>${basedir}/target/site</inputDirectory>
-                                </configuration>
-                            </execution>
-                        </executions>
-                    </plugin>
+                    <!--<plugin>-->
+                        <!--<groupId>org.apache.maven.plugins</groupId>-->
+                        <!--<artifactId>maven-site-plugin</artifactId>-->
+                        <!--<version>3.4</version>-->
+                        <!--<dependencies>-->
+                            <!--<dependency>-->
+                                <!--<groupId>org.apache.maven.wagon</groupId>-->
+                                <!--<artifactId>wagon-ssh</artifactId>-->
+                                <!--<version>2.8</version>-->
+                            <!--</dependency>-->
+                        <!--</dependencies>-->
+                        <!--<executions>-->
+                            <!--<execution>-->
+                                <!--<goals>-->
+                                    <!--<goal>deploy</goal>-->
+                                <!--</goals>-->
+                                <!--<phase>deploy</phase>-->
+                                <!--<configuration>-->
+                                    <!--<inputDirectory>${basedir}/target/site</inputDirectory>-->
+                                <!--</configuration>-->
+                            <!--</execution>-->
+                        <!--</executions>-->
+                    <!--</plugin>-->
                 </plugins>
             </build>
         </profile>


[11/18] incubator-ignite git commit: src-release zip fix

Posted by ak...@apache.org.
src-release zip fix


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

Branch: refs/heads/ignite-844
Commit: 09a33fe39b734f43767fd8ed9bbe2f1275f18324
Parents: 44b00ea
Author: Anton Vinogradov <av...@gridgain.com>
Authored: Thu Apr 30 23:32:41 2015 +0300
Committer: Anton Vinogradov <av...@gridgain.com>
Committed: Thu Apr 30 23:32:41 2015 +0300

----------------------------------------------------------------------
 pom.xml | 39 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 34 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/09a33fe3/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 98541ef..c859021 100644
--- a/pom.xml
+++ b/pom.xml
@@ -467,6 +467,35 @@
             <build>
                 <plugins>
                     <plugin>
+                        <artifactId>maven-assembly-plugin</artifactId>
+                        <dependencies>
+                            <dependency>
+                                <groupId>org.apache.apache.resources</groupId>
+                                <artifactId>apache-source-release-assembly-descriptor</artifactId>
+                                <version>1.0.4</version>
+                            </dependency>
+                        </dependencies>
+                        <executions>
+                            <execution>
+                                <id>source-release-assembly</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>single</goal>
+                                </goals>
+                                <configuration>
+                                    <runOnlyAtExecutionRoot>true</runOnlyAtExecutionRoot>
+                                    <descriptorRefs>
+                                        <descriptorRef>${sourceReleaseAssemblyDescriptor}</descriptorRef>
+                                    </descriptorRefs>
+                                    <tarLongFileMode>gnu</tarLongFileMode>
+                                    <finalName>incubator-ignite-${project.version}-src</finalName>
+                                    <appendAssemblyId>false</appendAssemblyId>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+
+                    <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-antrun-plugin</artifactId>
                         <executions>
@@ -533,7 +562,7 @@
                                 <fileSet>
                                     <directory>${basedir}/target</directory>
                                     <includes>
-                                        <include>${project.artifactId}-${project.version}-source-release.zip</include>
+                                        <include>incubator-ignite-${project.version}-src.zip</include>
                                         <include>bin/*.zip</include>
                                     </includes>
                                 </fileSet>
@@ -561,10 +590,10 @@
                                     <failOnError>false</failOnError>
                                     <target>
                                         <mkdir dir="${basedir}/target/site" />
-                                        <copy file="${basedir}/target/${project.artifactId}-${project.version}-source-release.zip" tofile="${basedir}/target/site/incubator-ignite-${project.version}-src.zip" failonerror="false" />
-                                        <copy file="${basedir}/target/${project.artifactId}-${project.version}-source-release.zip.asc" tofile="${basedir}/target/site/incubator-ignite-${project.version}-src.zip.asc" failonerror="false" />
-                                        <copy file="${basedir}/target/${project.artifactId}-${project.version}-source-release.zip.md5" tofile="${basedir}/target/site/incubator-ignite-${project.version}-src.zip.md5" failonerror="false" />
-                                        <copy file="${basedir}/target/${project.artifactId}-${project.version}-source-release.zip.sha1" tofile="${basedir}/target/site/incubator-ignite-${project.version}-src.zip.sha1" failonerror="false" />
+                                        <copy file="${basedir}/target/incubator-ignite-${project.version}-src.zip" tofile="${basedir}/target/site/incubator-ignite-${project.version}-src.zip" failonerror="false" />
+                                        <copy file="${basedir}/target/incubator-ignite-${project.version}-src.zip.asc" tofile="${basedir}/target/site/incubator-ignite-${project.version}-src.zip.asc" failonerror="false" />
+                                        <copy file="${basedir}/target/incubator-ignite-${project.version}-src.zip.md5" tofile="${basedir}/target/site/incubator-ignite-${project.version}-src.zip.md5" failonerror="false" />
+                                        <copy file="${basedir}/target/incubator-ignite-${project.version}-src.zip.sha1" tofile="${basedir}/target/site/incubator-ignite-${project.version}-src.zip.sha1" failonerror="false" />
                                         <copy todir="${basedir}/target/site">
                                             <fileset dir="${basedir}/target/bin">
                                                 <include name="**/*" />


[04/18] incubator-ignite git commit: minor

Posted by ak...@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/e0648d68
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e0648d68
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e0648d68

Branch: refs/heads/ignite-844
Commit: e0648d68781e3906b66f3c876fef59bc4141454e
Parents: f6ac27a
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Apr 30 17:18:44 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Apr 30 17:18:44 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/TcpClientDiscoverySelfTest.java | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e0648d68/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySelfTest.java
index 09cbd97..0c9f2f2 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySelfTest.java
@@ -275,9 +275,12 @@ public class TcpClientDiscoverySelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * TODO: IGNITE-587.
      * @throws Exception If failed.
      */
     public void testClientReconnect() throws Exception {
+        fail("ignite-587");
+
         clientsPerSrv = 1;
 
         startServerNodes(3);
@@ -318,9 +321,12 @@ public class TcpClientDiscoverySelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * TODO: IGNITE-587.
      * @throws Exception If failed.
      */
     public void testClientNodeLeaveOneServer() throws Exception {
+        fail("ignite-587");
+
         startServerNodes(1);
         startClientNodes(1);
 
@@ -430,6 +436,8 @@ public class TcpClientDiscoverySelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testDataExchangeFromClient() throws Exception {
+        fail("ignite-587");
+
         testDataExchange("client-0");
     }
 


[18/18] incubator-ignite git commit: IGNITE-844 Added tests for SQL queries on cache with type metadata.

Posted by ak...@apache.org.
IGNITE-844 Added tests for SQL queries on cache with type metadata.


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

Branch: refs/heads/ignite-844
Commit: e7f3f96db244a91dad2f7b50850df5941dc082cb
Parents: 0ad9b1b
Author: AKuznetsov <ak...@gridgain.com>
Authored: Mon May 4 16:06:49 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Mon May 4 16:06:49 2015 +0700

----------------------------------------------------------------------
 ...eCacheAtomicFieldsQueryTypeMetaSelfTest.java | 59 +++++++++++++++
 ...cNearEnabledFieldsQueryTypeMetaSelfTest.java | 30 ++++++++
 ...edFieldsQueryP2PEnabledTypeMetaSelfTest.java | 34 +++++++++
 ...ePartitionedFieldsQueryTypeMetaSelfTest.java | 56 ++++++++++++++
 ...edFieldsQueryP2PEnabledTypeMetaSelfTest.java | 34 +++++++++
 ...heReplicatedFieldsQueryTypeMetaSelfTest.java | 79 ++++++++++++++++++++
 ...teCacheLocalFieldsQueryTypeMetaSelfTest.java | 38 ++++++++++
 ...cheLocalFieldsQueryTypeMetadataSelfTest.java | 38 ----------
 .../IgniteCacheQuerySelfTestSuite.java          | 12 ++-
 9 files changed, 341 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e7f3f96d/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheAtomicFieldsQueryTypeMetaSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheAtomicFieldsQueryTypeMetaSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheAtomicFieldsQueryTypeMetaSelfTest.java
new file mode 100644
index 0000000..fb41a4d
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheAtomicFieldsQueryTypeMetaSelfTest.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.near;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.typedef.*;
+
+import java.util.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+
+/**
+ * Tests for fields queries.
+ */
+public class IgniteCacheAtomicFieldsQueryTypeMetaSelfTest extends IgniteCachePartitionedFieldsQueryTypeMetaSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return ATOMIC;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected NearCacheConfiguration nearConfiguration() {
+        return null;
+    }
+
+    /**
+     *
+     */
+    public void testUnsupportedOperations() {
+        try {
+            QueryCursor<List<?>> qry = grid(0).cache(null).query(new SqlFieldsQuery(
+                "update Person set name = ?").setArgs("Mary Poppins"));
+
+            qry.getAll();
+
+            fail("We don't support updates.");
+        }
+        catch (Exception e) {
+            X.println("___ " + e.getMessage());
+        }
+    }
+}

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

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e7f3f96d/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedFieldsQueryP2PEnabledTypeMetaSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedFieldsQueryP2PEnabledTypeMetaSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedFieldsQueryP2PEnabledTypeMetaSelfTest.java
new file mode 100644
index 0000000..7ed8f9b
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedFieldsQueryP2PEnabledTypeMetaSelfTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.near;
+
+import org.apache.ignite.configuration.*;
+
+/**
+ * Tests for fields queries.
+ */
+public class IgniteCachePartitionedFieldsQueryP2PEnabledTypeMetaSelfTest extends IgniteCachePartitionedFieldsQueryTypeMetaSelfTest {
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration c = super.getConfiguration(gridName);
+
+        c.setPeerClassLoadingEnabled(true);
+
+        return c;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e7f3f96d/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedFieldsQueryTypeMetaSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedFieldsQueryTypeMetaSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedFieldsQueryTypeMetaSelfTest.java
new file mode 100644
index 0000000..468ed4c
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedFieldsQueryTypeMetaSelfTest.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.near;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.jetbrains.annotations.*;
+
+import static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * Tests for fields queries.
+ */
+public class IgniteCachePartitionedFieldsQueryTypeMetaSelfTest extends IgniteCacheAbstractFieldsQueryTypeMetaSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return PARTITIONED;
+    }
+
+    /**
+     * @return Distribution.
+     */
+    protected NearCacheConfiguration nearConfiguration() {
+        return new NearCacheConfiguration();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 3;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheConfiguration cache(@Nullable String name, boolean primitives) {
+        CacheConfiguration cc = super.cache(name, primitives);
+
+        cc.setNearConfiguration(nearConfiguration());
+
+        return cc;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e7f3f96d/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQueryP2PEnabledTypeMetaSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQueryP2PEnabledTypeMetaSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQueryP2PEnabledTypeMetaSelfTest.java
new file mode 100644
index 0000000..7204589
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQueryP2PEnabledTypeMetaSelfTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.replicated;
+
+import org.apache.ignite.configuration.*;
+
+/**
+ * Tests for fields queries.
+ */
+public class IgniteCacheReplicatedFieldsQueryP2PEnabledTypeMetaSelfTest extends IgniteCacheReplicatedFieldsQueryTypeMetaSelfTest {
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration c = super.getConfiguration(gridName);
+
+        c.setPeerClassLoadingEnabled(true);
+
+        return c;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e7f3f96d/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQueryTypeMetaSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQueryTypeMetaSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQueryTypeMetaSelfTest.java
new file mode 100644
index 0000000..cb4aa90
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQueryTypeMetaSelfTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.replicated;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.query.*;
+import org.apache.ignite.testframework.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+
+import static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * Tests for fields queries.
+ */
+public class IgniteCacheReplicatedFieldsQueryTypeMetaSelfTest extends IgniteCacheAbstractFieldsQueryTypeMetaSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return REPLICATED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 3;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testLostIterator() throws Exception {
+        IgniteCache<Object, Object> cache = grid(0).cache(null);
+
+        QueryCursor<List<?>> qry = null;
+
+        int maximumQueryIteratorCount = GridCacheQueryManager.MAX_ITERATORS;
+
+        for (int i = 0; i < maximumQueryIteratorCount + 1; i++) {
+            QueryCursor<List<?>> q = cache
+               .query(new SqlFieldsQuery("select _key from Integer where _key >= 0 order by _key"));
+
+            assertEquals(0, q.iterator().next().get(0));
+
+            if (qry == null)
+                qry = q;
+        }
+
+        final QueryCursor<List<?>> qry0 = qry;
+
+        GridTestUtils.assertThrows(log, new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                int i = 0;
+
+                for (List<?> row : qry0)
+                    assertEquals(++i % 50, row.get(0));
+
+                return null;
+            }
+        }, IgniteException.class, null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e7f3f96d/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/local/IgniteCacheLocalFieldsQueryTypeMetaSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/local/IgniteCacheLocalFieldsQueryTypeMetaSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/local/IgniteCacheLocalFieldsQueryTypeMetaSelfTest.java
new file mode 100644
index 0000000..3106c82
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/local/IgniteCacheLocalFieldsQueryTypeMetaSelfTest.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.internal.processors.cache.local;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.internal.processors.cache.*;
+
+import static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * Tests for fields queries.
+ */
+public class IgniteCacheLocalFieldsQueryTypeMetaSelfTest extends IgniteCacheAbstractFieldsQueryTypeMetaSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return LOCAL;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 1;
+    }
+}

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

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e7f3f96d/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 ce05980..467ab90 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
@@ -70,7 +70,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
         suite.addTestSuite(GridCacheQuerySerializationSelfTest.class);
 
 
-        // Fields queries.
+        // Fields queries with indexed types.
         suite.addTestSuite(IgniteCacheLocalFieldsQuerySelfTest.class);
         suite.addTestSuite(IgniteCacheReplicatedFieldsQuerySelfTest.class);
         suite.addTestSuite(IgniteCacheReplicatedFieldsQueryP2PEnabledSelfTest.class);
@@ -80,6 +80,16 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
         suite.addTestSuite(IgniteCachePartitionedFieldsQueryP2PEnabledSelfTest.class);
         suite.addTestSuite(IgniteCacheFieldsQueryNoDataSelfTest.class);
 
+        // Fields queries with cache type metadata.
+        suite.addTestSuite(IgniteCacheLocalFieldsQueryTypeMetaSelfTest.class);
+        suite.addTestSuite(IgniteCacheReplicatedFieldsQueryTypeMetaSelfTest.class);
+        suite.addTestSuite(IgniteCacheReplicatedFieldsQueryP2PEnabledTypeMetaSelfTest.class);
+        suite.addTestSuite(IgniteCachePartitionedFieldsQueryTypeMetaSelfTest.class);
+        suite.addTestSuite(IgniteCacheAtomicFieldsQueryTypeMetaSelfTest.class);
+        suite.addTestSuite(IgniteCacheAtomicNearEnabledFieldsQueryTypeMetaSelfTest.class);
+        suite.addTestSuite(IgniteCachePartitionedFieldsQueryP2PEnabledTypeMetaSelfTest.class);
+        suite.addTestSuite(IgniteCacheFieldsQueryNoDataSelfTest.class);
+
         // Continuous queries.
         suite.addTestSuite(GridCacheContinuousQueryLocalSelfTest.class);
         suite.addTestSuite(GridCacheContinuousQueryLocalAtomicSelfTest.class);


[07/18] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-4' into ignite-sprint-4

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


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

Branch: refs/heads/ignite-844
Commit: 0885ac0565c798a9f4a9b82897deb002d19ee47e
Parents: ea91d22 49a9923
Author: avinogradov <av...@gridgain.com>
Authored: Thu Apr 30 18:10:53 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Thu Apr 30 18:10:53 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java      | 4 ----
 .../org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java | 4 ----
 .../ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java     | 8 ++++----
 .../ignite/spi/discovery/tcp/TcpClientDiscoverySelfTest.java | 8 ++++++++
 4 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------



[03/18] incubator-ignite git commit: Merge branches 'ignite-752' and 'ignite-sprint-4' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-752

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


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

Branch: refs/heads/ignite-844
Commit: f6ac27a35fe379b8024c824f00d3ce3f84d631fb
Parents: da85b11 ee5bae9
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Apr 30 12:51:56 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Apr 30 12:51:56 2015 +0300

----------------------------------------------------------------------
 DEVNOTES.txt                                    |   2 +-
 RELEASE_NOTES.txt                               |  13 +-
 .../spi/checkpoint/s3/S3CheckpointSpi.java      |   2 +-
 .../clients/src/test/resources/spring-cache.xml |   4 +-
 .../src/test/resources/spring-server-node.xml   |   4 +-
 .../test/resources/spring-server-ssl-node.xml   |   4 +-
 modules/cloud/README.txt                        |  32 ++
 modules/cloud/licenses/apache-2.0.txt           | 202 +++++++
 modules/cloud/pom.xml                           | 106 ++++
 .../cloud/TcpDiscoveryCloudIpFinder.java        | 433 +++++++++++++++
 .../tcp/ipfinder/cloud/package-info.java        |  21 +
 .../TcpDiscoveryCloudIpFinderSelfTest.java      | 124 +++++
 .../tcp/ipfinder/cloud/package-info.java        |  22 +
 .../ignite/testsuites/IgniteCloudTestSuite.java | 112 ++++
 .../ignite/codegen/MessageCodeGenerator.java    |  26 +-
 .../java/org/apache/ignite/IgniteLogger.java    |   8 +-
 .../java/org/apache/ignite/IgniteServices.java  |   2 +-
 .../main/java/org/apache/ignite/Ignition.java   |   2 +-
 .../eviction/sorted/SortedEvictionPolicy.java   |   2 +-
 .../configuration/CacheConfiguration.java       | 259 +++++++--
 .../configuration/ConnectorConfiguration.java   |   2 +-
 .../configuration/IgniteConfiguration.java      | 346 +++++++++---
 .../ignite/internal/GridDirectCollection.java   |   3 +
 .../ignite/internal/GridUpdateNotifier.java     |  66 ++-
 .../ignite/internal/IgniteComponentType.java    |  36 +-
 .../apache/ignite/internal/IgniteKernal.java    |  83 ++-
 .../org/apache/ignite/internal/IgnitionEx.java  |  17 +-
 .../internal/cluster/ClusterGroupAdapter.java   |  16 +
 .../managers/communication/GridIoManager.java   |  36 +-
 .../communication/GridIoMessageFactory.java     |   8 +
 .../deployment/GridDeploymentManager.java       |   2 +-
 .../GridDeploymentPerVersionStore.java          |   3 +-
 .../managers/indexing/GridIndexingManager.java  |  14 +-
 .../processors/cache/CacheObjectImpl.java       |   2 +-
 .../processors/cache/GridCacheMapEntry.java     |   9 +-
 .../processors/cache/GridCacheMvccManager.java  |   2 +-
 .../processors/cache/GridCacheProcessor.java    |   3 +-
 .../cache/GridCacheSharedContext.java           |   2 +-
 .../processors/cache/GridCacheSwapManager.java  |  35 +-
 .../processors/cache/IgniteCacheProxy.java      |  10 +-
 ...ridCacheOptimisticCheckPreparedTxFuture.java |  59 +-
 .../distributed/dht/GridDhtLockFuture.java      |  18 +-
 .../distributed/dht/GridDhtLockRequest.java     |  38 +-
 .../distributed/dht/GridDhtTxFinishFuture.java  | 102 +++-
 .../cache/distributed/dht/GridDhtTxLocal.java   |   6 +
 .../distributed/dht/GridDhtTxLocalAdapter.java  |  23 +
 .../cache/distributed/dht/GridDhtTxRemote.java  |   7 +
 .../dht/preloader/GridDhtPreloader.java         |   2 +-
 .../distributed/near/GridNearLockRequest.java   |  54 +-
 .../cache/distributed/near/GridNearTxLocal.java |   6 +
 .../cache/query/GridCacheQueryManager.java      |  22 +-
 .../cache/query/GridCacheSqlQuery.java          | 135 ++++-
 .../cache/query/GridCacheTwoStepQuery.java      |   8 +-
 .../cache/transactions/IgniteInternalTx.java    |   5 +
 .../cache/transactions/IgniteTxAdapter.java     |  10 +
 .../cache/transactions/IgniteTxHandler.java     |  57 +-
 .../cache/transactions/IgniteTxManager.java     | 117 +++-
 .../processors/query/GridQueryIndexing.java     |  19 +-
 .../processors/query/GridQueryProcessor.java    |  78 ++-
 .../messages/GridQueryNextPageResponse.java     |  68 ++-
 .../h2/twostep/messages/GridQueryRequest.java   |  21 +-
 .../ignite/internal/util/GridJavaProcess.java   |   4 +
 .../util/spring/IgniteSpringHelper.java         |   4 +-
 .../util/tostring/GridToStringBuilder.java      |   2 +-
 .../visor/cache/VisorCacheConfiguration.java    |   7 -
 .../internal/visor/cache/VisorCacheMetrics.java |  53 +-
 .../cache/VisorCacheNearConfiguration.java      |   4 +-
 .../visor/cache/VisorCacheNodesTask.java        |  74 +++
 .../visor/cache/VisorCacheStartTask.java        | 155 ++++++
 .../cache/VisorCacheStoreConfiguration.java     |  35 --
 .../cache/VisorCacheTypeFieldMetadata.java      |  36 +-
 .../visor/cache/VisorCacheTypeMetadata.java     |  99 +---
 .../internal/visor/igfs/VisorIgfsMetrics.java   | 128 +----
 .../node/VisorNodeEventsCollectorTask.java      |  58 +-
 .../internal/visor/query/VisorQueryArg.java     |  19 +-
 .../internal/visor/query/VisorQueryCursor.java  |   1 -
 .../internal/visor/query/VisorQueryJob.java     |   9 +-
 .../internal/visor/query/VisorQueryTask.java    |  41 --
 .../internal/visor/util/VisorEventMapper.java   |  13 +
 .../internal/visor/util/VisorTaskUtils.java     |  12 +-
 .../apache/ignite/logger/java/JavaLogger.java   |  12 +-
 .../apache/ignite/marshaller/Marshaller.java    |  14 +-
 .../ignite/marshaller/jdk/JdkMarshaller.java    |  10 +-
 .../optimized/OptimizedMarshaller.java          |   8 +-
 .../apache/ignite/resources/LoggerResource.java |   2 +-
 .../apache/ignite/resources/SpringResource.java |   2 +-
 .../org/apache/ignite/services/Service.java     |   2 +-
 .../ignite/services/ServiceConfiguration.java   |   2 +-
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |  19 +-
 .../checkpoint/cache/CacheCheckpointSpi.java    |   2 +-
 .../spi/checkpoint/jdbc/JdbcCheckpointSpi.java  |   2 +-
 .../sharedfs/SharedFsCheckpointSpi.java         |   4 +-
 .../fifoqueue/FifoQueueCollisionSpi.java        |  10 +-
 .../jobstealing/JobStealingCollisionSpi.java    |  14 +-
 .../PriorityQueueCollisionSpi.java              |   6 +-
 .../communication/tcp/TcpCommunicationSpi.java  |  12 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  10 +-
 .../discovery/tcp/TcpDiscoverySpiAdapter.java   |  10 +-
 .../memory/MemoryEventStorageSpi.java           |  10 +-
 .../spi/failover/always/AlwaysFailoverSpi.java  |  10 +-
 .../jobstealing/JobStealingFailoverSpi.java     |   6 +-
 .../spi/failover/never/NeverFailoverSpi.java    |   8 +-
 .../apache/ignite/spi/indexing/IndexingSpi.java |   4 +-
 .../adaptive/AdaptiveLoadBalancingSpi.java      |  12 +-
 .../roundrobin/RoundRobinLoadBalancingSpi.java  |  10 +-
 .../WeightedRandomLoadBalancingSpi.java         |  10 +-
 .../spi/swapspace/file/FileSwapSpaceSpi.java    |  10 +-
 .../resources/META-INF/classnames.properties    |  13 +
 .../core/src/main/resources/ignite.properties   |   2 +-
 .../src/test/config/load/merge-sort-base.xml    |   2 +-
 .../internal/GridUpdateNotifierSelfTest.java    |  13 +-
 ...ProjectionForCachesOnDaemonNodeSelfTest.java | 147 +++++
 .../cache/IgniteCachePutAllRestartTest.java     | 203 +++++++
 .../cache/IgniteCacheTxPreloadNoWriteTest.java  |  29 +-
 ...CacheLoadingConcurrentGridStartSelfTest.java | 154 ++++++
 ...GridCacheLoadingConcurrentGridStartTest.java | 154 ------
 .../distributed/GridCacheLockAbstractTest.java  |  75 +++
 ...xOriginatingNodeFailureAbstractSelfTest.java |   6 +-
 ...cOriginatingNodeFailureAbstractSelfTest.java |   7 +-
 ...itionedTxOriginatingNodeFailureSelfTest.java |   2 -
 .../near/IgniteCacheNearTxRollbackTest.java     | 133 +++++
 .../DataStreamerMultiThreadedSelfTest.java      |   2 +
 .../logger/java/IgniteJavaLoggerTest.java       |  65 ---
 .../ignite/logger/java/JavaLoggerTest.java      |  65 +++
 .../junits/logger/GridTestLog4jLogger.java      |  10 +-
 .../ignite/testsuites/IgniteBasicTestSuite.java |   2 +
 .../IgniteCacheFailoverTestSuite.java           |   8 +-
 .../testsuites/IgniteCacheRestartTestSuite.java |   3 +-
 .../ignite/testsuites/IgniteCacheTestSuite.java |   2 +-
 .../testsuites/IgniteLoggingSelfTestSuite.java  |   2 +-
 modules/gce/README.txt                          |  32 ++
 modules/gce/licenses/apache-2.0.txt             | 202 +++++++
 modules/gce/pom.xml                             |  92 ++++
 .../gce/TcpDiscoveryGoogleStorageIpFinder.java  | 380 +++++++++++++
 .../tcp/ipfinder/gce/package-info.java          |  22 +
 ...pDiscoveryGoogleStorageIpFinderSelfTest.java |  73 +++
 .../tcp/ipfinder/gce/package-info.java          |  22 +
 .../ignite/testsuites/IgniteGCETestSuite.java   |  71 +++
 .../processors/hadoop/HadoopProcessor.java      |   2 +-
 .../processors/query/h2/IgniteH2Indexing.java   | 169 +++++-
 .../query/h2/opt/GridH2AbstractKeyValueRow.java |  92 +---
 .../query/h2/opt/GridH2KeyValueRowOffheap.java  |   7 +-
 .../query/h2/opt/GridH2KeyValueRowOnheap.java   |   6 +-
 .../query/h2/opt/GridH2RowDescriptor.java       |  14 +-
 .../processors/query/h2/opt/GridH2Table.java    |  10 +-
 .../query/h2/opt/GridH2ValueCacheObject.java    | 191 +++++++
 .../query/h2/opt/GridLuceneIndex.java           |  84 ++-
 .../query/h2/twostep/GridMapQueryExecutor.java  |  21 +-
 .../query/h2/twostep/GridMergeIndex.java        |   6 +-
 .../h2/twostep/GridMergeIndexUnsorted.java      |   4 +-
 .../h2/twostep/GridReduceQueryExecutor.java     |  13 +-
 .../query/h2/twostep/GridResultPage.java        |  80 ++-
 .../query/h2/twostep/msg/GridH2Array.java       | 124 +++++
 .../query/h2/twostep/msg/GridH2Boolean.java     | 112 ++++
 .../query/h2/twostep/msg/GridH2Byte.java        | 113 ++++
 .../query/h2/twostep/msg/GridH2Bytes.java       | 113 ++++
 .../query/h2/twostep/msg/GridH2CacheObject.java | 148 +++++
 .../query/h2/twostep/msg/GridH2Date.java        | 115 ++++
 .../query/h2/twostep/msg/GridH2Decimal.java     | 134 +++++
 .../query/h2/twostep/msg/GridH2Double.java      | 113 ++++
 .../query/h2/twostep/msg/GridH2Float.java       | 113 ++++
 .../query/h2/twostep/msg/GridH2Geometry.java    | 134 +++++
 .../query/h2/twostep/msg/GridH2Integer.java     | 113 ++++
 .../query/h2/twostep/msg/GridH2JavaObject.java  | 113 ++++
 .../query/h2/twostep/msg/GridH2Long.java        | 113 ++++
 .../query/h2/twostep/msg/GridH2Null.java        |  78 +++
 .../query/h2/twostep/msg/GridH2Short.java       | 113 ++++
 .../query/h2/twostep/msg/GridH2String.java      | 115 ++++
 .../query/h2/twostep/msg/GridH2Time.java        | 116 ++++
 .../query/h2/twostep/msg/GridH2Timestamp.java   | 133 +++++
 .../query/h2/twostep/msg/GridH2Uuid.java        | 133 +++++
 .../h2/twostep/msg/GridH2ValueMessage.java      |  49 ++
 .../twostep/msg/GridH2ValueMessageFactory.java  | 201 +++++++
 .../IgniteCacheQueryMultiThreadedSelfTest.java  |   6 +-
 .../h2/GridIndexingSpiAbstractSelfTest.java     | 130 ++++-
 .../ignite/logger/jcl/IgniteJclLogger.java      | 167 ------
 .../org/apache/ignite/logger/jcl/JclLogger.java | 167 ++++++
 .../ignite/logger/jcl/IgniteJclLoggerTest.java  |  48 --
 .../apache/ignite/logger/jcl/JclLoggerTest.java |  48 ++
 .../ignite/testsuites/IgniteJclTestSuite.java   |   2 +-
 .../apache/ignite/logger/log4j/Log4JLogger.java |   8 +-
 .../ignite/logger/slf4j/GridSlf4jLogger.java    | 138 -----
 .../apache/ignite/logger/slf4j/Slf4jLogger.java | 138 +++++
 .../util/spring/IgniteSpringHelperImpl.java     |   2 +-
 ...gniteProjectionStartStopRestartSelfTest.java |  26 +-
 .../spi/deployment/uri/UriDeploymentSpi.java    |   2 +-
 .../ignite/visor/commands/VisorConsole.scala    | 314 ++++++-----
 .../visor/commands/VisorConsoleCommand.scala    |  77 ---
 .../ignite/visor/commands/VisorTextTable.scala  | 539 ------------------
 .../visor/commands/ack/VisorAckCommand.scala    |  42 +-
 .../commands/alert/VisorAlertCommand.scala      |  35 +-
 .../commands/cache/VisorCacheClearCommand.scala |  51 +-
 .../commands/cache/VisorCacheCommand.scala      |  36 +-
 .../commands/cache/VisorCacheScanCommand.scala  |  60 +-
 .../commands/cache/VisorCacheStopCommand.scala  |  30 +-
 .../commands/cache/VisorCacheSwapCommand.scala  |  66 +--
 .../commands/common/VisorConsoleCommand.scala   |  90 +++
 .../visor/commands/common/VisorTextTable.scala  | 543 +++++++++++++++++++
 .../config/VisorConfigurationCommand.scala      | 439 +++++++--------
 .../commands/deploy/VisorDeployCommand.scala    |  47 +-
 .../commands/disco/VisorDiscoveryCommand.scala  |  58 +-
 .../commands/events/VisorEventsCommand.scala    | 338 +++++-------
 .../visor/commands/gc/VisorGcCommand.scala      | 130 ++---
 .../visor/commands/kill/VisorKillCommand.scala  |  53 +-
 .../visor/commands/node/VisorNodeCommand.scala  |  47 +-
 .../visor/commands/ping/VisorPingCommand.scala  |  41 +-
 .../commands/start/VisorStartCommand.scala      |  34 +-
 .../commands/tasks/VisorTasksCommand.scala      |  76 +--
 .../commands/top/VisorTopologyCommand.scala     |  36 +-
 .../visor/commands/vvm/VisorVvmCommand.scala    |  32 +-
 .../scala/org/apache/ignite/visor/visor.scala   | 275 +++++++---
 .../ignite/visor/VisorTextTableSpec.scala       |   3 +-
 pom.xml                                         |   5 +-
 213 files changed, 9863 insertions(+), 3609 deletions(-)
----------------------------------------------------------------------


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

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


[09/18] incubator-ignite git commit: deploy to site enabled

Posted by ak...@apache.org.
deploy to site enabled


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

Branch: refs/heads/ignite-844
Commit: 04369fe6d02c9fb2d5cc24eb5b0f9c334bbf92a1
Parents: 0885ac0
Author: avinogradov <av...@gridgain.com>
Authored: Thu Apr 30 18:47:19 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Thu Apr 30 18:47:19 2015 +0300

----------------------------------------------------------------------
 pom.xml | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/04369fe6/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 181540b..98541ef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -577,29 +577,29 @@
                         </executions>
                     </plugin>
 
-                    <!--<plugin>-->
-                        <!--<groupId>org.apache.maven.plugins</groupId>-->
-                        <!--<artifactId>maven-site-plugin</artifactId>-->
-                        <!--<version>3.4</version>-->
-                        <!--<dependencies>-->
-                            <!--<dependency>-->
-                                <!--<groupId>org.apache.maven.wagon</groupId>-->
-                                <!--<artifactId>wagon-ssh</artifactId>-->
-                                <!--<version>2.8</version>-->
-                            <!--</dependency>-->
-                        <!--</dependencies>-->
-                        <!--<executions>-->
-                            <!--<execution>-->
-                                <!--<goals>-->
-                                    <!--<goal>deploy</goal>-->
-                                <!--</goals>-->
-                                <!--<phase>deploy</phase>-->
-                                <!--<configuration>-->
-                                    <!--<inputDirectory>${basedir}/target/site</inputDirectory>-->
-                                <!--</configuration>-->
-                            <!--</execution>-->
-                        <!--</executions>-->
-                    <!--</plugin>-->
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-site-plugin</artifactId>
+                        <version>3.4</version>
+                        <dependencies>
+                            <dependency>
+                                <groupId>org.apache.maven.wagon</groupId>
+                                <artifactId>wagon-ssh</artifactId>
+                                <version>2.8</version>
+                            </dependency>
+                        </dependencies>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>deploy</goal>
+                                </goals>
+                                <phase>deploy</phase>
+                                <configuration>
+                                    <inputDirectory>${basedir}/target/site</inputDirectory>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
                 </plugins>
             </build>
         </profile>


[13/18] incubator-ignite git commit: # sprint-4 - Added javadoc for the close method.

Posted by ak...@apache.org.
# sprint-4 - Added javadoc for the close method.


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

Branch: refs/heads/ignite-844
Commit: 601cf09930a16b1bf477d8407f5deed10c1f50c3
Parents: f298d72
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Thu Apr 30 18:32:56 2015 -0700
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Thu Apr 30 18:32:56 2015 -0700

----------------------------------------------------------------------
 modules/core/src/main/java/org/apache/ignite/IgniteCache.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/601cf099/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index bf4080a..f9007a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -499,7 +499,7 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
         CacheEntryProcessor<K, V, T> entryProcessor, Object... args);
 
     /**
-     * Completely deletes the cache with all its data from the system.
+     * Completely deletes the cache with all its data from the system on all cluster nodes.
      */
     @Override void close();
 


[08/18] incubator-ignite git commit: #ignite-732: IgniteCache.size() should not fail in case of topology changes.

Posted by ak...@apache.org.
#ignite-732: IgniteCache.size() should not fail in case of topology changes.


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

Branch: refs/heads/ignite-844
Commit: 139aa270ae61494c0757867f2dc531ec7251b1da
Parents: 0885ac0
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Apr 30 18:43:56 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Apr 30 18:43:56 2015 +0300

----------------------------------------------------------------------
 .../ignite/compute/ComputeTaskAdapter.java      |  14 +-
 .../processors/cache/GridCacheAdapter.java      | 503 ++++++++++---------
 .../processors/cache/GridCacheProcessor.java    | 109 ++--
 3 files changed, 349 insertions(+), 277 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/139aa270/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskAdapter.java b/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskAdapter.java
index c2ad198..87081fc 100644
--- a/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskAdapter.java
@@ -24,15 +24,16 @@ import java.util.*;
 
 /**
  * Convenience adapter for {@link ComputeTask} interface. Here is an example of
- * how {@code GridComputeTaskAdapter} can be used:
+ * how {@code ComputeTaskAdapter} can be used:
  * <pre name="code" class="java">
- * public class MyFooBarTask extends GridComputeTaskAdapter&lt;String, String&gt; {
+ * public class MyFooBarTask extends ComputeTaskAdapter&lt;String, String&gt; {
  *     // Inject load balancer.
  *     &#64;LoadBalancerResource
  *     ComputeLoadBalancer balancer;
  *
  *     // Map jobs to grid nodes.
- *     public Map&lt;? extends ComputeJob, GridNode&gt; map(List&lt;GridNode&gt; subgrid, String arg) throws IgniteCheckedException {
+ *     public Map&lt;? extends ComputeJob, GridNode&gt; map(List&lt;GridNode&gt; subgrid, String arg)
+ *         throws IgniteCheckedException {
  *         Map&lt;MyFooBarJob, GridNode&gt; jobs = new HashMap&lt;MyFooBarJob, GridNode&gt;(subgrid.size());
  *
  *         // In more complex cases, you can actually do
@@ -76,8 +77,8 @@ public abstract class ComputeTaskAdapter<T, R> implements ComputeTask<T, R> {
      * <p>
      * If remote job resulted in exception ({@link ComputeJobResult#getException()} is not {@code null}),
      * then {@link ComputeJobResultPolicy#FAILOVER} policy will be returned if the exception is instance
-     * of {@link org.apache.ignite.cluster.ClusterTopologyException} or {@link ComputeExecutionRejectedException}, which means that
-     * remote node either failed or job execution was rejected before it got a chance to start. In all
+     * of {@link org.apache.ignite.cluster.ClusterTopologyException} or {@link ComputeExecutionRejectedException},
+     * which means that remote node either failed or job execution was rejected before it got a chance to start. In all
      * other cases the exception will be rethrown which will ultimately cause task to fail.
      *
      * @param res Received remote grid executable result.
@@ -87,7 +88,8 @@ public abstract class ComputeTaskAdapter<T, R> implements ComputeTask<T, R> {
      * @throws IgniteException If handling a job result caused an error effectively rejecting
      *      a failover. This exception will be thrown out of {@link ComputeTaskFuture#get()} method.
      */
-    @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) throws IgniteException {
+    @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd)
+        throws IgniteException {
         IgniteException e = res.getException();
 
         // Try to failover if result is failed.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/139aa270/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 3f4e97b..39f19b1 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
@@ -75,6 +75,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     /** */
     private static final long serialVersionUID = 0L;
 
+    /** Failed result. */
+    private static final Object FAIL = new Integer(-1);
+
     /** clearLocally() split threshold. */
     public static final int CLEAR_ALL_SPLIT_THRESHOLD = 10000;
 
@@ -882,7 +885,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
     /** {@inheritDoc} */
     @Override public Set<Cache.Entry<K, V>> entrySet() {
-        return entrySet((CacheEntryPredicate[]) null);
+        return entrySet((CacheEntryPredicate[])null);
     }
 
     /** {@inheritDoc} */
@@ -897,17 +900,17 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
     /** {@inheritDoc} */
     @Override public Set<K> keySet() {
-        return keySet((CacheEntryPredicate[]) null);
+        return keySet((CacheEntryPredicate[])null);
     }
 
     /** {@inheritDoc} */
     @Override public Set<K> primaryKeySet() {
-        return primaryKeySet((CacheEntryPredicate[]) null);
+        return primaryKeySet((CacheEntryPredicate[])null);
     }
 
     /** {@inheritDoc} */
     @Override public Collection<V> values() {
-        return values((CacheEntryPredicate[]) null);
+        return values((CacheEntryPredicate[])null);
     }
 
     /**
@@ -1080,36 +1083,31 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
     /** {@inheritDoc} */
     @Override public void clear() throws IgniteCheckedException {
-        // Clear local cache synchronously.
-        clearLocally();
-
-        clearRemotes(0, new GlobalClearAllCallable(name()));
+        clearAll(0, new GlobalClearAllCallable(name(), ctx.affinity().affinityTopologyVersion()));
     }
 
     /** {@inheritDoc} */
     @Override public void clear(K key) throws IgniteCheckedException {
-        // Clear local cache synchronously.
-        clearLocally(key);
-
-        clearRemotes(0, new GlobalClearKeySetCallable<K, V>(name(), Collections.singleton(key)));
+        clearAll(0, new GlobalClearKeySetCallable<K, V>(name(), ctx.affinity().affinityTopologyVersion(),
+            Collections.singleton(key)));
     }
 
     /** {@inheritDoc} */
     @Override public void clearAll(Set<? extends K> keys) throws IgniteCheckedException {
-        // Clear local cache synchronously.
-        clearLocallyAll(keys);
-
-        clearRemotes(0, new GlobalClearKeySetCallable<K, V>(name(), keys));
+        clearAll(0, new GlobalClearKeySetCallable<K, V>(name(), ctx.affinity().affinityTopologyVersion(),
+            keys));
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<?> clearAsync(K key) {
-        return clearAsync(new GlobalClearKeySetCallable<K, V>(name(), Collections.singleton(key)));
+        return clearAsync(new GlobalClearKeySetCallable<K, V>(name(), ctx.affinity().affinityTopologyVersion(),
+            Collections.singleton(key)));
     }
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<?> clearAsync(Set<? extends K> keys) {
-        return clearAsync(new GlobalClearKeySetCallable<K, V>(name(), keys));
+        return clearAsync(new GlobalClearKeySetCallable<K, V>(name(), ctx.affinity().affinityTopologyVersion(),
+            keys));
     }
 
     /**
@@ -1118,19 +1116,13 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
      * @param clearCall Global clear callable object.
      * @throws IgniteCheckedException In case of cache could not be cleared on any of the nodes.
      */
-    private void clearRemotes(long timeout, GlobalClearCallable clearCall) throws IgniteCheckedException {
+    private void clearAll(long timeout, TopologyVersionAwareCallable clearCall) throws IgniteCheckedException {
         try {
-            // Send job to remote nodes only.
-            Collection<ClusterNode> nodes =
-                ctx.grid().cluster().forCacheNodes(name(), true, true, false).forRemotes().nodes();
-
             IgniteInternalFuture<Object> fut = null;
 
-            if (!nodes.isEmpty()) {
-                ctx.kernalContext().task().setThreadContext(TC_TIMEOUT, timeout);
+            ctx.kernalContext().task().setThreadContext(TC_TIMEOUT, timeout);
 
-                fut = ctx.closures().callAsyncNoFailover(BROADCAST, clearCall, nodes, true);
-            }
+            fut = new ClearFuture(ctx, clearCall);
 
             if (fut != null)
                 fut.get();
@@ -1149,19 +1141,18 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<?> clearAsync() {
-        return clearAsync(new GlobalClearAllCallable(name()));
+        return clearAsync(new GlobalClearAllCallable(name(), ctx.affinity().affinityTopologyVersion()));
     }
 
     /**
      * @param clearCall Global clear callable object.
      * @return Future.
      */
-    private IgniteInternalFuture<?> clearAsync(GlobalClearCallable clearCall) {
+    private IgniteInternalFuture<?> clearAsync(TopologyVersionAwareCallable clearCall) {
         Collection<ClusterNode> nodes = ctx.grid().cluster().forCacheNodes(name(), true, true, false).nodes();
 
         if (!nodes.isEmpty()) {
-            IgniteInternalFuture<Object> fut =
-                ctx.closures().callAsyncNoFailover(BROADCAST, clearCall, nodes, true);
+            IgniteInternalFuture<Object> fut = new ClearFuture(ctx, clearCall);
 
             return fut.chain(new CX1<IgniteInternalFuture<Object>, Object>() {
                 @Override public Object applyx(IgniteInternalFuture<Object> fut) throws IgniteCheckedException {
@@ -2117,7 +2108,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                 throws IgniteCheckedException {
                 Map<? extends K, EntryProcessor<K, V, Object>> invokeMap = F.viewAsMap(keys,
                     new C1<K, EntryProcessor<K, V, Object>>() {
-                            @Override public EntryProcessor apply(K k) {
+                        @Override public EntryProcessor apply(K k) {
                             return entryProcessor;
                         }
                     });
@@ -2145,7 +2136,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         IgniteInternalFuture<?> fut = asyncOp(new AsyncInOp() {
             @Override public IgniteInternalFuture<GridCacheReturn> inOp(IgniteTxLocalAdapter tx) {
                 Map<? extends K, EntryProcessor<K, V, Object>> invokeMap =
-                    Collections.singletonMap(key, (EntryProcessor<K, V, Object>) entryProcessor);
+                    Collections.singletonMap(key, (EntryProcessor<K, V, Object>)entryProcessor);
 
                 return tx.invokeAsync(ctx, invokeMap, args);
             }
@@ -2371,7 +2362,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         IgniteInternalFuture<V> fut = asyncOp(new AsyncOp<V>() {
             @Override public IgniteInternalFuture<V> op(IgniteTxLocalAdapter tx) {
                 return tx.putAllAsync(ctx, F.t(key, val), true, null, -1, ctx.noValArray())
-                    .chain((IgniteClosure<IgniteInternalFuture<GridCacheReturn>, V>) RET2VAL);
+                    .chain((IgniteClosure<IgniteInternalFuture<GridCacheReturn>, V>)RET2VAL);
             }
 
             @Override public String toString() {
@@ -2526,7 +2517,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         return asyncOp(new AsyncOp<Boolean>() {
             @Override public IgniteInternalFuture<Boolean> op(IgniteTxLocalAdapter tx) {
                 return tx.putAllAsync(ctx, F.t(key, val), false, null, -1, ctx.hasValArray()).chain(
-                    (IgniteClosure<IgniteInternalFuture<GridCacheReturn>, Boolean>) RET2FLAG);
+                    (IgniteClosure<IgniteInternalFuture<GridCacheReturn>, Boolean>)RET2FLAG);
             }
 
             @Override public String toString() {
@@ -2915,7 +2906,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                 if (ctx.deploymentEnabled())
                     ctx.deploy().registerClass(oldVal);
 
-                return (GridCacheReturn) tx.putAllAsync(ctx,
+                return tx.putAllAsync(ctx,
                         F.t(key, newVal),
                         true,
                         null,
@@ -3017,7 +3008,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                     ctx.deploy().registerClass(val);
 
                 return tx.removeAllAsync(ctx, Collections.singletonList(key), null, false,
-                        ctx.equalsValArray(val)).get().success();
+                    ctx.equalsValArray(val)).get().success();
             }
 
             @Override public String toString() {
@@ -3230,10 +3221,10 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         TransactionConfiguration cfg = ctx.gridConfig().getTransactionConfiguration();
 
         return txStart(
-                concurrency,
-                isolation,
-                cfg.getDefaultTxTimeout(),
-                0
+            concurrency,
+            isolation,
+            cfg.getDefaultTxTimeout(),
+            0
         );
     }
 
@@ -3576,22 +3567,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         if (nodes.isEmpty())
             return new GridFinishedFuture<>(0);
 
-        IgniteInternalFuture<Collection<Integer>> fut =
-            ctx.closures().broadcastNoFailover(new SizeCallable(ctx.name(), peekModes), null, nodes);
-
-        return fut.chain(new CX1<IgniteInternalFuture<Collection<Integer>>, Integer>() {
-            @Override public Integer applyx(IgniteInternalFuture<Collection<Integer>> fut)
-            throws IgniteCheckedException {
-                Collection<Integer> res = fut.get();
-
-                int totalSize = 0;
-
-                for (Integer size : res)
-                    totalSize += size;
-
-                return totalSize;
-            }
-        });
+        return new SizeFuture(peekModes, ctx, modes.near);
     }
 
     /** {@inheritDoc} */
@@ -3675,7 +3651,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         return F.iterator(iterator(),
             new IgniteClosure<Cache.Entry<K, V>, Cache.Entry<K, V>>() {
                 private IgniteCacheExpiryPolicy expiryPlc =
-                        ctx.cache().expiryPolicy(opCtx != null ? opCtx.expiry() : null);
+                    ctx.cache().expiryPolicy(opCtx != null ? opCtx.expiry() : null);
 
                 @Override public Cache.Entry<K, V> apply(Cache.Entry<K, V> lazyEntry) {
                     CacheOperationContext prev = ctx.gate().enter(opCtx);
@@ -3909,50 +3885,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     }
 
     /**
-     * Gets cache global size (with or without backups).
-     *
-     * @param primaryOnly {@code True} if only primary sizes should be included.
-     * @return Global size.
-     * @throws IgniteCheckedException If internal task execution failed.
-     */
-    private int globalSize(boolean primaryOnly) throws IgniteCheckedException {
-        try {
-            // Send job to remote nodes only.
-            Collection<ClusterNode> nodes = ctx.grid().cluster().forCacheNodes(name()).forRemotes().nodes();
-
-            IgniteInternalFuture<Collection<Integer>> fut = null;
-
-            if (!nodes.isEmpty()) {
-                ctx.kernalContext().task().setThreadContext(TC_TIMEOUT, gridCfg.getNetworkTimeout());
-
-                fut = ctx.closures().broadcastNoFailover(new GlobalSizeCallable(name(), primaryOnly), null, nodes);
-            }
-
-            // Get local value.
-            int globalSize = primaryOnly ? primarySize() : size();
-
-            if (fut != null) {
-                for (Integer i : fut.get())
-                    globalSize += i;
-            }
-
-            return globalSize;
-        }
-        catch (ClusterGroupEmptyCheckedException ignore) {
-            if (log.isDebugEnabled())
-                log.debug("All remote nodes left while cache clearLocally [cacheName=" + name() + "]");
-
-            return primaryOnly ? primarySize() : size();
-        }
-        catch (ComputeTaskTimeoutCheckedException e) {
-            U.warn(log, "Timed out waiting for remote nodes to finish cache clear (consider increasing " +
-                "'networkTimeout' configuration property) [cacheName=" + name() + "]");
-
-            throw e;
-        }
-    }
-
-    /**
      * @param op Cache operation.
      * @param <T> Return type.
      * @return Operation result.
@@ -4893,47 +4825,10 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     }
 
     /**
-     * Internal callable which performs clear operation on a cache with the given name.
-     */
-    @GridInternal
-    private static abstract class GlobalClearCallable implements Callable<Object>, Externalizable {
-        /** Cache name. */
-        protected String cacheName;
-
-        /** Injected grid instance. */
-        @IgniteInstanceResource
-        protected Ignite ignite;
-
-        /**
-         * Empty constructor for serialization.
-         */
-        public GlobalClearCallable() {
-            // No-op.
-        }
-
-        /**
-         * @param cacheName Cache name.
-         */
-        protected GlobalClearCallable(String cacheName) {
-            this.cacheName = cacheName;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writeExternal(ObjectOutput out) throws IOException {
-            U.writeString(out, cacheName);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-            cacheName = U.readString(in);
-        }
-    }
-
-    /**
      * Global clear all.
      */
     @GridInternal
-    private static class GlobalClearAllCallable extends GlobalClearCallable {
+    private static class GlobalClearAllCallable extends TopologyVersionAwareCallable {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -4946,24 +4841,30 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         /**
          * @param cacheName Cache name.
+         * @param topVer Affinity topology version.
          */
-        private GlobalClearAllCallable(String cacheName) {
-            super(cacheName);
+        private GlobalClearAllCallable(String cacheName, AffinityTopologyVersion topVer) {
+            super(cacheName, topVer);
         }
 
         /** {@inheritDoc} */
-        @Override public Object call() throws Exception {
+        @Override protected Object callLocal() {
             ((IgniteEx)ignite).cachex(cacheName).clearLocally();
 
             return null;
         }
+
+        /** {@inheritDoc} */
+        @Override protected Collection<ClusterNode> nodes(GridCacheContext ctx) {
+            return ctx.grid().cluster().forCacheNodes(ctx.name(), true, true, false).nodes();
+        }
     }
 
     /**
      * Global clear keys.
      */
     @GridInternal
-    private static class GlobalClearKeySetCallable<K, V> extends GlobalClearCallable {
+    private static class GlobalClearKeySetCallable<K, V> extends TopologyVersionAwareCallable {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -4979,33 +4880,25 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         /**
          * @param cacheName Cache name.
+         * @param topVer Affinity topology version.
          * @param keys Keys to clear.
          */
-        private GlobalClearKeySetCallable(String cacheName, Set<? extends K> keys) {
-            super(cacheName);
+        protected GlobalClearKeySetCallable(String cacheName, AffinityTopologyVersion topVer, Set<? extends K> keys) {
+            super(cacheName, topVer);
 
             this.keys = keys;
         }
 
         /** {@inheritDoc} */
-        @Override public Object call() throws Exception {
-            ((IgniteEx)ignite).<K, V>cachex(cacheName).clearLocallyAll(keys);
-
-            return null;
+        @Override protected Collection<ClusterNode> nodes(GridCacheContext ctx) {
+            return ctx.grid().cluster().forCacheNodes(ctx.name(), true, true, false).nodes();
         }
 
         /** {@inheritDoc} */
-        @Override public void writeExternal(ObjectOutput out) throws IOException {
-            super.writeExternal(out);
-
-            out.writeObject(keys);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-            super.readExternal(in);
+        @Override protected Object callLocal() {
+            ((IgniteEx)ignite).<K, V>cachex(cacheName).clearLocallyAll(keys);
 
-            keys = (Set<K>) in.readObject();
+            return null;
         }
     }
 
@@ -5013,127 +4906,202 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
      * Internal callable for global size calculation.
      */
     @GridInternal
-    private static class SizeCallable extends IgniteClosureX<Object, Integer> implements Externalizable {
+    private static class GlobalSizeCallable extends TopologyVersionAwareCallable {
         /** */
         private static final long serialVersionUID = 0L;
 
-        /** Cache name. */
-        private String cacheName;
-
         /** Peek modes. */
         private CachePeekMode[] peekModes;
 
-        /** Injected grid instance. */
-        @IgniteInstanceResource
-        private Ignite ignite;
+        /** Near enable. */
+        private boolean nearEnable;
 
         /**
          * Required by {@link Externalizable}.
          */
-        public SizeCallable() {
+        public GlobalSizeCallable() {
             // No-op.
         }
 
         /**
          * @param cacheName Cache name.
+         * @param topVer Affinity topology version.
          * @param peekModes Cache peek modes.
          */
-        private SizeCallable(String cacheName, CachePeekMode[] peekModes) {
-            this.cacheName = cacheName;
+        private GlobalSizeCallable(String cacheName, AffinityTopologyVersion topVer, CachePeekMode[] peekModes, boolean nearEnable) {
+            super(cacheName, topVer);
+
             this.peekModes = peekModes;
+            this.nearEnable = nearEnable;
         }
 
         /** {@inheritDoc} */
-        @Override public Integer applyx(Object o) throws IgniteCheckedException {
-            IgniteInternalCache<Object, Object> cache = ((IgniteEx)ignite).cachex(cacheName);
-
-            assert cache != null : cacheName;
+        @Override protected Object callLocal() {
+            try {
+                IgniteInternalCache<Object, Object> cache = ((IgniteEx)ignite).cachex(cacheName);
 
-            return cache.localSize(peekModes);
+                return cache == null ? 0 : cache.localSize(peekModes);
+            }
+            catch (IgniteCheckedException e) {
+                throw U.convertException(e);
+            }
         }
 
         /** {@inheritDoc} */
-        @SuppressWarnings("ForLoopReplaceableByForEach")
-        @Override public void writeExternal(ObjectOutput out) throws IOException {
-            U.writeString(out, cacheName);
+        @Override protected Collection<ClusterNode> nodes(GridCacheContext ctx) {
+            IgniteClusterEx cluster = ctx.grid().cluster();
 
-            out.writeInt(peekModes.length);
+            ClusterGroup grp = nearEnable ? cluster.forCacheNodes(ctx.name(), true, true, false) : cluster.forDataNodes(ctx.name());
 
-            for (int i = 0; i < peekModes.length; i++)
-                U.writeEnum(out, peekModes[i]);
+            return grp.nodes();
         }
 
         /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-            cacheName = U.readString(in);
+        public String toString() {
+            return S.toString(GlobalSizeCallable.class, this);
+        }
+    }
 
-            int len = in.readInt();
+    /**
+     * Cache size future.
+     */
+    private static class SizeFuture extends RetryFuture {
+        /** Size. */
+        private int size = 0;
 
-            peekModes = new CachePeekMode[len];
+        /**
+         * @param peekModes Peek modes.
+         */
+        public SizeFuture(CachePeekMode[] peekModes, GridCacheContext ctx, boolean near) {
+            super(ctx, new GlobalSizeCallable(ctx.name(), ctx.affinity().affinityTopologyVersion(), peekModes, near));
+        }
 
-            for (int i = 0; i < len; i++)
-                peekModes[i] = CachePeekMode.fromOrdinal(in.readByte());
+        /** {@inheritDoc} */
+        @Override protected void onInit() {
+            size = 0;
         }
 
         /** {@inheritDoc} */
-        public String toString() {
-            return S.toString(SizeCallable.class, this);
+        @Override protected void onLocal(Object localRes) {
+            size += (Integer)localRes;
+        }
+
+        /** {@inheritDoc} */
+        @Override protected void allDone() {
+            onDone(size);
         }
     }
 
     /**
-     * Internal callable which performs {@link IgniteInternalCache#size()} or {@link IgniteInternalCache#primarySize()}
-     * operation on a cache with the given name.
+     * Cache clear future.
      */
-    @GridInternal
-    private static class GlobalSizeCallable implements IgniteClosure<Object, Integer>, Externalizable {
-        /** */
-        private static final long serialVersionUID = 0L;
+    private static class ClearFuture extends RetryFuture {
+        /**
+         */
+        public ClearFuture(GridCacheContext ctx, TopologyVersionAwareCallable clearCall) {
+            super(ctx, clearCall);
+        }
 
-        /** Cache name. */
-        private String cacheName;
+        /** {@inheritDoc} */
+        @Override protected void onInit() {
+           // No-op.
+        }
 
-        /** Primary only flag. */
-        private boolean primaryOnly;
+        /** {@inheritDoc} */
+        @Override protected void onLocal(Object localRes) {
+            // No-op.
+        }
 
-        /** Injected grid instance. */
-        @IgniteInstanceResource
-        private Ignite ignite;
+        /** {@inheritDoc} */
+        @Override protected void allDone() {
+            onDone();
+        }
+    }
+
+    /**
+     * Retry future.
+     */
+    protected static abstract class RetryFuture<T> extends GridFutureAdapter<T> {
+        /** Context. */
+        private final GridCacheContext ctx;
+
+        /** Callable. */
+        private final TopologyVersionAwareCallable call;
+
+        /** Max retries count before issuing an error. */
+        private volatile int retries = 32;
 
         /**
-         * Empty constructor for serialization.
          */
-        public GlobalSizeCallable() {
-            // No-op.
+        public RetryFuture(GridCacheContext ctx, TopologyVersionAwareCallable call) {
+            this.ctx = ctx;
+            this.call = call;
+
+            init();
         }
 
         /**
-         * @param cacheName Cache name.
-         * @param primaryOnly Primary only flag.
+         * Init.
          */
-        private GlobalSizeCallable(String cacheName, boolean primaryOnly) {
-            this.cacheName = cacheName;
-            this.primaryOnly = primaryOnly;
-        }
+        private void init() {
+            Collection<ClusterNode> nodes = call.nodes(ctx);
 
-        /** {@inheritDoc} */
-        @Override public Integer apply(Object o) {
-            IgniteInternalCache<Object, Object> cache = ((IgniteEx)ignite).cachex(cacheName);
+            call.topologyVersion(ctx.affinity().affinityTopologyVersion());
 
-            return primaryOnly ? cache.primarySize() : cache.size();
-        }
+            IgniteInternalFuture<Collection<Object>> fut = ctx.closures().callAsyncNoFailover(BROADCAST,
+                F.asSet((Callable<Object>)call), nodes, true);
 
-        /** {@inheritDoc} */
-        @Override public void writeExternal(ObjectOutput out) throws IOException {
-            U.writeString(out, cacheName);
-            out.writeBoolean(primaryOnly);
-        }
+            fut.listen(new IgniteInClosure<IgniteInternalFuture<Collection<Object>>>() {
+                @Override public void apply(IgniteInternalFuture<Collection<Object>> fut) {
+                    try {
+                        Collection<Object> res = fut.get();
 
-        /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-            cacheName = U.readString(in);
-            primaryOnly = in.readBoolean();
+                        onInit();
+
+                        for (Object locRes : res) {
+                            if (locRes == FAIL) {
+                                if (retries-- > 0)
+                                    init();
+                                else {
+                                    onDone(new ClusterTopologyException("Failed to wait topology."));
+
+                                    return;
+                                }
+                            }
+
+                            onLocal(locRes);
+                        }
+
+                        allDone();
+                    }
+                    catch (IgniteCheckedException e) {
+                        if (X.hasCause(e, ClusterTopologyException.class)) {
+                            if (retries-- > 0)
+                                init();
+                            else
+                                onDone(e);
+                        }
+                        else
+                            onDone(e);
+                    }
+                }
+            });
         }
+
+        /**
+         * Init reducer.
+         */
+        protected abstract void onInit();
+
+        /**
+         * @param localRes Add local result to global result.
+         */
+        protected abstract void onLocal(Object localRes);
+
+        /**
+         * On done.
+         */
+        protected abstract void allDone();
     }
 
     /**
@@ -5697,4 +5665,89 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             metrics.addPutAndGetTimeNanos(System.nanoTime() - start);
         }
     }
+
+    /**
+     * Delayed callable class.
+     */
+    protected static abstract class TopologyVersionAwareCallable<K, V> implements Serializable, Callable<Object> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** Injected grid instance. */
+        @IgniteInstanceResource
+        protected Ignite ignite;
+
+        /** Affinity topology version. */
+        protected AffinityTopologyVersion topVer;
+
+        /** Cache name. */
+        protected String cacheName;
+
+        /**
+         * Empty constructor for serialization.
+         */
+        public TopologyVersionAwareCallable() {
+            // No-op.
+        }
+
+        /**
+         * @param topVer Affinity topology version.
+         */
+        public TopologyVersionAwareCallable(String cacheName, AffinityTopologyVersion topVer) {
+            this.cacheName = cacheName;
+            this.topVer = topVer;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object call() throws Exception {
+            if (!compareTopologyVersions())
+                return FAIL;
+
+            Object res = callLocal();
+
+            if (!compareTopologyVersions())
+                return FAIL;
+            else
+                return res;
+        }
+
+        /**
+         * Call local.
+         *
+         * @return Local result.
+         * @throws IgniteCheckedException If failed.
+         */
+        protected abstract Object callLocal() throws IgniteCheckedException;
+
+        /**
+         * @param ctx Grid cache context.
+         * @return Nodes to call.
+         */
+        protected abstract Collection<ClusterNode> nodes(GridCacheContext ctx);
+
+        /**
+         * Compare topology versions.
+         */
+        public boolean compareTopologyVersions() {
+            GridCacheProcessor cacheProc = ((IgniteKernal) ignite).context().cache();
+
+            GridCacheAdapter<K, V> cacheAdapter = cacheProc.internalCache(cacheName);
+
+            if (cacheAdapter == null)
+                return false;
+
+            final GridCacheContext<K, V> ctx = cacheAdapter.context();
+
+            AffinityTopologyVersion locTopVer = ctx.affinity().affinityTopologyVersion();
+
+            return locTopVer.compareTo(topVer) == 0;
+        }
+
+        /**
+         * @param topVer Affinity topology version.
+         */
+        public void topologyVersion(AffinityTopologyVersion topVer) {
+            this.topVer = topVer;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/139aa270/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index c0026ab..77fa104 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -124,6 +124,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     /** Must use JDK marshaller since it is used by discovery to fire custom events. */
     private Marshaller marshaller = new JdkMarshaller();
 
+    /** Count down latch for caches. */
+    private CountDownLatch cacheStartedLatch = new CountDownLatch(1);
+
     /**
      * @param ctx Kernal context.
      */
@@ -657,87 +660,92 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public void onKernalStart() throws IgniteCheckedException {
-        if (ctx.config().isDaemon())
-            return;
+        try {
+            if (ctx.config().isDaemon())
+                return;
 
-        ClusterNode locNode = ctx.discovery().localNode();
+            ClusterNode locNode = ctx.discovery().localNode();
 
-        // Init cache plugin managers.
-        final Map<String, CachePluginManager> cache2PluginMgr = new HashMap<>();
+            // Init cache plugin managers.
+            final Map<String, CachePluginManager> cache2PluginMgr = new HashMap<>();
 
-        for (DynamicCacheDescriptor desc : registeredCaches.values()) {
-            CacheConfiguration locCcfg = desc.cacheConfiguration();
+            for (DynamicCacheDescriptor desc : registeredCaches.values()) {
+                CacheConfiguration locCcfg = desc.cacheConfiguration();
 
-            CachePluginManager pluginMgr = new CachePluginManager(ctx, locCcfg);
+                CachePluginManager pluginMgr = new CachePluginManager(ctx, locCcfg);
 
-            cache2PluginMgr.put(locCcfg.getName(), pluginMgr);
-        }
+                cache2PluginMgr.put(locCcfg.getName(), pluginMgr);
+            }
 
-        if (!getBoolean(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK)) {
-            for (ClusterNode n : ctx.discovery().remoteNodes()) {
-                checkTransactionConfiguration(n);
+            if (!getBoolean(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK)) {
+                for (ClusterNode n : ctx.discovery().remoteNodes()) {
+                    checkTransactionConfiguration(n);
 
-                DeploymentMode locDepMode = ctx.config().getDeploymentMode();
-                DeploymentMode rmtDepMode = n.attribute(IgniteNodeAttributes.ATTR_DEPLOYMENT_MODE);
+                    DeploymentMode locDepMode = ctx.config().getDeploymentMode();
+                    DeploymentMode rmtDepMode = n.attribute(IgniteNodeAttributes.ATTR_DEPLOYMENT_MODE);
 
-                CU.checkAttributeMismatch(log, null, n.id(), "deploymentMode", "Deployment mode",
-                    locDepMode, rmtDepMode, true);
+                    CU.checkAttributeMismatch(log, null, n.id(), "deploymentMode", "Deployment mode",
+                        locDepMode, rmtDepMode, true);
 
-                for (DynamicCacheDescriptor desc : registeredCaches.values()) {
-                    CacheConfiguration rmtCfg = desc.remoteConfiguration(n.id());
+                    for (DynamicCacheDescriptor desc : registeredCaches.values()) {
+                        CacheConfiguration rmtCfg = desc.remoteConfiguration(n.id());
 
-                    if (rmtCfg != null) {
-                        CacheConfiguration locCfg = desc.cacheConfiguration();
+                        if (rmtCfg != null) {
+                            CacheConfiguration locCfg = desc.cacheConfiguration();
 
-                        checkCache(locCfg, rmtCfg, n);
+                            checkCache(locCfg, rmtCfg, n);
 
-                        // Check plugin cache configurations.
-                        CachePluginManager pluginMgr = cache2PluginMgr.get(locCfg.getName());
+                            // Check plugin cache configurations.
+                            CachePluginManager pluginMgr = cache2PluginMgr.get(locCfg.getName());
 
-                        assert pluginMgr != null : " Map=" + cache2PluginMgr;
+                            assert pluginMgr != null : " Map=" + cache2PluginMgr;
 
-                        pluginMgr.validateRemotes(rmtCfg, n);
+                            pluginMgr.validateRemotes(rmtCfg, n);
+                        }
                     }
                 }
             }
-        }
 
-        // Start dynamic caches received from collect discovery data.
-        for (DynamicCacheDescriptor desc : registeredCaches.values()) {
-            boolean started = desc.onStart();
+            // Start dynamic caches received from collect discovery data.
+            for (DynamicCacheDescriptor desc : registeredCaches.values()) {
+                boolean started = desc.onStart();
 
-            assert started : "Failed to change started flag for locally configured cache: " + desc;
+                assert started : "Failed to change started flag for locally configured cache: " + desc;
 
-            desc.clearRemoteConfigurations();
+                desc.clearRemoteConfigurations();
 
-            CacheConfiguration ccfg = desc.cacheConfiguration();
+                CacheConfiguration ccfg = desc.cacheConfiguration();
 
-            IgnitePredicate filter = ccfg.getNodeFilter();
+                IgnitePredicate filter = ccfg.getNodeFilter();
 
-            if (filter.apply(locNode)) {
-                CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(ccfg);
+                if (filter.apply(locNode)) {
+                    CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(ccfg);
 
-                CachePluginManager pluginMgr = cache2PluginMgr.get(ccfg.getName());
+                    CachePluginManager pluginMgr = cache2PluginMgr.get(ccfg.getName());
 
-                assert pluginMgr != null : " Map=" + cache2PluginMgr;
+                    assert pluginMgr != null : " Map=" + cache2PluginMgr;
 
-                GridCacheContext ctx = createCache(ccfg, pluginMgr, desc.cacheType(), cacheObjCtx);
+                    GridCacheContext ctx = createCache(ccfg, pluginMgr, desc.cacheType(), cacheObjCtx);
 
-                ctx.dynamicDeploymentId(desc.deploymentId());
+                    ctx.dynamicDeploymentId(desc.deploymentId());
 
-                sharedCtx.addCacheContext(ctx);
+                    sharedCtx.addCacheContext(ctx);
 
-                GridCacheAdapter cache = ctx.cache();
+                    GridCacheAdapter cache = ctx.cache();
 
-                String name = ccfg.getName();
+                    String name = ccfg.getName();
 
-                caches.put(maskNull(name), cache);
+                    caches.put(maskNull(name), cache);
 
-                startCache(cache);
+                    startCache(cache);
 
-                jCacheProxies.put(maskNull(name), new IgniteCacheProxy(ctx, cache, null, false));
+                    jCacheProxies.put(maskNull(name), new IgniteCacheProxy(ctx, cache, null, false));
+                }
             }
         }
+        finally {
+            cacheStartedLatch.countDown();
+        }
 
         ctx.marshallerContext().onMarshallerCacheStarted(ctx);
 
@@ -835,6 +843,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public void onKernalStop(boolean cancel) {
+        cacheStartedLatch.countDown();
+
         if (ctx.config().isDaemon())
             return;
 
@@ -2686,6 +2696,13 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         if (log.isDebugEnabled())
             log.debug("Getting internal cache adapter: " + name);
 
+        try {
+            cacheStartedLatch.await();
+        }
+        catch (InterruptedException e) {
+            throw new IgniteException("Failed to wait starting caches.");
+        }
+
         return (GridCacheAdapter<K, V>)caches.get(maskNull(name));
     }
 


[10/18] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-4' into ignite-sprint-4

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


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

Branch: refs/heads/ignite-844
Commit: 44b00ea46975ca8894ffbb24d53947ff4571d075
Parents: 04369fe 139aa27
Author: avinogradov <av...@gridgain.com>
Authored: Thu Apr 30 18:51:39 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Thu Apr 30 18:51:39 2015 +0300

----------------------------------------------------------------------
 .../ignite/compute/ComputeTaskAdapter.java      |  14 +-
 .../processors/cache/GridCacheAdapter.java      | 503 ++++++++++---------
 .../processors/cache/GridCacheProcessor.java    | 109 ++--
 3 files changed, 349 insertions(+), 277 deletions(-)
----------------------------------------------------------------------