[jira] [Commented] (CASSANDRA-12044) Materialized view definition regression in clustering key
[ https://issues.apache.org/jira/browse/CASSANDRA-12044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15356763#comment-15356763 ] Sylvain Lebresne commented on CASSANDRA-12044: -- +1 > Materialized view definition regression in clustering key > - > > Key: CASSANDRA-12044 > URL: https://issues.apache.org/jira/browse/CASSANDRA-12044 > Project: Cassandra > Issue Type: Bug >Reporter: Michael Mior >Assignee: Carl Yeksigian > > This bug was reported on the > [users|https://mail-archives.apache.org/mod_mbox/cassandra-user/201606.mbox/%3CCAG0vsSJRtRjLJqKsd3M8X-8nXpPwRj7Q80mNkuy8sy%2B%2B%3D%2BocHA%40mail.gmail.com%3E] > mailing list. The following definitions work in 3.0.3 but fail in 3.0.7. > {code} > CREATE TABLE ks.pa ( > id bigint, > sub_id text, > name text, > class text, > r_id bigint, > k_id bigint, > created timestamp, > priority int, > updated timestamp, > value text, > PRIMARY KEY (id, sub_id, name) > ); > CREATE ks.mv_pa AS > SELECT k_id, name, value, sub_id, id, class, r_id > FROM ks.pa > WHERE k_id IS NOT NULL AND name IS NOT NULL AND value IS NOT NULL AND > sub_id IS NOT NULL AND id IS NOT NULL > PRIMARY KEY ((k_id, name), value, sub_id, id); > {code} > After running bisect, I've narrowed it down to commit > [86ba227|https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=commit;h=86ba227477b9f8595eb610ecaf950cfbc29dd36b] > from [CASSANDRA-11475|https://issues.apache.org/jira/browse/CASSANDRA-11475]. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CASSANDRA-12044) Materialized view definition regression in clustering key
[ https://issues.apache.org/jira/browse/CASSANDRA-12044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15342350#comment-15342350 ] Michael Mior commented on CASSANDRA-12044: -- As an aside, the error message should probably change since it says "partition key" instead of "primary key." > Materialized view definition regression in clustering key > - > > Key: CASSANDRA-12044 > URL: https://issues.apache.org/jira/browse/CASSANDRA-12044 > Project: Cassandra > Issue Type: Bug >Reporter: Michael Mior >Assignee: Carl Yeksigian > > This bug was reported on the > [users|https://mail-archives.apache.org/mod_mbox/cassandra-user/201606.mbox/%3CCAG0vsSJRtRjLJqKsd3M8X-8nXpPwRj7Q80mNkuy8sy%2B%2B%3D%2BocHA%40mail.gmail.com%3E] > mailing list. The following definitions work in 3.0.3 but fail in 3.0.7. > {code} > CREATE TABLE ks.pa ( > id bigint, > sub_id text, > name text, > class text, > r_id bigint, > k_id bigint, > created timestamp, > priority int, > updated timestamp, > value text, > PRIMARY KEY (id, sub_id, name) > ); > CREATE ks.mv_pa AS > SELECT k_id, name, value, sub_id, id, class, r_id > FROM ks.pa > WHERE k_id IS NOT NULL AND name IS NOT NULL AND value IS NOT NULL AND > sub_id IS NOT NULL AND id IS NOT NULL > PRIMARY KEY ((k_id, name), value, sub_id, id); > {code} > After running bisect, I've narrowed it down to commit > [86ba227|https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=commit;h=86ba227477b9f8595eb610ecaf950cfbc29dd36b] > from [CASSANDRA-11475|https://issues.apache.org/jira/browse/CASSANDRA-11475]. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CASSANDRA-12044) Materialized view definition regression in clustering key
[ https://issues.apache.org/jira/browse/CASSANDRA-12044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15342348#comment-15342348 ] Michael Mior commented on CASSANDRA-12044: -- Thanks for clarifying. This makes a lot of sense. > Materialized view definition regression in clustering key > - > > Key: CASSANDRA-12044 > URL: https://issues.apache.org/jira/browse/CASSANDRA-12044 > Project: Cassandra > Issue Type: Bug >Reporter: Michael Mior >Assignee: Carl Yeksigian > > This bug was reported on the > [users|https://mail-archives.apache.org/mod_mbox/cassandra-user/201606.mbox/%3CCAG0vsSJRtRjLJqKsd3M8X-8nXpPwRj7Q80mNkuy8sy%2B%2B%3D%2BocHA%40mail.gmail.com%3E] > mailing list. The following definitions work in 3.0.3 but fail in 3.0.7. > {code} > CREATE TABLE ks.pa ( > id bigint, > sub_id text, > name text, > class text, > r_id bigint, > k_id bigint, > created timestamp, > priority int, > updated timestamp, > value text, > PRIMARY KEY (id, sub_id, name) > ); > CREATE ks.mv_pa AS > SELECT k_id, name, value, sub_id, id, class, r_id > FROM ks.pa > WHERE k_id IS NOT NULL AND name IS NOT NULL AND value IS NOT NULL AND > sub_id IS NOT NULL AND id IS NOT NULL > PRIMARY KEY ((k_id, name), value, sub_id, id); > {code} > After running bisect, I've narrowed it down to commit > [86ba227|https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=commit;h=86ba227477b9f8595eb610ecaf950cfbc29dd36b] > from [CASSANDRA-11475|https://issues.apache.org/jira/browse/CASSANDRA-11475]. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CASSANDRA-12044) Materialized view definition regression in clustering key
[ https://issues.apache.org/jira/browse/CASSANDRA-12044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15342323#comment-15342323 ] Carl Yeksigian commented on CASSANDRA-12044: The behavior in 3.0.7 is the correct one; we do not properly handle multiple non-primary key from the base table in the view. This will result in not properly cleaned up columns, which currently cannot be cleaned. The behavior is to be changed in CASSANDRA-9928, where we would properly support this scenario. Unfortunately, you will have to drop the view before upgrading, as 3.0.3 was improperly allowing that view to be created. It doesn't look like we had any tests for this; I've pushed a branch with an additional test to make sure that multiple non-primary keys can't be included in the view's primary key. ||branch||utest||dtest|| |[3.0|https://github.com/carlyeks/cassandra/tree/ticket/12044/3.0]|[3.0|http://cassci.datastax.com/job/carlyeks-ticket-12044-3.0-testall/]|[3.0|http://cassci.datastax.com/job/carlyeks-ticket-12044-3.0-dtest/]| |[3.x|https://github.com/carlyeks/cassandra/tree/ticket/12044/3.x]|[3.x|http://cassci.datastax.com/job/carlyeks-ticket-12044-3.x-testall/]|[3.x|http://cassci.datastax.com/job/carlyeks-ticket-12044-3.x-dtest/]| > Materialized view definition regression in clustering key > - > > Key: CASSANDRA-12044 > URL: https://issues.apache.org/jira/browse/CASSANDRA-12044 > Project: Cassandra > Issue Type: Bug >Reporter: Michael Mior > > This bug was reported on the > [users|https://mail-archives.apache.org/mod_mbox/cassandra-user/201606.mbox/%3CCAG0vsSJRtRjLJqKsd3M8X-8nXpPwRj7Q80mNkuy8sy%2B%2B%3D%2BocHA%40mail.gmail.com%3E] > mailing list. The following definitions work in 3.0.3 but fail in 3.0.7. > {code} > CREATE TABLE ks.pa ( > id bigint, > sub_id text, > name text, > class text, > r_id bigint, > k_id bigint, > created timestamp, > priority int, > updated timestamp, > value text, > PRIMARY KEY (id, sub_id, name) > ); > CREATE ks.mv_pa AS > SELECT k_id, name, value, sub_id, id, class, r_id > FROM ks.pa > WHERE k_id IS NOT NULL AND name IS NOT NULL AND value IS NOT NULL AND > sub_id IS NOT NULL AND id IS NOT NULL > PRIMARY KEY ((k_id, name), value, sub_id, id); > {code} > After running bisect, I've narrowed it down to commit > [86ba227|https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=commit;h=86ba227477b9f8595eb610ecaf950cfbc29dd36b] > from [CASSANDRA-11475|https://issues.apache.org/jira/browse/CASSANDRA-11475]. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CASSANDRA-12044) Materialized view definition regression in clustering key
[ https://issues.apache.org/jira/browse/CASSANDRA-12044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15341710#comment-15341710 ] Michael Mior commented on CASSANDRA-12044: -- The patch below seems to fix things. Just waiting for the test suite to run and need to add a test for this particular case. {code} commit 0bd763efb0a31d05cbb61427b8828df73b957164 Author: Michael MiorDate: Tue Jun 21 08:47:25 2016 -0400 Fix check for valid MV PKs diff --git a/src/java/org/apache/cassandra/cql3/statements/CreateViewStatement.java b/src/java/org/apache/cassandra/cql3/statements/Cr index 6446602..951dedd 100644 --- a/src/java/org/apache/cassandra/cql3/statements/CreateViewStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/CreateViewStatement.java @@ -315,7 +315,8 @@ public class CreateViewStatement extends SchemaAlteringStatement ColumnDefinition def = cfm.getColumnDefinition(identifier); boolean isPk = basePK.contains(identifier); -if (!isPk && hasNonPKColumn) +if (!isPk && hasNonPKColumn +&& cfm.getColumnDefinition(identifier).isPartitionKey()) throw new InvalidRequestException(String.format("Cannot include more than one non-primary key column '%s' in materialized // We don't need to include the "IS NOT NULL" filter on a non-composite partition key {code} > Materialized view definition regression in clustering key > - > > Key: CASSANDRA-12044 > URL: https://issues.apache.org/jira/browse/CASSANDRA-12044 > Project: Cassandra > Issue Type: Bug >Reporter: Michael Mior > > This bug was reported on the > [users|https://mail-archives.apache.org/mod_mbox/cassandra-user/201606.mbox/%3CCAG0vsSJRtRjLJqKsd3M8X-8nXpPwRj7Q80mNkuy8sy%2B%2B%3D%2BocHA%40mail.gmail.com%3E] > mailing list. The following definitions work in 3.0.3 but fail in 3.0.7. > {code} > CREATE TABLE ks.pa ( > id bigint, > sub_id text, > name text, > class text, > r_id bigint, > k_id bigint, > created timestamp, > priority int, > updated timestamp, > value text, > PRIMARY KEY (id, sub_id, name) > ); > CREATE ks.mv_pa AS > SELECT k_id, name, value, sub_id, id, class, r_id > FROM ks.pa > WHERE k_id IS NOT NULL AND name IS NOT NULL AND value IS NOT NULL AND > sub_id IS NOT NULL AND id IS NOT NULL > PRIMARY KEY ((k_id, name), value, sub_id, id); > {code} > After running bisect, I've narrowed it down to commit > [86ba227|https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=commit;h=86ba227477b9f8595eb610ecaf950cfbc29dd36b] > from [CASSANDRA-11475|https://issues.apache.org/jira/browse/CASSANDRA-11475]. -- This message was sent by Atlassian JIRA (v6.3.4#6332)