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


##########
src/java/org/apache/cassandra/repair/AccordRepairJob.java:
##########
@@ -91,30 +94,35 @@ protected void runRepair()
     @Override
     void abort(@Nullable Throwable reason)
     {
-        throw new UnsupportedOperationException("Have not implemented this 
yet, and the job runs synchronously so it isn't abortable");
+        shouldAbort = reason == null ? new RuntimeException("Abort") : reason;
     }
 
-    private void repairRange(TokenRange range)
+    private void repairRange(TokenRange range) throws Throwable
     {
         RoutingKey remainingStart = range.start();
         BigInteger rangeSize = splitter.sizeOf(range);
         if (rangeStep == null)
-            rangeStep = BigInteger.ONE.max(splitter.divide(rangeSize, 1000));
+        {
+            BigInteger divide = splitter.divide(rangeSize, 1000);
+            rangeStep = divide.equals(BigInteger.ZERO) ? rangeSize : 
BigInteger.ONE.max(divide);
+        }
 
         BigInteger offset = BigInteger.ZERO;
 
         TokenRange lastRepaired = null;
         int iteration = 0;
         while (true)
         {
+            if (shouldAbort != null)
+                throw shouldAbort;
             iteration++;
-            if (iteration % 100 == 0)
+            if (iteration % ACCORD_REPAIR_RANGE_STEP_UPDATE_INTERVAL.getInt() 
== 0)

Review Comment:
   can you cache `ACCORD_REPAIR_RANGE_STEP_UPDATE_INTERVAL` so we don't do this 
every time in the loop?



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