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


##########
test/simulator/main/org/apache/cassandra/simulator/paxos/HistoryValidator.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.simulator.paxos;
+
+import javax.annotation.Nullable;
+
+public interface HistoryValidator
+{
+    Checker start(Observation observation);
+
+    void log(@Nullable Integer pk);
+
+    interface Checker extends AutoCloseable
+    {
+        void witnessRead(int pk, int count, int[] seq);
+        void witnessWrite(int pk);

Review Comment:
   > As it stands, it is unclear what it is we are logging as written, which 
wasn't the case before. It's implicit knowledge that it is the observation id 
we are writing, which is especially obtuse since the id exists whether or not 
we write.
   
   I understand your point.  If we add the id then I question why `log` should 
see `Observation`?  Maybe the following is better?
   
   ```
   public interface HistoryValidator {
     Checker log(int start, int end);
     void log(@Nullable Integer pk);
   
     interface Checker extends AutoCloseable {
       void witnessRead(int pk, int count, int[] sequence);
       void witnessWrite(int pk, int id);
     }
   }
   ```
   
   The main issue with this interface is that `LinearizabilityValidator` 
doesn't see `Observation` so would need a refactor in `HistoryChecker`; not a 
large one but would be needed (issue is in 
`org.apache.cassandra.simulator.paxos.HistoryChecker#witness`), we did speak 
about dropping `LinearizabilityValidator`, maybe this is better motivation?
   
   I personally prefer the existing interface as you can't mess up and put 
event id in pk and pk in event id, but feel the above interface is a 
compromise?  Thoughts?
   
   



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