Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 10AD7D7D3 for ; Mon, 15 Oct 2012 08:52:06 +0000 (UTC) Received: (qmail 59673 invoked by uid 500); 15 Oct 2012 08:52:05 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 59474 invoked by uid 500); 15 Oct 2012 08:52:05 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 59317 invoked by uid 99); 15 Oct 2012 08:52:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Oct 2012 08:52:03 +0000 Date: Mon, 15 Oct 2012 08:52:03 +0000 (UTC) From: "Sylvain Lebresne (JIRA)" To: commits@cassandra.apache.org Message-ID: <1595834306.44713.1350291123993.JavaMail.jiratomcat@arcas> In-Reply-To: <1773030523.17890.1349834402981.JavaMail.jiratomcat@arcas> Subject: [jira] [Updated] (CASSANDRA-4786) NPE in migration stage after creating an index MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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