Skip to content

Commit

Permalink
Abort repairs of segments marked as RUNNING when resuming repair runs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bj0rnen committed Jan 21, 2015
1 parent ff43121 commit 9d96dab
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@

public class JmxConnectionFactory {

public final JmxProxy create(String host) throws ReaperException {
return create(Optional.<RepairStatusHandler>absent(), host);
}

public JmxProxy create(Optional<RepairStatusHandler> handler, String host)
throws ReaperException {
return JmxProxy.connect(handler, host);
}

public final JmxProxy create(String host) throws ReaperException {
return create(Optional.<RepairStatusHandler>absent(), host);
}

public final JmxProxy connectAny(Optional<RepairStatusHandler> handler, Collection<String> hosts)
throws ReaperException {
return create(handler, hosts.iterator().next());
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/com/spotify/reaper/service/RepairRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,14 @@ public static void resumeRunningRepairRuns(IStorage storage,
if (runningSegment == null) {
break;
}
// TODO: abort in Cassandra
SegmentRunner.postpone(storage, runningSegment);
try {
SegmentRunner.abort(storage, runningSegment,
jmxConnectionFactory.create(runningSegment.getCoordinatorHost()));
} catch (ReaperException e) {
LOG.debug("Tried to abort repair on segment {} marked as RUNNING, but the host was down"
+ " (so abortion won't be needed)", runningSegment.getId());
SegmentRunner.postpone(storage, runningSegment);
}
}
RepairRunner.startNewRepairRun(storage, repairRun.getId(), jmxConnectionFactory);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ public static void postpone(IStorage storage, RepairSegment segment) {
}

public static void abort(IStorage storage, RepairSegment segment, JmxProxy jmxConnection) {
postpone(storage, segment);
LOG.warn("Aborting command {} on segment {}", segment.getRepairCommandId(), segment.getId());
jmxConnection.cancelAllRepairs();
postpone(storage, segment);
}

private SegmentRunner(IStorage storage, long segmentId) {
Expand Down

0 comments on commit 9d96dab

Please sign in to comment.