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

Paulo Motta commented on CASSANDRA-8143:
----------------------------------------

The assertion {{assert partitioner != null}} on {{CFMetadata}} initialization 
is making {{Schema}} static initialization fail on client mode tools (such as 
sstableloader) with the following error:
{noformat}
java.lang.AssertionError: null
        at org.apache.cassandra.config.CFMetaData.<init>(CFMetaData.java:278) 
~[main/:na]
        at org.apache.cassandra.config.CFMetaData.<init>(CFMetaData.java:61) 
~[main/:na]
        at 
org.apache.cassandra.config.CFMetaData$Builder.build(CFMetaData.java:1314) 
~[main/:na]
        at org.apache.cassandra.config.CFMetaData.compile(CFMetaData.java:416) 
~[main/:na]
        at 
org.apache.cassandra.schema.SchemaKeyspace.compile(SchemaKeyspace.java:218) 
~[main/:na]
        at 
org.apache.cassandra.schema.SchemaKeyspace.<clinit>(SchemaKeyspace.java:81) 
~[main/:na]
        at org.apache.cassandra.config.Schema.<init>(Schema.java:93) ~[main/:na]
        at org.apache.cassandra.config.Schema.<clinit>(Schema.java:49) 
~[main/:na]
        at 
org.apache.cassandra.io.sstable.format.SSTableReader$InstanceTidier.tidy(SSTableReader.java:2130)
 ~[main/:na]
        at 
org.apache.cassandra.utils.concurrent.Ref$GlobalState.release(Ref.java:294) 
~[main/:na]
        at 
org.apache.cassandra.utils.concurrent.Ref$State.release(Ref.java:193) 
~[main/:na]
        at org.apache.cassandra.utils.concurrent.Ref.release(Ref.java:87) 
[main/:na]
        at 
org.apache.cassandra.io.sstable.SSTableLoader.releaseReferences(SSTableLoader.java:210)
 [main/:na]
        at 
org.apache.cassandra.io.sstable.SSTableLoader.onSuccess(SSTableLoader.java:196) 
[main/:na]
        at 
org.apache.cassandra.io.sstable.SSTableLoader.onSuccess(SSTableLoader.java:45) 
[main/:na]
        at com.google.common.util.concurrent.Futures$6.run(Futures.java:1319) 
[guava-18.0.jar:na]
        at 
com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:457)
 [guava-18.0.jar:na]
        at 
com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:156)
 [guava-18.0.jar:na]
        at 
com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:145) 
[guava-18.0.jar:na]
        at 
com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:185) 
[guava-18.0.jar:na]
        at 
org.apache.cassandra.streaming.StreamResultFuture.maybeComplete(StreamResultFuture.java:215)
 [main/:na]
        at 
org.apache.cassandra.streaming.StreamResultFuture.handleSessionComplete(StreamResultFuture.java:186)
 [main/:na]
        at 
org.apache.cassandra.streaming.StreamSession.closeSession(StreamSession.java:430)
 [main/:na]
        at 
org.apache.cassandra.streaming.StreamSession.complete(StreamSession.java:622) 
[main/:na]
        at 
org.apache.cassandra.streaming.StreamSession.messageReceived(StreamSession.java:486)
 [main/:na]
        at 
org.apache.cassandra.streaming.ConnectionHandler$IncomingMessageHandler.run(ConnectionHandler.java:267)
 [main/:na]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
{noformat}

The reason for this is that {{BulkLoader}} sets {{Config.setClientMode(true)}}, 
so {{DatabaseDescriptor}} does not have a have partitioner set, and 
{{SystemKeyspace}} cannot statically initialize/compile the system tables' 
{{CFMetadata}} because {{DatabaseDescriptor.getPartitioner()}} is null. 

This failure can be reproduced by running the dtest 
{{sstable_generation_loading_test}}, however it's not causing the test to fail 
because it's only affecting cleanup. However, the implementation of 
CASSANDRA-9839 performs a {{Schema.instance.getColumnFamilyStoreInstance}} 
during {{SStableReader}} initialization, so that test [is 
failing|http://cassci.datastax.com/view/Dev/view/paulomotta/job/pauloricardomg-3.0-9839-dtest/lastCompletedBuild/testReport/sstable_generation_loading_test/]
 is failing with {{NoClassDefFoundError}} because {{Schema}} cannot be 
initialized.

What's the best approach to solve this? If simple, I can add the fix in the 
context of CASSANDRA-9839.
1) Remove the {{partitioner != null}} assertion from {{CFMetadata}} 
initialization.
2) Perform the assertion only when {{Config.getClientMode() == false}}.
3) Set a default partitioner on {{DatabaseDescriptor}} when 
{{Config.getClientMode() == true}}.

> Partitioner should not be accessed through StorageService
> ---------------------------------------------------------
>
>                 Key: CASSANDRA-8143
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8143
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Branimir Lambov
>            Assignee: Branimir Lambov
>             Fix For: 3.0 beta 1
>
>
> The configured partitioner is no longer the only partitioner in use in the 
> database, as e.g. index tables use LocalPartitioner.
> To make sure the correct partitioner is used for each table, accesses of 
> StorageService.getPartitioner() should be replaced with retrieval of the 
> CFS-specific partitioner.



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

Reply via email to