Tracking counter columns
Getting information about a counter column.
You can use the sstable2json command to get information about a counter column.
Procedure
-
Run the counter example presented earlier that
loads data into a counter column and flushes data to disk.The counter is initialized to 1.
-
Run the sstable2json command.
sudo ./sstable2json /var/lib/cassandra/data/counterks/page_view_counts/counterks-page_view_counts-ib-1-Data.db
[ {"key": "7777772e64617461737461782e636f6d","columns": [[ "home:",",1370187164256000], [ "home:counter_value","0001000058852cd0cb9311e2940971f75c7d064100000000000000010000000000000001",1370187164256,"c",-9223372036854775808]]} ]
- Increase the counter column by 2 and flush the data to disk again.
-
Run the sstable2json command again.
sudo ./sstable2json /var/lib/cassandra/data/counterks/page_view_counts/counterks-page_view_counts-ib-2-Data.db
[ {"key": "7777772e64617461737461782e636f6d","columns": [[ "home:",",1370187315683000], [ "home:counter_value","0001000058852cd0cb9311e2940971f75c7d064100000000000000010000000000000002",1370187315683,"c",-9223372036854775808]]} ]
-9223372036854775808 is the timestamp of the last delete.