chengw-netflix opened a new pull request, #3628:
URL: https://github.com/apache/cassandra/pull/3628

   **Summary**
   This PR introduces a **-H** option to the **nodetool compactionhistory** 
command Cassandra. The **-H** option formats the output in a human-readable 
manner, making it easier for users to interpret the data.
   
   More specifically, when the -H option is used, the **bytes_in** and 
**bytes_out** fields are displayed in a more readable format (e.g., KiB). 
   
   **Testing**
   1. Without -H option:
   ```
   Compaction History:
   id                                   keyspace_name columnfamily_name   
compacted_at            bytes_in bytes_out rows_merged compaction_properties
   2a5355b0-90f0-11ef-bf8c-79bcdbb5790b system_schema tables              
2024-10-22T20:37:44.986 10526    3985      {2:4, 3:2}  
{compaction_type:Compaction}
   2a348310-90f0-11ef-bf8c-79bcdbb5790b system_schema keyspaces           
2024-10-22T20:37:44.779 808      312       {2:4, 3:2}  
{compaction_type:Compaction}
   ```
   
   2. With -H option:
   ```
   Compaction History:
   id                                   keyspace_name columnfamily_name   
compacted_at            bytes_in  bytes_out rows_merged compaction_properties
   2a5355b0-90f0-11ef-bf8c-79bcdbb5790b system_schema tables              
2024-10-22T20:37:44.986 10.28 KiB 3.89 KiB  {2:4, 3:2}  
{compaction_type:Compaction}
   2a348310-90f0-11ef-bf8c-79bcdbb5790b system_schema keyspaces           
2024-10-22T20:37:44.779 808 bytes 312 bytes {2:4, 3:2}  
{compaction_type:Compaction}
   ```
   
   3. With -F json option:
   ```
   {
     "CompactionHistory" : [ {
       "keyspace_name" : "system_schema",
       "bytes_out" : "3985",
       "bytes_in" : "10526",
       "compaction_properties" : "{compaction_type:Compaction}",
       "columnfamily_name" : "tables",
       "rows_merged" : "{2:4, 3:2}",
       "id" : "2a5355b0-90f0-11ef-bf8c-79bcdbb5790b",
       "compacted_at" : "2024-10-22T20:37:44.986"
   }
   ```
   
   4. With -F json -H option:
   ```
   {
     "CompactionHistory" : [ {
       "keyspace_name" : "system_schema",
       "bytes_out" : "3.89 KiB",
       "bytes_in" : "10.28 KiB",
       "compaction_properties" : "{compaction_type:Compaction}",
       "columnfamily_name" : "tables",
       "rows_merged" : "{2:4, 3:2}",
       "id" : "2a5355b0-90f0-11ef-bf8c-79bcdbb5790b",
       "compacted_at" : "2024-10-22T20:37:44.986"
     }, 
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to