ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: ignite-5075
Date Mon, 15 May 2017 15:42:23 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-5075 f5c4ede2a -> f04db168a


ignite-5075


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

Branch: refs/heads/ignite-5075
Commit: f04db168a1f9bcbd797a02f646eb098a2c5ba304
Parents: f5c4ede
Author: sboikov <sboikov@gridgain.com>
Authored: Mon May 15 18:42:15 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Mon May 15 18:42:15 2017 +0300

----------------------------------------------------------------------
 .../distributed/dht/GridDhtLocalPartition.java  |  2 +-
 .../processors/cache/IgniteCacheGroupsTest.java | 74 ++++++++++++--------
 2 files changed, 46 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f04db168/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index 8c3fa15..03959c7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -556,7 +556,7 @@ public class GridDhtLocalPartition extends GridCacheConcurrentMapImpl
implements
 
     /** {@inheritDoc} */
     @Override protected void release(int sizeChange, GridCacheEntryEx e) {
-        if (sizeChange != 0)
+        if (grp.sharedGroup() && sizeChange != 0)
             cacheSizeCounter(e.context().cacheId()).addAndGet(sizeChange);
 
         release0(sizeChange);

http://git-wip-us.apache.org/repos/asf/ignite/blob/f04db168/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
index 31fec12..b06a129 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
@@ -92,7 +92,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
 
         Ignite client = startGrid(1);
 
-        IgniteCache c1 = client.createCache(cacheConfiguration(GROUP1, "c1", PARTITIONED,
ATOMIC, 0));
+        IgniteCache c1 = client.createCache(cacheConfiguration(GROUP1, "c1", PARTITIONED,
ATOMIC, 0, false));
 
         checkCacheGroup(0, GROUP1, true);
         checkCacheGroup(0, GROUP1, true);
@@ -145,7 +145,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
         for (int iter = 0; iter < 3; iter++) {
             log.info("Iteration: " + iter);
 
-            srv0.createCache(cacheConfiguration(GROUP1, "cache1", PARTITIONED, ATOMIC, 2));
+            srv0.createCache(cacheConfiguration(GROUP1, "cache1", PARTITIONED, ATOMIC, 2,
false));
 
             for (int i = 0; i < srvs; i++) {
                 checkCacheGroup(i, GROUP1, true);
@@ -153,7 +153,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
                 checkCache(i, "cache1");
             }
 
-            srv0.createCache(cacheConfiguration(GROUP1, "cache2", PARTITIONED, ATOMIC, 2));
+            srv0.createCache(cacheConfiguration(GROUP1, "cache2", PARTITIONED, ATOMIC, 2,
false));
 
             for (int i = 0; i < srvs; i++) {
                 checkCacheGroup(i, GROUP1, true);
@@ -202,9 +202,9 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
 
         {
             IgniteCache<Object, Object> cache1 =
-                srv0.createCache(cacheConfiguration("grp1", "cache1", PARTITIONED, ATOMIC,
2));
+                srv0.createCache(cacheConfiguration("grp1", "cache1", PARTITIONED, ATOMIC,
2, false));
             IgniteCache<Object, Object> cache2 =
-                srv0.createCache(cacheConfiguration("grp1", "cache2", PARTITIONED, ATOMIC,
2));
+                srv0.createCache(cacheConfiguration("grp1", "cache2", PARTITIONED, ATOMIC,
2, false));
 
             cache1.put(new Key1(1), 1);
             assertEquals(1, cache1.get(new Key1(1)));
@@ -242,9 +242,9 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
 
         {
             IgniteCache<Object, Object> cache1 =
-                srv0.createCache(cacheConfiguration(GROUP1, "cache1", PARTITIONED, ATOMIC,
0));
+                srv0.createCache(cacheConfiguration(GROUP1, "cache1", PARTITIONED, ATOMIC,
0, false));
             IgniteCache<Object, Object> cache2 =
-                srv0.createCache(cacheConfiguration(GROUP1, "cache2", PARTITIONED, ATOMIC,
0));
+                srv0.createCache(cacheConfiguration(GROUP1, "cache2", PARTITIONED, ATOMIC,
0, false));
 
             for (int i = 0; i < 10; i++) {
                 cache1.put(new Key1(i), 1);
@@ -267,17 +267,18 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
 
         startGrid(4);
 
-        cacheApiTest(PARTITIONED, TRANSACTIONAL, 2);
+        cacheApiTest(PARTITIONED, TRANSACTIONAL, 2, false);
     }
 
     /**
      * @param cacheMode Cache mode.
      * @param atomicityMode Atomicity mode.
      * @param backups Number of backups.
+     * @param heapCache On heap cache flag.
      */
-    private void cacheApiTest(CacheMode cacheMode, CacheAtomicityMode atomicityMode, int
backups) {
+    private void cacheApiTest(CacheMode cacheMode, CacheAtomicityMode atomicityMode, int
backups, boolean heapCache) {
         for (int i = 0; i < 2; i++)
-            ignite(0).createCache(cacheConfiguration(GROUP1, "cache-" + i, cacheMode, atomicityMode,
backups));
+            ignite(0).createCache(cacheConfiguration(GROUP1, "cache-" + i, cacheMode, atomicityMode,
backups, heapCache));
 
         for (Ignite node : Ignition.allGrids()) {
             for (int i = 0; i < 2; i++) {
@@ -316,11 +317,12 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
 
         startGridsMultiThreaded(SRVS, CLIENTS);
 
-        final int CACHES = 4;
+        final int CACHES = 8;
 
         for (int i = 0; i < CACHES; i++) {
-            srv0.createCache(cacheConfiguration(GROUP1, GROUP1 + "-" + i, PARTITIONED, ATOMIC,
i));
-            srv0.createCache(cacheConfiguration(GROUP2, GROUP2 + "-" + i, PARTITIONED, TRANSACTIONAL,
i));
+            srv0.createCache(cacheConfiguration(GROUP1, GROUP1 + "-" + i, PARTITIONED, ATOMIC,
i, i % 2 == 0));
+
+            srv0.createCache(cacheConfiguration(GROUP2, GROUP2 + "-" + i, PARTITIONED, TRANSACTIONAL,
i, i % 2 == 0));
         }
 
         final AtomicInteger idx = new AtomicInteger();
@@ -362,20 +364,22 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
             @Override public void run() {
                 try {
                     while (!stop.get()) {
-//                        ThreadLocalRandom rnd = ThreadLocalRandom.current();
-//
-//                        String grp = rnd.nextBoolean() ? GROUP1 : GROUP2;
-//
-//                        Ignite node = ignite(rnd.nextInt(NODES));
-//
-//                        IgniteCache cache = node.createCache(cacheConfiguration(grp, "tmpCache",
-//                            rnd.nextBoolean() ? ATOMIC : TRANSACTIONAL,
-//                            rnd.nextInt(3)));
-//
-//                        for (int i = 0; i < 10; i++)
-//                            cacheOperation(rnd, cache);
-//
-//                        node.destroyCache(cache.getName());
+                        ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+                        String grp = rnd.nextBoolean() ? GROUP1 : GROUP2;
+
+                        Ignite node = ignite(rnd.nextInt(NODES));
+
+                        IgniteCache cache = node.createCache(cacheConfiguration(grp, "tmpCache",
+                            PARTITIONED,
+                            rnd.nextBoolean() ? ATOMIC : TRANSACTIONAL,
+                            rnd.nextInt(3),
+                            rnd.nextBoolean()));
+
+                        for (int i = 0; i < 10; i++)
+                            cacheOperation(rnd, cache);
+
+                        node.destroyCache(cache.getName());
 
                         U.sleep(1000);
                     }
@@ -408,7 +412,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
      * @param cache Cache.
      */
     private void cacheOperation(ThreadLocalRandom rnd, IgniteCache cache) {
-        int key = rnd.nextInt(1000);
+        Object key = cache.getName() + rnd.nextInt(1000);
 
         cache.put(key, 1);
     }
@@ -479,12 +483,23 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
         }
     }
 
+    /**
+     * @param grpName Cache group name.
+     * @param name Cache name.
+     * @param cacheMode Cache mode.
+     * @param atomicityMode Atomicity mode.
+     * @param backups Backups number.
+     * @param heapCache On heap cache flag.
+     * @return Cache configuration.
+     */
     private CacheConfiguration cacheConfiguration(
         String grpName,
         String name,
         CacheMode cacheMode,
         CacheAtomicityMode atomicityMode,
-        int backups) {
+        int backups,
+        boolean heapCache
+    ) {
         CacheConfiguration ccfg = new CacheConfiguration();
 
         ccfg.setName(name);
@@ -493,6 +508,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
         ccfg.setBackups(backups);
         ccfg.setCacheMode(cacheMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
+        ccfg.setOnheapCacheEnabled(heapCache);
 
         return ccfg;
     }


Mime
View raw message