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

Stefan Miklosovic commented on CASSANDRA-13158:
-----------------------------------------------

I followed the code code and quickly ...

 
{code:java}
// definitely not safe for tools + clients - implicitly instantiates schema
public static void applyPartitioner()
{
    /* Hashing strategy */
    if (conf.partitioner == null)
    {
        throw new ConfigurationException("Missing directive: partitioner", 
false);
    }
    try
    {
        partitioner = 
FBUtilities.newPartitioner(System.getProperty(Config.PROPERTY_PREFIX + 
"partitioner", conf.partitioner));
    }
    catch (Exception e)
    {
        // IT THROWS THIS so try is bad
        throw new ConfigurationException("Invalid partitioner class " + 
conf.partitioner, false);
    }

    paritionerName = partitioner.getClass().getCanonicalName();
}
{code}
newPartitioner in FBUtilities does this:

 
{code:java}
static IPartitioner newPartitioner(String partitionerClassName, 
Optional<AbstractType<?>> comparator) throws ConfigurationException
{
    if (!partitionerClassName.contains("."))
        partitionerClassName = "org.apache.cassandra.dht." + 
partitionerClassName;

    if 
(partitionerClassName.equals("org.apache.cassandra.dht.LocalPartitioner"))
    {
        assert comparator.isPresent() : "Expected a comparator for local 
partitioner";
        return new LocalPartitioner(comparator.get());
    }
    return FBUtilities.instanceOrConstruct(partitionerClassName, "partitioner");
}
{code}
 

Hence finally, it constructs it like this:

 
{code:java}
public static <T> T instanceOrConstruct(String classname, String readable) 
throws ConfigurationException
{
    Class<T> cls = FBUtilities.classForName(classname, readable);
    try
    {
        Field instance = cls.getField("instance");
        return cls.cast(instance.get(null));
    }
    catch (NoSuchFieldException | SecurityException | IllegalArgumentException 
| IllegalAccessException e)
    {
        // Could not get instance field. Try instantiating.
        return construct(cls, classname, readable);
    }
}
{code}
The only place where it can throw is either in classForName, or in getField or 
in cast and finally in construct method. I would bet that it is not in 
"cls.getField" because that field exists on murmur instance and it points to 
object so it it can not call construct but why? Too bad that we are not 
propagaing underlying exception in that first ConfigurationException throw ... 

 

> Nodetool cleanup throwing exception
> -----------------------------------
>
>                 Key: CASSANDRA-13158
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13158
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tool/nodetool
>         Environment: Fedora 25 x86
>            Reporter: Tomas Repik
>            Assignee: Eduard Tudenhoefner
>            Priority: Normal
>             Fix For: 4.0
>
>
> After running nodetool cleanup I get this exception:
> error: Invalid partitioner class org.apache.cassandra.dht.Murmur3Partitioner
> -- StackTrace --
> org.apache.cassandra.exceptions.ConfigurationException: Invalid partitioner 
> class org.apache.cassandra.dht.Murmur3Partitioner
>       at 
> org.apache.cassandra.config.DatabaseDescriptor.applyConfig(DatabaseDescriptor.java:383)
>       at 
> org.apache.cassandra.config.DatabaseDescriptor.<clinit>(DatabaseDescriptor.java:125)
>       at 
> org.apache.cassandra.cql3.QueryProcessor.<clinit>(QueryProcessor.java:84)
>       at org.apache.cassandra.config.CFMetaData.compile(CFMetaData.java:411)
>       at 
> org.apache.cassandra.schema.SchemaKeyspace.compile(SchemaKeyspace.java:240)
>       at 
> org.apache.cassandra.schema.SchemaKeyspace.<clinit>(SchemaKeyspace.java:88)
>       at org.apache.cassandra.config.Schema.<init>(Schema.java:107)
>       at org.apache.cassandra.config.Schema.<clinit>(Schema.java:55)
>       at org.apache.cassandra.tools.nodetool.Cleanup.execute(Cleanup.java:50)
>       at 
> org.apache.cassandra.tools.NodeTool$NodeToolCmd.run(NodeTool.java:251)
>       at org.apache.cassandra.tools.NodeTool.main(NodeTool.java:165)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to