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

Joel Koshy commented on KAFKA-1098:
-----------------------------------

Thanks for the patch - this is interesting/weird.

The real issue seems to be that since the map is defined as {{[Long, 
LogSegment]}} the null return of floorKey is getting converted to a 0 Long 
value and failing the eq null check.

i.e., the actual from value is also -1. floorKey should return null (and it 
does) but it is implicitly converted to 0, so it does not enter the {{floor eq 
null}} block but we want it to.

I'm wondering if we should just switch the map to use java.lang.Long instead of 
scala Long to avoid these implicit conversions.

{code}
scala> val m = new ConcurrentSkipListMap[Long, Any]
m: java.util.concurrent.ConcurrentSkipListMap[Long,Any] = {}

scala> m.floorKey(0)
res10: Long = 0

scala> val m = new ConcurrentSkipListMap[java.lang.Long, Any]
m: java.util.concurrent.ConcurrentSkipListMap[java.lang.Long,Any] = {}

scala> m.floorKey(0)
res11: java.lang.Long = null
{code}

> Unit test failure in 0.8.1 related to LogCleaner
> ------------------------------------------------
>
>                 Key: KAFKA-1098
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1098
>             Project: Kafka
>          Issue Type: Bug
>          Components: log
>    Affects Versions: 0.8.1
>            Reporter: Neha Narkhede
>            Assignee: Jay Kreps
>         Attachments: kafka_1098-v1.patch
>
>
> Floor = 0, To = -1
> [2013-10-22 09:39:25,001] ERROR Error in cleaner thread 0: 
> (kafka.log.LogCleaner:103)
> java.lang.IllegalArgumentException: inconsistent range
>       at 
> java.util.concurrent.ConcurrentSkipListMap$SubMap.<init>(ConcurrentSkipListMap.java:2506)
>       at 
> java.util.concurrent.ConcurrentSkipListMap.subMap(ConcurrentSkipListMap.java:1984)
>       at kafka.log.Log.logSegments(Log.scala:605)
>       at kafka.log.LogToClean.<init>(LogCleaner.scala:596)
>       at kafka.log.LogCleaner$$anonfun$5.apply(LogCleaner.scala:137)
>       at kafka.log.LogCleaner$$anonfun$5.apply(LogCleaner.scala:137)
>       at 
> scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
>       at 
> scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
>       at 
> scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
>       at scala.collection.immutable.List.foreach(List.scala:45)
>       at scala.collection.TraversableLike$class.map(TraversableLike.scala:206)
>       at scala.collection.immutable.List.map(List.scala:45)
>       at 
> kafka.log.LogCleaner.kafka$log$LogCleaner$$grabFilthiestLog(LogCleaner.scala:137)
>       at kafka.log.LogCleaner$CleanerThread.cleanOrSleep(LogCleaner.scala:203)
>       at kafka.log.LogCleaner$CleanerThread.run(LogCleaner.scala:189)



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to