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/07/01 19:27:53 UTC

[cassandra] branch cassandra-4.0 updated: Add repaired/unrepaired bytes back to nodetool

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

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


The following commit(s) were added to refs/heads/cassandra-4.0 by this push:
     new d727072  Add repaired/unrepaired bytes back to nodetool
d727072 is described below

commit d7270725a1a0807e99b1e23a2d02c38fe8ddd94a
Author: Josh Turner <tu...@gmail.com>
AuthorDate: Thu Jul 1 12:24:40 2021 -0500

    Add repaired/unrepaired bytes back to nodetool
    
    Patch by Josh Turner, reviewed by marcuse and brandonwilliams for
    CASSANDRA-15282
---
 CHANGES.txt                                            |  1 +
 .../tools/nodetool/stats/TableStatsHolder.java         | 14 ++++++++++++++
 .../tools/nodetool/stats/TableStatsPrinter.java        |  6 ++++++
 .../tools/nodetool/stats/TableStatsPrinterTest.java    | 18 ++++++++++++++++++
 4 files changed, 39 insertions(+)

diff --git a/CHANGES.txt b/CHANGES.txt
index e976214..aa95028 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0.1
+ * Add repaired/unrepaired bytes back to nodetool (CASSANDRA-15282)
  * Upgrade lz4-java to 1.8.0 to add RH6 support back (CASSANDRA-16753)
  * Improve DiagnosticEventService.publish(event) logging message of events (CASSANDRA-16749)
  * Cleanup dependency scopes (CASSANDRA-16704)
diff --git a/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsHolder.java b/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsHolder.java
index 8b9b722..b1685e6 100644
--- a/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsHolder.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsHolder.java
@@ -136,6 +136,9 @@ public class TableStatsHolder implements StatsHolder
         mpTable.put("local_write_latency_ms", String.format("%01.3f", table.localWriteLatencyMs));
         mpTable.put("pending_flushes", table.pendingFlushes);
         mpTable.put("percent_repaired", table.percentRepaired);
+        mpTable.put("bytes_repaired", table.bytesRepaired);
+        mpTable.put("bytes_unrepaired", table.bytesUnrepaired);
+        mpTable.put("bytes_pending_repair", table.bytesPendingRepair);
         mpTable.put("bloom_filter_false_positives", table.bloomFilterFalsePositives);
         mpTable.put("bloom_filter_false_ratio", String.format("%01.5f", table.bloomFilterFalseRatio));
         mpTable.put("bloom_filter_space_used", table.bloomFilterSpaceUsed);
@@ -241,6 +244,9 @@ public class TableStatsHolder implements StatsHolder
                 Long compressionMetadataOffHeapSize = null;
                 Long offHeapSize = null;
                 Double percentRepaired = null;
+                Long bytesRepaired = null;
+                Long bytesUnrepaired = null;
+                Long bytesPendingRepair = null;
 
                 try
                 {
@@ -250,6 +256,9 @@ public class TableStatsHolder implements StatsHolder
                     compressionMetadataOffHeapSize = (Long) probe.getColumnFamilyMetric(keyspaceName, tableName, "CompressionMetadataOffHeapMemoryUsed");
                     offHeapSize = memtableOffHeapSize + bloomFilterOffHeapSize + indexSummaryOffHeapSize + compressionMetadataOffHeapSize;
                     percentRepaired = (Double) probe.getColumnFamilyMetric(keyspaceName, tableName, "PercentRepaired");
+                    bytesRepaired = (Long) probe.getColumnFamilyMetric(keyspaceName, tableName, "BytesRepaired");
+                    bytesUnrepaired = (Long) probe.getColumnFamilyMetric(keyspaceName, tableName, "BytesUnrepaired");
+                    bytesPendingRepair = (Long) probe.getColumnFamilyMetric(keyspaceName, tableName, "BytesPendingRepair");
                 }
                 catch (RuntimeException e)
                 {
@@ -271,6 +280,11 @@ public class TableStatsHolder implements StatsHolder
                 {
                     statsTable.percentRepaired = Math.round(100 * percentRepaired) / 100.0;
                 }
+
+                statsTable.bytesRepaired = bytesRepaired != null ? bytesRepaired : 0;
+                statsTable.bytesUnrepaired = bytesUnrepaired != null ? bytesUnrepaired : 0;
+                statsTable.bytesPendingRepair = bytesPendingRepair != null ? bytesPendingRepair : 0;
+
                 statsTable.sstableCompressionRatio = probe.getColumnFamilyMetric(keyspaceName, tableName, "CompressionRatio");
                 Object estimatedPartitionCount = probe.getColumnFamilyMetric(keyspaceName, tableName, "EstimatedPartitionCount");
                 if (Long.valueOf(-1L).equals(estimatedPartitionCount))
diff --git a/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsPrinter.java b/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsPrinter.java
index 8c27e1e..f4188e4 100644
--- a/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsPrinter.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsPrinter.java
@@ -21,6 +21,8 @@ package org.apache.cassandra.tools.nodetool.stats;
 import java.io.PrintStream;
 import java.util.List;
 
+import org.apache.cassandra.utils.FBUtilities;
+
 public class TableStatsPrinter<T extends StatsHolder>
 {
     public static <T extends StatsHolder> StatsPrinter<T> from(String format, boolean sorted)
@@ -101,6 +103,10 @@ public class TableStatsPrinter<T extends StatsHolder>
             out.println(indent + "Pending flushes: " + table.pendingFlushes);
             out.println(indent + "Percent repaired: " + table.percentRepaired);
 
+            out.println(indent +"Bytes repaired: " + FBUtilities.prettyPrintMemory(table.bytesRepaired));
+            out.println(indent +"Bytes unrepaired: " + FBUtilities.prettyPrintMemory(table.bytesUnrepaired));
+            out.println(indent +"Bytes pending repair: " + FBUtilities.prettyPrintMemory(table.bytesPendingRepair));
+
             out.println(indent + "Bloom filter false positives: " + table.bloomFilterFalsePositives);
             out.printf(indent + "Bloom filter false ratio: %01.5f%n", table.bloomFilterFalseRatio);
             out.println(indent + "Bloom filter space used: " + table.bloomFilterSpaceUsed);
diff --git a/test/unit/org/apache/cassandra/tools/nodetool/stats/TableStatsPrinterTest.java b/test/unit/org/apache/cassandra/tools/nodetool/stats/TableStatsPrinterTest.java
index cc2caa3..992f711 100644
--- a/test/unit/org/apache/cassandra/tools/nodetool/stats/TableStatsPrinterTest.java
+++ b/test/unit/org/apache/cassandra/tools/nodetool/stats/TableStatsPrinterTest.java
@@ -49,6 +49,9 @@ public class TableStatsPrinterTest extends TableStatsTestBase
         "\tLocal write latency: 0.050 ms\n" +
         "\tPending flushes: 11111\n" +
         "\tPercent repaired: 100.0\n" +
+        "\tBytes repaired: 0.000KiB\n" +
+        "\tBytes unrepaired: 0.000KiB\n" +
+        "\tBytes pending repair: 0.000KiB\n" +
         "\tBloom filter false positives: 30\n" +
         "\tBloom filter false ratio: 0.40000\n" +
         "\tBloom filter space used: 789\n" +
@@ -82,6 +85,9 @@ public class TableStatsPrinterTest extends TableStatsTestBase
         "\tLocal write latency: 0.000 ms\n" +
         "\tPending flushes: 222222\n" +
         "\tPercent repaired: 99.9\n" +
+        "\tBytes repaired: 0.000KiB\n" +
+        "\tBytes unrepaired: 0.000KiB\n" +
+        "\tBytes pending repair: 0.000KiB\n" +
         "\tBloom filter false positives: 600\n" +
         "\tBloom filter false ratio: 0.01000\n" +
         "\tBloom filter space used: 161718\n" +
@@ -116,6 +122,9 @@ public class TableStatsPrinterTest extends TableStatsTestBase
         "\tLocal write latency: NaN ms\n" +
         "\tPending flushes: 333\n" +
         "\tPercent repaired: 99.8\n" +
+        "\tBytes repaired: 0.000KiB\n" +
+        "\tBytes unrepaired: 0.000KiB\n" +
+        "\tBytes pending repair: 0.000KiB\n" +
         "\tBloom filter false positives: 20\n" +
         "\tBloom filter false ratio: 0.50000\n" +
         "\tBloom filter space used: 456\n" +
@@ -149,6 +158,9 @@ public class TableStatsPrinterTest extends TableStatsTestBase
         "\tLocal write latency: 2.000 ms\n" +
         "\tPending flushes: 4444\n" +
         "\tPercent repaired: 50.0\n" +
+        "\tBytes repaired: 0.000KiB\n" +
+        "\tBytes unrepaired: 0.000KiB\n" +
+        "\tBytes pending repair: 0.000KiB\n" +
         "\tBloom filter false positives: 500\n" +
         "\tBloom filter false ratio: 0.02000\n" +
         "\tBloom filter space used: 131415\n" +
@@ -183,6 +195,9 @@ public class TableStatsPrinterTest extends TableStatsTestBase
         "\tLocal write latency: 1.000 ms\n" +
         "\tPending flushes: 5\n" +
         "\tPercent repaired: 93.0\n" +
+        "\tBytes repaired: 0.000KiB\n" +
+        "\tBytes unrepaired: 0.000KiB\n" +
+        "\tBytes pending repair: 0.000KiB\n" +
         "\tBloom filter false positives: 10\n" +
         "\tBloom filter false ratio: 0.60000\n" +
         "\tBloom filter space used: 123\n" +
@@ -216,6 +231,9 @@ public class TableStatsPrinterTest extends TableStatsTestBase
         "\tLocal write latency: 0.500 ms\n" +
         "\tPending flushes: 66\n" +
         "\tPercent repaired: 0.0\n" +
+        "\tBytes repaired: 0.000KiB\n" +
+        "\tBytes unrepaired: 0.000KiB\n" +
+        "\tBytes pending repair: 0.000KiB\n" +
         "\tBloom filter false positives: 400\n" +
         "\tBloom filter false ratio: 0.03000\n" +
         "\tBloom filter space used: 101112\n" +

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