You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dg...@apache.org on 2019/04/03 15:24:41 UTC
[ignite] branch master updated: IGNITE-11574 Fix exchange on
NodeLeft event hangs when cluster is in transition state - Fixes #6310.
This is an automated email from the ASF dual-hosted git repository.
dgovorukhin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 770e2ba IGNITE-11574 Fix exchange on NodeLeft event hangs when cluster is in transition state - Fixes #6310.
770e2ba is described below
commit 770e2ba8ea5671946c77c43f65a47d971ce3d7cb
Author: ibessonov <be...@gmail.com>
AuthorDate: Wed Apr 3 18:23:46 2019 +0300
IGNITE-11574 Fix exchange on NodeLeft event hangs when cluster is in transition state - Fixes #6310.
Signed-off-by: Dmitriy Govorukhin <dm...@gmail.com>
---
.../cache/GridCachePartitionExchangeManager.java | 4 +-
.../processors/DeadLockOnNodeLeftExchangeTest.java | 111 +++++++++++++++++++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 3 +
3 files changed, 117 insertions(+), 1 deletion(-)
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 11551b0..8f6132e 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
@@ -290,7 +290,9 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
return;
}
- if (cache.state().transition()) {
+ if (cache.state().transition() &&
+ (evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_JOINED || evt.type() == EVT_NODE_FAILED)
+ ) {
if (log.isDebugEnabled())
log.debug("Adding pending event: " + evt);
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/DeadLockOnNodeLeftExchangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/DeadLockOnNodeLeftExchangeTest.java
new file mode 100644
index 0000000..a36d286
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/DeadLockOnNodeLeftExchangeTest.java
@@ -0,0 +1,111 @@
+/*
+ * 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;
+
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.FailureHandler;
+import org.apache.ignite.failure.StopNodeFailureHandler;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.TestRecordingCommunicationSpi;
+import org.apache.ignite.internal.cluster.IgniteClusterEx;
+import org.apache.ignite.internal.processors.cache.ExchangeContext;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.WithSystemProperty;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/** */
+public class DeadLockOnNodeLeftExchangeTest extends GridCommonAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ cfg.setConsistentId(igniteInstanceName);
+
+ cfg.setDataStorageConfiguration(new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+ .setPersistenceEnabled(true)
+ )
+ );
+
+ cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+ return new StopNodeFailureHandler();
+ }
+
+ /** */
+ @Before
+ public void before() throws Exception {
+ stopAllGrids();
+
+ cleanPersistenceDir();
+ }
+
+ /** */
+ @After
+ public void after() throws Exception {
+ stopAllGrids();
+
+ cleanPersistenceDir();
+ }
+
+ /** */
+ @Test
+ @WithSystemProperty(key = ExchangeContext.IGNITE_EXCHANGE_COMPATIBILITY_VER_1, value = "true")
+ @WithSystemProperty(key = IgniteSystemProperties.IGNITE_BASELINE_AUTO_ADJUST_ENABLED, value = "false")
+ public void test() throws Exception {
+ startGrids(4);
+
+ IgniteClusterEx cluster = grid(0).cluster();
+
+ cluster.active(true);
+
+ TestRecordingCommunicationSpi spi = TestRecordingCommunicationSpi.spi(grid(3));
+ spi.blockMessages(GridDhtPartitionsSingleMessage.class, getTestIgniteInstanceName(0));
+
+ stopGrid(1);
+
+ spi.waitForBlocked();
+
+ IgniteInternalFuture setBaselineTopFut = GridTestUtils.runAsync(() -> {
+ cluster.setBaselineTopology(cluster.topologyVersion());
+ });
+
+ assertTrue(GridTestUtils.waitForCondition(
+ () -> grid(0).context().state().clusterState().transition(),
+ 5_000L
+ ));
+
+ stopGrid(2);
+
+ spi.stopBlock();
+
+ setBaselineTopFut.get(30_000L);
+ }
+}
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 37411f4..7e1290d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -43,6 +43,7 @@ import org.apache.ignite.internal.MarshallerContextLockingSelfTest;
import org.apache.ignite.internal.TransactionsMXBeanImplTest;
import org.apache.ignite.internal.managers.IgniteDiagnosticMessagesMultipleConnectionsTest;
import org.apache.ignite.internal.managers.IgniteDiagnosticMessagesTest;
+import org.apache.ignite.internal.processors.DeadLockOnNodeLeftExchangeTest;
import org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentV2Test;
import org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentV2TestNoOptimizations;
import org.apache.ignite.internal.processors.affinity.GridAffinityProcessorMemoryLeakTest;
@@ -228,6 +229,8 @@ import org.junit.runners.Suite;
VariationsIteratorTest.class,
NotStringSystemPropertyTest.class,
ConfigVariationsTestSuiteBuilderTest.class,
+
+ DeadLockOnNodeLeftExchangeTest.class,
})
public class IgniteBasicTestSuite {
}