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



---------------------------------------------------------------------
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