You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by pa...@apache.org on 2022/01/03 14:58:46 UTC
[cassandra] branch cassandra-4.0 updated: CASSANDRA-16308: Add droppable tombstone metrics to nodetool tablestats
This is an automated email from the ASF dual-hosted git repository.
paulo 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 c420d75 CASSANDRA-16308: Add droppable tombstone metrics to nodetool tablestats
c420d75 is described below
commit c420d754d8571120e58b2fe4838c766d26169d7d
Author: tejavadali <kv...@bloomberg.net>
AuthorDate: Sun Dec 12 22:31:15 2021 +0530
CASSANDRA-16308: Add droppable tombstone metrics to nodetool tablestats
patch by Krishna Vadali; reviewed by Paulo Motta and Brandon Williams for CASSANDRA-16308
Closes #1359
---
CHANGES.txt | 1 +
src/java/org/apache/cassandra/tools/NodeProbe.java | 5 +++++
src/java/org/apache/cassandra/tools/nodetool/stats/StatsTable.java | 1 +
.../apache/cassandra/tools/nodetool/stats/TableStatsHolder.java | 3 +++
.../apache/cassandra/tools/nodetool/stats/TableStatsPrinter.java | 1 +
.../cassandra/tools/nodetool/stats/TableStatsPrinterTest.java | 6 ++++++
.../apache/cassandra/tools/nodetool/stats/TableStatsTestBase.java | 7 +++++++
7 files changed, 24 insertions(+)
diff --git a/CHANGES.txt b/CHANGES.txt
index 77d2737..aa3b707 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
4.0.2
+ * Add droppable tombstone metrics to nodetool tablestats (CASSANDRA-16308)
* Fix disk failure triggered when enabling FQL on an unclean directory (CASSANDRA-17136)
* Fixed broken classpath when multiple jars in build directory (CASSANDRA-17129)
* DebuggableThreadPoolExecutor does not propagate client warnings (CASSANDRA-17072)
diff --git a/src/java/org/apache/cassandra/tools/NodeProbe.java b/src/java/org/apache/cassandra/tools/NodeProbe.java
index 9b221e9..101aab3 100644
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@ -467,6 +467,11 @@ public class NodeProbe implements AutoCloseable
return result;
}
+ public double getDroppableTombstoneRatio(String keyspace, String table) {
+ ColumnFamilyStoreMBean cfsProxy = getCfsProxy(keyspace, table);
+ return cfsProxy.getDroppableTombstoneRatio();
+ }
+
public void invalidateCounterCache()
{
cacheService.invalidateCounterCache();
diff --git a/src/java/org/apache/cassandra/tools/nodetool/stats/StatsTable.java b/src/java/org/apache/cassandra/tools/nodetool/stats/StatsTable.java
index d897eab..0859327 100644
--- a/src/java/org/apache/cassandra/tools/nodetool/stats/StatsTable.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/stats/StatsTable.java
@@ -70,4 +70,5 @@ public class StatsTable
public String droppedMutations;
public List<String> sstablesInEachLevel = new ArrayList<>();
public Boolean isInCorrectLocation = null; // null: option not active
+ public double droppableTombstoneRatio;
}
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 b1685e6..a587738 100644
--- a/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsHolder.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsHolder.java
@@ -161,6 +161,8 @@ public class TableStatsHolder implements StatsHolder
mpTable.put("maximum_tombstones_per_slice_last_five_minutes",
table.maximumTombstonesPerSliceLastFiveMinutes);
mpTable.put("dropped_mutations", table.droppedMutations);
+ mpTable.put("droppable_tombstone_ratio",
+ String.format("%01.5f", table.droppableTombstoneRatio));
if (locationCheck)
mpTable.put("sstables_in_correct_location", table.isInCorrectLocation);
return mpTable;
@@ -345,6 +347,7 @@ public class TableStatsHolder implements StatsHolder
statsTable.averageTombstonesPerSliceLastFiveMinutes = histogram.getMean();
statsTable.maximumTombstonesPerSliceLastFiveMinutes = histogram.getMax();
statsTable.droppedMutations = format((Long) probe.getColumnFamilyMetric(keyspaceName, tableName, "DroppedMutations"), humanReadable);
+ statsTable.droppableTombstoneRatio = probe.getDroppableTombstoneRatio(keyspaceName, tableName);
statsKeyspace.tables.add(statsTable);
}
keyspaces.add(statsKeyspace);
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 f4188e4..d8e4d4a 100644
--- a/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsPrinter.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsPrinter.java
@@ -126,6 +126,7 @@ public class TableStatsPrinter<T extends StatsHolder>
out.println(indent + "Average tombstones per slice (last five minutes): " + table.averageTombstonesPerSliceLastFiveMinutes);
out.println(indent + "Maximum tombstones per slice (last five minutes): " + table.maximumTombstonesPerSliceLastFiveMinutes);
out.println(indent + "Dropped Mutations: " + table.droppedMutations);
+ out.printf(indent + "Droppable tombstone ratio: %01.5f%n", table.droppableTombstoneRatio);
if (table.isInCorrectLocation != null)
out.println(indent + "SSTables in correct location: " + table.isInCorrectLocation);
out.println("");
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 992f711..d67ef5d 100644
--- a/test/unit/org/apache/cassandra/tools/nodetool/stats/TableStatsPrinterTest.java
+++ b/test/unit/org/apache/cassandra/tools/nodetool/stats/TableStatsPrinterTest.java
@@ -63,6 +63,7 @@ public class TableStatsPrinterTest extends TableStatsTestBase
"\tAverage tombstones per slice (last five minutes): 5.0\n" +
"\tMaximum tombstones per slice (last five minutes): 1\n" +
"\tDropped Mutations: 0\n" +
+ "\tDroppable tombstone ratio: 0.00000\n" +
"\n";
public static final String expectedDefaultTable2Output =
@@ -102,6 +103,7 @@ public class TableStatsPrinterTest extends TableStatsTestBase
"\tAverage tombstones per slice (last five minutes): 4.001\n" +
"\tMaximum tombstones per slice (last five minutes): 2\n" +
"\tDropped Mutations: 222\n" +
+ "\tDroppable tombstone ratio: 0.22222\n" +
"\n";
public static final String expectedDefaultTable3Output =
@@ -136,6 +138,7 @@ public class TableStatsPrinterTest extends TableStatsTestBase
"\tAverage tombstones per slice (last five minutes): NaN\n" +
"\tMaximum tombstones per slice (last five minutes): 3\n" +
"\tDropped Mutations: 33333\n" +
+ "\tDroppable tombstone ratio: 0.33333\n" +
"\n";
public static final String expectedDefaultTable4Output =
@@ -175,6 +178,7 @@ public class TableStatsPrinterTest extends TableStatsTestBase
"\tAverage tombstones per slice (last five minutes): 0.0\n" +
"\tMaximum tombstones per slice (last five minutes): 3\n" +
"\tDropped Mutations: 4444\n" +
+ "\tDroppable tombstone ratio: 0.44444\n" +
"\n";
public static final String expectedDefaultTable5Output =
@@ -209,6 +213,7 @@ public class TableStatsPrinterTest extends TableStatsTestBase
"\tAverage tombstones per slice (last five minutes): 4.01\n" +
"\tMaximum tombstones per slice (last five minutes): 5\n" +
"\tDropped Mutations: 0\n" +
+ "\tDroppable tombstone ratio: 0.55556\n" +
"\n";
public static final String expectedDefaultTable6Output =
@@ -248,6 +253,7 @@ public class TableStatsPrinterTest extends TableStatsTestBase
"\tAverage tombstones per slice (last five minutes): 6.0\n" +
"\tMaximum tombstones per slice (last five minutes): 6\n" +
"\tDropped Mutations: 666666\n" +
+ "\tDroppable tombstone ratio: 0.66667\n" +
"\n";
/**
diff --git a/test/unit/org/apache/cassandra/tools/nodetool/stats/TableStatsTestBase.java b/test/unit/org/apache/cassandra/tools/nodetool/stats/TableStatsTestBase.java
index 1721a01..8ef0ea3 100644
--- a/test/unit/org/apache/cassandra/tools/nodetool/stats/TableStatsTestBase.java
+++ b/test/unit/org/apache/cassandra/tools/nodetool/stats/TableStatsTestBase.java
@@ -294,6 +294,13 @@ public class TableStatsTestBase
table4.sstableCount = 2000;
table5.sstableCount = 40000;
table6.sstableCount = 1000;
+ // Droppable Tombstone ratio
+ table1.droppableTombstoneRatio = 0;
+ table2.droppableTombstoneRatio = 0.222222;
+ table3.droppableTombstoneRatio = 0.333333;
+ table4.droppableTombstoneRatio = 0.444444;
+ table5.droppableTombstoneRatio = 0.555555;
+ table6.droppableTombstoneRatio = 0.666666;
// set even numbered tables to have some offheap usage
table2.offHeapUsed = true;
table4.offHeapUsed = true;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org