Skip to content

Commit

Permalink
Add repaired/unrepaired bytes back to nodetool
Browse files Browse the repository at this point in the history
Patch by Josh Turner, reviewed by marcuse and brandonwilliams for
CASSANDRA-15282
  • Loading branch information
tdl-jturner authored and driftx committed Jul 1, 2021
1 parent 2fb3d9e commit d727072
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions 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)
Expand Down
Expand Up @@ -136,6 +136,9 @@ private Map<String, Object> convertStatsTableToMap(StatsTable table)
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);
Expand Down Expand Up @@ -241,6 +244,9 @@ private void initializeKeyspaces(NodeProbe probe, boolean ignore, List<String> t
Long compressionMetadataOffHeapSize = null;
Long offHeapSize = null;
Double percentRepaired = null;
Long bytesRepaired = null;
Long bytesUnrepaired = null;
Long bytesPendingRepair = null;

try
{
Expand All @@ -250,6 +256,9 @@ private void initializeKeyspaces(NodeProbe probe, boolean ignore, List<String> t
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)
{
Expand All @@ -271,6 +280,11 @@ private void initializeKeyspaces(NodeProbe probe, boolean ignore, List<String> t
{
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))
Expand Down
Expand Up @@ -21,6 +21,8 @@
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)
Expand Down Expand Up @@ -101,6 +103,10 @@ protected void printStatsTable(StatsTable table, String tableDisplayName, String
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);
Expand Down
Expand Up @@ -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" +
Expand Down Expand Up @@ -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" +
Expand Down Expand Up @@ -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" +
Expand Down Expand Up @@ -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" +
Expand Down Expand Up @@ -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" +
Expand Down Expand Up @@ -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" +
Expand Down

0 comments on commit d727072

Please sign in to comment.