sergey-chugunov-1985 commented on code in PR #12449:
URL: https://github.com/apache/ignite/pull/12449#discussion_r2481653432


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMdcGetTest.java:
##########
@@ -0,0 +1,140 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteNodeAttributes;
+import org.apache.ignite.internal.TestRecordingCommunicationSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/** */
+@RunWith(Parameterized.class)
+public class CacheMdcGetTest extends GridCommonAbstractTest {
+    /** */
+    private static final String DC_ID_0 = "DC0";
+
+    /** */
+    private static final String DC_ID_1 = "DC1";
+
+    /** */
+    private static final String KEY = "key";
+
+    /** */
+    private static final String VAL = "val";
+
+    /** */
+    @Parameterized.Parameters(name = "atomicity={0}")
+    public static Iterable<Object[]> data() {
+        List<Object[]> res = new ArrayList<>();
+
+        for (CacheAtomicityMode mode : CacheAtomicityMode.values()) {
+            res.add(new Object[] {mode});
+        }
+
+        return res;
+    }
+
+    /** */
+    @Parameterized.Parameter()
+    public CacheAtomicityMode atomicityMode;
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+
+        System.clearProperty(IgniteSystemProperties.IGNITE_DATA_CENTER_ID);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());
+
+        // Enforce different mac adresses to emulate distributed environment 
by default.
+        cfg.setUserAttributes(Collections.singletonMap(
+            IgniteNodeAttributes.ATTR_MACS_OVERRIDE, 
UUID.randomUUID().toString()));
+
+        return cfg;
+    }
+
+    /** */
+    @Test
+    public void test() throws Exception {

Review Comment:
   ```suggestion
       public void testReadFromReplicatedCache() throws Exception {
   ```



##########
modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite2.java:
##########
@@ -228,6 +229,7 @@
     PeriodicHistogramMetricImplTest.class,
 
     FreeListCutTailDifferentGcTest.class,
+    CacheMdcGetTest.class,

Review Comment:
   ```suggestion
       MdcCacheReadRequestsRoutingTest .class,
   ```



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMdcGetTest.java:
##########
@@ -0,0 +1,140 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteNodeAttributes;
+import org.apache.ignite.internal.TestRecordingCommunicationSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/** */
+@RunWith(Parameterized.class)
+public class CacheMdcGetTest extends GridCommonAbstractTest {

Review Comment:
   ```suggestion
   public class MdcCacheReadRequestsRoutingTest extends GridCommonAbstractTest {
   ```



##########
modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite2.java:
##########
@@ -46,6 +46,7 @@
 import org.apache.ignite.internal.pagemem.wal.record.WALRecordTest;
 import 
org.apache.ignite.internal.processors.cache.CacheLocalGetSerializationTest;
 import 
org.apache.ignite.internal.processors.cache.CacheLockCandidatesThreadTest;
+import org.apache.ignite.internal.processors.cache.CacheMdcGetTest;

Review Comment:
   ```suggestion
   import 
org.apache.ignite.internal.processors.cache.MdcCacheReadRequestsRoutingTest ;
   ```



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java:
##########
@@ -2226,6 +2226,10 @@ else if (type == EVT_CACHE_REBALANCE_STOPPED) {
             if ((canRemap || discovery().alive(node)) && 
!invalidNodes.contains(node)) {
                 if (locMacs.equals(node.attribute(ATTR_MACS)))
                     return node;
+                else if (localNode().dataCenterId() != null) {
+                    if (node.dataCenterId().equals(localNode().dataCenterId()))

Review Comment:
   ```suggestion
                       if 
(localNode().dataCenterId().equals(node.dataCenterId()))
   ```



-- 
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]

Reply via email to