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

Andrew Purtell edited comment on HBASE-12748 at 12/23/14 3:40 AM:
------------------------------------------------------------------

On second thought let me take that back.

I was tinkering around with this. 

This patch adds 'coprocessorList', a simple ArrayList that can be used for 
iterating the coprocessor list without creating an Iterator. However 
'coprocessorList' replaces use of SortedCopyOnWriteSet for iteration, which is 
safe for iteration concurrent with adding or removing coprocessors, without 
providing a similar guarantee. A CopyOnWriteArrayList would make a fresh copy 
of the underlying array at each {{add()}}. Synchronization on 'coprocessorList' 
would undo why we have SortedCopyOnWriteSet here in the first place. Maybe 
making 'coprocessorList' volatile, building up a list, and replacing the 
reference with the completed list would work, or use an AtomicReference (with 
lazySet)? 


was (Author: apurtell):
On second thought let me take that back.

I was tinkering around with this. 

This patch 'coprocessorList', a simple ArrayList that can be used for iterating 
the coprocessor list without creating an Iterator. However 'coprocessorList' 
replaces use of SortedCopyOnWriteSet for iteration, which is safe for iteration 
concurrent with adding or removing coprocessors, without providing a similar 
guarantee. A CopyOnWriteArrayList would make a fresh copy of the underlying 
array at each {{add()}}. Synchronization on 'coprocessorList' would undo why we 
have SortedCopyOnWriteSet here in the first place. Maybe making 
'coprocessorList' volatile, building up a list, and replacing the reference 
with the completed list would work, or use an AtomicReference (with lazySet)? 

> RegionCoprocessorHost.execOperation creates too many iterator objects
> ---------------------------------------------------------------------
>
>                 Key: HBASE-12748
>                 URL: https://issues.apache.org/jira/browse/HBASE-12748
>             Project: HBase
>          Issue Type: Sub-task
>    Affects Versions: 0.94.25, 0.98.9
>            Reporter: Vladimir Rodionov
>            Assignee: Vladimir Rodionov
>             Fix For: 1.0.0, 2.0.0, 0.94.26, 0.98.10
>
>         Attachments: HBase-12748.patch
>
>
> This is typical pattern of enhanced for ... loop usage in a hot code path. 
> For every HBase operation it instantiates iterator for coprocessor list 
> twice. 



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

Reply via email to