belliottsmith commented on code in PR #65:
URL: https://github.com/apache/cassandra-accord/pull/65#discussion_r1443380467


##########
accord-core/src/test/java/accord/burn/BurnTest.java:
##########
@@ -217,21 +254,41 @@ static void burn(RandomSource random, TopologyFactory 
topologyFactory, List<Id>
                     .asLongSupplier(forked);
         };
 
-        Verifier verifier = createVerifier(keyCount);
-        SimulatedDelayedExecutorService globalExecutor = new 
SimulatedDelayedExecutorService(queue, null);
-
+        SimulatedDelayedExecutorService globalExecutor = new 
SimulatedDelayedExecutorService(queue, new ListAgent(1000L, failures::add, 
retryBootstrap, (i1, i2) -> {
+            throw new IllegalAccessError("Global executor should enver get a 
stale event");
+        }));
+        Int2ObjectHashMap<Verifier> validators = new Int2ObjectHashMap<>();
         Function<CommandStore, AsyncExecutor> executor = ignore -> 
globalExecutor;
 
         MessageListener listener = MessageListener.get();
 
-        Packet[] requests = toArray(generate(random, listener, executor, 
clients, nodes, keyCount, operations), Packet[]::new);
+        if (keyCount > ((long) HASH_RANGE_END - (long) HASH_RANGE_START + 1L))
+            throw new AssertionError(String.format("Attempted to create %d 
keys which is larger than the range (%d, %d]", keyCount, HASH_RANGE_START, 
HASH_RANGE_END));
+        int[] keys = new int[keyCount];
+        {
+            IntHashSet seen = new IntHashSet();
+            for (int i = 0; i < keyCount; i++)
+            {
+                int hash;
+                do
+                {
+                    // start is exclusive, and end is inclusive; which is the 
oposite of nextInt, so +1 to account for this
+                    hash = 1 + random.nextInt(HASH_RANGE_START, 
HASH_RANGE_END);
+                }
+                while (!seen.add(hash));
+                keys[i] = CRCUtils.reverseCRC32LittleEnding(hash);

Review Comment:
   I don't think we need to use the same hashing behaviour between tests 
though? It would be nicer to support hash collisions IMO, as this tests 
additional functionality. Though we could force collisions if we wanted as 
well, by reducing the hash range rather than hard coding it.



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

Reply via email to