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

Materialized view is not deleting/updating data when made changes in base table

    XMLWordPrintableJSON

Details

    • Low

    Description

      we have seen issue in mat view for 3.11.1 where mat view

      1) we have inserted a row in test table and the same recored is in test_mat table, with Enabled = true,
      2) when I update the same record with Enabled = False, a new row is created in test_mat table(one with true and one with false) but in test table original record got updated to FALSE.
      3) when I delete the record using Feature UUID then only the record with Fales is getting deleted in both the tables. however I can see the TRUE record in test_mat table.

      Issue is not reproducible in 3.11.2
      Steps

      CREATE TABLE test (
      feature_uuid uuid,
      namespace text,
      feature_name text,
      allocation_type text,
      description text,
      enabled boolean,
      expiration_dt timestamp,
      last_modified_dt timestamp,
      last_modified_user text,
      persist_allocations boolean,
      rule text,
      PRIMARY KEY (feature_uuid, namespace, feature_name, allocation_type)
      ) WITH CLUSTERING ORDER BY (namespace ASC, feature_name ASC, allocation_type ASC)
      AND bloom_filter_fp_chance = 0.01
      AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
      AND comment = ''
      AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
      AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
      AND crc_check_chance = 1.0
      AND dclocal_read_repair_chance = 0.3
      AND default_time_to_live = 63072000
      AND gc_grace_seconds = 864000
      AND max_index_interval = 2048
      AND memtable_flush_period_in_ms = 0
      AND min_index_interval = 128
      AND read_repair_chance = 0.3
      AND speculative_retry = '99PERCENTILE';

      CREATE MATERIALIZED VIEW test_mat AS
      SELECT allocation_type, enabled, feature_uuid, namespace, feature_name, last_modified_dt, last_modified_user, persist_allocations, rule
      FROM test
      WHERE feature_uuid IS NOT NULL AND allocation_type IS NOT NULL AND namespace IS NOT NULL AND feature_name IS NOT NULL AND enabled IS NOT NULL
      PRIMARY KEY (allocation_type, enabled, feature_uuid, namespace, feature_name)
      WITH CLUSTERING ORDER BY (enabled ASC, feature_uuid ASC, namespace ASC, feature_name ASC)
      AND bloom_filter_fp_chance = 0.01
      AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
      AND comment = ''
      AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
      AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
      AND crc_check_chance = 1.0
      AND dclocal_read_repair_chance = 0.1
      AND default_time_to_live = 0
      AND gc_grace_seconds = 864000
      AND max_index_interval = 2048
      AND memtable_flush_period_in_ms = 0
      AND min_index_interval = 128
      AND read_repair_chance = 0.0
      AND speculative_retry = '99PERCENTILE';

      INSERT INTO test (feature_uuid, namespace, feature_name, allocation_type, description, enabled, expiration_dt, last_modified_dt, last_modified_user, persist_allocations,rule) VALUES (uuid(),'Service','NEW','preallocation','20newproduct',TRUE,'2019-10-02 05:05:05 -0500','2018-08-03 06:06:06 -0500','swapnil',TRUE,'NEW');
      UPDATE test SET enabled=FALSE WHERE feature_uuid=b2d5c245-e30e-4ea8-8609-d36b627dbb2a and namespace='Service' and feature_name='NEW' and allocation_type='preallocation' IF EXISTS ;
      Delete from test where feature_uuid=98e6ebcc-cafd-4889-bf3d-774a746a3298;

       
       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bhisey.swapnil@gmail.com SWAPNIL BALWANT BHISEY
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: