You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Luis E Fernandez (Jira)" <ji...@apache.org> on 2023/10/26 18:03:00 UTC

[jira] [Created] (CASSANDRA-18966) Error thrown when creating transaction with counter column type

Luis E Fernandez created CASSANDRA-18966:
--------------------------------------------

             Summary: Error thrown when creating transaction with counter column type
                 Key: CASSANDRA-18966
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18966
             Project: Cassandra
          Issue Type: Bug
            Reporter: Luis E Fernandez


*System configuration and information:*

Single node Cassandra with Accord transactions enabled running on docker

Built from commit: [a7cd114435704b988c81f47ef53d0bfd6441f38b|https://github.com/apache/cassandra/commit/a7cd114435704b988c81f47ef53d0bfd6441f38b]

CQLSH: [cqlsh 6.2.0 | Cassandra 5.0-alpha2-SNAPSHOT | CQL spec 3.4.7 | Native protocol v5]

 

*Steps to reproduce in CQLSH:*
{code:java}
CREATE KEYSPACE accord WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}  AND durable_writes = true;{code}
{code:java}
CREATE TABLE accord.accounts (
    partition_key text,
    account_id int,
    balance counter,
    PRIMARY KEY (partition_key, account_id)
) WITH CLUSTERING ORDER BY (account_id ASC)
{code}
{code:java}
BEGIN TRANSACTION UPDATE accord.accounts SET balance = balance + 1000 WHERE partition_key = 'default' AND account_id = 1; COMMIT TRANSACTION;{code}
at this point the row is correctly inserted

bug happens after executing the following statement:

I was not able to update the `balance` counter column. I expected to be able to update the `balance` column to 2000.
{code:java}
BEGIN TRANSACTION LET row = (SELECT * FROM accord.accounts WHERE partition_key = 'default' AND account_id = 1); SELECT row.balance; UPDATE accord.accounts SET balance = balance + 1000 WHERE partition_key = 'default' AND account_id = 1; COMMIT TRANSACTION;{code}
 

Bug / Error:
======================================================================

{color:#de350b}Traceback (most recent call last):{color}
{color:#de350b}  File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.25.0.zip/cassandra-driver-3.25.0/cassandra/protocol.py", line 755, in recv_results_rows{color}
{color:#de350b}    self.parsed_rows = [{color}
{color:#de350b}  File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.25.0.zip/cassandra-driver-3.25.0/cassandra/protocol.py", line 756, in <listcomp>{color}
{color:#de350b}    tuple(ctype.from_binary(val, protocol_version){color}
{color:#de350b}  File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.25.0.zip/cassandra-driver-3.25.0/cassandra/protocol.py", line 756, in <genexpr>{color}
{color:#de350b}    tuple(ctype.from_binary(val, protocol_version){color}
{color:#de350b}  File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.25.0.zip/cassandra-driver-3.25.0/cassandra/cqltypes.py", line 312, in from_binary{color}
{color:#de350b}    return cls.deserialize(byts, protocol_version){color}
{color:#de350b}  File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.25.0.zip/cassandra-driver-3.25.0/cassandra/cqltypes.py", line 550, in deserialize{color}
{color:#de350b}    return int64_unpack(byts){color}
{color:#de350b}  File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.25.0.zip/cassandra-driver-3.25.0/cassandra/marshal.py", line 22, in <lambda>{color}
{color:#de350b}    unpack = lambda s: packer.unpack(s)[0]{color}
{color:#de350b}struct.error: unpack requires a buffer of 8 bytes{color}

{color:#de350b}During handling of the above exception, another exception occurred:{color}

{color:#de350b}Traceback (most recent call last):{color}
{color:#de350b}  File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.25.0.zip/cassandra-driver-3.25.0/cassandra/protocol.py", line 763, in recv_results_rows{color}
{color:#de350b}    self.column_types[i].from_binary(row[i], protocol_version){color}
{color:#de350b}  File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.25.0.zip/cassandra-driver-3.25.0/cassandra/cqltypes.py", line 312, in from_binary{color}
{color:#de350b}    return cls.deserialize(byts, protocol_version){color}
{color:#de350b}  File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.25.0.zip/cassandra-driver-3.25.0/cassandra/cqltypes.py", line 550, in deserialize{color}
{color:#de350b}    return int64_unpack(byts){color}
{color:#de350b}  File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.25.0.zip/cassandra-driver-3.25.0/cassandra/marshal.py", line 22, in <lambda>{color}
{color:#de350b}    unpack = lambda s: packer.unpack(s)[0]{color}
{color:#de350b}struct.error: unpack requires a buffer of 8 bytes{color}

{color:#de350b}During handling of the above exception, another exception occurred:{color}

{color:#de350b}Traceback (most recent call last):{color}
{color:#de350b}  File "/opt/cassandra/bin/../pylib/cqlshlib/cqlshmain.py", line 987, in perform_simple_statement{color}
{color:#de350b}    result = future.result(){color}
{color:#de350b}  File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.25.0.zip/cassandra-driver-3.25.0/cassandra/cluster.py", line 4894, in result{color}
{color:#de350b}    raise self._final_exception{color}
{color:#de350b}  File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.25.0.zip/cassandra-driver-3.25.0/cassandra/connection.py", line 1199, in process_msg{color}
{color:#de350b}    response = decoder(header.version, self.user_type_map, stream_id,{color}
{color:#de350b}  File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.25.0.zip/cassandra-driver-3.25.0/cassandra/protocol.py", line 1196, in decode_message{color}
{color:#de350b}    msg = msg_class.recv_body(body, protocol_version, user_type_map, result_metadata){color}
{color:#de350b}  File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.25.0.zip/cassandra-driver-3.25.0/cassandra/protocol.py", line 744, in recv_body{color}
{color:#de350b}    msg.recv(f, protocol_version, user_type_map, result_metadata){color}
{color:#de350b}  File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.25.0.zip/cassandra-driver-3.25.0/cassandra/protocol.py", line 730, in recv{color}
{color:#de350b}    self.recv_results_rows(f, protocol_version, user_type_map, result_metadata){color}
{color:#de350b}  File "/opt/cassandra/bin/../lib/cassandra-driver-internal-only-3.25.0.zip/cassandra-driver-3.25.0/cassandra/protocol.py", line 765, in recv_results_rows{color}
{color:#de350b}    raise DriverException('Failed decoding result column "%s" of type %s: %s' % (self.column_names[i],{color}
{color:#de350b}cassandra.DriverException: Failed decoding result column "row.balance" of type counter: unpack requires a buffer of 8 bytes{color}

 

{color:#172b4d}This is found while testing Accord transactions with [~henrik.ingo] and team.{color}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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