The Cassandra trift API does not have a single incrementAndGet operation.
The counters in Kassandra are ultimately consistent and non-nuclear. The operation Fragile ConsistencyLevel.ALL is necessary to get the counter value "guaranteed to be updated", i.e. Perform sequential reads. ConsistencyLevel.QUORUM is not enough (as indicated in the design documentation of the counters: https://issues.apache.org/jira/secure/attachment/12459754/Partitionedcountersdesigndoc.pdf ).
To implement an incrementAndGet method that looks consistent, you may first need to read the counter value, then mutate the increment and return (read the value + inc).
For example, if the previous value of the counter is from 10 to 20 (on different replicas), and one addition of 50 to it, the reading index of the pre-increment will return either 60 or 70. And reading-after-increment can still return 10 or 20 .
source share