You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2021/09/22 16:40:10 UTC

[cassandra] branch trunk updated: Add sstable count to compactionstats output

This is an automated email from the ASF dual-hosted git repository.

brandonwilliams pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 9ed8810  Add sstable count to compactionstats output
9ed8810 is described below

commit 9ed8810183abdf15cbb72c23ab078b61c14ee2cd
Author: Brandon Williams <br...@apache.org>
AuthorDate: Mon Aug 30 11:18:26 2021 -0500

    Add sstable count to compactionstats output
    
    Patch by brandonwilliams; reviwed by Aleksei Zotov and adelapena for
    CASSANDRA-16844
---
 CHANGES.txt                                                       | 1 +
 doc/source/troubleshooting/use_nodetool.rst                       | 4 ++--
 src/java/org/apache/cassandra/tools/nodetool/CompactionStats.java | 5 +++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 02237b7..ed95f95 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.1
+ * Add number of sstables in a compaction to compactionstats output (CASSANDRA-16844)
  * Upgrade Caffeine to 2.9.2 (CASSANDRA-15153)
  * Allow DELETE and TRUNCATE to work on Virtual Tables if the implementation allows it (CASSANDRA-16806)
  * Include SASI components to snapshots (CASSANDRA-15134)
diff --git a/doc/source/troubleshooting/use_nodetool.rst b/doc/source/troubleshooting/use_nodetool.rst
index 5072f85..7138503 100644
--- a/doc/source/troubleshooting/use_nodetool.rst
+++ b/doc/source/troubleshooting/use_nodetool.rst
@@ -227,8 +227,8 @@ good idea to check if compactions are even running using
     pending tasks: 2
     - keyspace.table: 2
 
-    id                                   compaction type keyspace table completed total    unit  progress
-    2062b290-7f3a-11e8-9358-cd941b956e60 Compaction      keyspace table 21848273  97867583 bytes 22.32%
+    id                                   compaction type keyspace table sstables completed total    unit  progress
+    2062b290-7f3a-11e8-9358-cd941b956e60 Compaction      keyspace table 3        21848273  97867583 bytes 22.32%
     Active compaction remaining time :   0h00m04s
 
 In this case there is a single compaction running on the ``keyspace.table``
diff --git a/src/java/org/apache/cassandra/tools/nodetool/CompactionStats.java b/src/java/org/apache/cassandra/tools/nodetool/CompactionStats.java
index 04dcc2b..a4ca09b 100644
--- a/src/java/org/apache/cassandra/tools/nodetool/CompactionStats.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/CompactionStats.java
@@ -80,7 +80,7 @@ public class CompactionStats extends NodeToolCmd
             long remainingBytes = 0;
             TableBuilder table = new TableBuilder();
 
-            table.add("id", "compaction type", "keyspace", "table", "completed", "total", "unit", "progress");
+            table.add("id", "compaction type", "keyspace", "table", "sstables", "completed", "total", "unit", "progress");
             for (Map<String, String> c : compactions)
             {
                 long total = Long.parseLong(c.get(CompactionInfo.TOTAL));
@@ -90,11 +90,12 @@ public class CompactionStats extends NodeToolCmd
                 String columnFamily = c.get(CompactionInfo.COLUMNFAMILY);
                 String unit = c.get(CompactionInfo.UNIT);
                 boolean toFileSize = humanReadable && Unit.isFileSize(unit);
+                String[] tables = c.get(CompactionInfo.SSTABLES).split(",");
                 String completedStr = toFileSize ? FileUtils.stringifyFileSize(completed) : Long.toString(completed);
                 String totalStr = toFileSize ? FileUtils.stringifyFileSize(total) : Long.toString(total);
                 String percentComplete = total == 0 ? "n/a" : new DecimalFormat("0.00").format((double) completed / total * 100) + "%";
                 String id = c.get(CompactionInfo.COMPACTION_ID);
-                table.add(id, taskType, keyspace, columnFamily, completedStr, totalStr, unit, percentComplete);
+                table.add(id, taskType, keyspace, columnFamily, String.valueOf(tables.length), completedStr, totalStr, unit, percentComplete);
                 remainingBytes += total - completed;
             }
             table.printTo(out);

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org