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

Mikhail Antonov commented on HBASE-11290:
-----------------------------------------

bq. not define and declare all in the one go rather than wait on the constructor
Right. Just didn't touch this code. Makes sense.

bq. What is idea behind erasure
There's no erasure, is it? Just java7 syntax, still proper type inference.. 
Thought it would make code little bit more compact. But yeah, not related to 
patch at all. I can revert it all.

bq. There is nowhere where we mod two Maps and we need to do it inside 
synchronize?

There're quite a bit of such places, but those still go under global lock (i 
mean, monitor on _this_ object), i.e. #createRegionState() puts entries in 
several collection. Idea was that all methods modifying several collections 
still need to grab _this_ lock, but methods only reading from the collections 
can do so without getting the lock, but rather using internal CHM sync (so 
intent is to just try to reduce read lock contention on getters, assuming that 
we can relax consistency for callers who just do gets (as now all individual 
getters to get global lock).

Upon further thinking, the other (possibly better) solutions seems to be:
 - instead of making bunch of those collection CHM, just use RW-lock in this 
class, and make all getters method use R-lock from it. That would help for the 
case when there're just lot of readers to RegionStates class. Won't speedup 
stuff like bulk assignment, as exclusive writers will push the readers out, but 
will help to reduce read contention in more stable case (stable case is easier 
yeah..)
 - make locking more coarse-grained and do operations like bulk assignments 
under it.


> Unlock RegionStates
> -------------------
>
>                 Key: HBASE-11290
>                 URL: https://issues.apache.org/jira/browse/HBASE-11290
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: Francis Liu
>            Assignee: Francis Liu
>         Attachments: HBASE-11290.draft.patch
>
>
> Even though RegionStates is a highly accessed data structure in HMaster. Most 
> of it's methods are synchronized. Which limits concurrency. Even simply 
> making some of the getters non-synchronized by using concurrent data 
> structures has helped with region assignments. We can go as simple as this 
> approach or create locks per region or a bucket lock per region bucket.



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

Reply via email to