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

Materialized View throws error if Map type is in base table

    XMLWordPrintableJSON

Details

    • Critical

    Description

      Using the following test setup:

      CREATE TABLE test (
        a int PRIMARY KEY,
        b text,
        c map<text,text>
      );
      
      CREATE MATERIALIZED VIEW test_mv AS
      SELECT a, b
      FROM test
      WHERE a IS NOT NULL AND b IS NOT NULL
      PRIMARY KEY(b, a);
      

      When inserting data to the base table:

      INSERT INTO test (a,b,c)
      VALUES(1, 'b', {'c':'c'});
      

      The insert will fail and a stack trace is generated in the logs:

      ERROR [SharedPool-Worker-2] 2016-02-10 05:25:05,957 StorageProxy.java:1339 - Failed to apply mutation locally : {}
      java.lang.IllegalStateException: [ColumnDefinition{name=c, type=org.apache.cassandra.db.marshal.MapType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type), kind=REGULAR, position=-1}] is not a subset of []
      	at org.apache.cassandra.db.Columns$Serializer.encodeBitmap(Columns.java:532) ~[main/:na]
      	at org.apache.cassandra.db.Columns$Serializer.serializedSubsetSize(Columns.java:484) ~[main/:na]
      	at org.apache.cassandra.db.rows.UnfilteredSerializer.serializedRowBodySize(UnfilteredSerializer.java:277) ~[main/:na]
      	at org.apache.cassandra.db.rows.UnfilteredSerializer.serializedSize(UnfilteredSerializer.java:249) ~[main/:na]
      	at org.apache.cassandra.db.rows.UnfilteredSerializer.serializedSize(UnfilteredSerializer.java:236) ~[main/:na]
      	at org.apache.cassandra.db.rows.UnfilteredSerializer.serializedSize(UnfilteredSerializer.java:229) ~[main/:na]
      	at org.apache.cassandra.db.rows.UnfilteredRowIteratorSerializer.serializedSize(UnfilteredRowIteratorSerializer.java:171) ~[main/:na]
      	at org.apache.cassandra.db.partitions.PartitionUpdate$PartitionUpdateSerializer.serializedSize(PartitionUpdate.java:716) ~[main/:na]
      	at org.apache.cassandra.db.Mutation$MutationSerializer.serializedSize(Mutation.java:372) ~[main/:na]
      	at org.apache.cassandra.db.commitlog.CommitLog.add(CommitLog.java:262) ~[main/:na]
      	at org.apache.cassandra.db.Keyspace.apply(Keyspace.java:498) ~[main/:na]
      	at org.apache.cassandra.db.Keyspace.apply(Keyspace.java:399) ~[main/:na]
      	at org.apache.cassandra.db.Mutation.applyFuture(Mutation.java:202) ~[main/:na]
      	at org.apache.cassandra.db.Mutation.apply(Mutation.java:214) ~[main/:na]
      	at org.apache.cassandra.service.StorageProxy.mutateMV(StorageProxy.java:748) ~[main/:na]
      	at org.apache.cassandra.db.view.ViewManager.pushViewReplicaUpdates(ViewManager.java:149) ~[main/:na]
      	at org.apache.cassandra.db.Keyspace.apply(Keyspace.java:516) ~[main/:na]
      	at org.apache.cassandra.db.Keyspace.apply(Keyspace.java:399) ~[main/:na]
      	at org.apache.cassandra.db.Mutation.applyFuture(Mutation.java:202) ~[main/:na]
      	at org.apache.cassandra.db.Mutation.apply(Mutation.java:214) ~[main/:na]
      	at org.apache.cassandra.db.Mutation.apply(Mutation.java:228) ~[main/:na]
      	at org.apache.cassandra.service.StorageProxy$$Lambda$197/1675816556.run(Unknown Source) ~[na:na]
      	at org.apache.cassandra.service.StorageProxy$8.runMayThrow(StorageProxy.java:1333) ~[main/:na]
      	at org.apache.cassandra.service.StorageProxy$LocalMutationRunnable.run(StorageProxy.java:2510) [main/:na]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_45]
      	at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:164) [main/:na]
      	at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$LocalSessionFutureTask.run(AbstractLocalAwareExecutorService.java:136) [main/:na]
      	at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:105) [main/:na]
      	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
      ERROR [SharedPool-Worker-2] 2016-02-10 05:26:08,687 StorageProxy.java:752 - Error applying local view update to keyspace killrvideo: Mutation(keyspace='killrvideo', key='62', modifications=[
        [killrvideo.test_mv] key=b columns=[[] | [c]]
          Row: a=1 | c={}
      ])
      ERROR [SharedPool-Worker-2] 2016-02-10 05:26:08,688 Keyspace.java:521 - Unknown exception caught while attempting to update MaterializedView! killrvideo.test
      java.lang.IllegalStateException: [ColumnDefinition{name=c, type=org.apache.cassandra.db.marshal.MapType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type), kind=REGULAR, position=-1}] is not a subset of []
      	at org.apache.cassandra.db.Columns$Serializer.encodeBitmap(Columns.java:532) ~[main/:na]
      	at org.apache.cassandra.db.Columns$Serializer.serializedSubsetSize(Columns.java:484) ~[main/:na]
      	at org.apache.cassandra.db.rows.UnfilteredSerializer.serializedRowBodySize(UnfilteredSerializer.java:277) ~[main/:na]
      	at org.apache.cassandra.db.rows.UnfilteredSerializer.serializedSize(UnfilteredSerializer.java:249) ~[main/:na]
      	at org.apache.cassandra.db.rows.UnfilteredSerializer.serializedSize(UnfilteredSerializer.java:236) ~[main/:na]
      	at org.apache.cassandra.db.rows.UnfilteredSerializer.serializedSize(UnfilteredSerializer.java:229) ~[main/:na]
      	at org.apache.cassandra.db.rows.UnfilteredRowIteratorSerializer.serializedSize(UnfilteredRowIteratorSerializer.java:171) ~[main/:na]
      	at org.apache.cassandra.db.partitions.PartitionUpdate$PartitionUpdateSerializer.serializedSize(PartitionUpdate.java:716) ~[main/:na]
      	at org.apache.cassandra.db.Mutation$MutationSerializer.serializedSize(Mutation.java:372) ~[main/:na]
      	at org.apache.cassandra.db.commitlog.CommitLog.add(CommitLog.java:262) ~[main/:na]
      	at org.apache.cassandra.db.Keyspace.apply(Keyspace.java:498) [main/:na]
      	at org.apache.cassandra.db.Keyspace.apply(Keyspace.java:399) [main/:na]
      	at org.apache.cassandra.db.Mutation.applyFuture(Mutation.java:202) [main/:na]
      	at org.apache.cassandra.db.Mutation.apply(Mutation.java:214) [main/:na]
      	at org.apache.cassandra.service.StorageProxy.mutateMV(StorageProxy.java:748) ~[main/:na]
      	at org.apache.cassandra.db.view.ViewManager.pushViewReplicaUpdates(ViewManager.java:149) ~[main/:na]
      	at org.apache.cassandra.db.Keyspace.apply(Keyspace.java:516) [main/:na]
      	at org.apache.cassandra.db.Keyspace.apply(Keyspace.java:399) [main/:na]
      	at org.apache.cassandra.db.Mutation.applyFuture(Mutation.java:202) [main/:na]
      	at org.apache.cassandra.db.Mutation.apply(Mutation.java:214) [main/:na]
      	at org.apache.cassandra.db.Mutation.apply(Mutation.java:228) [main/:na]
      	at org.apache.cassandra.service.StorageProxy$$Lambda$197/1675816556.run(Unknown Source) [main/:na]
      	at org.apache.cassandra.service.StorageProxy$8.runMayThrow(StorageProxy.java:1333) [main/:na]
      	at org.apache.cassandra.service.StorageProxy$LocalMutationRunnable.run(StorageProxy.java:2510) [main/:na]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_45]
      	at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:164) [main/:na]
      	at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$LocalSessionFutureTask.run(AbstractLocalAwareExecutorService.java:136) [main/:na]
      	at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:105) [main/:na]
      	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            pmcfadin Patrick McFadin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: