timoninmaxim commented on a change in pull request #9807:
URL: https://github.com/apache/ignite/pull/9807#discussion_r813995119



##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/consistency/GridNearReadRepairAbstractFuture.java
##########
@@ -58,15 +57,16 @@
     /** Maximum number of attempts to remap key to the same primary node. */
     protected static final int MAX_REMAP_CNT = 
getInteger(IGNITE_NEAR_GET_MAX_REMAPS, DFLT_MAX_REMAP_CNT);

Review comment:
       Let's set it to 0, or fail on remap (unstable topology isn't in the 
scope of the ticket).

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/consistency/GridNearReadRepairFuture.java
##########
@@ -79,11 +117,25 @@ public GridNearReadRepairFuture(
             deserializeBinary,
             recovery,
             expiryPlc,
-            tx);
+            tx,
+            remappedFut);
 
         assert ctx.transactional() : "Atomic cache should not be recovered 
using this future";
+    }
 
-        init();
+    /** {@inheritDoc} */
+    @Override protected GridNearReadRepairAbstractFuture 
remapFuture(AffinityTopologyVersion topVer) {
+        return new GridNearReadRepairFuture(
+            topVer,
+            ctx,
+            keys,
+            strategy,
+            readThrough,
+            taskName,
+            deserializeBinary,
+            recovery,
+            expiryPlc,
+            tx);

Review comment:
       There should be a `this` for remapping

##########
File path: 
modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTestSelfTest.java
##########
@@ -0,0 +1,180 @@
+/*
+ * 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.testframework.junits.common;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class GridCommonAbstractTestSelfTest extends GridCommonAbstractTest {
+    /**
+     *
+     */
+    @Test
+    public void testOrderedCollectionsEqualityChecks() {
+        assertEqualsCollections(
+            Arrays.asList(1, 2, 3),
+            Arrays.asList(1, 2, 3));
+
+        asserFailed(() -> assertEqualsCollections(
+            Arrays.asList(1, 2, 3),
+            Arrays.asList(2, 3, 1)));
+
+        asserFailed(() -> assertEqualsCollections(
+            Arrays.asList(1, 2, 3, null),
+            Arrays.asList(2, 3, 1)));
+
+        asserFailed(() -> assertEqualsCollections(
+            Arrays.asList(1, 2, 3),
+            Arrays.asList(2, 3, 1, null)));
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void testCollectionsEqualityChecks() {
+        assertEqualsCollectionsIgnoringOrder(
+            Arrays.asList(1, 2, 3),
+            Arrays.asList(1, 2, 3));
+
+        assertEqualsCollectionsIgnoringOrder(
+            Arrays.asList(1, 2, 3),
+            Arrays.asList(2, 3, 1));
+
+        assertEqualsCollectionsIgnoringOrder(
+            Arrays.asList(1, 2, 2, 3),
+            Arrays.asList(2, 3, 2, 1));
+
+        asserFailed(() -> assertEqualsCollectionsIgnoringOrder(
+            Arrays.asList(1, 2, 3),
+            Arrays.asList(2, 3, 1, 2)));
+
+        asserFailed(() -> assertEqualsCollectionsIgnoringOrder(
+            Arrays.asList(1, 2, 3),
+            Arrays.asList(1, 2, 2, 3)));
+
+        asserFailed(() -> assertEqualsCollectionsIgnoringOrder(
+            Arrays.asList(1, 2, 2, 3),
+            Arrays.asList(1, 1, 2, 3)));
+
+        asserFailed(() -> assertEqualsCollectionsIgnoringOrder(
+            Arrays.asList(1, 2, 2),
+            Arrays.asList(1, 2, 2, 4)));
+
+        asserFailed(() -> assertEqualsCollectionsIgnoringOrder(
+            Arrays.asList(1, 2, 2),
+            Arrays.asList(1, 2, 2, null)));
+
+        asserFailed(() -> assertEqualsCollectionsIgnoringOrder(
+            Arrays.asList(1, 2, 2, null),
+            Arrays.asList(1, 2, 2)));
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void testMapsEqualityChecks() {
+        assertEqualsMaps(
+            new HashMap<Integer, Integer>() {{
+                put(1, 1);
+                put(2, 2);
+                put(3, 3);
+            }},
+            new HashMap<Integer, Integer>() {{
+                put(1, 1);
+                put(3, 3);
+                put(2, 2);
+            }});
+
+        asserFailed(() -> assertEqualsMaps(
+            new HashMap<Integer, Integer>() {{
+                put(1, 1);
+                put(2, 2);
+                put(3, 3);
+            }},
+            new HashMap<Integer, Integer>() {{
+                put(1, 1);
+                put(2, 2);
+                put(3, 3);
+                put(4, 4);
+            }}));
+
+        asserFailed(() -> assertEqualsMaps(
+            new HashMap<Integer, Integer>() {{
+                put(1, 1);
+                put(2, 2);
+                put(3, 3);
+                put(null, null);
+            }},
+            new HashMap<Integer, Integer>() {{
+                put(1, 1);
+                put(2, 2);
+                put(3, 3);
+                put(4, 4);
+            }}));
+
+        asserFailed(() -> assertEqualsMaps(
+            new HashMap<Integer, Integer>() {{
+                put(1, 1);
+                put(2, 2);
+                put(3, 3);
+                put(null, null);
+            }},
+            new HashMap<Integer, Integer>() {{
+                put(1, 1);
+                put(2, 2);
+                put(3, 3);
+            }}));
+
+        asserFailed(() -> assertEqualsMaps(
+            new HashMap<Integer, Integer>() {{
+                put(1, 1);
+                put(2, 2);
+                put(3, 3);
+            }},
+            new HashMap<Integer, Integer>() {{
+                put(1, 1);
+                put(2, 2);
+                put(3, 3);
+                put(null, null);
+            }}));
+    }
+
+    /**
+     * @param r Runnable.
+     */
+    private void asserFailed(Runnable r) {

Review comment:
       asser --> assert

##########
File path: 
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/consistency/AbstractFullSetReadRepairTest.java
##########
@@ -270,20 +270,20 @@
      * @param data Data.
      */
     protected void check(ReadRepairData data, 
IgniteIrreparableConsistencyViolationException e, boolean evtRecorded) {
-        Collection<?> irreparableKeys = e != null ? e.irreparableKeys() : null;
+        Collection<Object> irreparableKeys = e != null ? e.irreparableKeys() : 
null;
 
         if (e != null) {
-            Collection<?> repairableKeys = e.repairableKeys();
+            Collection<Object> repairableKeys = e.repairableKeys();
 
             if (repairableKeys != null)
                 assertTrue(Collections.disjoint(repairableKeys, 
irreparableKeys));
 
-            Collection<?> expectedToBeIrreparableKeys = 
data.data.entrySet().stream()
+            Collection<Object> expectedToBeIrreparableKeys = 
data.data.entrySet().stream()
                 .filter(entry -> !entry.getValue().repairable)
                 .map(Map.Entry::getKey)
                 .collect(Collectors.toSet());
 
-            assertEquals(expectedToBeIrreparableKeys, irreparableKeys);
+            assertEqualsCollectionsIgnoringOrder(expectedToBeIrreparableKeys, 
irreparableKeys);

Review comment:
       Why don't use 
`assertTrue(expectedToBeIrreparableKeys.equals(irreparableKeys))`?




-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to