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


##########
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:
   > Have you looked at how the Paxos one works? It uses +=, and can manage 
blind writes just fine for both registers. Obviously under the hood the 
implementation has to perform a read for the string based +=, so it is not a 
blind write in implementation. But at the CQL level it is a blind write, and at 
the implementation level these are treated slightly differently.
   
   
   Yep, looked closely at it before doing this patch.  A blind write there 
still performs a read, so I took advantage of the fact we have access to the 
reads.  If we want to remove this direct access, then I can have `writeOnly` as 
the current writes are in fact blind...
   
   If we are cool keeping this access, I did confirm 
`org.apache.cassandra.cql3.Lists.Appender#doAppend` doesn't do a read, but we 
need to make sure not flatten else it looks to just override the celll (aka 
does *not* append, it *sets*)... given that I can switch/add list to add blind 
writes.
   
   > Saying that, it would probably also be good to randomise whether seq1 as 
maintained/unmaintained so we can separately track the correctness of truly 
blind writes, as with Accord they are treated differently.
   
   I don't know what paxos does, can you explain?  Given `seq1 text` I assume 
this is doing a `set` rather than `append`?  So would need to extend the 
validators to handle this truncate of history?  How does paxos handle this 
differently?



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