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

Enrico Olivelli edited comment on BOOKKEEPER-964 at 12/19/16 10:00 AM:
-----------------------------------------------------------------------

This implementation introduced some findbugs errors:
{code}
[INFO] --- findbugs-maven-plugin:3.0.3:check (default-cli) @ bookkeeper-server 
---
[INFO] BugInstance size is 20
[INFO] Error size is 0
[INFO] Total bugs: 20
[INFO] Dead store to leftArgs in 
org.apache.bookkeeper.proto.BookieServer.parseArgs(String[]) 
[org.apache.bookkeeper.proto.BookieServer] At BookieServer.java:[line 329] 
DLS_DEAD_LOCAL_STORE
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section.put(long, 
Object, int, boolean, LongFunction) 
[org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section] At 
ConcurrentLongHashMap.java:[line 283] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section.put(long, 
Object, int, boolean, LongFunction) 
[org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section] At 
ConcurrentLongHashMap.java:[line 288] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section.put(long, 
Object, int, boolean, LongFunction) 
[org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section] At 
ConcurrentLongHashMap.java:[line 308] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section.remove(long,
 Object, int) 
[org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section] At 
ConcurrentLongHashMap.java:[line 349] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongHashSet$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentLongHashSet$Section.add(long, 
long) [org.apache.bookkeeper.util.collections.ConcurrentLongHashSet$Section] At 
ConcurrentLongHashSet.java:[line 251] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongHashSet$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentLongHashSet$Section.remove(long,
 int) [org.apache.bookkeeper.util.collections.ConcurrentLongHashSet$Section] At 
ConcurrentLongHashSet.java:[line 283] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.size 
in 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.addAndGet(long,
 long, int) 
[org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section] At 
ConcurrentLongLongHashMap.java:[line 433] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.size 
in 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.compareAndSet(long,
 long, long, int) 
[org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section] At 
ConcurrentLongLongHashMap.java:[line 488] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.size 
in 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.put(long,
 long, int, boolean, ConcurrentLongLongHashMap$LongLongFunction) 
[org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section] At 
ConcurrentLongLongHashMap.java:[line 377] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.size 
in 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.remove(long,
 long, int) 
[org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section] At 
ConcurrentLongLongHashMap.java:[line 525] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.size 
in 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.removeIf(LongPredicate)
 [org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section] At 
ConcurrentLongLongHashMap.java:[line 557] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.size 
in 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.removeIf(ConcurrentLongLongHashMap$LongLongPredicate)
 [org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section] At 
ConcurrentLongLongHashMap.java:[line 583] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap$Section.size
 in 
org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap$Section.put(long,
 long, long, long, int, boolean) 
[org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap$Section] 
At ConcurrentLongLongPairHashMap.java:[line 318] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap$Section.size
 in 
org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap$Section.remove(long,
 long, long, long, int) 
[org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap$Section] 
At ConcurrentLongLongPairHashMap.java:[line 354] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section.put(Object,
 Object, int, boolean, Function) 
[org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section] At 
ConcurrentOpenHashMap.java:[line 294] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section.remove(Object,
 Object, int) 
[org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section] At 
ConcurrentOpenHashMap.java:[line 328] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section.removeIf(BiPredicate)
 [org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section] At 
ConcurrentOpenHashMap.java:[line 413] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashSet$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashSet$Section.add(Object,
 int) [org.apache.bookkeeper.util.collections.ConcurrentOpenHashSet$Section] At 
ConcurrentOpenHashSet.java:[line 247] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashSet$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashSet$Section.remove(Object,
 int) [org.apache.bookkeeper.util.collections.ConcurrentOpenHashSet$Section] At 
ConcurrentOpenHashSet.java:[line 282] VO_VOLATILE_INCREMENT
[INFO]
{code}




was (Author: eolivelli):
This implementation introduced some findbugs errors:
{code}
{code}
[INFO] --- findbugs-maven-plugin:3.0.3:check (default-cli) @ bookkeeper-server 
---
[INFO] BugInstance size is 20
[INFO] Error size is 0
[INFO] Total bugs: 20
[INFO] Dead store to leftArgs in 
org.apache.bookkeeper.proto.BookieServer.parseArgs(String[]) 
[org.apache.bookkeeper.proto.BookieServer] At BookieServer.java:[line 329] 
DLS_DEAD_LOCAL_STORE
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section.put(long, 
Object, int, boolean, LongFunction) 
[org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section] At 
ConcurrentLongHashMap.java:[line 283] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section.put(long, 
Object, int, boolean, LongFunction) 
[org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section] At 
ConcurrentLongHashMap.java:[line 288] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section.put(long, 
Object, int, boolean, LongFunction) 
[org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section] At 
ConcurrentLongHashMap.java:[line 308] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section.remove(long,
 Object, int) 
[org.apache.bookkeeper.util.collections.ConcurrentLongHashMap$Section] At 
ConcurrentLongHashMap.java:[line 349] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongHashSet$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentLongHashSet$Section.add(long, 
long) [org.apache.bookkeeper.util.collections.ConcurrentLongHashSet$Section] At 
ConcurrentLongHashSet.java:[line 251] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongHashSet$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentLongHashSet$Section.remove(long,
 int) [org.apache.bookkeeper.util.collections.ConcurrentLongHashSet$Section] At 
ConcurrentLongHashSet.java:[line 283] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.size 
in 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.addAndGet(long,
 long, int) 
[org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section] At 
ConcurrentLongLongHashMap.java:[line 433] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.size 
in 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.compareAndSet(long,
 long, long, int) 
[org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section] At 
ConcurrentLongLongHashMap.java:[line 488] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.size 
in 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.put(long,
 long, int, boolean, ConcurrentLongLongHashMap$LongLongFunction) 
[org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section] At 
ConcurrentLongLongHashMap.java:[line 377] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.size 
in 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.remove(long,
 long, int) 
[org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section] At 
ConcurrentLongLongHashMap.java:[line 525] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.size 
in 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.removeIf(LongPredicate)
 [org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section] At 
ConcurrentLongLongHashMap.java:[line 557] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.size 
in 
org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section.removeIf(ConcurrentLongLongHashMap$LongLongPredicate)
 [org.apache.bookkeeper.util.collections.ConcurrentLongLongHashMap$Section] At 
ConcurrentLongLongHashMap.java:[line 583] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap$Section.size
 in 
org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap$Section.put(long,
 long, long, long, int, boolean) 
[org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap$Section] 
At ConcurrentLongLongPairHashMap.java:[line 318] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap$Section.size
 in 
org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap$Section.remove(long,
 long, long, long, int) 
[org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap$Section] 
At ConcurrentLongLongPairHashMap.java:[line 354] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section.put(Object,
 Object, int, boolean, Function) 
[org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section] At 
ConcurrentOpenHashMap.java:[line 294] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section.remove(Object,
 Object, int) 
[org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section] At 
ConcurrentOpenHashMap.java:[line 328] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section.removeIf(BiPredicate)
 [org.apache.bookkeeper.util.collections.ConcurrentOpenHashMap$Section] At 
ConcurrentOpenHashMap.java:[line 413] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashSet$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashSet$Section.add(Object,
 int) [org.apache.bookkeeper.util.collections.ConcurrentOpenHashSet$Section] At 
ConcurrentOpenHashSet.java:[line 247] VO_VOLATILE_INCREMENT
[INFO] Increment of volatile field 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashSet$Section.size in 
org.apache.bookkeeper.util.collections.ConcurrentOpenHashSet$Section.remove(Object,
 int) [org.apache.bookkeeper.util.collections.ConcurrentOpenHashSet$Section] At 
ConcurrentOpenHashSet.java:[line 282] VO_VOLATILE_INCREMENT
[INFO]
{code}





> Add concurrent maps and sets for primitive types
> ------------------------------------------------
>
>                 Key: BOOKKEEPER-964
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-964
>             Project: Bookkeeper
>          Issue Type: Improvement
>            Reporter: Matteo Merli
>            Assignee: Matteo Merli
>             Fix For: 4.5.0
>
>
> In BookKeeper there are many instances of maps and sets that use ledger id
> and entry ids as keys or values. JDK concurrent collections have the overhead
> of boxing all the primitive values into objects (eg: long --> Long) that would
> need to be allocated from the heap. In addition to that, JDK map 
> implementations
> are closed hash tables and they will require at least one more allocation to 
> hold
> the linked-list/tree node.
> There are already available libraries that offer primitive collections with
> zero-allocation, but none of these support concurrent maps/sets.
> We have added a handful of specializations, all based on the same 
> implementation
> idea. We have a hash table which is broken down into multiple sections. Each
> sections, on its own, is an open hash table with linear probing, protected by
> a stamped lock.
> All insertions, lookups and iterations on these collections are allocation 
> free.
> {noformat}
> ConcurrentLongHashMap: Map<long, Object>
> ConcurrentLongHashSet: Set<long>
> ConcurrentLongLongHashMap: Map<long, long>
> ConcurrentLongLongPairHashMap: Map< Pair<long, long>, Pair<long, long> >
> ConcurrentOpenHashMap: Map<Object, Object>
> ConcurrentOpenHashSet: Set<Object>
> {noformat}



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

Reply via email to