Skip to content

Commit 4600378

Browse files
author
Radovan Zvoncek
committed
Resume repair after error
1 parent a68d825 commit 4600378

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/main/java/com/spotify/reaper/service/RepairRunner.java

+17
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ public void run() {
157157
case PAUSED:
158158
context.repairManager.scheduleRetry(this);
159159
break;
160+
case ERROR:
161+
resumeAfterError();
162+
break;
160163
}
161164
} catch (RuntimeException e) {
162165
LOG.error("RepairRun FAILURE");
@@ -193,6 +196,20 @@ private void start() {
193196
startNextSegment();
194197
}
195198

199+
/**
200+
* Resumes execution of a repair run. Does the same as {@code start()}, except setting start time.
201+
*/
202+
private void resumeAfterError() {
203+
LOG.info("Repairs for repair run #{} resuming after error", repairRunId);
204+
synchronized (this) {
205+
RepairRun repairRun = context.storage.getRepairRun(repairRunId).get();
206+
context.storage.updateRepairRun(repairRun.with()
207+
.runState(RepairRun.RunState.RUNNING)
208+
.build(repairRun.getId()));
209+
}
210+
startNextSegment();
211+
}
212+
196213
/**
197214
* Concludes the repair run.
198215
*/

0 commit comments

Comments
 (0)