[ https://issues.apache.org/jira/browse/CASSANDRA-12500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15459556#comment-15459556 ]
Aditya Pandit commented on CASSANDRA-12500: ------------------------------------------- CounterCache value gets hit on UPDATE operation of same row the CounterCache will register a hit as it re-uses the same Counter object. example: add another update to the same row: UPDATE test.test2 SET v=v+1 WHERE id=1 and c=2; And then check nodetool info | grep Cache I added one more row and updated it again to get 4 entries and saw 1 hit(for the one that I updated twice). {noformat} Key Cache : entries 23, size 1.77 KiB, capacity 50 MiB, 70 hits, 92 requests, 0.761 recent hit rate, 14400 save period in seconds Row Cache : entries 0, size 0 bytes, capacity 10 MiB, 0 hits, 0 requests, NaN recent hit rate, 0 save period in seconds Counter Cache : entries 4, size 440 bytes, capacity 20 MiB, 1 hits, 2 requests, 0.500 recent hit rate, 7200 save period in seconds Chunk Cache : entries 26, size 1.62 MiB, capacity 219 MiB, 38 misses, 162 requests, 0.765 recent hit rate, 570.397 microseconds miss latency {noformat} > 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)