You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (JIRA)" <ji...@apache.org> on 2012/10/15 10:52:03 UTC

[jira] [Updated] (CASSANDRA-4786) NPE in migration stage after creating an index

     [ https://issues.apache.org/jira/browse/CASSANDRA-4786?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylvain Lebresne updated CASSANDRA-4786:
----------------------------------------

    Attachment: 4786.txt

So the NPE is because when we switch the memtable during reload, there could be a race where some other thread flush the current memtable first and thus maybeSwitchMemtable returns null.

This can be fixed by storing the comparator at the time a memtable is created, and when we try to change the memtable in reload, try switching the memtable until we know it has the right comparator (this also has the advantage that we won't switch the memtable unless there has been a comparator change). Patch attached to implement that.

Note that the patch also switch all the non-final variables from CFMetadata to volatile as they are definitively accessed from multiple threads.
                
> NPE in migration stage after creating an index
> ----------------------------------------------
>
>                 Key: CASSANDRA-4786
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4786
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Brandon Williams
>            Assignee: Pavel Yaskevich
>             Fix For: 1.2.0 beta 2
>
>         Attachments: 4786.txt
>
>
> The dtests are generating this error after trying to create an index in cql2:
> {noformat}
> ERROR [MigrationStage:1] 2012-10-09 20:54:12,796 CassandraDaemon.java (line 132) Exception in thread Thread[MigrationStage:1,5,main]
> java.lang.NullPointerException
>     at org.apache.cassandra.db.ColumnFamilyStore.reload(ColumnFamilyStore.java:162)
>     at org.apache.cassandra.db.DefsTable.updateColumnFamily(DefsTable.java:549)
>     at org.apache.cassandra.db.DefsTable.mergeColumnFamilies(DefsTable.java:479)
>     at org.apache.cassandra.db.DefsTable.mergeSchema(DefsTable.java:344)
>     at org.apache.cassandra.service.MigrationManager$1.call(MigrationManager.java:256)
>     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>     at java.lang.Thread.run(Thread.java:662)
> ERROR [Thrift:1] 2012-10-09 20:54:12,797 CustomTThreadPoolServer.java (line 214) Error occurred during processing of message.
> java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
>     at org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:348)
>     at org.apache.cassandra.service.MigrationManager.announce(MigrationManager.java:238)
>     at org.apache.cassandra.service.MigrationManager.announceColumnFamilyUpdate(MigrationManager.java:209)
>     at org.apache.cassandra.cql.QueryProcessor.processStatement(QueryProcessor.java:714)
>     at org.apache.cassandra.cql.QueryProcessor.process(QueryProcessor.java:816)
>     at org.apache.cassandra.thrift.CassandraServer.execute_cql_query(CassandraServer.java:1656)
>     at org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:3721)
>     at org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:3709)
>     at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
>     at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
>     at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:196)
>     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>     at java.lang.Thread.run(Thread.java:662)
> Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
>     at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
>     at java.util.concurrent.FutureTask.get(FutureTask.java:83)
>     at org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:344)
>     ... 13 more
> Caused by: java.lang.NullPointerException
>     at org.apache.cassandra.db.ColumnFamilyStore.reload(ColumnFamilyStore.java:162)
>     at org.apache.cassandra.db.DefsTable.updateColumnFamily(DefsTable.java:549)
>     at org.apache.cassandra.db.DefsTable.mergeColumnFamilies(DefsTable.java:479)
>     at org.apache.cassandra.db.DefsTable.mergeSchema(DefsTable.java:344)
>     at org.apache.cassandra.service.MigrationManager$1.call(MigrationManager.java:256)
>     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>     ... 3 more
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira