Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-18966

Error thrown when creating transaction with counter column type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Normal
    • Resolution: Unresolved
    • 5.x
    • CQL/Interpreter
    • None
    • Correctness - Recoverable Corruption / Loss
    • Normal
    • Normal
    • User Report
    • All
    • None

    Description

      System configuration and information:

      Single node Cassandra with Accord transactions enabled running on docker

      Built from 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:

      CREATE KEYSPACE accord WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}  AND durable_writes = true;
      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)
      
      BEGIN TRANSACTION UPDATE accord.accounts SET balance = balance + 1000 WHERE partition_key = 'default' AND account_id = 1; COMMIT TRANSACTION;

      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.

      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;

       

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

      Traceback (most recent call last):
        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
          self.parsed_rows = [
        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>
          tuple(ctype.from_binary(val, protocol_version)
        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>
          tuple(ctype.from_binary(val, protocol_version)
        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
          return cls.deserialize(byts, protocol_version)
        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
          return int64_unpack(byts)
        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>
          unpack = lambda s: packer.unpack(s)[0]
      struct.error: unpack requires a buffer of 8 bytes

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        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
          self.column_types[i].from_binary(row[i], protocol_version)
        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
          return cls.deserialize(byts, protocol_version)
        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
          return int64_unpack(byts)
        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>
          unpack = lambda s: packer.unpack(s)[0]
      struct.error: unpack requires a buffer of 8 bytes

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/opt/cassandra/bin/../pylib/cqlshlib/cqlshmain.py", line 987, in perform_simple_statement
          result = future.result()
        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
          raise self._final_exception
        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
          response = decoder(header.version, self.user_type_map, stream_id,
        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
          msg = msg_class.recv_body(body, protocol_version, user_type_map, result_metadata)
        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
          msg.recv(f, protocol_version, user_type_map, result_metadata)
        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
          self.recv_results_rows(f, protocol_version, user_type_map, result_metadata)
        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
          raise DriverException('Failed decoding result column "%s" of type %s: %s' % (self.column_names[i],
      cassandra.DriverException: Failed decoding result column "row.balance" of type counter: unpack requires a buffer of 8 bytes

       

      This was found while testing Accord transactions with henrik.ingo and team.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              antithesis-luis Luis E Fernandez
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: