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 2019/03/28 07:11:55 UTC

[ignite] branch master updated: IGNITE-11631 Fix NPE on server node start and persistence - Fixes #6344.

This is an automated email from the ASF dual-hosted git repository.

agoncharuk 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 51ab35f  IGNITE-11631 Fix NPE on server node start and persistence - Fixes #6344.
51ab35f is described below

commit 51ab35fa094cc409bb0c20d24affecfc100a9006
Author: Sergey Antonov <an...@gmail.com>
AuthorDate: Thu Mar 28 10:10:46 2019 +0300

    IGNITE-11631 Fix NPE on server node start and persistence - Fixes #6344.
    
    Signed-off-by: Alexey Goncharuk <al...@gmail.com>
---
 .../ignite/spi/discovery/tcp/TcpDiscoverySpi.java  |  4 +-
 .../persistence/SingleNodePersistenceSslTest.java  | 73 ++++++++++++++++++++++
 .../IgniteBasicWithPersistenceTestSuite.java       |  3 +
 3 files changed, 78 insertions(+), 2 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index fcb88a6..b7df270 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -2080,8 +2080,6 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements IgniteDiscovery
 
     /** {@inheritDoc} */
     @Override public void spiStart(@Nullable String igniteInstanceName) throws IgniteSpiException {
-        sslEnable = ignite().configuration().getSslContextFactory() != null;
-
         initializeImpl();
 
         registerMBean(igniteInstanceName, new TcpDiscoverySpiMBeanImpl(this), TcpDiscoverySpiMBean.class);
@@ -2096,6 +2094,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements IgniteDiscovery
         if (impl != null)
             return;
 
+        sslEnable = ignite().configuration().getSslContextFactory() != null;
+
         initFailureDetectionTimeout();
 
         if (!forceSrvMode && (Boolean.TRUE.equals(ignite.configuration().isClientMode()))) {
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/SingleNodePersistenceSslTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/SingleNodePersistenceSslTest.java
new file mode 100644
index 0000000..118d57d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/SingleNodePersistenceSslTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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.persistence;
+
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.failure.StopNodeFailureHandler;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+
+/**
+ * Checks, that cluster correct workds with enabled persistence and SSL.
+ */
+public class SingleNodePersistenceSslTest extends GridCommonAbstractTest {
+    /** {@inheritDoc} */
+    @Override public IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName)
+            .setSslContextFactory(GridTestUtils.sslFactory())
+            .setFailureHandler(new StopNodeFailureHandler())
+            .setDataStorageConfiguration(
+                new DataStorageConfiguration().setDefaultDataRegionConfiguration(
+                    new DataRegionConfiguration().setPersistenceEnabled(true)
+                )
+            );
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+    }
+
+    /**
+     * Checks, that cluster could be started and activated.
+     *
+     * @throws Exception If test failed.
+     */
+    @Test
+    public void testActivate() throws Exception {
+        startGrids(2).cluster().active(true);
+
+        assertTrue(grid(0).cluster().active());
+    }
+}
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicWithPersistenceTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicWithPersistenceTestSuite.java
index d0a251a..2e9a132 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicWithPersistenceTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicWithPersistenceTestSuite.java
@@ -31,6 +31,7 @@ import org.apache.ignite.internal.encryption.EncryptedCacheNodeJoinTest;
 import org.apache.ignite.internal.encryption.EncryptedCachePreconfiguredRestartTest;
 import org.apache.ignite.internal.encryption.EncryptedCacheRestartTest;
 import org.apache.ignite.internal.processors.cache.persistence.CheckpointReadLockFailureTest;
+import org.apache.ignite.internal.processors.cache.persistence.SingleNodePersistenceSslTest;
 import org.apache.ignite.marshaller.GridMarshallerMappingConsistencyTest;
 import org.apache.ignite.util.GridCommandHandlerSslTest;
 import org.apache.ignite.util.GridCommandHandlerTest;
@@ -64,6 +65,8 @@ import org.junit.runners.Suite;
     EncryptedCacheNodeJoinTest.class,
     EncryptedCacheRestartTest.class,
     EncryptedCachePreconfiguredRestartTest.class,
+
+    SingleNodePersistenceSslTest.class
 })
 public class IgniteBasicWithPersistenceTestSuite {
 }