[
https://issues.apache.org/jira/browse/CASSANDRA-20149?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stefan Miklosovic updated CASSANDRA-20149:
------------------------------------------
Description:
listsnapshots calls jmx on two occasions
1) when getting trueSnapshotsSize
2) when getting snapshot details
What it was doing in practice before CASSANDRA-18111 was that it was
essentially loading the snapshots twice hence almost double the time to list.
What it is doing after CASSANDRA-18111 is that it still resolves sizes but in a
way more efficient way however it still calls jmx twice which is not necessary.
The fix consists of returning resolved sizes together with snapshot details and
then on the client size we just display and sum it up in case of wanting to
know the total.
It is more optimal to just return results in one response and sum few numbers
on the client from the results than to call jmx twice.
It is, actually, safer too. Because for now, total true snapshots size is
returned _before_ we list snapshots. So what can happen, albeit quite
improbably, is that a snapshot can be removed _after_ we call true snapshot
size method but _before_ we list all snapshots. So that means that total true
disk size would be bigger than the sum of true disk sizes for all snapshots
after one of them was removed.
This also means that a user will get true raw size (raw means not human
friendly, human friendly is returned in the response already) of a snapshot in
the result of snapshot details automatically. They do not need to call extra
MBean method for that (which this patch opportunistically introduces too).
was:
listsnapshots calls jmx on two occasions
1) when getting trueSnapshotsSize
2) when getting snapshot details
What it was doing in practice before CASSANDRA-18111 was that it was
essentially loading the snapshots twice hence almost double the time to list.
What it is doing after CASSANDRA-18111 is that it still resolves sizes but in a
way more efficient way however it still calls jmx twice which is not necessary.
The fix consists of returning resolved sizes together with snapshot details and
then on the client size we just display and sum it up in case of wanting to
know the total.
It is more optimal to just return results in one response and sum few numbers
on the client from the results than to call jmx twice.
It is, actually, safer too. Because for now, true snapshots size is return
_before_ we list snapshots. So what can happen, albeit quite improbably, is
that a snapshot can be removed _after_ we call true snapshot size method but
_before_ we list all snapshots. So that means that total true disk size would
be bigger than the sum of true disk sizes for all snapshots after one of them
was removed.
This also means that a user will get true raw size (raw means not human
friendly, human friendly is returned in the response already) of a snapshot in
the result of snapshot details automatically. They do not need to call extra
MBean method for that (which this patch opportunistically introduces too).
> nodetool listsnapshots initiates two jmx calls unnecessarily
> ------------------------------------------------------------
>
> Key: CASSANDRA-20149
> URL: https://issues.apache.org/jira/browse/CASSANDRA-20149
> Project: Apache Cassandra
> Issue Type: Improvement
> Components: Local/Snapshots
> Reporter: Stefan Miklosovic
> Assignee: Stefan Miklosovic
> Priority: Normal
> Fix For: 5.x
>
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> listsnapshots calls jmx on two occasions
> 1) when getting trueSnapshotsSize
> 2) when getting snapshot details
> What it was doing in practice before CASSANDRA-18111 was that it was
> essentially loading the snapshots twice hence almost double the time to list.
> What it is doing after CASSANDRA-18111 is that it still resolves sizes but in
> a way more efficient way however it still calls jmx twice which is not
> necessary.
> The fix consists of returning resolved sizes together with snapshot details
> and then on the client size we just display and sum it up in case of wanting
> to know the total.
> It is more optimal to just return results in one response and sum few numbers
> on the client from the results than to call jmx twice.
> It is, actually, safer too. Because for now, total true snapshots size is
> returned _before_ we list snapshots. So what can happen, albeit quite
> improbably, is that a snapshot can be removed _after_ we call true snapshot
> size method but _before_ we list all snapshots. So that means that total true
> disk size would be bigger than the sum of true disk sizes for all snapshots
> after one of them was removed.
> This also means that a user will get true raw size (raw means not human
> friendly, human friendly is returned in the response already) of a snapshot
> in the result of snapshot details automatically. They do not need to call
> extra MBean method for that (which this patch opportunistically introduces
> too).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]