cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Jirsa (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-10503) NPE in MVs on update
Date Sun, 11 Oct 2015 20:36:05 GMT


Jeff Jirsa commented on CASSANDRA-10503:

Was able to get tests to run, and confirmed that this happens iff there are more than one
table in a KS AND more than one tables with a corresponding MV. Force pushed an updated test
to the cassandra-10503 github link above. [~carlyeks] , you may want to catch this higher
up in the call stack? 

> NPE in MVs on update
> --------------------
>                 Key: CASSANDRA-10503
>                 URL:
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Jeff Jirsa
>            Assignee: Carl Yeksigian
>            Priority: Critical
>             Fix For: 3.0.0 rc2
> I've stumbled upon an NPE in MVs on update. This script will reproduce 100% on trunk
from {{Date:   Sat Oct 10 09:23:15 2015 +0100}}
> {code}
> ERROR [SharedPool-Worker-3] 2015-10-10 21:35:01,867 - Unknown exception
caught while attempting to update MaterializedView! test.test_with_cluster
> java.lang.NullPointerException: null
>         at org.apache.cassandra.db.view.TemporalRow.clusteringValue(
>         at org.apache.cassandra.db.view.View.createUpdatesForInserts( ~[main/:na]
>         at org.apache.cassandra.db.view.View.createMutations( ~[main/:na]
>         at org.apache.cassandra.db.view.ViewManager.pushViewReplicaUpdates(
>         at org.apache.cassandra.db.Keyspace.apply( [main/:na]
>         at org.apache.cassandra.db.Keyspace.apply( [main/:na]
>         at org.apache.cassandra.db.Mutation.apply( [main/:na]
>         at org.apache.cassandra.service.StorageProxy$$Lambda$149/
Source) [main/:na]
>         at org.apache.cassandra.service.StorageProxy$7.runMayThrow(
>         at org.apache.cassandra.service.StorageProxy$
>         at java.util.concurrent.Executors$ [na:1.8.0_45]
>         at org.apache.cassandra.concurrent.AbstractTracingAwareExecutorService$
>         at [main/:na]
>         at [na:1.8.0_45]
> {code}
> And the script to trigger:
> {code}
> ccm remove test; 
> ccm create test --install-dir=/Users/jeff/Desktop/Dev/cassandra/ -s -n 1 ; 
> echo "create keyspace test WITH replication = {'class': 'SimpleStrategy', 'replication_factor':
1}; use test; create table test ( id text primary key, last text, first text, high int, low
int); insert into test(id,last,first,high,low) values ('a', 'a', 'a', 1, 1); insert into test(id,last,first,high,low)
values ('a', 'b', 'b', 2, 2); insert into test(id,last,first,high,low) values ('a', 'c', 'c',
3, 3); insert into test(id,last,first,high,low) values ('a', 'e', 'e', 5, 5); insert into
test(id,last,first,high,low) values ('a', 'd', 'd', 4, 4); select * from test where id='a';"
| ccm node1 cqlsh
> echo "Creating MV test_by_high on test"
> echo "use test; create materialized view test_by_high as select id, high from test where
high is not null primary key(high, id);" | ccm node1 cqlsh
> echo "Insert high score 6, this will succeed"
> echo "use test; insert into test(id,last,first,high,low) values ('a', 'f', 'f', 6, 6);
" | ccm node1 cqlsh 
> sleep 1
> echo "Select from MV where score = 6, this will succeed"
> echo "use test; select * from test_by_high where high=6; " | ccm node1 cqlsh
> echo "Create a larger table with clustering key"
> echo "use test; create table test_with_cluster(part text, clus text, last text, first
text, high int, low int, primary key (part, clus));" | ccm node1 cqlsh
> echo "use test; create materialized view high_view as select part, clus, high from test_with_cluster
where part is not null and clus is not null and high is not null primary key(high, part, clus);"
| ccm node1 cqlsh
> echo "Populate test_with_cluster, this will break"
> echo "use test; insert into test_with_cluster(part, clus,last,first,high,low) values
('a', 'a', 'a', 'a', 1, 1); " | ccm node1 cqlsh
> {code}
> Logs from my previous tests (which I've deleted, unfortunately) suggest that the NPE
is due to using the wrong {{ColumnIdentifier}} - it's using {{id}} (from test.test?) which
causes the NPE in {{clusteringValue()}}, since it's in the wrong base table. 

This message was sent by Atlassian JIRA

View raw message