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

Materialized view remained rows

    XMLWordPrintableJSON

Details

    • Normal

    Description

      I've created a table and a materialized view.

      > CREATE TABLE test (id text PRIMARY KEY, key text, value int);
      > CREATE MATERIALIZED VIEW test_view AS SELECT * FROM test WHERE key IS NOT NULL PRIMARY KEY(key, id);
      

      I've put a value into the table:

      > update test set key='key', value=1 where id='id';
      > select * from test; select * from test_view ;
      
       id | key | value
      ----+-----+-------
       id | key |     1
      
      (1 rows)
      
       key | id | value
      -----+----+-------
       key | id |     1
      
      (1 rows)
      

      I've updated the value without specified the key of the materialized view:

      > update test set value=2 where id='id';
      > select * from test; select * from test_view ;
      
       id | key | value
      ----+-----+-------
       id | key |     2
      
      (1 rows)
      
       key | id | value
      -----+----+-------
       key | id |     2
      
      (1 rows)
      

      It works as I think...

      ...but I've updated the key of the materialized view:

      > update test set key='newKey' where id='id';
      > select * from test; select * from test_view ;
      
       id | key    | value
      ----+--------+-------
       id | newKey |     2
      
      (1 rows)
      
       key    | id | value
      --------+----+-------
          key | id |     2
       newKey | id |     2
      
      (2 rows)
      

      ...I've updated the value of the row:

      > update test set key='newKey', value=3 where id='id';
      > select * from test; select * from test_view ;
      
       id | key    | value
      ----+--------+-------
       id | newKey |     3
      
      (1 rows)
      
       key    | id | value
      --------+----+-------
          key | id |     2
       newKey | id |     3
      
      (2 rows)
      

      ...I've deleted the row by the id key:

      > delete from test where id='id';
      > select * from test; select * from test_view ;
      
       id | key | value
      ----+-----+-------
      
      (0 rows)
      
       key | id | value
      -----+----+-------
       key | id |     2
      
      (1 rows)
      

      Is it a bug?

      Attachments

        Activity

          People

            carlyeks Carl Yeksigian
            gabor.auth Gábor Auth
            Carl Yeksigian
            T Jake Luciani
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: