You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "sashapolo (via GitHub)" <gi...@apache.org> on 2024/08/07 15:46:42 UTC

[PR] IGNITE-22957 Use a non-random transaction IDs in tests [ignite-3]

sashapolo opened a new pull request, #4201:
URL: https://github.com/apache/ignite-3/pull/4201

   https://issues.apache.org/jira/browse/IGNITE-22957
   
   Thank you for submitting the pull request.
   
   To streamline the review process of the patch and ensure better code quality
   we ask both an author and a reviewer to verify the following:
   
   ### The Review Checklist
   - [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:  
   \- 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 description of the JIRA ticket explains WHAT was made, WHY and 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.
   - [ ] **Design:** new code conforms with the design principles of the components it is added to.
   - [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
   - [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
   - [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
   
   ### Notes
   - [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)


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


Re: [PR] IGNITE-22957 Use non-random transaction IDs in tests [ignite-3]

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #4201:
URL: https://github.com/apache/ignite-3/pull/4201#discussion_r1708833776


##########
modules/schema/src/testFixtures/java/org/apache/ignite/internal/schema/BinaryRowMatcher.java:
##########
@@ -30,16 +29,25 @@ public class BinaryRowMatcher extends CustomMatcher<BinaryRow> {
     private final @Nullable BinaryRow row;
 
     private BinaryRowMatcher(@Nullable BinaryRow row) {
-        super("Expected row to be equal to " + rowToString(row));
+        super("a row equal to " + rowToString(row));
         this.row = row;
     }
 
+    @Override
+    public void describeMismatch(Object item, Description description) {
+        if (item instanceof BinaryRow) {

Review Comment:
   No, because `TypeSafeMatcher` does not allow `null`s



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


Re: [PR] IGNITE-22957 Use non-random transaction IDs in tests [ignite-3]

Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch commented on code in PR #4201:
URL: https://github.com/apache/ignite-3/pull/4201#discussion_r1708848621


##########
modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/BaseMvStoragesTest.java:
##########
@@ -72,7 +74,7 @@ public abstract class BaseMvStoragesTest extends BaseIgniteAbstractTest {
             = MARSHALLER_FACTORY.create(SCHEMA_DESCRIPTOR, TestKey.class, TestValue.class);
 
     /** Hybrid clock to generate timestamps. */
-    protected final HybridClock clock = new HybridClockImpl();
+    protected static final HybridClock CLOCK = new HybridClockImpl();

Review Comment:
   Statics are evil, especially if they store something with state. Clock's state is small now, but ideally it would be greate to have a fresh clock instance per test.
   
   If it's too difficult to achieve, let's leave it static.



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


Re: [PR] IGNITE-22957 Use non-random transaction IDs in tests [ignite-3]

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo merged PR #4201:
URL: https://github.com/apache/ignite-3/pull/4201


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


Re: [PR] IGNITE-22957 Use non-random transaction IDs in tests [ignite-3]

Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch commented on code in PR #4201:
URL: https://github.com/apache/ignite-3/pull/4201#discussion_r1707621144


##########
modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/BaseMvStoragesTest.java:
##########
@@ -72,7 +74,7 @@ public abstract class BaseMvStoragesTest extends BaseIgniteAbstractTest {
             = MARSHALLER_FACTORY.create(SCHEMA_DESCRIPTOR, TestKey.class, TestValue.class);
 
     /** Hybrid clock to generate timestamps. */
-    protected final HybridClock clock = new HybridClockImpl();
+    protected static final HybridClock CLOCK = new HybridClockImpl();

Review Comment:
   Why was this change introduced? Just to make it possible to make `newTransactionId()` static? If yes, why does it need to be static?



##########
modules/schema/src/testFixtures/java/org/apache/ignite/internal/schema/BinaryRowMatcher.java:
##########
@@ -30,16 +29,25 @@ public class BinaryRowMatcher extends CustomMatcher<BinaryRow> {
     private final @Nullable BinaryRow row;
 
     private BinaryRowMatcher(@Nullable BinaryRow row) {
-        super("Expected row to be equal to " + rowToString(row));
+        super("a row equal to " + rowToString(row));
         this.row = row;
     }
 
+    @Override
+    public void describeMismatch(Object item, Description description) {
+        if (item instanceof BinaryRow) {

Review Comment:
   Can this be a `TypeSafeMatcher` to avoid casting?



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


Re: [PR] IGNITE-22957 Use non-random transaction IDs in tests [ignite-3]

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #4201:
URL: https://github.com/apache/ignite-3/pull/4201#discussion_r1708835381


##########
modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/BaseMvStoragesTest.java:
##########
@@ -72,7 +74,7 @@ public abstract class BaseMvStoragesTest extends BaseIgniteAbstractTest {
             = MARSHALLER_FACTORY.create(SCHEMA_DESCRIPTOR, TestKey.class, TestValue.class);
 
     /** Hybrid clock to generate timestamps. */
-    protected final HybridClock clock = new HybridClockImpl();
+    protected static final HybridClock CLOCK = new HybridClockImpl();

Review Comment:
   hm, good question, I don't really remember now. But is this change that bad?



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


Re: [PR] IGNITE-22957 Use non-random transaction IDs in tests [ignite-3]

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #4201:
URL: https://github.com/apache/ignite-3/pull/4201#discussion_r1708835381


##########
modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/BaseMvStoragesTest.java:
##########
@@ -72,7 +74,7 @@ public abstract class BaseMvStoragesTest extends BaseIgniteAbstractTest {
             = MARSHALLER_FACTORY.create(SCHEMA_DESCRIPTOR, TestKey.class, TestValue.class);
 
     /** Hybrid clock to generate timestamps. */
-    protected final HybridClock clock = new HybridClockImpl();
+    protected static final HybridClock CLOCK = new HybridClockImpl();

Review Comment:
   hm, good question, I don't really remember now (originally I made these changes in a different PR a while ago). But is this change that bad?



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


Re: [PR] IGNITE-22957 Use non-random transaction IDs in tests [ignite-3]

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #4201:
URL: https://github.com/apache/ignite-3/pull/4201#discussion_r1708901097


##########
modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/BaseMvStoragesTest.java:
##########
@@ -72,7 +74,7 @@ public abstract class BaseMvStoragesTest extends BaseIgniteAbstractTest {
             = MARSHALLER_FACTORY.create(SCHEMA_DESCRIPTOR, TestKey.class, TestValue.class);
 
     /** Hybrid clock to generate timestamps. */
-    protected final HybridClock clock = new HybridClockImpl();
+    protected static final HybridClock CLOCK = new HybridClockImpl();

Review Comment:
   ok, makes sense



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