ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [3/4] incubator-ignite git commit: # ignite-565
Date Thu, 26 Mar 2015 12:01:39 GMT
# ignite-565


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

Branch: refs/heads/ignite-565
Commit: c221613663ff3a536868b14b5fd90230e2979edd
Parents: 0de8a1b
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Mar 26 14:59:55 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Mar 26 15:01:00 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      |  6 +--
 .../processors/cache/GridCacheUtils.java        |  1 -
 .../ignite/IgniteCacheAffinitySelfTest.java     | 29 +++++++++++++-
 .../cache/GridCacheAbstractFullApiSelfTest.java |  2 +-
 ...idCacheNearOnlyMultiNodeFullApiSelfTest.java |  4 +-
 ...ridCacheContinuousQueryAbstractSelfTest.java |  6 +--
 .../junits/common/GridCommonAbstractTest.java   |  3 +-
 .../IgniteCacheQueryMultiThreadedSelfTest.java  |  3 +-
 .../GridCacheReplicatedFieldsQuerySelfTest.java | 40 +++++++++++++++++++-
 .../query/h2/GridH2IndexRebuildTest.java        |  4 +-
 10 files changed, 79 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2216136/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 cd0aec0..c779eef 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
@@ -4154,7 +4154,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
 
             if (modes.heap)
                 size += size();
-            }
+        }
         else {
             if (modes.heap) {
                 if (modes.near)
@@ -4168,11 +4168,11 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
 
                     if (modes.backup)
                         size += (cache.size() - cache.primarySize());
-                    }
+                }
                 else
                     size += cache.size();
-                }
             }
+        }
 
         // Swap and offheap are disabled for near cache.
         if (modes.primary || modes.backup) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2216136/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 070f45e..d5e466b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -1682,7 +1682,6 @@ public class GridCacheUtils {
      *
      * @param cache Cache.
      * @param key Key.
-     * @return {@code True} if entry was invalidated.
      */
     public static <K, V> void invalidate(IgniteCache<K, V> cache, K key) {
         cache.localClear(key);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2216136/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
index 74bb790..e07fcea 100644
--- a/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
@@ -128,14 +128,20 @@ public class IgniteCacheAffinitySelfTest extends IgniteCacheAbstractTest
{
 
     /**
      * Check affinityKey method.
+     *
+     * @param testAff Affinity1.
+     * @param aff Affinity2.
      */
-    private void checkAffinityKey(Affinity testAff,Affinity aff) {
+    private void checkAffinityKey(Affinity testAff, Affinity aff) {
         for (int i = 0; i < 10000; i++)
             assertEquals(testAff.affinityKey(i), aff.affinityKey(i));
     }
 
     /**
      * Check allPartitions, backupPartitions and primaryPartitions methods.
+     *
+     * @param testAff Affinity1.
+     * @param aff Affinity2.
      */
     private void checkPartitions(Affinity testAff, Affinity aff) {
         for (ClusterNode n : nodes()) {
@@ -149,6 +155,9 @@ public class IgniteCacheAffinitySelfTest extends IgniteCacheAbstractTest
{
 
     /**
      * Check isBackup, isPrimary and isPrimaryOrBackup methods.
+     *
+     * @param testAff Affinity1.
+     * @param aff Affinity2.
      */
     private void checkIsBackupOrPrimary(Affinity testAff, Affinity aff) {
         for (int i = 0; i < 10000; i++)
@@ -163,6 +172,9 @@ public class IgniteCacheAffinitySelfTest extends IgniteCacheAbstractTest
{
 
     /**
      * Check mapKeyToNode, mapKeyToPrimaryAndBackups methods.
+     *
+     * @param testAff Affinity1.
+     * @param aff Affinity2.
      */
     private void checkMapKeyToNode(Affinity testAff, Affinity aff) {
         for (int i = 0; i < 10000; i++) {
@@ -174,6 +186,9 @@ public class IgniteCacheAffinitySelfTest extends IgniteCacheAbstractTest
{
 
     /**
      * Check mapPartitionToPrimaryAndBackups and mapPartitionToNode methods.
+     *
+     * @param testAff Affinity1.
+     * @param aff Affinity2.
      */
     private void checkMapPartitionToNode(Affinity testAff, Affinity aff) {
         assertEquals(aff.partitions(), testAff.partitions());
@@ -188,6 +203,9 @@ public class IgniteCacheAffinitySelfTest extends IgniteCacheAbstractTest
{
 
     /**
      * Check mapKeysToNodes methods.
+     *
+     * @param testAff Affinity1.
+     * @param aff Affinity2.
      */
     private void checkMapKeysToNodes(Affinity testAff, Affinity aff) {
         List<Integer> keys = new ArrayList<>(10000);
@@ -200,6 +218,9 @@ public class IgniteCacheAffinitySelfTest extends IgniteCacheAbstractTest
{
 
     /**
      * Check mapPartitionsToNodes methods.
+     *
+     * @param testAff Affinity1.
+     * @param aff Affinity2.
      */
     private void checkMapPartitionsToNodes(Affinity testAff, Affinity aff) {
         List<Integer> parts = new ArrayList<>(aff.partitions());
@@ -212,6 +233,9 @@ public class IgniteCacheAffinitySelfTest extends IgniteCacheAbstractTest
{
 
     /**
      * Check equal arrays.
+     *
+     * @param arr1 Array 1.
+     * @param arr2 Array 2.
      */
     private static void checkEqualIntArray(int[] arr1, int[] arr2) {
         assertEquals(arr1.length, arr2.length);
@@ -232,6 +256,9 @@ public class IgniteCacheAffinitySelfTest extends IgniteCacheAbstractTest
{
 
     /**
      * Check equal collections.
+     *
+     * @param col1 Collection 1.
+     * @param col2 Collection 2.
      */
     private static void checkEqualCollection(Collection<ClusterNode> col1, Collection<ClusterNode>
col2) {
         assertEquals(col1.size(), col2.size());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2216136/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 8ec68b1..6e9a869 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -47,7 +47,7 @@ import java.util.concurrent.atomic.*;
 import java.util.concurrent.locks.*;
 
 import static java.util.concurrent.TimeUnit.*;
-import static org.apache.ignite.cache.CacheMemoryMode.OFFHEAP_TIERED;
+import static org.apache.ignite.cache.CacheMemoryMode.*;
 import static org.apache.ignite.cache.CacheMode.*;
 import static org.apache.ignite.events.EventType.*;
 import static org.apache.ignite.testframework.GridTestUtils.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2216136/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
index c512f58..0f699e7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
@@ -209,8 +209,8 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
     }
 
     /**
-     *
-     * @throws Exception
+     * @param inTx If {@code true} starts explicit transaction.
+     * @throws Exception If failed.
      */
     private void checkReaderTtl(boolean inTx) throws Exception {
         int ttl = 1000;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2216136/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
index 8258b3e..27bb4e4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
@@ -148,9 +148,8 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends
GridCommo
                 try {
                     IgniteCache<Object, Object> cache = grid(i).cache(null);
 
-                    for (Cache.Entry<Object, Object> entry : cache.localEntries(new
CachePeekMode[] {CachePeekMode.ALL})) {
+                    for (Cache.Entry<Object, Object> entry : cache.localEntries(new
CachePeekMode[] {CachePeekMode.ALL}))
                         cache.remove(entry.getKey());
-                    }
 
                     break;
                 }
@@ -425,8 +424,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends
GridCommo
         final CountDownLatch latch = new CountDownLatch(1);
 
         qry.setLocalListener(new CacheEntryUpdatedListener<Integer,Integer>() {
-            @Override
-            public void onUpdated(Iterable<CacheEntryEvent<? extends Integer,? extends
Integer>> evts) {
+            @Override public void onUpdated(Iterable<CacheEntryEvent<? extends Integer,?
extends Integer>> evts) {
                 for (CacheEntryEvent<? extends Integer,? extends Integer> e : evts)
{
                     synchronized (map) {
                         List<Integer> vals = map.get(e.getKey());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2216136/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index a309d72..507afa3 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -109,6 +109,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
 
     /**
      * @param cache Cache.
+     * @return Cache.
      */
     protected <K, V> GridCacheAdapter<K, V> internalCache(IgniteCache<K, V>
cache) {
         return ((IgniteKernal)cache.unwrap(Ignite.class)).internalCache(cache.getName());
@@ -123,6 +124,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
 
     /**
      * @param cache Cache.
+     * @return Cache.
      */
     @SuppressWarnings("TypeMayBeWeakened")
     protected <K> Set<K> keySet(IgniteCache<K, ?> cache) {
@@ -351,7 +353,6 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
     protected void awaitPartitionMapExchange() throws InterruptedException {
         for (Ignite g : G.allGrids()) {
             for (GridCache<?, ?> c : ((IgniteEx)g).cachesx()) {
-
                 CacheConfiguration cfg = c.configuration();
 
                 if (cfg.getCacheMode() == PARTITIONED && cfg.getRebalanceMode() !=
NONE && g.cluster().nodes().size() > 1) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2216136/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
index d9f9649..fcc2840 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
@@ -184,9 +184,8 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes
             // removeAll() removes mapping only when it presents at a primary node.
             // To remove all mappings used force remove by key.
             if (c.size() > 0) {
-                for (Cache.Entry<Object, Object> e : c.localEntries()) {
+                for (Cache.Entry<Object, Object> e : c.localEntries())
                     c.remove(e.getKey());
-                }
             }
 
             assertEquals("Swap keys: " + c.size(CachePeekMode.SWAP), 0, c.size(CachePeekMode.SWAP));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2216136/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFieldsQuerySelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFieldsQuerySelfTest.java
index a3f7606..a904994 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFieldsQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFieldsQuerySelfTest.java
@@ -19,7 +19,6 @@ 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.cluster.*;
 import org.apache.ignite.events.*;
 import org.apache.ignite.internal.*;
@@ -32,7 +31,6 @@ import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.testframework.*;
 
-import javax.cache.*;
 import java.util.*;
 import java.util.concurrent.*;
 
@@ -118,4 +116,42 @@ public class GridCacheReplicatedFieldsQuerySelfTest extends GridCacheAbstractFie
             stopGrid();
         }
     }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testLostIterator() throws Exception {
+        GridCacheAdapter<Integer, Integer> cache = ((IgniteKernal)grid(0)).internalCache(null);
+
+        CacheQueryFuture<List<?>> fut = null;
+
+        for (int i = 0; i < GridCacheQueryManager.MAX_ITERATORS + 1; i++) {
+            CacheQuery<List<?>> q = cache.queries().createSqlFieldsQuery(
+                "select _key from Integer where _key >= 0 order by _key").projection(grid(0).cluster());
+
+            q.pageSize(50);
+
+            CacheQueryFuture<List<?>> f = q.execute();
+
+            assertEquals(0, f.next().get(0));
+
+            if (fut == null)
+                fut = f;
+        }
+
+        final CacheQueryFuture<List<?>> fut0 = fut;
+
+        GridTestUtils.assertThrows(log, new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                int i = 0;
+
+                List<?> next;
+
+                while ((next = fut0.next()) != null)
+                    assertEquals(++i % 50, next.get(0));
+
+                return null;
+            }
+        }, IgniteException.class, null);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2216136/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexRebuildTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexRebuildTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexRebuildTest.java
index 21b5f04..bf81716 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexRebuildTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexRebuildTest.java
@@ -236,6 +236,7 @@ public class GridH2IndexRebuildTest extends GridCacheAbstractSelfTest
{
     }
 
     /**
+     * @param fut Future.
      * @throws Exception if failed.
      */
     private void checkCancel(final IgniteInternalFuture<?> fut) throws Exception {
@@ -244,8 +245,7 @@ public class GridH2IndexRebuildTest extends GridCacheAbstractSelfTest
{
         assertTrue(fut.cancel());
 
         GridTestUtils.assertThrows(log, new Callable<Void>() {
-            @Override
-            public Void call() throws Exception {
+            @Override public Void call() throws Exception {
                 fut.get();
                 return null;
             }


Mime
View raw message