cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carl Yeksigian (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-10424) Altering base table column with materialized view causes unexpected server error.
Date Fri, 02 Oct 2015 20:54:26 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-10424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14941742#comment-14941742
] 

Carl Yeksigian commented on CASSANDRA-10424:
--------------------------------------------

I've pushed a fix for allowing {{ALTER}} on reversed types, and added a test to show that
it is now working.

That also fixes the MV alter tests, since we're handling the cases of altering an MV type
properly. It makes sense to keep the validation in there since we are calling different methods
that might diverge over time, but right now there shouldn't be a case where we validate on
the base table but not the view, I think. If there is, it'd be good to add that as a test.

> Altering base table column with materialized view causes unexpected server error.
> ---------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-10424
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10424
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>         Environment: cassandra-3.0.0-rc1, with python driver 3.0-alpha
>            Reporter: Greg Bestland
>            Assignee: Carl Yeksigian
>             Fix For: 3.0.0 rc2
>
>
> When attempting to alter column type of base table which has a corresponding  materialized
view we get an exception from the server.
> Steps to reproduce.
> 1. Create a base table
> {code}
> CREATE TABLE test.scores(
>                         user TEXT,
>                         game TEXT,
>                         year INT,
>                         month INT,
>                         day INT,
>                         score TEXT,
>                         PRIMARY KEY (user, game, year, month, day)
>                         )
> {code}
> 2. Create a corresponding materialized view
> {code}
> CREATE MATERIALIZED VIEW test.monthlyhigh AS
>                 SELECT game, year, month, score, user, day FROM test.scores
>                 WHERE game IS NOT NULL AND year IS NOT NULL AND month IS NOT NULL AND
score IS NOT NULL AND user IS NOT NULL AND day IS NOT NULL
>                 PRIMARY KEY ((game, year, month), score, user, day)
>                 WITH CLUSTERING ORDER BY (score DESC, user ASC, day ASC)
> {code}
> 3. Attempt to Alter the base table 
> {code}
> ALTER TABLE test.scores ALTER score TYPE blob
> {code}
> In the python driver we see the following exception returned from the server
> {code}
> Ignoring schedule_unique for already-scheduled task: (<bound method ControlConnection.refresh_schema
of <cassandra.cluster.ControlConnection object at 0x100f72c50>>, (), (('keyspace',
'test'), ('target_type', 'KEYSPACE'), ('change_type', 'UPDATED')))
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "./cassandra/cluster.py", line 1623, in execute
>     result = future.result()
>   File "./cassandra/cluster.py", line 3205, in result
>     raise self._final_exception
> cassandra.protocol.ServerError: <ErrorMessage code=0000 [Server error] message="java.lang.RuntimeException:
java.util.concurrent.ExecutionException: org.apache.cassandra.exceptions.ConfigurationException:
Column family comparators do not match or are not compatible (found ClusteringComparator;
expected ClusteringComparator).">
> {code}
> On the server I see the following stack trace
> {code}
> INFO  [MigrationStage:1] 2015-09-30 11:45:47,457 ColumnFamilyStore.java:825 - Enqueuing
flush of keyspaces: 512 (0%) on-heap, 0 (0%) off-heap
> INFO  [MemtableFlushWriter:11] 2015-09-30 11:45:47,457 Memtable.java:362 - Writing Memtable-keyspaces@1714565887(0.146KiB
serialized bytes, 1 ops, 0%/0% of on/off-heap limit)
> INFO  [MemtableFlushWriter:11] 2015-09-30 11:45:47,463 Memtable.java:395 - Completed
flushing /Users/gregbestland/.ccm/tests/node1/data/system_schema/keyspaces-abac5682dea631c5b535b3d6cffd0fb6/ma-54-big-Data.db
(0.109KiB) for commitlog position ReplayPosition(segmentId=1443623481894, position=9812)
> INFO  [MigrationStage:1] 2015-09-30 11:45:47,472 ColumnFamilyStore.java:825 - Enqueuing
flush of columns: 877 (0%) on-heap, 0 (0%) off-heap
> INFO  [MemtableFlushWriter:12] 2015-09-30 11:45:47,472 Memtable.java:362 - Writing Memtable-columns@771367282(0.182KiB
serialized bytes, 1 ops, 0%/0% of on/off-heap limit)
> INFO  [MemtableFlushWriter:12] 2015-09-30 11:45:47,478 Memtable.java:395 - Completed
flushing /Users/gregbestland/.ccm/tests/node1/data/system_schema/columns-24101c25a2ae3af787c1b40ee1aca33f/ma-51-big-Data.db
(0.107KiB) for commitlog position ReplayPosition(segmentId=1443623481894, position=9812)
> INFO  [MigrationStage:1] 2015-09-30 11:45:47,490 ColumnFamilyStore.java:825 - Enqueuing
flush of views: 2641 (0%) on-heap, 0 (0%) off-heap
> INFO  [MemtableFlushWriter:11] 2015-09-30 11:45:47,490 Memtable.java:362 - Writing Memtable-views@1740452585(0.834KiB
serialized bytes, 1 ops, 0%/0% of on/off-heap limit)
> INFO  [MemtableFlushWriter:11] 2015-09-30 11:45:47,496 Memtable.java:395 - Completed
flushing /Users/gregbestland/.ccm/tests/node1/data/system_schema/views-9786ac1cdd583201a7cdad556410c985/ma-22-big-Data.db
(0.542KiB) for commitlog position ReplayPosition(segmentId=1443623481894, position=9812)
> ERROR [MigrationStage:1] 2015-09-30 11:45:47,507 CassandraDaemon.java:195 - Exception
in thread Thread[MigrationStage:1,5,main]
> org.apache.cassandra.exceptions.ConfigurationException: Column family comparators do
not match or are not compatible (found ClusteringComparator; expected ClusteringComparator).
> 	at org.apache.cassandra.config.CFMetaData.validateCompatility(CFMetaData.java:789) ~[main/:na]
> 	at org.apache.cassandra.config.CFMetaData.apply(CFMetaData.java:744) ~[main/:na]
> 	at org.apache.cassandra.config.CFMetaData.reload(CFMetaData.java:729) ~[main/:na]
> 	at org.apache.cassandra.config.Schema.updateView(Schema.java:677) ~[main/:na]
> 	at org.apache.cassandra.schema.SchemaKeyspace$2.onUpdated(SchemaKeyspace.java:587) ~[main/:na]
> 	at org.apache.cassandra.schema.SchemaKeyspace.diffSchema(SchemaKeyspace.java:701) ~[main/:na]
> 	at org.apache.cassandra.schema.SchemaKeyspace.mergeViews(SchemaKeyspace.java:573) ~[main/:na]
> 	at org.apache.cassandra.schema.SchemaKeyspace.mergeSchema(SchemaKeyspace.java:515) ~[main/:na]
> 	at org.apache.cassandra.schema.SchemaKeyspace.mergeSchema(SchemaKeyspace.java:481) ~[main/:na]
> 	at org.apache.cassandra.service.MigrationManager$1.runMayThrow(MigrationManager.java:502)
~[main/:na]
> 	at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28) ~[main/:na]
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_45]
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_45]
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_45]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45]
> 	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
> ERROR [SharedPool-Worker-1] 2015-09-30 11:45:47,508 QueryMessage.java:128 - Unexpected
error during query
> java.lang.RuntimeException: java.util.concurrent.ExecutionException: org.apache.cassandra.exceptions.ConfigurationException:
Column family comparators do not match or are not compatible (found ClusteringComparator;
expected ClusteringComparator).
> 	at org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:368) ~[main/:na]
> 	at org.apache.cassandra.service.MigrationManager.announce(MigrationManager.java:483)
~[main/:na]
> 	at org.apache.cassandra.service.MigrationManager.announceViewUpdate(MigrationManager.java:389)
~[main/:na]
> 	at org.apache.cassandra.cql3.statements.AlterTableStatement.announceMigration(AlterTableStatement.java:359)
~[main/:na]
> 	at org.apache.cassandra.cql3.statements.SchemaAlteringStatement.execute(SchemaAlteringStatement.java:93)
~[main/:na]
> 	at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:205)
~[main/:na]
> 	at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:236) ~[main/:na]
> 	at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:221) ~[main/:na]
> 	at org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:115)
~[main/:na]
> 	at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:507)
[main/:na]
> 	at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:401)
[main/:na]
> 	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
> 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
> 	at io.netty.channel.AbstractChannelHandlerContext.access$700(AbstractChannelHandlerContext.java:32)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
> 	at io.netty.channel.AbstractChannelHandlerContext$8.run(AbstractChannelHandlerContext.java:324)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_45]
> 	at org.apache.cassandra.concurrent.AbstractTracingAwareExecutorService$FutureTask.run(AbstractTracingAwareExecutorService.java:164)
[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]
> Caused by: java.util.concurrent.ExecutionException: org.apache.cassandra.exceptions.ConfigurationException:
Column family comparators do not match or are not compatible (found ClusteringComparator;
expected ClusteringComparator).
> 	at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:1.8.0_45]
> 	at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[na:1.8.0_45]
> 	at org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:364) ~[main/:na]
> 	... 18 common frames omitted
> Caused by: org.apache.cassandra.exceptions.ConfigurationException: Column family comparators
do not match or are not compatible (found ClusteringComparator; expected ClusteringComparator).
> 	at org.apache.cassandra.config.CFMetaData.validateCompatility(CFMetaData.java:789) ~[main/:na]
> 	at org.apache.cassandra.config.CFMetaData.apply(CFMetaData.java:744) ~[main/:na]
> 	at org.apache.cassandra.config.CFMetaData.reload(CFMetaData.java:729) ~[main/:na]
> 	at org.apache.cassandra.config.Schema.updateView(Schema.java:677) ~[main/:na]
> 	at org.apache.cassandra.schema.SchemaKeyspace$2.onUpdated(SchemaKeyspace.java:587) ~[main/:na]
> 	at org.apache.cassandra.schema.SchemaKeyspace.diffSchema(SchemaKeyspace.java:701) ~[main/:na]
> 	at org.apache.cassandra.schema.SchemaKeyspace.mergeViews(SchemaKeyspace.java:573) ~[main/:na]
> 	at org.apache.cassandra.schema.SchemaKeyspace.mergeSchema(SchemaKeyspace.java:515) ~[main/:na]
> 	at org.apache.cassandra.schema.SchemaKeyspace.mergeSchema(SchemaKeyspace.java:481) ~[main/:na]
> 	at org.apache.cassandra.service.MigrationManager$1.runMayThrow(MigrationManager.java:502)
~[main/:na]
> 	at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28) ~[main/:na]
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_45]
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_45]
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_45]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_45]
> 	... 1 common frames omitted
> ERROR [SharedPool-Worker-1] 2015-09-30 11:45:47,508 ErrorMessage.java:336 - Unexpected
exception during request
> java.lang.RuntimeException: java.util.concurrent.ExecutionException: org.apache.cassandra.exceptions.ConfigurationException:
Column family comparators do not match or are not compatible (found ClusteringComparator;
expected ClusteringComparator).
> 	at org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:368) ~[main/:na]
> 	at org.apache.cassandra.service.MigrationManager.announce(MigrationManager.java:483)
~[main/:na]
> 	at org.apache.cassandra.service.MigrationManager.announceViewUpdate(MigrationManager.java:389)
~[main/:na]
> 	at org.apache.cassandra.cql3.statements.AlterTableStatement.announceMigration(AlterTableStatement.java:359)
~[main/:na]
> 	at org.apache.cassandra.cql3.statements.SchemaAlteringStatement.execute(SchemaAlteringStatement.java:93)
~[main/:na]
> 	at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:205)
~[main/:na]
> 	at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:236) ~[main/:na]
> 	at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:221) ~[main/:na]
> 	at org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:115)
~[main/:na]
> 	at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:507)
[main/:na]
> 	at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:401)
[main/:na]
> 	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
> 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
> 	at io.netty.channel.AbstractChannelHandlerContext.access$700(AbstractChannelHandlerContext.java:32)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
> 	at io.netty.channel.AbstractChannelHandlerContext$8.run(AbstractChannelHandlerContext.java:324)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_45]
> 	at org.apache.cassandra.concurrent.AbstractTracingAwareExecutorService$FutureTask.run(AbstractTracingAwareExecutorService.java:164)
[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]
> Caused by: java.util.concurrent.ExecutionException: org.apache.cassandra.exceptions.ConfigurationException:
Column family comparators do not match or are not compatible (found ClusteringComparator;
expected ClusteringComparator).
> 	at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:1.8.0_45]
> 	at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[na:1.8.0_45]
> 	at org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:364) ~[main/:na]
> 	... 18 common frames omitted
> Caused by: org.apache.cassandra.exceptions.ConfigurationException: Column family comparators
do not match or are not compatible (found ClusteringComparator; expected ClusteringComparator).
> 	at org.apache.cassandra.config.CFMetaData.validateCompatility(CFMetaData.java:789) ~[main/:na]
> 	at org.apache.cassandra.config.CFMetaData.apply(CFMetaData.java:744) ~[main/:na]
> 	at org.apache.cassandra.config.CFMetaData.reload(CFMetaData.java:729) ~[main/:na]
> 	at org.apache.cassandra.config.Schema.updateView(Schema.java:677) ~[main/:na]
> 	at org.apache.cassandra.schema.SchemaKeyspace$2.onUpdated(SchemaKeyspace.java:587) ~[main/:na]
> 	at org.apache.cassandra.schema.SchemaKeyspace.diffSchema(SchemaKeyspace.java:701) ~[main/:na]
> 	at org.apache.cassandra.schema.SchemaKeyspace.mergeViews(SchemaKeyspace.java:573) ~[main/:na]
> 	at org.apache.cassandra.schema.SchemaKeyspace.mergeSchema(SchemaKeyspace.java:515) ~[main/:na]
> 	at org.apache.cassandra.schema.SchemaKeyspace.mergeSchema(SchemaKeyspace.java:481) ~[main/:na]
> 	at org.apache.cassandra.service.MigrationManager$1.runMayThrow(MigrationManager.java:502)
~[main/:na]
> 	at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28) ~[main/:na]
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_45]
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_45]
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_45]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_45]
> 	... 1 common frames omitted
> {code}
> It would appear as though the base table column was migrated, as it now seems to be of
type blob, but I'm not sure internally what state its in.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message