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

Eshcar Hillel commented on HBASE-15991:
---------------------------------------

Some comments:

1. The exception is due to StealJobQueue extending PriorityBlockingQueue which 
throws the exception when it cannot determine the position of the item in the 
queue. I agree there is no need in a priority queue for the in-memory flush, at 
least for now. If it is required in the future the attribute for comparison 
will become obvious as well.

2. We should consider the pros/cons of LinkedBlockingQueue vs other queue such 
as ConcurrentLinkedQueue.
see in  
http://stackoverflow.com/questions/1301691/java-queue-implementations-which-one
"The most important difference between LinkedBlockingQueue and 
ConcurrentLinkedQueue is that if you request an element from a 
LinkedBlockingQueue and the queue is empty, your thread will wait until there 
is something there. A ConcurrentLinkedQueue will return right away with the 
behavior of an empty queue."

on the other hand in ConcurrentLinkedQueue
"Beware that, unlike in most collections, the size method is NOT a 
constant-time operation. Because of the asynchronous nature of these queues, 
determining the current number of elements requires a traversal of the 
elements."

So we need to consider what is more important having a size method with 
constant time, or making sure retrieving an element never blocks.


> CompactingMemstore#InMemoryFlushRunnable should implement 
> Comparable/Comparator
> -------------------------------------------------------------------------------
>
>                 Key: HBASE-15991
>                 URL: https://issues.apache.org/jira/browse/HBASE-15991
>             Project: HBase
>          Issue Type: Sub-task
>    Affects Versions: 2.0.0
>            Reporter: ramkrishna.s.vasudevan
>            Assignee: ramkrishna.s.vasudevan
>            Priority: Critical
>             Fix For: 2.0.0
>
>         Attachments: HBASE-15991.patch, HBASE-15991_test.patch
>
>
> Configuring CompactingMemstore for a table fails due to the following error
> {code}
> 2016-06-08 23:27:03,761 ERROR [B.defaultRpcServer.handler...
> 2016-06-08 23:27:03,761 ERROR 
> [B.defaultRpcServer.handler=38,queue=8,port=16041] ipc.RpcServer: Unexpected 
> throwable object
> java.lang.ClassCastException: 
> org.apache.hadoop.hbase.regionserver.CompactingMemStore$InMemoryFlushRunnable 
> cannot be cast to java.lang.Comparable
>         at 
> java.util.concurrent.PriorityBlockingQueue.siftUpComparable(PriorityBlockingQueue.java:357)
>         at 
> java.util.concurrent.PriorityBlockingQueue.offer(PriorityBlockingQueue.java:489)
>         at 
> org.apache.hadoop.hbase.util.StealJobQueue$1.offer(StealJobQueue.java:56)
>         at 
> java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1361)
>         at 
> org.apache.hadoop.hbase.regionserver.CompactingMemStore.checkActiveSize(CompactingMemStore.java:258)
>         at 
> org.apache.hadoop.hbase.regionserver.AbstractMemStore.internalAdd(AbstractMemStore.java:403)
>         at 
> org.apache.hadoop.hbase.regionserver.AbstractMemStore.add(AbstractMemStore.java:113)
>         at org.apache.hadoop.hbase.regionserver.HStore.add(HStore.java:630)
>         at 
> org.apache.hadoop.hbase.regionserver.HRegion.applyToMemstore(HRegion.java:3769)
>         at 
> org.apache.hadoop.hbase.regionserver.HRegion.applyFamilyMapToMemstore(HRegion.java:3740)
>         at 
> org.apache.hadoop.hbase.regionserver.HRegion.doMiniBatchMutate(HRegion.java:3222)
>         at 
> org.apache.hadoop.hbase.regionserver.HRegion.batchMutate(HRegion.java:2954)
>         at 
> org.apache.hadoop.hbase.regionserver.HRegion.batchMutate(HRegion.java:2896)
>         at 
> org.apache.hadoop.hbase.regionserver.RSRpcServices.doBatchOp(RSRpcServices.java:868)
>         at 
> org.apache.hadoop.hbase.regionserver.RSRpcServices.doNonAtomicRegionMutation(RSRpcServices.java:830)
>         at 
> org.apache.hadoop.hbase.regionserver.RSRpcServices.multi(RSRpcServices.java:2307)
>         at 
> org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:34826)
>  
> {code}
> It is a straight forward fix. But If we implement the Comparable the 
> compareTo() should be based on what attribute?  Should be based on the time?  



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

Reply via email to