[ https://issues.apache.org/jira/browse/CASSANDRA-12500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jeff Jirsa resolved CASSANDRA-12500. ------------------------------------ Resolution: Invalid Finally got around to reading the code, and you're right - {{ColumnFamilyStore.getCachedCounter}} is only called by {{CounterMutation}} on update, not on the read path, so it's not a bug. Sorta surprised it's not used on the read path, but there's (clearly) a lot I don't know about the counter paths, so probably a good reason it's not used. > Counter cache hit counter not incrementing > ------------------------------------------- > > Key: CASSANDRA-12500 > URL: https://issues.apache.org/jira/browse/CASSANDRA-12500 > Project: Cassandra > Issue Type: Bug > Reporter: Jeff Jirsa > Priority: Minor > > Trivial repro on 3.7 with scripts below. Haven't dug through > {{CounterCacheTest}} to find out if the cache is getting skipped or if it's > just not updating the hit counter properly: > {code} > #!/bin/sh > ccm remove test > ccm create test -v 3.7 -n 1 > sed -i'' -e 's/row_cache_size_in_mb: 0/row_cache_size_in_mb: 100/g' > .ccm/test/node1/conf/cassandra.yaml > ccm start > sleep 5 > ccm node1 cqlsh < ~/keyspace.cql > ccm node1 cqlsh < ~/table-counter.cql > ccm node1 cqlsh < ~/table-counter-clustering.cql > echo "Schema created, reads and writes starting" > ccm node1 nodetool info | grep Cache > echo "UPDATE test.test SET v=v+1 WHERE id=1; " | ccm node1 cqlsh > echo "UPDATE test.test2 SET v=v+1 WHERE id=1 and c=1; " | ccm node1 cqlsh > echo "UPDATE test.test2 SET v=v+1 WHERE id=1 and c=2; " | ccm node1 cqlsh > echo "SELECT * FROM test.test WHERE id=1; " | ccm node1 cqlsh > ccm node1 nodetool info | grep Cache > echo "SELECT * FROM test.test WHERE id=1; " | ccm node1 cqlsh > ccm node1 nodetool info | grep Cache > echo "SELECT * FROM test.test2 WHERE id=1; " | ccm node1 cqlsh > ccm node1 nodetool info | grep Cache > echo "SELECT * FROM test.test2 WHERE id=1; " | ccm node1 cqlsh > ccm node1 nodetool info | grep Cache > echo "SELECT * FROM test.test2 WHERE id=1 and c=1; " | ccm node1 cqlsh > ccm node1 nodetool info | grep Cache > echo "SELECT * FROM test.test2 WHERE id=1 and c=1; " | ccm node1 cqlsh > ccm node1 nodetool info | grep Cache > {code} > Keyspace / tables: > {code} > CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', > 'replication_factor': '1'} AND durable_writes = true; > {code} > {code} > CREATE TABLE test.test ( > id int PRIMARY KEY, > v counter > ) WITH caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}; > {code} > {code} > CREATE TABLE test.test2 ( > id int, > c int, > v counter, > PRIMARY KEY(id, c) > ) WITH caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}; > {code} > Output: > {code} > Schema created, reads and writes starting > Key Cache : entries 17, size 1.29 KiB, capacity 24 MiB, 61 hits, > 84 requests, 0.726 recent hit rate, 14400 save period in seconds > Row Cache : entries 0, size 0 bytes, capacity 100 MiB, 0 hits, 0 > requests, NaN recent hit rate, 0 save period in seconds > Counter Cache : entries 0, size 0 bytes, capacity 12 MiB, 0 hits, 0 > requests, NaN recent hit rate, 7200 save period in seconds > Chunk Cache : entries 14, size 896 KiB, capacity 91 MiB, 38 > misses, 227 requests, 0.833 recent hit rate, 80.234 microseconds miss latency > id | v > ----+--- > 1 | 1 > (1 rows) > Key Cache : entries 17, size 1.29 KiB, capacity 24 MiB, 70 hits, > 93 requests, 0.753 recent hit rate, 14400 save period in seconds > Row Cache : entries 0, size 0 bytes, capacity 100 MiB, 0 hits, 0 > requests, NaN recent hit rate, 0 save period in seconds > Counter Cache : entries 3, size 328 bytes, capacity 12 MiB, 0 hits, > 3 requests, 0.000 recent hit rate, 7200 save period in seconds > Chunk Cache : entries 14, size 896 KiB, capacity 91 MiB, 38 > misses, 288 requests, 0.868 recent hit rate, 80.234 microseconds miss latency > id | v > ----+--- > 1 | 1 > (1 rows) > Key Cache : entries 17, size 1.29 KiB, capacity 24 MiB, 72 hits, > 95 requests, 0.758 recent hit rate, 14400 save period in seconds > Row Cache : entries 0, size 0 bytes, capacity 100 MiB, 0 hits, 0 > requests, NaN recent hit rate, 0 save period in seconds > Counter Cache : entries 3, size 328 bytes, capacity 12 MiB, 0 hits, > 3 requests, 0.000 recent hit rate, 7200 save period in seconds > Chunk Cache : entries 14, size 896 KiB, capacity 91 MiB, 38 > misses, 303 requests, 0.875 recent hit rate, 80.234 microseconds miss latency > id | c | v > ----+---+--- > 1 | 1 | 1 > 1 | 2 | 1 > (2 rows) > Key Cache : entries 17, size 1.29 KiB, capacity 24 MiB, 74 hits, > 97 requests, 0.763 recent hit rate, 14400 save period in seconds > Row Cache : entries 0, size 0 bytes, capacity 100 MiB, 0 hits, 0 > requests, NaN recent hit rate, 0 save period in seconds > Counter Cache : entries 3, size 328 bytes, capacity 12 MiB, 0 hits, > 3 requests, 0.000 recent hit rate, 7200 save period in seconds > Chunk Cache : entries 14, size 896 KiB, capacity 91 MiB, 38 > misses, 318 requests, 0.881 recent hit rate, 80.234 microseconds miss latency > id | c | v > ----+---+--- > 1 | 1 | 1 > 1 | 2 | 1 > (2 rows) > Key Cache : entries 17, size 1.29 KiB, capacity 24 MiB, 76 hits, > 99 requests, 0.768 recent hit rate, 14400 save period in seconds > Row Cache : entries 0, size 0 bytes, capacity 100 MiB, 0 hits, 0 > requests, NaN recent hit rate, 0 save period in seconds > Counter Cache : entries 3, size 328 bytes, capacity 12 MiB, 0 hits, > 3 requests, 0.000 recent hit rate, 7200 save period in seconds > Chunk Cache : entries 14, size 896 KiB, capacity 91 MiB, 38 > misses, 333 requests, 0.886 recent hit rate, 80.234 microseconds miss latency > id | c | v > ----+---+--- > 1 | 1 | 1 > (1 rows) > Key Cache : entries 17, size 1.29 KiB, capacity 24 MiB, 78 hits, > 101 requests, 0.772 recent hit rate, 14400 save period in seconds > Row Cache : entries 0, size 0 bytes, capacity 100 MiB, 0 hits, 0 > requests, NaN recent hit rate, 0 save period in seconds > Counter Cache : entries 3, size 328 bytes, capacity 12 MiB, 0 hits, > 3 requests, 0.000 recent hit rate, 7200 save period in seconds > Chunk Cache : entries 14, size 896 KiB, capacity 91 MiB, 38 > misses, 348 requests, 0.891 recent hit rate, 80.234 microseconds miss latency > id | c | v > ----+---+--- > 1 | 1 | 1 > (1 rows) > Key Cache : entries 17, size 1.29 KiB, capacity 24 MiB, 80 hits, > 103 requests, 0.777 recent hit rate, 14400 save period in seconds > Row Cache : entries 0, size 0 bytes, capacity 100 MiB, 0 hits, 0 > requests, NaN recent hit rate, 0 save period in seconds > Counter Cache : entries 3, size 328 bytes, capacity 12 MiB, 0 hits, > 3 requests, 0.000 recent hit rate, 7200 save period in seconds > Chunk Cache : entries 14, size 896 KiB, capacity 91 MiB, 38 > misses, 363 requests, 0.895 recent hit rate, 80.234 microseconds miss latency > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)