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

Views do not handle single-column deletions of view PK columns correctly

    XMLWordPrintableJSON

Details

    • Normal

    Description

      When a materialized view has a regular base column in its primary key, and that regular base column is deleted through a single-column deletion, the view does not handle it correctly, and may produce an error.

      For example, with a table like:

      CREATE TABLE foo (
          a int, b int, c int, d int
          PRIMARY KEY (a, b)
      )
      

      and a view like:

      CREATE MATERIALIZED VIEW BAR
          AS SELECT * FROM foo
          WHERE ...
          PRIMARY KEY (a, d, b)
      

      a deletion like this will not be handled correctly:

      DELETE d FROM foo WHERE a = 0 AND b = 0
      

      The source of the problem is that we aren't checking whether individual cells in the TemporalRow are live or not when building the clustering and partition key for the row. Instead, we're just using the cell value, which is an empty ByteBuffer.

      I should have a patch with a fix and tests posted tomorrow.

      Attachments

        Activity

          People

            thobbs Tom Hobbs
            thobbs Tom Hobbs
            Tom Hobbs
            Carl Yeksigian
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: