[ 
https://issues.apache.org/jira/browse/HADOOP-17752?focusedWorklogId=609575&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-609575
 ]

ASF GitHub Bot logged work on HADOOP-17752:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 10/Jun/21 09:12
            Start Date: 10/Jun/21 09:12
    Worklog Time Spent: 10m 
      Work Description: liangxs commented on pull request #3085:
URL: https://github.com/apache/hadoop/pull/3085#issuecomment-858455111


   @steveloughran Thanks for you comment.
   
   The only problem may occur as follows
   
   0. REGISTRY contains two configurations: `conf_b` and `conf_c`
   
   1. Thread t1 is reloading all Configurations of REGISTRY, the state and the 
map iterator order are
       [`conf_b`(reloaded💚) **->** `conf_c`(_reloading_)]
   
   2. Meanwhile, another thread t2 creates `conf_a` and then creates `conf_d`, 
which are both put into REGISTRY.
   
   3. Thread t1 done reload operation.
   
   3. Now the state may be 
       [`conf_a`(**not_reload**⚠️) **->** `conf_b`(reloaded💚) 
**->**`conf_c`(reloaded💚) **->** `conf_d`(reloaded💚)]
   
   For thread t2, `conf_a` is happen-before `conf_d`, but `conf_a` is not 
reloaded and `conf_d` is reloaded.
   
   
   I think this is ok.
   If this is a concern, I can add a ReentrantReadWriteLock to prevent it.
   The reload operation can be guard by WriteLock, because configurations are 
not very frequently reloaded.
   The put operations can be guard by ReadLock, which gain performance from 
parallel.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 609575)
    Time Spent: 40m  (was: 0.5h)

> Remove lock contention in REGISTRY of Configuration
> ---------------------------------------------------
>
>                 Key: HADOOP-17752
>                 URL: https://issues.apache.org/jira/browse/HADOOP-17752
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: common
>            Reporter: Xuesen Liang
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Every Configuration instance is put into *Configuration#REGISTRY* by its 
> constructor. This operation is guard by Configuration.class.
> REGISTRY is a *WeakHashMap*, which should be replaced by *ConcurrentHashMap*.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to