dcapwell commented on code in PR #3656:
URL: https://github.com/apache/cassandra/pull/3656#discussion_r1828437469


##########
test/distributed/org/apache/cassandra/fuzz/topology/HarryTopologyMixupTest.java:
##########
@@ -66,65 +107,130 @@ protected void destroyState(State<Spec> state, @Nullable 
Throwable cause)
         }
     }
 
-    private static Spec createSchemaSpec(RandomSource rs, Cluster cluster)
+    private static BiFunction<RandomSource, Cluster, Spec> 
createSchemaSpec(AccordMode mode)
     {
-        ReplayingHistoryBuilder harry = HarryHelper.dataGen(rs.nextLong(),
-                                                            new 
InJvmSut(cluster),
-                                                            new 
TokenPlacementModel.SimpleReplicationFactor(3),
-                                                            
SystemUnderTest.ConsistencyLevel.QUORUM);
-        cluster.schemaChange(String.format("CREATE KEYSPACE %s WITH 
replication = {'class': 'SimpleStrategy', 'replication_factor' : 3};", 
HarryHelper.KEYSPACE));
-        var schema = harry.schema();
-        cluster.schemaChange(schema.compile().cql());
-        waitForCMSToQuiesce(cluster, cluster.get(1));
-        return new Spec(harry);
+        return (rs, cluster) -> {
+            long seed = rs.nextLong();
+            var schema = HarryHelper.schemaSpecBuilder("harry", 
"tbl").surjection().inflate(seed);
+            if (mode.kind != AccordMode.Kind.None)
+                schema = schema.withTransactionMode(mode.passthroughMode);
+            ReplayingHistoryBuilder harry = HarryHelper.dataGen(seed,
+                    mode.kind == AccordMode.Kind.Direct ? new 
AccordSut(cluster) : new InJvmSut(cluster),
+                    new TokenPlacementModel.SimpleReplicationFactor(3),
+                    SystemUnderTest.ConsistencyLevel.QUORUM,
+                    schema);
+            cluster.schemaChange(String.format("CREATE KEYSPACE %s WITH 
replication = {'class': 'SimpleStrategy', 'replication_factor' : 3};", 
HarryHelper.KEYSPACE));
+            cluster.schemaChange(schema.compile().cql());
+            waitForCMSToQuiesce(cluster, cluster.get(1));
+            return new Spec(harry, mode);
+        };
     }
 
-    private static CommandGen<Spec> cqlOperations(Spec spec)
+    private static class HarryCommand extends SimpleCommand<State<Spec>>
     {
-        class HarryCommand extends SimpleCommand<State<Spec>>
+        HarryCommand(Function<State<Spec>, String> name, Consumer<State<Spec>> 
fn)
         {
-            HarryCommand(Function<State<Spec>, String> name, 
Consumer<State<Spec>> fn)
-            {
-                super(name, fn);
-            }
+            super(name, fn);
+        }
 
-            @Override
-            public PreCheckResult checkPreconditions(State<Spec> state)
-            {
-                int clusterSize = state.topologyHistory.up().length;
-                return clusterSize >= 3 ? PreCheckResult.Ok : 
PreCheckResult.Ignore;
-            }
+        @Override
+        public PreCheckResult checkPreconditions(State<Spec> state)
+        {
+            int clusterSize = state.topologyHistory.up().length;
+            return clusterSize >= 3 ? PreCheckResult.Ok : 
PreCheckResult.Ignore;
         }
+    }
+
+    private static CommandGen<Spec> cqlOperations(Spec spec)
+    {
         Command<State<Spec>, Void, ?> insert = new HarryCommand(state -> 
"Harry Insert" + state.commandNamePostfix(), state -> {
             spec.harry.insert();
             ((HarryState) state).numInserts++;
         });
-        Command<State<Spec>, Void, ?> validateAll = new HarryCommand(state -> 
"Harry Validate All" + state.commandNamePostfix(), state -> {

Review Comment:
   what partition is causing the command to timeout?  Or is there too many 
partitions?
   
   I made this change for better integration with the history log... each 
partition is its own `Command` which means they each get their own timeout... 
this slightly improved stability, but better improved visibility into what 
partition is getting blocked...
   
   Also, the existing logic does non-deterministic ordering (hash map), so this 
switch now makes the reads deterministic in terms of order



-- 
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-unsubscr...@cassandra.apache.org

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


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

Reply via email to