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

After upgrading from 3.11.16 to 4.1.3 the CREATE MATERIALIZED VIEW generated by DESCRIBE KEYSPACE is invalid.

    XMLWordPrintableJSON

Details

    • Correctness - API / Semantic Definition
    • Normal
    • Normal
    • User Report
    • All
    • None

    Description

      After upgrading from 3.11.16 to 4.1.3 the CREATE MATERIALIZED VIEW generated by DESCRIBE KEYSPACE is invalid.
      Way back when In a 3.11.x cluster we did

      CREATE TABLE myks.devices (
          id text,
          serial text,
          PRIMARY KEY (id)
      );
      CREATE MATERIALIZED VIEW myks.devices_by_serial AS
          SELECT *
          FROM myks.devices
          WHERE serial IS NOT NULL
          PRIMARY KEY (serial, id)
          WITH CLUSTERING ORDER BY (id ASC);

       

      This was perfectley ok back then as KEY's was assumed NOT NULL
      so going trough various upgrades our last upgrade from 3.11.16 to 4.1.3 it is no longer possible to use the schema generated by DESCRIBE KEYSPACE myks as this outpts 

       

      CREATE MATERIALIZED VIEW myks.devices_by_serial AS
          SELECT *
          FROM myks.devices
          WHERE serial IS NOT NULL
          PRIMARY KEY (serial, id)
          WITH CLUSTERING ORDER BY (id ASC);

      but this is no longer valid as it is missing 'AND id IS NOT NULL' to be valid cql. The expected output would be 

      CREATE MATERIALIZED VIEW myks.devices_by_serial AS
          SELECT *
          FROM myks.devices
          WHERE serial IS NOT NULL AND id IS NOT NULL
          PRIMARY KEY (serial, id)
          WITH CLUSTERING ORDER BY (id ASC);

      There is obviousley no ALTER command that will fix this, but i would have expected the upgraded DESCRIBE to have made valid cql.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            fvissing Frank vissing
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: