You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/06/19 11:35:19 UTC
ignite git commit: ignite-5100 Do not remove active exchange futures
from ExchangeFutureSet
Repository: ignite
Updated Branches:
refs/heads/master d4bf7c989 -> ecb9e4dc3
ignite-5100 Do not remove active exchange futures from ExchangeFutureSet
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ecb9e4dc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ecb9e4dc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ecb9e4dc
Branch: refs/heads/master
Commit: ecb9e4dc31b48a3de2f676d455ed8286379f85b1
Parents: d4bf7c9
Author: Evgeny Stanilovskiy <es...@gridgain.com>
Authored: Mon Jun 19 14:34:58 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Jun 19 14:34:58 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 3 +
.../GridCachePartitionExchangeManager.java | 15 ++--
...chePartitionExchangeManagerHistSizeTest.java | 76 ++++++++++++++++++++
.../testsuites/IgniteCacheTestSuite5.java | 3 +
4 files changed, 93 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecb9e4dc/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index d9c112c..7d2d48f 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -158,6 +158,9 @@ public final class IgniteSystemProperties {
*/
public static final String IGNITE_CONSOLE_APPENDER = "IGNITE_CONSOLE_APPENDER";
+ /** Maximum size for exchange history. Default value is {@code 1000}.*/
+ public static final String IGNITE_EXCHANGE_HISTORY_SIZE = "IGNITE_EXCHANGE_HISTORY_SIZE";
+
/**
* Name of the system property defining name of command line program.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecb9e4dc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 2dff4cf..f64fb21 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -121,7 +121,8 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.preloa
*/
public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedManagerAdapter<K, V> {
/** Exchange history size. */
- private static final int EXCHANGE_HISTORY_SIZE = 1000;
+ private static final int EXCHANGE_HISTORY_SIZE =
+ IgniteSystemProperties.getInteger(IgniteSystemProperties.IGNITE_EXCHANGE_HISTORY_SIZE, 1_000);
/** Atomic reference for pending timeout object. */
private AtomicReference<ResendTimeoutObject> pendingResend = new AtomicReference<>();
@@ -2121,8 +2122,14 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
GridDhtPartitionsExchangeFuture fut) {
GridDhtPartitionsExchangeFuture cur = super.addx(fut);
- while (size() > EXCHANGE_HISTORY_SIZE)
+ while (size() > EXCHANGE_HISTORY_SIZE) {
+ GridDhtPartitionsExchangeFuture last = last();
+
+ if (!last.isDone())
+ break;
+
removeLast();
+ }
// Return the value in the set.
return cur == null ? fut : cur;
@@ -2130,8 +2137,8 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
/** {@inheritDoc} */
@Nullable @Override public synchronized GridDhtPartitionsExchangeFuture removex(
- GridDhtPartitionsExchangeFuture val
- ) {
+ GridDhtPartitionsExchangeFuture val) {
+
return super.removex(val);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecb9e4dc/modules/core/src/test/java/org/apache/ignite/internal/GridCachePartitionExchangeManagerHistSizeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridCachePartitionExchangeManagerHistSizeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridCachePartitionExchangeManagerHistSizeTest.java
new file mode 100644
index 0000000..5f1c3a8
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridCachePartitionExchangeManagerHistSizeTest.java
@@ -0,0 +1,76 @@
+/*
+ * 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;
+
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_EXCHANGE_HISTORY_SIZE;
+
+/**
+ * Test exchange history size parameter effect.
+ */
+public class GridCachePartitionExchangeManagerHistSizeTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private String oldHistVal;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
+ cfg.setCacheConfiguration(new CacheConfiguration(DEFAULT_CACHE_NAME));
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ oldHistVal = System.getProperty(IGNITE_EXCHANGE_HISTORY_SIZE);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
+ if (oldHistVal != null)
+ System.setProperty(IGNITE_EXCHANGE_HISTORY_SIZE, oldHistVal);
+ else
+ System.clearProperty(IGNITE_EXCHANGE_HISTORY_SIZE);
+ }
+
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSingleExchangeHistSize() throws Exception {
+ System.setProperty(IGNITE_EXCHANGE_HISTORY_SIZE, "1");
+
+ startGridsMultiThreaded(10);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecb9e4dc/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 18b9258..4134dc1 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
@@ -23,6 +23,7 @@ import org.apache.ignite.IgniteCacheAffinitySelfTest;
import org.apache.ignite.cache.affinity.AffinityClientNodeSelfTest;
import org.apache.ignite.cache.affinity.AffinityHistoryCleanupTest;
import org.apache.ignite.cache.affinity.local.LocalAffinityFunctionTest;
+import org.apache.ignite.internal.GridCachePartitionExchangeManagerHistSizeTest;
import org.apache.ignite.internal.processors.cache.CacheKeepBinaryTransactionTest;
import org.apache.ignite.internal.processors.cache.CacheNearReaderUpdateTest;
import org.apache.ignite.internal.processors.cache.CacheRebalancingSelfTest;
@@ -89,6 +90,8 @@ public class IgniteCacheTestSuite5 extends TestSuite {
suite.addTestSuite(PartitionsExchangeOnDiscoveryHistoryOverflowTest.class);
+ suite.addTestSuite(GridCachePartitionExchangeManagerHistSizeTest.class);
+
return suite;
}
}