You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/05/27 15:25:58 UTC

[GitHub] [ignite] anton-vinogradov opened a new pull request, #10047: IGNITE-15834 Read Repair should support arrays and collections as values

anton-vinogradov opened a new pull request, #10047:
URL: https://github.com/apache/ignite/pull/10047

   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [ ] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [ ] The JIRA ticket has the _Patch Available_ state.
   - [ ] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [ ] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


-- 
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-unsubscribe@ignite.apache.org

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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10047: IGNITE-15834 Read Repair should support arrays and collections as values

Posted by GitBox <gi...@apache.org>.
nizhikov commented on code in PR #10047:
URL: https://github.com/apache/ignite/pull/10047#discussion_r893230898


##########
modules/core/src/test/java/org/apache/ignite/testframework/junits/JUnitAssertAware.java:
##########
@@ -203,4 +203,33 @@ protected static void assertNotSame(Object unexpected, Object actual) {
     protected static void assertNotSame(String msg, Object exp, Object actual) {
         Assert.assertNotSame(msg, exp, actual);
     }
+
+    /** Check arrays equality as well as objects equality. */
+    protected static void assertEqualsArraysOrObjects(Object exp, Object actual) {
+        assertEqualsArraysOrObjects(null, exp, actual);
+    }
+
+    /** Check arrays equality as well as objects equality. */
+    protected static void assertEqualsArraysOrObjects(String msg, Object exp, Object actual) {

Review Comment:
   We have copy of this method - `FunctionalTest#assertEqualsArraysAware` - let's keep one copy and deduplicate.



-- 
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-unsubscribe@ignite.apache.org

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


[GitHub] [ignite] anton-vinogradov commented on a diff in pull request #10047: IGNITE-15834 Read Repair should support arrays and collections as values

Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on code in PR #10047:
URL: https://github.com/apache/ignite/pull/10047#discussion_r893303604


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/consistency/ReadRepairDataGenerator.java:
##########
@@ -218,6 +217,17 @@ public void generateAndCheck(
         }
     }
 
+    /**
+     * @param obj Object.
+     */
+    private Object describeArrayIfNeeded(Object obj) {
+        if (obj instanceof Object[])
+            return Arrays.deepToString((Object[])obj);
+        else if (obj instanceof int[])

Review Comment:
   You should call explicit method for each type. 
   Each type has it's own `toString`.
   Thats why only required impmented.



-- 
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-unsubscribe@ignite.apache.org

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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10047: IGNITE-15834 Read Repair should support arrays and collections as values

Posted by GitBox <gi...@apache.org>.
nizhikov commented on code in PR #10047:
URL: https://github.com/apache/ignite/pull/10047#discussion_r893231897


##########
modules/core/src/test/java/org/apache/ignite/testframework/junits/JUnitAssertAware.java:
##########
@@ -203,4 +203,33 @@ protected static void assertNotSame(Object unexpected, Object actual) {
     protected static void assertNotSame(String msg, Object exp, Object actual) {
         Assert.assertNotSame(msg, exp, actual);
     }
+
+    /** Check arrays equality as well as objects equality. */
+    protected static void assertEqualsArraysOrObjects(Object exp, Object actual) {
+        assertEqualsArraysOrObjects(null, exp, actual);
+    }
+
+    /** Check arrays equality as well as objects equality. */
+    protected static void assertEqualsArraysOrObjects(String msg, Object exp, Object actual) {
+        if (exp instanceof Object[] && actual instanceof Object[])
+            Assert.assertArrayEquals(msg, (Object[])exp, (Object[])actual);
+        else if (exp instanceof byte[] && actual instanceof byte[])

Review Comment:
   This can be shortened to `exp != null && exp.getClass().isArray() && exp.getClass().getElementClass().isPrimitive()` or event to `U.isPrimitiveArray(exp)`



-- 
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-unsubscribe@ignite.apache.org

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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10047: IGNITE-15834 Read Repair should support arrays and collections as values

Posted by GitBox <gi...@apache.org>.
nizhikov commented on code in PR #10047:
URL: https://github.com/apache/ignite/pull/10047#discussion_r893220355


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/consistency/ReadRepairDataGenerator.java:
##########
@@ -218,6 +217,17 @@ public void generateAndCheck(
         }
     }
 
+    /**
+     * @param obj Object.
+     */
+    private Object describeArrayIfNeeded(Object obj) {
+        if (obj instanceof Object[])
+            return Arrays.deepToString((Object[])obj);
+        else if (obj instanceof int[])

Review Comment:
   Let's user `obj != null && obj.getClass().isArray()` here. To handle all primitive arrays.



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/consistency/ReadRepairDataGenerator.java:
##########
@@ -218,6 +217,17 @@ public void generateAndCheck(
         }
     }
 
+    /**
+     * @param obj Object.
+     */
+    private Object describeArrayIfNeeded(Object obj) {
+        if (obj instanceof Object[])
+            return Arrays.deepToString((Object[])obj);
+        else if (obj instanceof int[])

Review Comment:
   Let's use `obj != null && obj.getClass().isArray()` here. To handle all primitive arrays.



-- 
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-unsubscribe@ignite.apache.org

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


[GitHub] [ignite] anton-vinogradov commented on a diff in pull request #10047: IGNITE-15834 Read Repair should support arrays and collections as values

Posted by GitBox <gi...@apache.org>.
anton-vinogradov commented on code in PR #10047:
URL: https://github.com/apache/ignite/pull/10047#discussion_r893334692


##########
modules/core/src/test/java/org/apache/ignite/testframework/junits/JUnitAssertAware.java:
##########
@@ -203,4 +203,33 @@ protected static void assertNotSame(Object unexpected, Object actual) {
     protected static void assertNotSame(String msg, Object exp, Object actual) {
         Assert.assertNotSame(msg, exp, actual);
     }
+
+    /** Check arrays equality as well as objects equality. */
+    protected static void assertEqualsArraysOrObjects(Object exp, Object actual) {
+        assertEqualsArraysOrObjects(null, exp, actual);
+    }
+
+    /** Check arrays equality as well as objects equality. */
+    protected static void assertEqualsArraysOrObjects(String msg, Object exp, Object actual) {
+        if (exp instanceof Object[] && actual instanceof Object[])
+            Assert.assertArrayEquals(msg, (Object[])exp, (Object[])actual);
+        else if (exp instanceof byte[] && actual instanceof byte[])

Review Comment:
   Replased with proposed method body



-- 
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-unsubscribe@ignite.apache.org

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


[GitHub] [ignite] anton-vinogradov merged pull request #10047: IGNITE-15834 Read Repair should support arrays and collections as values

Posted by GitBox <gi...@apache.org>.
anton-vinogradov merged PR #10047:
URL: https://github.com/apache/ignite/pull/10047


-- 
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-unsubscribe@ignite.apache.org

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


[GitHub] [ignite] nizhikov commented on a diff in pull request #10047: IGNITE-15834 Read Repair should support arrays and collections as values

Posted by GitBox <gi...@apache.org>.
nizhikov commented on code in PR #10047:
URL: https://github.com/apache/ignite/pull/10047#discussion_r893231897


##########
modules/core/src/test/java/org/apache/ignite/testframework/junits/JUnitAssertAware.java:
##########
@@ -203,4 +203,33 @@ protected static void assertNotSame(Object unexpected, Object actual) {
     protected static void assertNotSame(String msg, Object exp, Object actual) {
         Assert.assertNotSame(msg, exp, actual);
     }
+
+    /** Check arrays equality as well as objects equality. */
+    protected static void assertEqualsArraysOrObjects(Object exp, Object actual) {
+        assertEqualsArraysOrObjects(null, exp, actual);
+    }
+
+    /** Check arrays equality as well as objects equality. */
+    protected static void assertEqualsArraysOrObjects(String msg, Object exp, Object actual) {
+        if (exp instanceof Object[] && actual instanceof Object[])
+            Assert.assertArrayEquals(msg, (Object[])exp, (Object[])actual);
+        else if (exp instanceof byte[] && actual instanceof byte[])

Review Comment:
   This can be shortened to `exp != null && exp.getClass().isArray() && exp.getClass().getElementClass().isPrimitive()`.



-- 
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-unsubscribe@ignite.apache.org

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