aweisberg commented on code in PR #3174:
URL: https://github.com/apache/cassandra/pull/3174#discussion_r1572640966


##########
src/java/org/apache/cassandra/repair/messages/RepairOption.java:
##########
@@ -313,21 +307,23 @@ else if (ranges.isEmpty())
     private final boolean repairPaxos;
     private final boolean paxosOnly;
 
-    private final boolean accordRepair;
+    private final boolean accordOnly;
+    private final boolean isConsensusMigration;

Review Comment:
   `isConsensusMigration` might be too declarative at the level of specifying 
what a repair should do. Maybe it should just indicate that this is all vs 
quorum for Accord.



##########
src/java/org/apache/cassandra/repair/RepairCoordinator.java:
##########
@@ -282,12 +283,29 @@ public void run()
         }
     }
 
+    private void validate(RepairOption options)
+    {
+        if (options.paxosOnly() && options.accordOnly())
+            throw new IllegalArgumentException("Cannot specify a repair as 
both paxos only and accord only");
+
+        for (ColumnFamilyStore cfs : columnFamilies)
+        {
+            TableMetadata metadata = cfs.metadata();
+            if (options.paxosOnly() && !metadata.supportsPaxosOperations())
+                throw new IllegalArgumentException(String.format("Cannot run 
paxos only repair on %s.%s, which isn't configured for paxos operations", 
cfs.keyspace.getName(), cfs.name));
+
+            if (options.accordOnly() && !metadata.requiresAccordSupport())

Review Comment:
   As an operator this might be painful because it requires you to know which 
kind you should invoke when in reality you just want to run the active 
consensus system's repair and you don't care which. I think we should split the 
ranges and then run the appropriate repair for each.
   
   If we can make existing external tooling continue to "just work" we 
definitely should. 



##########
src/java/org/apache/cassandra/service/accord/AccordService.java:
##########
@@ -341,16 +357,17 @@ public IVerbHandler<? extends Request> verbHandler()
         return requestHandler;
     }
 
-    @Override
-    public long barrier(@Nonnull Seekables keysOrRanges, long epoch, long 
queryStartNanos, long timeoutNanos, BarrierType barrierType, boolean isForWrite)
+    private <S extends Seekables<?, ?>> long barrier(@Nonnull S keysOrRanges, 
long epoch, long queryStartNanos, long timeoutNanos, BarrierType barrierType, 
boolean isForWrite, BiFunction<Node, S, AsyncResult<SyncPoint<S>>> syncPoint)
     {
         AccordClientRequestMetrics metrics = isForWrite ? accordWriteMetrics : 
accordReadMetrics;
         TxnId txnId = null;
         try
         {
             logger.debug("Starting barrier key: {} epoch: {} barrierType: {} 
isForWrite {}", keysOrRanges, epoch, barrierType, isForWrite);
             txnId = node.nextTxnId(Kind.SyncPoint, keysOrRanges.domain());
-            AsyncResult<Timestamp> asyncResult = node.barrier(keysOrRanges, 
epoch, barrierType);
+            AsyncResult<Timestamp> asyncResult = syncPoint == null
+                                                 ? node.barrier(keysOrRanges, 
epoch, barrierType)
+                                                 : Barrier.barrier(node, 
keysOrRanges, epoch, barrierType, syncPoint);

Review Comment:
   One version launches straight into `Barrier.barrier` the other goes through 
`node.barrier`. Should we pick a single level of interfacing with Accord here?



##########
src/java/org/apache/cassandra/tools/nodetool/Repair.java:
##########
@@ -105,6 +105,9 @@ public class Repair extends NodeToolCmd
     @Option(title = "paxos-only", name = {"-paxos-only", "--paxos-only"}, 
description = "If the --paxos-only flag is included, no table data is repaired, 
only paxos operations..")
     private boolean paxosOnly = false;
 
+    @Option(title = "accord-only", name = {"-accord-only", "--accord-only"}, 
description = "If the --accord-only flag is included, no table data is 
repaired, only accord operations..")
+    private boolean accordOnly = false;

Review Comment:
   That makes sense, but just to make sure we are on the same page, Barriers 
used for repair should wait for application, they should call 
`ApplyThenWaitUntilApplied` after gathering dependencies. There is the 
exclusive sync points which don't wait, and instead populate that map that 
rejects transactions that are too old.



##########
src/java/org/apache/cassandra/service/accord/repair/RepairSyncPointAdapter.java:
##########
@@ -0,0 +1,69 @@
+/*
+ * 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.service.accord.repair;
+
+import java.util.Collection;
+import java.util.function.BiConsumer;
+
+import com.google.common.collect.ImmutableSet;
+
+import accord.api.Result;
+import accord.coordinate.CoordinationAdapter;
+import accord.coordinate.ExecutePath;
+import accord.coordinate.ExecuteSyncPoint;
+import accord.local.Node;
+import accord.primitives.Deps;
+import accord.primitives.FullRoute;
+import accord.primitives.Seekables;
+import accord.primitives.SyncPoint;
+import accord.primitives.Timestamp;
+import accord.primitives.Txn;
+import accord.primitives.TxnId;
+import accord.primitives.Writes;
+import accord.topology.Topologies;
+
+public class RepairSyncPointAdapter<S extends Seekables<?, ?>> extends 
CoordinationAdapter.Adapters.AbstractSyncPointAdapter<S>

Review Comment:
   Needs a class level summary about what it is trying to do. Looks like this 
is how we are adding `ALL` to barriers? 
   
   I am not sure this is 100% safe since the required list of endpoints could 
have an endpoint that will never be included in the actual transaction because 
of a topology change.
   
   Will Accord eventually finish the transaction?



##########
src/java/org/apache/cassandra/repair/RepairSession.java:
##########
@@ -166,13 +170,14 @@ public RepairSession(SharedContext ctx,
                          boolean optimiseStreams,
                          boolean repairPaxos,
                          boolean paxosOnly,
-                         boolean accordRepair,
+                         boolean accordOnly, boolean isConsensusMigration,

Review Comment:
   Comment parameter list should probably be updated



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