Skip to content

Commit

Permalink
Listing snapshots can fail easily (if snapshot files/directories are …
Browse files Browse the repository at this point in the history
…deleted by someone else).

Handle such situations gracefully.

ref: #488
  • Loading branch information
michaelsembwever committed Jul 21, 2018
1 parent d32b54e commit 9b2c66d
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ public void clearSnapshot(String snapshotName) {
}
try {
((StorageServiceMBean) ssProxy).clearSnapshot(snapshotName);
} catch (AssertionError | IOException e) {
} catch (AssertionError | IOException | RuntimeException e) {
LOG.error("failed to clear snapshot " + snapshotName, e);
}
}
Expand Down Expand Up @@ -1041,8 +1041,13 @@ public List<Snapshot> listSnapshots() throws UnsupportedOperationException {
"Snapshot listing is not supported in Cassandra 2.0 and prior.");
}

final Map<String, TabularData> snapshotDetails =
((StorageServiceMBean) ssProxy).getSnapshotDetails();
Map<String, TabularData> snapshotDetails = Collections.emptyMap();
try {
snapshotDetails = ((StorageServiceMBean) ssProxy).getSnapshotDetails();
} catch (RuntimeException ex) {
LOG.warn("failed getting snapshots details from " + clusterName, ex);
}

if (snapshotDetails.isEmpty()) {
LOG.debug("There are no snapshots on host {}", this.host);
return snapshots;
Expand Down

0 comments on commit 9b2c66d

Please sign in to comment.