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

Fredrik LS edited comment on CASSANDRA-8238 at 3/13/15 10:24 AM:
-----------------------------------------------------------------

Reproduced this in 2.1.3.
I'm not very familiar with the Cassandra code base but took me the liberty to 
do some debugging.
This occurs when doing bulkloading from JMX. 
The problem is that the SSTableLoader has a static initializer setting 
{code}
    static
    {
        Config.setClientMode(true);
    }
{code} 
(I guess going through JMX shouldn't be considered client mode but only when 
running SSTableLoader standalone).
Every SSTableReader created after the clientMode flag is set will have the 
readMeter set to null according to the SSTableReader constructor. The 
SSTableReader for SSTables existing at startup will have the readMeter set to 
some value but when JMX bulkloading is used, there will be a mix of 
SSTableReader for the same CF both with readMeter with a value and readMeter 
with null. That in combination with hot and cold SSTables in 
{code}SizeTieredCompactionStrategy.filterColdSSTables(...){code} will trigger 
the NullPointerException when CompactionExecutor kicks in trying to compact the 
"hot" SSTables already existing from startup which have a readMeter set and the 
just streamed cold SSTables from JMX bulkloading which have readMeter set to 
null.

Regards
/Fredrik


was (Author: fredrikl74):
Reproduced this in 2.1.3.
I'm not very familiar with the Cassandra code base but took me the liberty to 
do some debugging.
This occurs when doing bulkloading from JMX. 
The problem is that the SSTableLoader has a static initializer setting 
{code}
    static
    {
        Config.setClientMode(true);
    }
{code} 
(I guess going through JMX shouldn't be considered client mode but only when 
running SSTableLoader standalone).
Every SSTableReader created after the clientMode flag is set will have the 
readMeter set to null according to the SSTableReader constructor. The 
SSTableReader for SSTables existing at startup will have the readMeter set to 
some value but when JMX bulkloading is used, there will be a mix of 
SSTableReader for the same CF both with readMeter with a value and readMeter 
with null. That in combination with hot and cold SSTables in 
{code}SizeTieredCompactionStrategy.filterColdSSTables(...){code} will trigger 
the NullPointerException when CompactionExecutor kicks in trying to compact the 
"hot" SSTables already existing from startup which have a readMeter set and the 
just streamed cold SSTables from JMX bulkloading which have readMeter set to 
null.

Hope my analyze is correct  and that the code formatting isn't too bad.

Regards
/Fredrik

> NPE in SizeTieredCompactionStrategy.filterColdSSTables
> ------------------------------------------------------
>
>                 Key: CASSANDRA-8238
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8238
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Tyler Hobbs
>            Assignee: Marcus Eriksson
>             Fix For: 2.1.3
>
>         Attachments: 0001-assert-that-readMeter-is-not-null.patch
>
>
> {noformat}
> ERROR [CompactionExecutor:15] 2014-10-31 15:28:32,318 
> CassandraDaemon.java:153 - Exception in thread 
> Thread[CompactionExecutor:15,1,main]
>     java.lang.NullPointerException: null
>     at 
> org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy.filterColdSSTables(SizeTieredCompactionStrategy.java:181)
>  ~[apache-cassandra-2.1.1.jar:2.1.1]
>     at 
> org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy.getNextBackgroundSSTables(SizeTieredCompactionStrategy.java:83)
>  ~[apache-cassandra-2.1.1.jar:2.1.1]
>     at 
> org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy.getNextBackgroundTask(SizeTieredCompactionStrategy.java:267)
>  ~[apache-cassandra-2.1.1.jar:2.1.1]
>     at 
> org.apache.cassandra.db.compaction.CompactionManager$BackgroundCompactionTask.run(CompactionManager.java:226)
>  ~[apache-cassandra-2.1.1.jar:2.1.1]
>     at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) 
> ~[na:1.7.0_72]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:262) ~[na:1.7.0_72]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>  ~[na:1.7.0_72]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>  [na:1.7.0_72]
>     at java.lang.Thread.run(Thread.java:745) [na:1.7.0_72]
> {noformat}



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

Reply via email to