[
https://issues.apache.org/jira/browse/HBASE-12748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14274617#comment-14274617
]
Andrew Purtell commented on HBASE-12748:
----------------------------------------
With the latest patch, we take snapshots of the coprocessor set, build a list,
and use an atomic reference to make iterating over the list safe. So far so
good. However, when updating coprocessorList, can we guarantee the atomic
reference always points to a snapshot that reflects the latest state of the
coprocessor set? Say thread A and B are both concurrently mutating the set.
Thread A misses thread B's new entry, but thread A is delayed and completes
after thread B, so the final reference is set by A, not B. Can this ordering
happen? Maybe I'm just being paranoid, but if we can serialize execution of
updateCoprocessorList while not impacting list iteration then we for sure are
good.
Also, please fix formatting like the below, and remove all tabs, this does not
conform to our coding style as mentioned before:
{code}
@@ -90,6 +97,16 @@ public abstract class CoprocessorHost<E extends
CoprocessorEnvironment> {
this.pathPrefix = UUID.randomUUID().toString();
}
+ protected void updateCoprocessorList()
+ {
+ List<E> newList = new ArrayList<E>();
+ for(E env: coprocessors)
+ {
+ newList.add(env);
+ }
+ this.coprocessorList.set(newList);
+ }
{code}
> 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.98.10, 0.94.27
>
> 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)