You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "belliottsmith (via GitHub)" <gi...@apache.org> on 2024/11/15 18:37:48 UTC

[PR] Investigate mixup test [cassandra-accord]

belliottsmith opened a new pull request, #138:
URL: https://github.com/apache/cassandra-accord/pull/138

   (no comment)


-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] Investigate mixup test [cassandra-accord]

Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #138:
URL: https://github.com/apache/cassandra-accord/pull/138#discussion_r1844326505


##########
accord-core/src/main/java/accord/coordinate/CoordinateEphemeralRead.java:
##########
@@ -136,6 +136,6 @@ void onPreAccepted(Topologies topologies)
     {
         Deps deps = Deps.merge(oks, oks.domainSize(), SortedListMap::getValue, ok -> ok.deps);
         topologies = node.topology().reselect(topologies, QuorumEpochIntersections.preaccept.include, route, executeAtEpoch, executeAtEpoch, Owned);
-        new ExecuteEphemeralRead(node, topologies, route, txnId, txn, executeAtEpoch, deps, this).start();
+        new ExecuteEphemeralRead(node, topologies, route, txnId.withEpoch(executeAtEpoch), txn, executeAtEpoch, deps, this).start();

Review Comment:
   why this change?  I am not familiar with the ephemeral read execute_at vs txn_id debate, I thought only sync points did such a thing?



##########
accord-core/src/test/java/accord/KeysTest.java:
##########
@@ -225,6 +237,51 @@ public void slice()
         });
     }
 
+    @Test
+    public void keysWithout()
+    {
+        without(IntKey::key, Key[]::new, Keys::of, Keys::without);
+    }
+
+    @Test
+    public void routingKeysWithout()
+    {
+        without(IntKey::routing, RoutingKey[]::new, RoutingKeys::of, RoutingKeys::without);
+    }
+
+    private <K extends RoutableKey, KS extends AbstractKeys<K>> void without(IntFunction<K> keyFactory,
+                                                                             IntFunction<K[]> arrayFactory,
+                                                                             Function<K[], KS> keysFactory,
+                                                                             BiFunction<KS, KS, Routables<K>> without)
+    {
+        final int maxSize = 100;
+        final int maxKey = 1000;
+        for (int test = 0 ; test < 10000 ; ++test)
+        {
+            RandomTestRunner.test().check(rs -> {
+                K[] keys = arrayFactory.apply(rs.nextInt(2, maxSize));
+                IntHashSet used = new IntHashSet();
+                for (int i = 0 ; i < keys.length ; ++i)
+                {
+                    int k = rs.nextInt(maxKey);
+                    while (!used.add(k)) k = rs.nextInt(maxKey);
+                    keys[i] = keyFactory.apply(k);
+                }
+                int addTo = rs.nextInt(1, keys.length);
+                int removeFrom = addTo - rs.nextInt(addTo);

Review Comment:
   ```suggestion
                   int removeFrom = addTo - rs.nextInt(addTo + 1);
   ```
   
   this test doesn't cover the case that the remove set is fully inclusive of the add set, so never reaches the empty set.  By doing `addTo + 1` we allow `removeFrom` to reach `0` which would test the empty set as well.



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] Investigate mixup test [cassandra-accord]

Posted by "belliottsmith (via GitHub)" <gi...@apache.org>.
belliottsmith merged PR #138:
URL: https://github.com/apache/cassandra-accord/pull/138


-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] Investigate mixup test [cassandra-accord]

Posted by "belliottsmith (via GitHub)" <gi...@apache.org>.
belliottsmith commented on code in PR #138:
URL: https://github.com/apache/cassandra-accord/pull/138#discussion_r1844364332


##########
accord-core/src/main/java/accord/coordinate/CoordinateEphemeralRead.java:
##########
@@ -136,6 +136,6 @@ void onPreAccepted(Topologies topologies)
     {
         Deps deps = Deps.merge(oks, oks.domainSize(), SortedListMap::getValue, ok -> ok.deps);
         topologies = node.topology().reselect(topologies, QuorumEpochIntersections.preaccept.include, route, executeAtEpoch, executeAtEpoch, Owned);
-        new ExecuteEphemeralRead(node, topologies, route, txnId, txn, executeAtEpoch, deps, this).start();
+        new ExecuteEphemeralRead(node, topologies, route, txnId.withEpoch(executeAtEpoch), txn, executeAtEpoch, deps, this).start();

Review Comment:
   ephemeral reads chase an epoch they can validly execute in. For simplicity, we define the txnId = executeAt, and so to execute in a future epoch we simply make txnId.epoch == executeAt.epoch. This change was already made, but somehow this codepath lost(?) the update.



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org