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

LegacyLayout does not have same behavior as 2.x when handling unknown column names

    XMLWordPrintableJSON

Details

    Description

      Due to a bug I haven't been able to reproduce the production cluster had unknown column names. To replicate the issue for this test I did the following:

      $ ccm create -v 2.1.19 -n 1 -s bug
      $ cat > schema.cql << 'EOF'
      CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true;
      CREATE TABLE test.unknowntest (id int primary key, payload text, "paylo!d" text);
      EOF
      $ ccm node1 cqlsh -f schema.cql
      $ export CASSANDRA_INCLUDE=~/.ccm/bug/node1/bin/cassandra.in.sh
      $ cat > bug.json << 'EOF'
      [
      {"key": "1",
      "cells": [["","",1554432501209207],
      ["paylo!d","hello world",1554432501209207],
      ["payload","hello world",1554432501209207]]}
      ]
      EOF
      $ ~/.ccm/repository/2.1.19/tools/bin/json2sstable -K test -c unknowntest ~/bug.json ~/.ccm/bug/node1/data0/test/unknowntest-<cfid>/test-unknowntest-ka-1-Data.db

      Then test the behavior of unknown columns in 2.1:

      $ ccm stop
      $ ccm create -v 2.1.19 -n 1 -s bug2_1_19
      $ cat > schema2.cql << 'EOF'
      CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true;
      CREATE TABLE test.unknowntest (id int primary key, payload text);
      EOF
      $ ccm node1 cqlsh -f schema2.cql
      $ ccm stop
      $ cp ~/.ccm/bug/node1/data0/test/unknowntest-<cfid>/test-unknowntest-ka-1-* ~/.ccm/bug2_1_19/node1/data0/test/unknowntest-<cfid>/
      $ ccm start
      $ ccm node1 cqlsh
      Connected to bug2_1_19 at 127.0.0.1:9042.
      [cqlsh 5.0.1 | Cassandra 2.1.19 | CQL spec 3.2.1 | Native protocol v3]
      Use HELP for help.
      cqlsh> select * from test.unknowntest where id = 1;
      
      id | payload
      ----+-------------
      1 | hello world
      
      (1 rows)

      Compared to 3.11.4 which did the following:

      $ ccm stop
      $ ccm create -v 3.11.4 -n 1 -s bug3_11_4
      $ ccm node1 cqlsh -f schema2.cql
      $ ccm stop
      $ cp ~/.ccm/bug/node1/data0/test/unknowntest-<cfid>/test-unknowntest-ka-1-* ~/.ccm/bug3_11_4/node1/data0/test/unknowntest-<cfid>/
      $ ccm start
      $ ccm node1 cqlsh
      Connected to bug3_11_4 at 127.0.0.1:9042.
      [cqlsh 5.0.1 | Cassandra 3.11.4 | CQL spec 3.4.4 | Native protocol v4]
      Use HELP for help.
      cqlsh> select * from test.unknowntest where id = 1;
      ReadFailure: Error from server: code=1300 [Replica(s) failed to execute read] message="Operation failed - received 0 responses and 1 failures" info={'failures': 1, 'received_responses': 0, 'required_responses': 1, 'consistency': 'ONE'}
      

      In the logs this resulted in an IllegalStateException from LegacyLayout line 1127

      The expected behavior would be to ignore the column and return results the same as in 2.1

      Attachments

        1. 15081.patch
          2 kB
          Cameron Zemek

        Issue Links

          Activity

            People

              cam1982 Cameron Zemek
              cam1982 Cameron Zemek
              Cameron Zemek
              Michael Semb Wever
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m