Skip to content

Commit

Permalink
Merge pull request #68 from spotify/zvo/logFailedHostConnection
Browse files Browse the repository at this point in the history
Log hostname/port of a host JMXProxy failed to connect to
  • Loading branch information
Bj0rnen committed Feb 23, 2015
2 parents 6ba2c52 + ece34af commit 5d278bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/spotify/reaper/cassandra/JmxProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static JmxProxy connect(Optional<RepairStatusHandler> handler, String hos
ssMbeanName = new ObjectName(SS_OBJECT_NAME);
cmMbeanName = new ObjectName(CompactionManager.MBEAN_OBJECT_NAME);
} catch (MalformedURLException | MalformedObjectNameException e) {
LOG.error("Failed to prepare the JMX connection");
LOG.error(String.format("Failed to prepare the JMX connection to %s:%s", host, port));
throw new ReaperException("Failure during preparations for JMX connection", e);
}
try {
Expand All @@ -136,7 +136,7 @@ public static JmxProxy connect(Optional<RepairStatusHandler> handler, String hos
LOG.debug(String.format("JMX connection to %s properly connected.", host));
return proxy;
} catch (IOException | InstanceNotFoundException e) {
LOG.error("Failed to establish JMX connection");
LOG.error(String.format("Failed to establish JMX connection to %s:%s", host, port));
throw new ReaperException("Failure when establishing JMX connection", e);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/spotify/reaper/service/SegmentRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ boolean canRepair(RepairSegment segment, String keyspace, JmxProxy coordinator)
Collection<String> allHosts =
coordinator.tokenRangeToEndpoint(keyspace, segment.getTokenRange());
for (String hostName : allHosts) {
LOG.debug("checking host '{}' for pending compactions and other repairs (can repair?)"
+ " Run id '{}'", hostName, segment.getRunId());
try (JmxProxy hostProxy = context.jmxConnectionFactory.connect(hostName)) {
LOG.debug("checking host '{}' for pending compactions and other repairs (can repair?)"
+ " Run id '{}'", hostName, segment.getRunId());
int pendingCompactions = hostProxy.getPendingCompactions();
if (pendingCompactions > MAX_PENDING_COMPACTIONS) {
LOG.warn("SegmentRunner declined to repair segment {} because of too many pending "
Expand Down

0 comments on commit 5d278bf

Please sign in to comment.