Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toppartitions: Fix toppartitions to only jmx once #250

Merged
merged 1 commit into from
May 27, 2021

Conversation

StarostaGit
Copy link

@StarostaGit StarostaGit commented May 10, 2021

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.

This is part of the fix for #243 and scylladb/scylladb#8459. It should be merged after scylladb/scylla-jmx#165

@@ -673,7 +673,7 @@
/** 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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work? You changed the interface, but not the implementation?

Maybe the implementation is autogenerated, but it has to be generated from some IDL?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation is in the jmx PR
meant to mark it as draft, sorry
the whole fix is composed of three PRs, we'll link them here once I describe the commits in the third one

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But to answer the question more thoroughly, nodetool uses this interface which searches for the implementation of it in the jmx package

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then how do upgrades work? We'll need to make the old/new versions interoperate.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the PR desc
scylladb/scylla-jmx#165 has to be merged first into scylla-jmx, only then this can be merged as well

@@ -482,11 +482,12 @@ public void repairAsync(final PrintStream out, final String keyspace, Map<String

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call here doesn't mention samplers. So I assume it uses all possible samplers (what are they, read/write?)? If so, if the user asks for just one sampler, won't we do extra work, which is then discarded?

Maybe we need to pass the list of samplers down the stack.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The samplers are passed into this method, but not propagated further, contrary to how it worked before. The reason is we want to only call the jmx and therefore the scylla backend once (since it always gives us info for all samplers anyway) and only here, in the NodeProbe code, extract counters for the samplers the caller requested

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. If Scylla always samples everything, we can use the new approach without losing anything.

@StarostaGit StarostaGit requested a review from amnonh May 10, 2021 11:17
@StarostaGit
Copy link
Author

StarostaGit commented May 27, 2021

@avikivity You wanted me to make this work with older version of the JMX call. Asked how old under the previous PR, but maybe it went unnoticed so reposting here

I already made it detect the absence of the new method, just have to know which method to redirect to - before this set of PRs or before the generic toppartitions API

@avikivity
Copy link
Member

@avikivity You wanted me to make this work with older version of the JMX call. Asked how old under the previous PR, but maybe it went unnoticed so reposting here

I am quite lossy, ping when needed. It's annoying and I apologize.

by "older" I meant the previous version before your change.

I already made it detect the absence of the new method, just have to know which method to redirect to - before this set of PRs or before the generic toppartitions API

Isn't that sufficient? It will use the new API is present and fall back to the old one if not.

@StarostaGit
Copy link
Author

no worries

@avikivity
by "older" I meant the previous version before your change.

That's what I wanted to know, great, will post the change soon

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.
@StarostaGit
Copy link
Author

@avikivity done, it falls back successfully when the new method is not found

@bhalevy
Copy link
Member

bhalevy commented Jun 16, 2021

@StarostaGit I still see 2 calls in the scylla log, e.g.:

INFO  2021-06-16 10:25:07,157 [shard 0] api - toppartitions query: #table_filters=all #keyspace_filters=all duration=10000 list_size= capacity=256
INFO  2021-06-16 10:25:17,174 [shard 0] api - toppartitions query: #table_filters=all #keyspace_filters=all duration=10000 list_size= capacity=256

I'm not exactly sure what this PR was trying to achieve but the second calls overrides the first one, i.e. nodetool toppartitions returns the stats only from the 2nd period as far as I can tell from the dtest.

@bhalevy
Copy link
Member

bhalevy commented Jun 16, 2021

@StarostaGit
Copy link
Author

@StarostaGit I still see 2 calls in the scylla log, e.g.:

INFO  2021-06-16 10:25:07,157 [shard 0] api - toppartitions query: #table_filters=all #keyspace_filters=all duration=10000 list_size= capacity=256
INFO  2021-06-16 10:25:17,174 [shard 0] api - toppartitions query: #table_filters=all #keyspace_filters=all duration=10000 list_size= capacity=256

I'm not exactly sure what this PR was trying to achieve but the second calls overrides the first one, i.e. nodetool toppartitions returns the stats only from the 2nd period as far as I can tell from the dtest.

It had a wrong Class parameter passed for lists in the older/newer method call dispatch, hence for new ones it was still 2 calls to the method. There was a followup for that in #256 and it should be ok once it went in
Same for the dtests, let me call the BYO again

@bhalevy
Copy link
Member

bhalevy commented Jun 16, 2021

It had a wrong Class parameter passed for lists in the older/newer method call dispatch, hence for new ones it was still 2 calls to the method. There was a followup for that in #256 and it should be ok once it went in
Same for the dtests, let me call the BYO again

fwiw, they pass for me locally with #256

@bhalevy
Copy link
Member

bhalevy commented Jun 16, 2021

thanks

@StarostaGit
Copy link
Author

it works locally for me as well, the PR with updated dtests is also just waiting for #256 so that the BYO job passes

@bhalevy
Copy link
Member

bhalevy commented Jun 16, 2021

what PR updating dtests? https://github.com/scylladb/scylla-dtest/pull/2147?

@StarostaGit
Copy link
Author

what PR updating dtests? scylladb/scylla-dtest#2147?

Yes, this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants