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


##########
test/simulator/main/org/apache/cassandra/simulator/paxos/PairOfSequencesAccordSimulation.java:
##########
@@ -281,21 +211,151 @@ protected String preInsertStmt()
     }
 
     @Override
-    Operation verifying(int operationId, IInvokableInstance instance, int 
primaryKey, HistoryChecker historyChecker)
+    boolean allowMultiplePartitions() { return true; }
+
+    @Override
+    BiFunction<SimulatedSystems, int[], Supplier<Action>> actionFactory()
     {
-        return new VerifyingOperation(operationId, instance, 
serialConsistency, primaryKey, historyChecker);
+        AtomicInteger id = new AtomicInteger(0);
+
+        return (simulated, primaryKeyIndex) -> {
+            int[] partitions = IntStream.of(primaryKeyIndex).map(i -> 
primaryKeys[i]).toArray();
+            return () -> accordAction(id.getAndIncrement(), simulated, 
partitions);
+        };
     }
 
-    @Override
-    Operation nonVerifying(int operationId, IInvokableInstance instance, int 
primaryKey, HistoryChecker historyChecker)
+    private static IIsolatedExecutor.SerializableCallable<SimpleQueryResult> 
query(int id, int[] partitions, int[] readOnly)
     {
-        return new NonVerifyingOperation(operationId, instance, 
serialConsistency, primaryKey, historyChecker);
+        return () -> execute(createAccordTxn(id, partitions, readOnly), "pk", 
"count", "seq");
     }
 
-    @Override
-    Operation modifying(int operationId, IInvokableInstance instance, int 
primaryKey, HistoryChecker historyChecker)
+    public class ReadWriteOperation extends Operation
     {
-        return new ModifyingOperation(operationId, instance, ANY, 
serialConsistency, primaryKey, historyChecker);
+        private final IntSet allPartitions;
+        private final IntSet readOnlySet;

Review Comment:
   `allPartitions` contains all read/write partitions.  `readOnlySet` is the 
set that only did a read. Because we have access to the read accord did, all 
write operations have a read as well, so currently we do not get write only 
partitions.
   
   I am not 100% sure how to do a write only txn as the validation logic tracks 
history; so if a txn doesn't load that history then its doing a blind write and 
could trigger a violation that wasn't a real violation.  My first thought would 
be that we periodically truncate the history, but do wonder if that would just 
make things more complex (if we have not observed all writes and did a 
truncate, may miss a violation)



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