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

ALTER ... ADD can increase the number of SSTables being read

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 3.11.11, 4.0.1
    • CQL/Semantics
    • None

    Description

      With the following SSTables:

      CREATE TABLE my_table (pk int, ck int, v1 int, PRIMARY KEY(pk, ck))
      
      INSERT INTO my_table (pk, ck, v1) VALUES (1, 1, 1) USING TIMESTAMP 1000;
      --> flush()
      INSERT INTO my_table (pk, ck, v1) VALUES (1, 1, 2) USING TIMESTAMP 2000;
      --> flush()
      INSERT INTO my_table  (pk, ck, v1) VALUES (1, 1, 3) USING TIMESTAMP 3000
      --> flush()
      

      the following query:

      SELECT pk, ck, v1 FROM my_table WHERE pk = 1 AND ck = 1

      will only read the third SSTable.

      If we add a column to the table (e.g. ALTER TABLE my_table ADD v2 int) and rerun the query, the query will read the 3 SSTables.

      The reason for this behavior is due to the fact that C* is trying to read all the fetched columns to ensure that it will return a row if at least one of its column is non null.

      In practice for CQL tables, C* does not need to fetch all columns if the row contains a primary key liveness as it is enough to guaranty that the row exists. By consequence, even after the addition of the new column C* should read only the third SSTable.

      Attachments

        Activity

          People

            blerer Benjamin Lerer
            blerer Benjamin Lerer
            Benjamin Lerer
            Caleb Rackliffe, Ekaterina Dimitrova
            Votes:
            0 Vote for this issue
            Watchers:
            4 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 - 2h 40m
                2h 40m