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-2042 Added special queue/set key classes to make collocation work with BinaryMarshaller.
Date Wed, 02 Dec 2015 13:03:39 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1537 f7783a78c -> 02a31824e


ignite-2042 Added special queue/set key classes to make collocation work with BinaryMarshaller.


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

Branch: refs/heads/ignite-1537
Commit: 02a31824ec67a72f9dd1405e533dac914e1a5653
Parents: f7783a7
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Dec 2 16:03:26 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Dec 2 16:03:26 2015 +0300

----------------------------------------------------------------------
 .../datastructures/CollocatedQueueItemKey.java  |  4 +-
 .../datastructures/CollocatedSetItemKey.java    |  4 +-
 .../IgnitePartitionedQueueCollocationTest.java  | 92 --------------------
 .../IgnitePartitionedQueueNoBackupsTest.java    | 92 ++++++++++++++++++++
 .../IgniteCacheDataStructuresSelfTestSuite.java |  4 +-
 5 files changed, 98 insertions(+), 98 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/02a31824/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedQueueItemKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedQueueItemKey.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedQueueItemKey.java
index e9b7a8b..8eb9fa0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedQueueItemKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedQueueItemKey.java
@@ -30,7 +30,7 @@ public class CollocatedQueueItemKey implements QueueItemKey {
 
     /** */
     @AffinityKeyMapped
-    private String queueName;
+    private int queueNameHash;
 
     /** */
     private long idx;
@@ -42,7 +42,7 @@ public class CollocatedQueueItemKey implements QueueItemKey {
      */
     public CollocatedQueueItemKey(IgniteUuid queueId, String queueName, long idx) {
         this.queueId = queueId;
-        this.queueName = queueName;
+        this.queueNameHash = queueName.hashCode();
         this.idx = idx;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/02a31824/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedSetItemKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedSetItemKey.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedSetItemKey.java
index afc110c..94cffd4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedSetItemKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CollocatedSetItemKey.java
@@ -35,7 +35,7 @@ public class CollocatedSetItemKey implements SetItemKey {
 
     /** */
     @AffinityKeyMapped
-    private String setName;
+    private int setNameHash;
 
     /**
      * @param setName Set name.
@@ -43,7 +43,7 @@ public class CollocatedSetItemKey implements SetItemKey {
      * @param item Set item.
      */
     public CollocatedSetItemKey(String setName, IgniteUuid setId, Object item) {
-        this.setName = setName;
+        this.setNameHash = setName.hashCode();
         this.setId = setId;
         this.item = item;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/02a31824/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedQueueCollocationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedQueueCollocationTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedQueueCollocationTest.java
deleted file mode 100644
index 6b8a75c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedQueueCollocationTest.java
+++ /dev/null
@@ -1,92 +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.datastructures.partitioned;
-
-import java.util.Iterator;
-import java.util.UUID;
-import org.apache.ignite.IgniteQueue;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMemoryMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.CollectionConfiguration;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
-import org.apache.ignite.testframework.GridTestUtils;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMemoryMode.ONHEAP_TIERED;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- *
- */
-public class IgnitePartitionedQueueCollocationTest extends GridCachePartitionedQueueApiSelfTest
{
-    /** {@inheritDoc} */
-    @Override protected CacheMode collectionCacheMode() {
-        return PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheMemoryMode collectionMemoryMode() {
-        return ONHEAP_TIERED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode collectionCacheAtomicityMode() {
-        return ATOMIC;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CollectionConfiguration collectionConfiguration() {
-        CollectionConfiguration colCfg = super.collectionConfiguration();
-
-        colCfg.setBackups(0);
-
-        return colCfg;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCollocation() throws Exception {
-        IgniteQueue<Integer> queue = grid(0).queue("queue", 0, config(true));
-
-        for (int i = 0; i < 1000; i++)
-            assertTrue(queue.add(i));
-
-        assertEquals(1000, queue.size());
-
-        GridCacheContext cctx = GridTestUtils.getFieldValue(queue, "cctx");
-
-        UUID setNodeId = null;
-
-        for (int i = 0; i < gridCount(); i++) {
-            IgniteKernal grid = (IgniteKernal)grid(i);
-
-            Iterator<GridCacheEntryEx> entries =
-                grid.context().cache().internalCache(cctx.name()).map().allEntries0().iterator();
-
-            if (entries.hasNext()) {
-                if (setNodeId == null)
-                    setNodeId = grid.localNode().id();
-                else
-                    fail("For collocated queue all items should be stored on single node.");
-            }
-        }
-    }}

http://git-wip-us.apache.org/repos/asf/ignite/blob/02a31824/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedQueueNoBackupsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedQueueNoBackupsTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedQueueNoBackupsTest.java
new file mode 100644
index 0000000..880c638
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedQueueNoBackupsTest.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.datastructures.partitioned;
+
+import java.util.Iterator;
+import java.util.UUID;
+import org.apache.ignite.IgniteQueue;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMemoryMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CollectionConfiguration;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
+import org.apache.ignite.testframework.GridTestUtils;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheMemoryMode.ONHEAP_TIERED;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+
+/**
+ *
+ */
+public class IgnitePartitionedQueueNoBackupsTest extends GridCachePartitionedQueueApiSelfTest
{
+    /** {@inheritDoc} */
+    @Override protected CacheMode collectionCacheMode() {
+        return PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheMemoryMode collectionMemoryMode() {
+        return ONHEAP_TIERED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode collectionCacheAtomicityMode() {
+        return ATOMIC;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CollectionConfiguration collectionConfiguration() {
+        CollectionConfiguration colCfg = super.collectionConfiguration();
+
+        colCfg.setBackups(0);
+
+        return colCfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCollocation() throws Exception {
+        IgniteQueue<Integer> queue = grid(0).queue("queue", 0, config(true));
+
+        for (int i = 0; i < 1000; i++)
+            assertTrue(queue.add(i));
+
+        assertEquals(1000, queue.size());
+
+        GridCacheContext cctx = GridTestUtils.getFieldValue(queue, "cctx");
+
+        UUID setNodeId = null;
+
+        for (int i = 0; i < gridCount(); i++) {
+            IgniteKernal grid = (IgniteKernal)grid(i);
+
+            Iterator<GridCacheEntryEx> entries =
+                grid.context().cache().internalCache(cctx.name()).map().allEntries0().iterator();
+
+            if (entries.hasNext()) {
+                if (setNodeId == null)
+                    setNodeId = grid.localNode().id();
+                else
+                    fail("For collocated queue all items should be stored on single node.");
+            }
+        }
+    }}

http://git-wip-us.apache.org/repos/asf/ignite/blob/02a31824/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
index f697114..519d3c1 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheDataStructuresSelfTestSuite.java
@@ -65,7 +65,7 @@ import org.apache.ignite.internal.processors.cache.datastructures.partitioned.Gr
 import org.apache.ignite.internal.processors.cache.datastructures.partitioned.GridCachePartitionedSetSelfTest;
 import org.apache.ignite.internal.processors.cache.datastructures.partitioned.IgnitePartitionedAtomicLongApiSelfTest;
 import org.apache.ignite.internal.processors.cache.datastructures.partitioned.IgnitePartitionedCountDownLatchSelfTest;
-import org.apache.ignite.internal.processors.cache.datastructures.partitioned.IgnitePartitionedQueueCollocationTest;
+import org.apache.ignite.internal.processors.cache.datastructures.partitioned.IgnitePartitionedQueueNoBackupsTest;
 import org.apache.ignite.internal.processors.cache.datastructures.partitioned.IgnitePartitionedSetNoBackupsSelfTest;
 import org.apache.ignite.internal.processors.cache.datastructures.replicated.GridCacheReplicatedAtomicReferenceApiSelfTest;
 import org.apache.ignite.internal.processors.cache.datastructures.replicated.GridCacheReplicatedAtomicStampedApiSelfTest;
@@ -166,7 +166,7 @@ public class IgniteCacheDataStructuresSelfTestSuite extends TestSuite
{
         suite.addTest(new TestSuite(IgniteClientDataStructuresTest.class));
         suite.addTest(new TestSuite(IgniteClientDiscoveryDataStructuresTest.class));
 
-        suite.addTest(new TestSuite(IgnitePartitionedQueueCollocationTest.class));
+        suite.addTest(new TestSuite(IgnitePartitionedQueueNoBackupsTest.class));
 
         return suite;
     }


Mime
View raw message