maedhroz commented on code in PR #4696:
URL: https://github.com/apache/cassandra/pull/4696#discussion_r3029307939


##########
src/java/org/apache/cassandra/repair/RepairCoordinator.java:
##########
@@ -496,26 +552,60 @@ private Future<?> prepare(List<ColumnFamilyStore> 
columnFamilies, Set<InetAddres
 
     private Future<Pair<CoordinatedRepairResult, Supplier<String>>> 
repair(String[] cfnames, NeighborsAndRanges neighborsAndRanges)
     {
-        RepairTask task;
+        ExecutorPlus executor = createExecutor();
+        state.phase.repairSubmitted();
+
         if (state.options.isPreview())
         {
-            task = new PreviewRepairTask(this, state.id, 
neighborsAndRanges.filterCommonRanges(state.keyspace, cfnames), 
neighborsAndRanges.shouldExcludeDeadParticipants, cfnames);
+            RepairTask task = new PreviewRepairTask(this, state.id, 
neighborsAndRanges.filterCommonRanges(state.keyspace, cfnames), 
neighborsAndRanges.shouldExcludeDeadParticipants, cfnames);
+            return task.perform(executor, validationScheduler)
+                       .<Pair<CoordinatedRepairResult, Supplier<String>>>map(r 
-> Pair.create(r, task::successMessage))
+                       .addCallback((s, f) -> executor.shutdown());

Review Comment:
   This block here is duplicated 3 more times below. The original code here 
avoided that by returning after the `if/else` stuff, but we could just delegate 
to a `submitRepairTask()` or something similar.



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