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

Hiroshi Ikeda commented on HBASE-14279:
---------------------------------------

To tell the truth ConcurrentHashMap is more sophisticated and has advantage to 
a simple striped map; ConcurrentHashMap.get just has a momentary critical path, 
and it is a well-known idiom to try get before putIfAbsent. I'm not sure how to 
implement the similar feature in this issue.

{code}
+    private static class DefaultValueSetFactory<V> implements Supplier<Set<V>> 
{
...skip...
+      public Set<V> get() {
+        return new ConcurrentSkipListSet<V>(comparator);
+      }
{code}

Using a concurrent or synchronized set wastes completely, because their 
instances are always accessed under locking segments.


> Race condition in ConcurrentIndex
> ---------------------------------
>
>                 Key: HBASE-14279
>                 URL: https://issues.apache.org/jira/browse/HBASE-14279
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Hiroshi Ikeda
>            Assignee: Heng Chen
>            Priority: Minor
>         Attachments: HBASE-14279.patch, HBASE-14279_v2.patch, 
> HBASE-14279_v3.patch, HBASE-14279_v4.patch, HBASE-14279_v5.patch, 
> LockStripedBag.java
>
>
> {{ConcurrentIndex.put}} and {{remove}} are in race condition. It is possible 
> to remove a non-empty set, and to add a value to a removed set. Also 
> {{ConcurrentIndex.values}} is vague in sense that the returned set sometimes 
> trace the current state and sometimes doesn't.



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

Reply via email to