You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vk...@apache.org on 2015/08/05 03:46:16 UTC

[16/19] incubator-ignite git commit: IGNITE-104 - Ordered ATOMIC updates

IGNITE-104 - Ordered ATOMIC updates


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

Branch: refs/heads/ignite-104
Commit: 3be215d941011283868b5d4ccaae2c8c6d1289df
Parents: 7d9ea01
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Tue Aug 4 18:22:30 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Tue Aug 4 18:22:30 2015 -0700

----------------------------------------------------------------------
 .../IgniteCacheStoreSessionAbstractTest.java    |  2 +-
 .../junits/common/GridCommonAbstractTest.java   | 20 +++++++++++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3be215d9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
index 7784003..c6150f8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
@@ -115,7 +115,7 @@ public abstract class IgniteCacheStoreSessionAbstractTest extends IgniteCacheAbs
      * @throws Exception If failed.
      */
     private void testStoreSession(IgniteCache<Object, Object> cache) throws Exception {
-        Set<Integer> keys = new HashSet<>(primaryKeys(cache, 3, 100_000));
+        Set<Integer> keys = new HashSet<>(primaryKeys(cache, 3, 100_000, true));
 
         Integer key = keys.iterator().next();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3be215d9/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 8698b4a..247a99e 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
@@ -503,6 +503,17 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
      * @return Collection of keys for which given cache is primary.
      */
     protected List<Integer> primaryKeys(IgniteCache<?, ?> cache, int cnt, int startFrom) {
+        return primaryKeys(cache, cnt, startFrom, false);
+    }
+
+    /**
+     * @param cache Cache.
+     * @param cnt Keys count.
+     * @param startFrom Start value for keys search.
+     * @param singlePart Single partition.
+     * @return Collection of keys for which given cache is primary.
+     */
+    protected List<Integer> primaryKeys(IgniteCache<?, ?> cache, int cnt, int startFrom, boolean singlePart) {
         assert cnt > 0 : cnt;
 
         List<Integer> found = new ArrayList<>(cnt);
@@ -511,10 +522,17 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
 
         Affinity<Integer> aff = (Affinity<Integer>)affinity(cache);
 
+        int part = -1;
+
         for (int i = startFrom; i < startFrom + 100_000; i++) {
             Integer key = i;
 
-            if (aff.isPrimary(locNode, key)) {
+            boolean add = part == -1 ? aff.isPrimary(locNode, key) : aff.partition(key) == part;
+
+            if (add) {
+                if (singlePart)
+                    part = aff.partition(key);
+
                 found.add(key);
 
                 if (found.size() == cnt)