oleg-vlsk commented on code in PR #13263: URL: https://github.com/apache/ignite/pull/13263#discussion_r3533191144
########## modules/core/src/test/java/org/apache/ignite/internal/processors/cache/DynamicCacheStartExchangeTest.java: ########## @@ -0,0 +1,135 @@ +/* + * 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; + +import org.apache.ignite.Ignition; +import org.apache.ignite.cache.CacheAtomicityMode; +import org.apache.ignite.cache.CacheMode; +import org.apache.ignite.client.ClientCache; +import org.apache.ignite.client.ClientCacheConfiguration; +import org.apache.ignite.client.IgniteClient; +import org.apache.ignite.configuration.ClientConfiguration; +import org.apache.ignite.configuration.ClientConnectorConfiguration; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.internal.util.typedef.internal.CU; +import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; + +/** */ +public class DynamicCacheStartExchangeTest extends GridCommonAbstractTest { + /** */ + private static final int SRV_NODES = 3; + + /** */ + private static final int FIRST_CLIENT_PORT = 10800; + + /** */ + private static final int DYNAMIC_GROUPS = 3; + + /** */ + private static final int CACHES_PER_GROUP = 2; + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); + + int idx = getTestIgniteInstanceIndex(igniteInstanceName); + + return cfg.setClientConnectorConfiguration(new ClientConnectorConfiguration() + .setPort(FIRST_CLIENT_PORT + idx) + .setPortRange(0)); + } + + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + stopAllGrids(true); + + super.afterTest(); + } + + /** */ + @Test + public void testThinClientDynamicCacheStartCreatesCacheGroups() throws Exception { Review Comment: I thoroughly debugged the current version of the test and found out that it does not cover the skip check path at all: - `CacheAffinitySharedManager#initCoordinatorCaches` is not called during the dynamic cache creation; - neither is it called during the proposed additional node startup. It is only called during the initial cluster startup on the coordinator node upon static cache initialization. That’s why it was necessary to repeatedly shut down the cluster and start it up again in the reproducer and the initial stress test. Based on that, a smaller happy-path test with several static cache groups seems more relevant: it verifies that cache groups which belong to the current coordinator initialization exchange are not skipped and are properly started, even though during their initialization `CacheAffinitySharedManager#skipNotStartedDynamicGroup` is called. Therefore I changed the happy-path test to `CacheAffinityCoordinatorInitTest#testStaticCacheGroupsOnCoordinatorStart`. This still does not cover the exact “future dynamic group descriptor” scenario. Covering that would require either an internal hook, or the initial stress test. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
