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

CASSANDRA-19104 Standardize tablestats formatting and data units #2977

Closed
wants to merge 11 commits into from

Conversation

zaaath
Copy link
Contributor

@zaaath zaaath commented Dec 9, 2023

Standardizes space and memory formatting in nodetool tablestats human-readable output.

Before

Nodetool tablestats returns a mix of "bytes", "KiB/MiB/GiB", or no units at all.
Example:

        Space used (live): 1463210998523 bytes
        Space used (total): 1463210998523 bytes
        Space used by snapshots (total): 0
        Off heap memory used (total): 607419608 bytes
...
        Memtable data size: 248539982 bytes
        Memtable off heap memory used: 0 bytes
...
        Bytes repaired: 0.000KiB
        Bytes unrepaired: 4315.386GiB
        Bytes pending repair: 0.000KiB
...
        Bloom filter space used: 33590024 bytes
        Bloom filter off heap memory used: 33532560 bytes
        Index summary off heap memory used: 8174024 bytes
        Compression metadata off heap memory used: 565713024 bytes
        Compacted partition minimum bytes: 36
        Compacted partition maximum bytes: 17797419593
        Compacted partition mean bytes: 189740

After

Nodetool tablestats formats space and memory numbers using KiB/MiB/GiB units.
Example:

        Space used (live): 1.33 TiB
        Space used (total): 1.33 TiB
        Space used by snapshots (total): 0 bytes
        Off heap memory used (total): 579.28 MiB
...
        Memtable data size: 237.03 MiB
        Memtable off heap memory used: 0 bytes
...
        Bytes repaired: 0 bytes
        Bytes unrepaired: 4.21 TiB
        Bytes pending repair: 0 bytes
...
        Bloom filter space used: 32.03 MiB
        Bloom filter off heap memory used: 31.98 MiB
        Index summary off heap memory used: 7.8 MiB
        Compression metadata off heap memory used: 539.51 MiB
        Compacted partition minimum bytes: 36 bytes
        Compacted partition maximum bytes: 16.58 GiB
        Compacted partition mean bytes: 185.29 KiB

How to reproduce

nodetool tablestats -H

Tests

ant testsome -Dtest.name=org.apache.cassandra.utils.FBUtilitiesTest
ant testsome -Dtest.name=org.apache.cassandra.tools.nodetool.stats.TableStatsPrinterTest
ant testsome -Dtest.name=org.apache.cassandra.tools.nodetool.TableStatsTest

patch by @zaaath; reviewed by @smiklosovic for CASSANDRA-19104

@bschoening
Copy link
Contributor

Using the existing stringifyFileSize seems like the right approach.

@zaaath
Copy link
Contributor Author

zaaath commented Dec 14, 2023

@bschoening thanks, I totally agree that using the existing stringifyFileSize method is the right approach.

@smiklosovic smiklosovic closed this Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants