Reputation: 230
I badly need the count of rows in a ColumnFamily but "Number of Keys" is missing from "nodetool cfstats" output in cassandra 2.1.2. How to get the count of rows now?
Here is the output of cfstats
Keyspace: liftrmt
Read Count: 0
Read Latency: NaN ms.
Write Count: 0
Write Latency: NaN ms.
Pending Flushes: 0
Table: reportcodedaycount
SSTable count: 4
Space used (live): 11.49 MB
Space used (total): 11.49 MB
Space used by snapshots (total): 0 bytes
SSTable Compression Ratio: 0.38099920748493266
Memtable cell count: 0
Memtable data size: 0 bytes
Memtable switch count: 0
Local read count: 0
Local read latency: NaN ms
Local write count: 0
Local write latency: NaN ms
Pending flushes: 0
Bloom filter false positives: 0
Bloom filter false ratio: 0.00000
Bloom filter space used: 64 bytes
Compacted partition minimum bytes: 444.17 KB
Compacted partition maximum bytes: 6.68 MB
Compacted partition mean bytes: 4.17 MB
Average live cells per slice (last five minutes): 0.0
Maximum live cells per slice (last five minutes): 0.0
Average tombstones per slice (last five minutes): 0.0
Maximum tombstones per slice (last five minutes): 0.0
Upvotes: 4
Views: 1128
Reputation: 7305
UPDATE: This issue is now solved in 2.1.3.
I went ahead and created a jira for this. Not sure why number of keys is missing in 2.1.2: https://issues.apache.org/jira/browse/CASSANDRA-8400
Upvotes: 1
Reputation: 14173
You need to use the new metrics that can be accessed via JMX. I'll access them using JConsole.
Open up jconsole then navigate to:
org.apache.cassandra.metrics
-> ColumnFamily
-> ksname (in my case test)
-> cfname (in my case group)
-> EstimatedColumnCountHistogram
-> Attributes -> Value
Open up the long [90] array, and in my case it's the second value. These are keys that are in sstables, if it's in a memtable, it wont be accessable through this metric (i.e. if you wanna see it, you need to flush your memtables to sstables).
Screenshot of 22 unique keys inserted into test.group below for clarity...
More on the new metrics API.
Upvotes: 4