Skip to content

Commit

Permalink
Fix NPE caused by ExternalCompactions page in monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
DomGarguilo committed Nov 25, 2024
1 parent 767a68a commit 7cca644
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -687,9 +687,10 @@ private static class ExternalCompactionsSnapshot {
public final RunningCompactions runningCompactions;
public final Map<String,TExternalCompaction> ecRunningMap;

private ExternalCompactionsSnapshot(Map<String,TExternalCompaction> ecRunningMap) {
this.ecRunningMap = Collections.unmodifiableMap(ecRunningMap);
this.runningCompactions = new RunningCompactions(ecRunningMap);
private ExternalCompactionsSnapshot(Optional<Map<String,TExternalCompaction>> ecRunningMapOpt) {
this.ecRunningMap =
ecRunningMapOpt.map(Collections::unmodifiableMap).orElse(Collections.emptyMap());
this.runningCompactions = new RunningCompactions(this.ecRunningMap);
}
}

Expand All @@ -707,7 +708,7 @@ private ExternalCompactionsSnapshot computeExternalCompactionsSnapshot() {
throw new IllegalStateException("Unable to get running compactions from " + ccHost, e);
}

return new ExternalCompactionsSnapshot(running.getCompactions());
return new ExternalCompactionsSnapshot(Optional.ofNullable(running.getCompactions()));
}

public RunningCompactions getRunnningCompactions() {
Expand Down

0 comments on commit 7cca644

Please sign in to comment.