cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andres de la Peña (Jira) <>
Subject [jira] [Commented] (CASSANDRA-16938) Missed wait latencies in the output of `nodetool tpstats -F`
Date Thu, 09 Sep 2021 16:37:00 GMT


Andres de la Peña commented on CASSANDRA-16938:

I don't see how it matters in a serialized format like json. If people are trying to read
it themselves and specifically chose json output to do so...well, this is still valid json,
I agree, the new rearranged json is equivalent to the previous one and any parser should produce
the same output as before. 

By the way, at some point we should probably try to get rid of other usages of the venerable
{{json-simple}}. We are using version 1.1 which was released in 2009. The only newer version
is 1.1.1, which is from 2012 and doesn't solve the bug with numeric arrays.

> Missed wait latencies in the output of `nodetool tpstats -F`
> ------------------------------------------------------------
>                 Key: CASSANDRA-16938
>                 URL:
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tool/nodetool
>            Reporter: Andres de la Peña
>            Assignee: Andres de la Peña
>            Priority: Normal
>             Fix For: 4.1, 4.0.x
>         Attachments: json-after.txt, json-before.txt
> The output of {{nodetool tpstats -F json}} always prints an empty map for {{WaitLatencies}}:
> {code:java}
> $ nodetool tpstats -F json
> (...)"WaitLatencies":{},(...)
> {code}
> The same happens with yaml output:
> {code:java}
> $ nodetool tpstats -F yaml
> (...)
> WaitLatencies: {}
> (...)
> {code}
> This happens because [this cast|]
silently fails inside a try-catch with an empty catch block:
> {code:java}
> String[] strValues = (String[])
>                                       .map(D -> D.toString())
>                                       .toArray();
> {code}
> When we would need something like:
> {code:java}
> String[] strValues =
>                            .map(Object::toString)
>                            .toArray(String[]::new);
> {code}
> This conversion from {{Double[]}} to {{String[]}} was introduced during CASSANDRA-16230.
My guess is that the conversion was done trying to work around a malformed JSON output detected
in [the new tests|]
added by that ticket. Without the conversion the output would be something like:
> {code:java}
> $ nodetool tpstats -F json
> (...)"WaitLatencies":{"READ_RSP":[Ljava.lang.Double;@398dada8,(...)
> {code}
> That's because {{json-simple}} doesn't handle well arrays. I think that instead of converting
the array of doubles to an array of strings we can simply use {{jackson-mapper-asl}} to print
the proper array.

This message was sent by Atlassian Jira

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message