Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A80D8200CC5 for ; Tue, 27 Jun 2017 02:14:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A6A57160BDE; Tue, 27 Jun 2017 00:14:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CF08A160BDA for ; Tue, 27 Jun 2017 02:14:05 +0200 (CEST) Received: (qmail 43310 invoked by uid 500); 27 Jun 2017 00:14:05 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 43299 invoked by uid 99); 27 Jun 2017 00:14:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Jun 2017 00:14:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 865C6C1232 for ; Tue, 27 Jun 2017 00:14:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id AZ4J8jcit-Nf for ; Tue, 27 Jun 2017 00:14:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 492575FC57 for ; Tue, 27 Jun 2017 00:14:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id E177FE0D54 for ; Tue, 27 Jun 2017 00:14:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 2849724128 for ; Tue, 27 Jun 2017 00:14:00 +0000 (UTC) Date: Tue, 27 Jun 2017 00:14:00 +0000 (UTC) From: "Krishna Dattu Koneru (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CASSANDRA-13547) Filtered materialized views missing data MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 27 Jun 2017 00:14:06 -0000 [ https://issues.apache.org/jira/browse/CASSANDRA-13547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16064031#comment-16064031 ] Krishna Dattu Koneru commented on CASSANDRA-13547: -------------------------------------------------- Hey [~jasonstack] I saw that you are working on related issue https://issues.apache.org/jira/browse/CASSANDRA-13127 . Could you have a look at this patch as well ? ||Patch||testall|| |[3.11|https://github.com/apache/cassandra/compare/cassandra-3.11...krishna-koneru:cassandra-3.11-13547]|[testall|https://circleci.com/gh/kgreav/cassandra/5]| > Filtered materialized views missing data > ---------------------------------------- > > Key: CASSANDRA-13547 > URL: https://issues.apache.org/jira/browse/CASSANDRA-13547 > Project: Cassandra > Issue Type: Bug > Components: Materialized Views > Environment: Official Cassandra 3.10 Docker image (ID 154b919bf8ce). > Reporter: Craig Nicholson > Assignee: Krishna Dattu Koneru > Priority: Blocker > Labels: materializedviews > Fix For: 3.11.x > > > When creating a materialized view against a base table the materialized view does not always reflect the correct data. > Using the following test schema: > {code:title=Schema|language=sql} > DROP KEYSPACE IF EXISTS test; > CREATE KEYSPACE test > WITH REPLICATION = { > 'class' : 'SimpleStrategy', > 'replication_factor' : 1 > }; > CREATE TABLE test.table1 ( > id int, > name text, > enabled boolean, > foo text, > PRIMARY KEY (id, name)); > CREATE MATERIALIZED VIEW test.table1_mv1 AS SELECT id, name, foo > FROM test.table1 > WHERE id IS NOT NULL > AND name IS NOT NULL > AND enabled = TRUE > PRIMARY KEY ((name), id); > CREATE MATERIALIZED VIEW test.table1_mv2 AS SELECT id, name, foo, enabled > FROM test.table1 > WHERE id IS NOT NULL > AND name IS NOT NULL > AND enabled = TRUE > PRIMARY KEY ((name), id); > {code} > When I insert a row into the base table the materialized views are updated appropriately. (+) > {code:title=Insert row|language=sql} > cqlsh> INSERT INTO test.table1 (id, name, enabled, foo) VALUES (1, 'One', TRUE, 'Bar'); > cqlsh> SELECT * FROM test.table1; > id | name | enabled | foo > ----+------+---------+----- > 1 | One | True | Bar > (1 rows) > cqlsh> SELECT * FROM test.table1_mv1; > name | id | foo > ------+----+----- > One | 1 | Bar > (1 rows) > cqlsh> SELECT * FROM test.table1_mv2; > name | id | enabled | foo > ------+----+---------+----- > One | 1 | True | Bar > (1 rows) > {code} > Updating the record in the base table and setting enabled to FALSE will filter the record from both materialized views. (+) > {code:title=Disable the row|language=sql} > cqlsh> UPDATE test.table1 SET enabled = FALSE WHERE id = 1 AND name = 'One'; > cqlsh> SELECT * FROM test.table1; > id | name | enabled | foo > ----+------+---------+----- > 1 | One | False | Bar > (1 rows) > cqlsh> SELECT * FROM test.table1_mv1; > name | id | foo > ------+----+----- > (0 rows) > cqlsh> SELECT * FROM test.table1_mv2; > name | id | enabled | foo > ------+----+---------+----- > (0 rows) > {code} > However a further update to the base table setting enabled to TRUE should include the record in both materialzed views, however only one view (table1_mv2) gets updated. (-) > It appears that only the view (table1_mv2) that returns the filtered column (enabled) is updated. (-) > Additionally columns that are not part of the partiion or clustering key are not updated. You can see that the foo column has a null value in table1_mv2. (-) > {code:title=Enable the row|language=sql} > cqlsh> UPDATE test.table1 SET enabled = TRUE WHERE id = 1 AND name = 'One'; > cqlsh> SELECT * FROM test.table1; > id | name | enabled | foo > ----+------+---------+----- > 1 | One | True | Bar > (1 rows) > cqlsh> SELECT * FROM test.table1_mv1; > name | id | foo > ------+----+----- > (0 rows) > cqlsh> SELECT * FROM test.table1_mv2; > name | id | enabled | foo > ------+----+---------+------ > One | 1 | True | null > (1 rows) > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org For additional commands, e-mail: commits-help@cassandra.apache.org