[ 
https://issues.apache.org/jira/browse/CASSANDRA-16653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17340315#comment-17340315
 ] 

Andres de la Peña commented on CASSANDRA-16653:
-----------------------------------------------

It seems that the problem is that {{AlterTableStatement}} replace all the 
{{TableMetadata}} flags by a single {{COMPOUND}} flag 
([here|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/cql3/statements/schema/AlterTableStatement.java#L437]).
 This removes the {{DENSE}} flag, as it's desired. The problem is that the 
{{COUNTER}} flag is also removed, so the table is not considered as a counters 
table anymore. This leads to sending wrong mutations to the table, producing 
the problem that we can see in the provided reproduction steps.

The proposed patch simply makes sure to preserve the the {{COUNTER}} flag.

CI is running:
 4.0:
 * [CircleCI 
J8|https://app.circleci.com/pipelines/github/adelapena/cassandra/406/workflows/7bafc2a3-4c98-4d1b-9869-24407099147b]
 * [CircleCI 
J11|https://app.circleci.com/pipelines/github/adelapena/cassandra/406/workflows/86f980d7-5566-4d65-a2b7-e573dc70d737]

trunk:
 * [CircleCI 
J8|https://app.circleci.com/pipelines/github/adelapena/cassandra/405/workflows/ae9977c7-02d6-4050-89fd-3683fe8fc581]
 * [CircleCI 
J11|https://app.circleci.com/pipelines/github/adelapena/cassandra/405/workflows/d5f61277-870e-45b7-9d14-99d93da24b82]

> Multinode counters don't get updated
> ------------------------------------
>
>                 Key: CASSANDRA-16653
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16653
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Feature/Counters
>            Reporter: Berenguer Blasi
>            Assignee: Andres de la Peña
>            Priority: Normal
>             Fix For: 4.0-rc, 4.x
>
>
> A multi node setup with counters doesn't update counters value. Works as 
> expected on a single node though. Comes from 
> [this|https://github.com/apache/cassandra-dtest/blob/trunk/upgrade_tests/cql_tests.py#L460]
>  test. Repro:
> {noformat}
> ccm create counters40
> ccm populate -n 2
> ccm start
> ccm node1 cqlsh
>   CREATE KEYSPACE foo WITH REPLICATION = { 'class' : 
> 'NetworkTopologyStrategy', 'datacenter1' : 1 } ;
>   use foo;
>   CREATE TABLE clicks ( userid int, url text, total counter, PRIMARY KEY 
> (userid, url) ) WITH COMPACT STORAGE;
>   ALTER TABLE clicks DROP COMPACT STORAGE;
>   TRUNCATE clicks;
>   UPDATE clicks SET total = total + 1 WHERE userid = 1 AND url = 
> 'http://foo.com';
>   SELECT total FROM clicks WHERE userid = 1 AND url = 'http://foo.com';
>      total
>     -------
>          1
>   UPDATE clicks SET total = total - 4 WHERE userid = 1 AND url = 
> 'http://foo.com';
>   SELECT total FROM clicks WHERE userid = 1 AND url = 'http://foo.com';
>      total
>     -------
>          1 *********** Should be '-3'
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to