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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]