diff --git a/CHANGES.txt b/CHANGES.txt index 221701a12d..e7b058cfa2 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -6,6 +6,7 @@ Merged from 4.0: * Migrate Python optparse to argparse (CASSANDRA-17914) Merged from 3.11: Merged from 3.0: + * Fix missing speculative retries in tablestats (CASSANDRA-18767) * Fix Requires for Java for RPM package (CASSANDRA-18751) * Fix CQLSH online help topic link (CASSANDRA-17534) * Remove unused suppressions (CASSANDRA-18724) 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 8b5090bd86..5d527edc16 100644 --- a/src/java/org/apache/cassandra/tools/nodetool/stats/StatsTable.java +++ b/src/java/org/apache/cassandra/tools/nodetool/stats/StatsTable.java @@ -43,6 +43,7 @@ public class StatsTable public boolean memtableOffHeapUsed = false; public String memtableOffHeapMemoryUsed; public Object memtableSwitchCount; + public Object speculativeRetries; public long localReadCount; public double localReadLatencyMs; public long localWriteCount; 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 60132d1fed..52d07c7a73 100644 --- a/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsHolder.java +++ b/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsHolder.java @@ -135,6 +135,7 @@ public class TableStatsHolder implements StatsHolder if (table.memtableOffHeapUsed) mpTable.put("memtable_off_heap_memory_used", table.memtableOffHeapMemoryUsed); mpTable.put("memtable_switch_count", table.memtableSwitchCount); + mpTable.put("speculative_retries", table.speculativeRetries); mpTable.put("local_read_count", table.localReadCount); mpTable.put("local_read_latency_ms", String.format("%01.3f", table.localReadLatencyMs)); mpTable.put("local_write_count", table.localWriteCount); @@ -321,6 +322,7 @@ public class TableStatsHolder implements StatsHolder statsTable.memtableOffHeapMemoryUsed = format(memtableOffHeapSize, humanReadable); } statsTable.memtableSwitchCount = probe.getColumnFamilyMetric(keyspaceName, tableName, "MemtableSwitchCount"); + statsTable.speculativeRetries = probe.getColumnFamilyMetric(keyspaceName, tableName, "SpeculativeRetries"); statsTable.localReadCount = ((CassandraMetricsRegistry.JmxTimerMBean) probe.getColumnFamilyMetric(keyspaceName, tableName, "ReadLatency")).getCount(); double localReadLatency = ((CassandraMetricsRegistry.JmxTimerMBean) probe.getColumnFamilyMetric(keyspaceName, tableName, "ReadLatency")).getMean() / 1000; 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 7f17c21d6d..5618bf4db0 100644 --- a/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsPrinter.java +++ b/src/java/org/apache/cassandra/tools/nodetool/stats/TableStatsPrinter.java @@ -101,6 +101,7 @@ public class TableStatsPrinter if (table.memtableOffHeapUsed) out.println(indent + "Memtable off heap memory used: " + table.memtableOffHeapMemoryUsed); out.println(indent + "Memtable switch count: " + table.memtableSwitchCount); + out.println(indent + "Speculative retries: " + table.speculativeRetries); out.println(indent + "Local read count: " + table.localReadCount); out.printf(indent + "Local read latency: %01.3f ms%n", table.localReadLatencyMs); out.println(indent + "Local write count: " + table.localWriteCount); 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 81687ba7c0..d6c2e2b633 100644 --- a/test/unit/org/apache/cassandra/tools/nodetool/stats/TableStatsPrinterTest.java +++ b/test/unit/org/apache/cassandra/tools/nodetool/stats/TableStatsPrinterTest.java @@ -44,6 +44,7 @@ public class TableStatsPrinterTest extends TableStatsTestBase "\tMemtable cell count: 111\n" + "\tMemtable data size: 0\n" + "\tMemtable switch count: 1\n" + + "\tSpeculative retries: 0\n" + "\tLocal read count: 0\n" + "\tLocal read latency: 2.000 ms\n" + "\tLocal write count: 5\n" + @@ -81,6 +82,7 @@ public class TableStatsPrinterTest extends TableStatsTestBase "\tMemtable data size: 900\n" + "\tMemtable off heap memory used: 314159265\n" + "\tMemtable switch count: 22222\n" + + "\tSpeculative retries: 0\n" + "\tLocal read count: 1\n" + "\tLocal read latency: 3.000 ms\n" + "\tLocal write count: 4\n" + @@ -119,6 +121,7 @@ public class TableStatsPrinterTest extends TableStatsTestBase "\tMemtable cell count: 333333\n" + "\tMemtable data size: 1999\n" + "\tMemtable switch count: 3333\n" + + "\tSpeculative retries: 0\n" + "\tLocal read count: 2\n" + "\tLocal read latency: 4.000 ms\n" + "\tLocal write count: 3\n" + @@ -156,6 +159,7 @@ public class TableStatsPrinterTest extends TableStatsTestBase "\tMemtable data size: 3000\n" + "\tMemtable off heap memory used: 141421356\n" + "\tMemtable switch count: 444444\n" + + "\tSpeculative retries: 0\n" + "\tLocal read count: 3\n" + "\tLocal read latency: NaN ms\n" + "\tLocal write count: 2\n" + @@ -194,6 +198,7 @@ public class TableStatsPrinterTest extends TableStatsTestBase "\tMemtable cell count: 55555\n" + "\tMemtable data size: 20000\n" + "\tMemtable switch count: 5\n" + + "\tSpeculative retries: 0\n" + "\tLocal read count: 4\n" + "\tLocal read latency: 0.000 ms\n" + "\tLocal write count: 1\n" + @@ -231,6 +236,7 @@ public class TableStatsPrinterTest extends TableStatsTestBase "\tMemtable data size: 1000000\n" + "\tMemtable off heap memory used: 161803398\n" + "\tMemtable switch count: 6\n" + + "\tSpeculative retries: 0\n" + "\tLocal read count: 5\n" + "\tLocal read latency: 1.000 ms\n" + "\tLocal write count: 0\n" + @@ -401,6 +407,7 @@ public class TableStatsPrinterTest extends TableStatsTestBase " \"bloom_filter_off_heap_memory_used\" : \"667408\",\n" + " \"bytes_pending_repair\" : 0,\n" + " \"memtable_switch_count\" : 6,\n" + + " \"speculative_retries\" : 0,\n" + " \"maximum_tombstones_per_slice_last_five_minutes\" : 6,\n" + " \"memtable_cell_count\" : 6666,\n" + " \"memtable_data_size\" : \"1000000\",\n" + @@ -467,6 +474,7 @@ public class TableStatsPrinterTest extends TableStatsTestBase " bloom_filter_off_heap_memory_used: '667408'\n" + " bytes_pending_repair: 0\n" + " memtable_switch_count: 6\n" + + " speculative_retries: 0\n" + " maximum_tombstones_per_slice_last_five_minutes: 6\n" + " memtable_cell_count: 6666\n" + " memtable_data_size: '1000000'\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 8ef0ea3c94..3902bba228 100644 --- a/test/unit/org/apache/cassandra/tools/nodetool/stats/TableStatsTestBase.java +++ b/test/unit/org/apache/cassandra/tools/nodetool/stats/TableStatsTestBase.java @@ -81,6 +81,7 @@ public class TableStatsTestBase template.memtableCellCount = 0L; template.memtableDataSize = "0"; template.memtableSwitchCount = 0L; + template.speculativeRetries = 0L; template.localReadCount =0L; template.localReadLatencyMs = Double.NaN; template.localWriteCount = 0L;