Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-11390 DistributedMetaStorage start is incorrect for in-memory cluster #6170

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public ChangeTopologyWatcher(GridKernalContext ctx) {
if (isLocalNodeCoordinator(discoveryMgr)) {
exchangeManager.affinityReadyFuture(new AffinityTopologyVersion(discoEvt.topologyVersion()))
.listen((IgniteInClosure<IgniteInternalFuture<AffinityTopologyVersion>>)future -> {
if (future.error() != null)
return;

if (exchangeManager.lastFinishedFuture().hasLostPartitions()) {
log.warning("Baseline won't be changed cause the lost partitions were detected");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,6 @@ public DistributedMetaStorageImpl(GridKernalContext ctx) {
ver = DistributedMetaStorageVersion.INITIAL_VERSION;

bridge = new EmptyDistributedMetaStorageBridge();

for (DistributedMetastorageLifecycleListener subscriber : subscrProcessor.getDistributedMetastorageSubscribers())
subscriber.onReadyForRead(this);
}

GridDiscoveryManager discovery = ctx.discovery();
Expand All @@ -205,6 +202,14 @@ public DistributedMetaStorageImpl(GridKernalContext ctx) {

/** {@inheritDoc} */
@Override public void onKernalStart(boolean active) throws IgniteCheckedException {
if (ctx.clientNode() || ctx.isDaemon())
return;

if (!isPersistenceEnabled(ctx.config())) {
for (DistributedMetastorageLifecycleListener subscriber : subscrProcessor.getDistributedMetastorageSubscribers())
subscriber.onReadyForRead(this);
}

if (active)
onActivate(ctx);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;

import static org.junit.Assume.assumeTrue;

/**
*
*/
public class DistributedConfigurationTest extends GridCommonAbstractTest {
public abstract class DistributedConfigurationAbstractTest extends GridCommonAbstractTest {
/** */
private static final String TEST_PROP = "someLong";

Expand Down Expand Up @@ -57,48 +59,24 @@ public class DistributedConfigurationTest extends GridCommonAbstractTest {
DataStorageConfiguration storageCfg = new DataStorageConfiguration();

storageCfg.getDefaultDataRegionConfiguration()
.setPersistenceEnabled(true)
.setPersistenceEnabled(isPersistent())
.setMaxSize(500L * 1024 * 1024);

cfg.setDataStorageConfiguration(storageCfg);

return cfg;
}

// /**
// * @throws Exception If failed.
// */
// @Test
// public void test() throws Exception {
// IgniteEx ignite0 = startGrid(0);
// IgniteEx ignite1 = startGrid(1);
//
// ignite0.cluster().active(true);
//
// Assert.assertEquals(0, ignite0.cluster().baselineConfiguration().getBaselineAutoAdjustTimeout());
// Assert.assertEquals(0, ignite1.cluster().baselineConfiguration().getBaselineAutoAdjustTimeout());
//
// ignite0.cluster().baselineConfiguration().setBaselineAutoAdjustTimeout(2);
//
// Assert.assertEquals(2, ignite0.cluster().baselineConfiguration().getBaselineAutoAdjustTimeout());
// Assert.assertEquals(2, ignite1.cluster().baselineConfiguration().getBaselineAutoAdjustTimeout());
//
// stopAllGrids();
//
// ignite0 = startGrid(0);
// ignite1 = startGrid(1);
//
// ignite0.cluster().active(true);
//
// Assert.assertEquals(2, ignite0.cluster().baselineConfiguration().getBaselineAutoAdjustTimeout());
// Assert.assertEquals(2, ignite1.cluster().baselineConfiguration().getBaselineAutoAdjustTimeout());
// }
/** */
protected abstract boolean isPersistent();

/**
* @throws Exception If failed.
*/
@Test
public void testSuccessClusterWideUpdate() throws Exception {
assumeTrue(isPersistent());

IgniteEx ignite0 = startGrid(0);
IgniteEx ignite1 = startGrid(1);

Expand Down Expand Up @@ -135,6 +113,8 @@ public void testSuccessClusterWideUpdate() throws Exception {
*/
@Test
public void testReadLocalValueOnInactiveGrid() throws Exception {
assumeTrue(isPersistent());

IgniteEx ignite0 = startGrid(0);
startGrid(1);

Expand Down Expand Up @@ -193,6 +173,8 @@ public void testNotAttachedProperty() throws Exception {
*/
@Test(expected = NotWritablePropertyException.class)
public void testPropagateValueOnInactiveGridShouldThrowException() throws Exception {
assumeTrue(isPersistent());

IgniteEx ignite0 = (IgniteEx)startGrids(2);

DistributedLongProperty long0 = ignite0.context().distributedConfiguration().registerLong(TEST_PROP, 0L);
Expand All @@ -205,6 +187,8 @@ public void testPropagateValueOnInactiveGridShouldThrowException() throws Except
*/
@Test
public void testReadInitValueBeforeOnReadyForReady() throws Exception {
assumeTrue(isPersistent());

IgniteEx ignite0 = startGrid(0);
IgniteEx ignite1 = startGrid(1);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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.configuration.distributed;

/** */
public class DistributedConfigurationInMemoryTest extends DistributedConfigurationAbstractTest {
/** {@inheritDoc} */
@Override protected boolean isPersistent() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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.configuration.distributed;

/** */
public class DistributedConfigurationPersistentTest extends DistributedConfigurationAbstractTest {
/** {@inheritDoc} */
@Override protected boolean isPersistent() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import org.apache.ignite.internal.processors.closure.GridClosureProcessorRemoteTest;
import org.apache.ignite.internal.processors.closure.GridClosureProcessorSelfTest;
import org.apache.ignite.internal.processors.closure.GridClosureSerializationTest;
import org.apache.ignite.internal.processors.configuration.distributed.DistributedConfigurationInMemoryTest;
import org.apache.ignite.internal.processors.continuous.GridEventConsumeSelfTest;
import org.apache.ignite.internal.processors.continuous.GridMessageListenSelfTest;
import org.apache.ignite.internal.processors.database.BPlusTreeFakeReuseSelfTest;
Expand Down Expand Up @@ -214,6 +215,7 @@

// In-memory Distributed MetaStorage.
DistributedMetaStorageTest.class,
DistributedConfigurationInMemoryTest.class,

ConsistentIdImplicitlyExplicitlyTest.class,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.apache.ignite.internal.processors.cache.persistence.wal.SegmentedRingByteBufferTest;
import org.apache.ignite.internal.processors.cache.persistence.wal.SysPropWalDeltaConsistencyTest;
import org.apache.ignite.internal.processors.cache.persistence.wal.aware.SegmentAwareTest;
import org.apache.ignite.internal.processors.configuration.distributed.DistributedConfigurationPersistentTest;
import org.apache.ignite.internal.processors.database.IgniteDbDynamicCacheSelfTest;
import org.apache.ignite.internal.processors.database.IgniteDbMultiNodePutGetTest;
import org.apache.ignite.internal.processors.database.IgniteDbPutGetWithCacheStoreTest;
Expand Down Expand Up @@ -173,5 +174,6 @@ public static void addRealPageStoreTests(List<Class<?>> suite, Collection<Class>
//MetaStorage
GridTestUtils.addTestIfNeeded(suite, IgniteMetaStorageBasicTest.class, ignoredTests);
GridTestUtils.addTestIfNeeded(suite, DistributedMetaStoragePersistentTest.class, ignoredTests);
GridTestUtils.addTestIfNeeded(suite, DistributedConfigurationPersistentTest.class, ignoredTests);
}
}