You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/09/12 14:35:59 UTC
ignite git commit: IGNITE-6356 - Fixed partition ID negative overflow
Repository: ignite
Updated Branches:
refs/heads/ignite-6356 [created] 7841984d4
IGNITE-6356 - Fixed partition ID negative overflow
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7841984d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7841984d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7841984d
Branch: refs/heads/ignite-6356
Commit: 7841984d470cb5fd38ac8c6ac63e22791d0d45b5
Parents: 8c23805
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Tue Sep 12 17:35:46 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Tue Sep 12 17:35:46 2017 +0300
----------------------------------------------------------------------
.../configuration/CacheConfiguration.java | 2 +-
.../dht/preloader/GridDhtPartitionMap.java | 4 +-
.../distributed/Cache64kPartitionsTest.java | 86 ++++++++++++++++++++
.../testsuites/IgniteCacheTestSuite5.java | 4 +-
4 files changed, 92 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7841984d/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 2b4ec1d..6c43d13 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -77,7 +77,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
private static final long serialVersionUID = 0L;
/** Maximum number of partitions. */
- public static final int MAX_PARTITIONS_COUNT = 0xFFFF;
+ public static final int MAX_PARTITIONS_COUNT = 65000;
/** Default size of rebalance thread pool. */
@Deprecated
http://git-wip-us.apache.org/repos/asf/ignite/blob/7841984d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
index 5173a01..3aa982b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
@@ -293,8 +293,8 @@ public class GridDhtPartitionMap implements Comparable<GridDhtPartitionMap>, Ext
map = new GridPartitionStateMap();
for (int i = 0; i < size; i++) {
- int ordinal = in.readByte();
- int part = in.readShort();
+ int ordinal = in.readByte() & 0xFF;
+ int part = in.readShort() & 0xFFFF;
put(part, GridDhtPartitionState.fromOrdinal(ordinal));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7841984d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java
new file mode 100644
index 0000000..fe139ba
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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;
+
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class Cache64kPartitionsTest extends GridCommonAbstractTest {
+ /** */
+ private boolean persistenceEnabled;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ CacheConfiguration ccfg = new CacheConfiguration("default");
+
+ ccfg.setAffinity(new RendezvousAffinityFunction(false, CacheConfiguration.MAX_PARTITIONS_COUNT));
+
+ cfg.setCacheConfiguration(ccfg);
+
+ cfg.setActiveOnStart(false);
+
+ if (persistenceEnabled)
+ cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+
+ return cfg;
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testManyPartitionsNoPersistence() throws Exception {
+ checkManyPartitions();
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testManyPartitionsWithPersistence() throws Exception {
+ persistenceEnabled = true;
+
+ checkManyPartitions();
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ private void checkManyPartitions() throws Exception {
+ try {
+ startGrids(4);
+
+ grid(0).active(true);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ GridTestUtils.deleteDbFiles();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7841984d/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
index 953c789..38ffb4c 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
@@ -35,9 +35,9 @@ import org.apache.ignite.internal.processors.cache.IgniteCachePutStackOverflowSe
import org.apache.ignite.internal.processors.cache.IgniteCacheReadThroughEvictionsVariationsSuite;
import org.apache.ignite.internal.processors.cache.IgniteCacheStoreCollectionTest;
import org.apache.ignite.internal.processors.cache.PartitionsExchangeOnDiscoveryHistoryOverflowTest;
+import org.apache.ignite.internal.processors.cache.distributed.Cache64kPartitionsTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheLateAffinityAssignmentNodeJoinValidationTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheLateAffinityAssignmentTest;
-import org.apache.ignite.internal.processors.cache.distributed.GridCachePartitionEvictionDuringReadThroughSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheGroupsPartitionLossPolicySelfTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCachePartitionLossPolicySelfTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheTxIteratorSelfTest;
@@ -96,6 +96,8 @@ public class IgniteCacheTestSuite5 extends TestSuite {
suite.addTestSuite(NotMappedPartitionInTxTest.class);
+ suite.addTestSuite(Cache64kPartitionsTest.class);
+
return suite;
}
}