Skip to content

Commit

Permalink
toppartitions: Fix toppartitions to only jmx once
Browse files Browse the repository at this point in the history
In line with previous API, nodetool called jmx's toppartitions
for each sampler separately. A better way to do this is to call
it once and then pick results for the samplers we need.
  • Loading branch information
Piotr Wojtczak committed May 10, 2021
1 parent fd92603 commit 24aea19
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/java/org/apache/cassandra/service/StorageService.java
Original file line number Diff line number Diff line change
Expand Up @@ -5201,7 +5201,7 @@ public void setHintedHandoffThrottleInKB(int throttleInKB)
logger.info("Updated hinted_handoff_throttle_in_kb to {}", throttleInKB);
}

public CompositeData getToppartitions(String sampler, List<String> keyspaceFilters, List<String> tableFilters, int duration, int capacity, int count) throws OpenDataException
public Map<String, CompositeData> getToppartitions(List<String> keyspaceFilters, List<String> tableFilters, int duration, int capacity, int count) throws OpenDataException
{
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ public interface StorageServiceMBean extends NotificationEmitter
/** Sets the hinted handoff throttle in kb per second, per delivery thread. */
public void setHintedHandoffThrottleInKB(int throttleInKB);

public CompositeData getToppartitions(String sampler, List<String> keyspaceFilters, List<String> tableFilters, int duration, int capacity, int count) throws OpenDataException;
public Map<String, CompositeData> getToppartitions(List<String> keyspaceFilters, List<String> tableFilters, int duration, int capacity, int count) throws OpenDataException;

/**
* Resume bootstrap streaming when there is failed data streaming.
Expand Down
5 changes: 3 additions & 2 deletions src/java/org/apache/cassandra/tools/NodeProbe.java
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,12 @@ public Map<Sampler, CompositeData> getPartitionSample(String ks, String cf, int

public Map<Sampler, CompositeData> getToppartitions(List<String> keyspaceFilters, List<String> tableFilters, int capacity, int duration, int count, List<Sampler> samplers) throws OpenDataException
{
Map<Sampler, CompositeData> result = Maps.newHashMap();
Map<String, CompositeData> toppartitions = ssProxy.getToppartitions(keyspaceFilters, tableFilters, duration, capacity, count);

Map<Sampler, CompositeData> result = Maps.newHashMap();
for (Sampler sampler : samplers)
{
result.put(sampler, ssProxy.getToppartitions(sampler.name(), keyspaceFilters, tableFilters, duration, capacity, count));
result.put(sampler, toppartitions.get(sampler.name().toLowerCase()));
}

return result;
Expand Down

0 comments on commit 24aea19

Please sign in to comment.