[
https://issues.apache.org/jira/browse/HADOOP-18236?focusedWorklogId=774755&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-774755
]
ASF GitHub Bot logged work on HADOOP-18236:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 25/May/22 18:24
Start Date: 25/May/22 18:24
Worklog Time Spent: 10m
Work Description: ayushtkn commented on PR #4320:
URL: https://github.com/apache/hadoop/pull/4320#issuecomment-1137686111
Logically from the present code flow this lock is redundant and there is
enough discussion on the original jira, this was kept because the method
calling was protected and a comment there confirms that it is indeed deliberate
https://issues.apache.org/jira/browse/HADOOP-16028?focusedCommentId=16731433&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16731433
I don't think we can change this access modifier to private for compat
reasons and the reason for which it was done then still holds true
Issue Time Tracking
-------------------
Worklog Id: (was: 774755)
Time Spent: 1h 20m (was: 1h 10m)
> Remove duplicate locks in NetworkTopology
> -----------------------------------------
>
> Key: HADOOP-18236
> URL: https://issues.apache.org/jira/browse/HADOOP-18236
> Project: Hadoop Common
> Issue Type: Improvement
> Reporter: ZanderXu
> Assignee: ZanderXu
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> During reading the hadoop NetworkTopology.java, I suspect there is a
> duplicate lock.
> chooseRandom(line 532), and code is:
> {code:java}
> final int availableNodes;
> if (excludedScope == null) {
> availableNodes = countNumOfAvailableNodes(scope, excludedNodes);
> } else {
> netlock.readLock().lock();
> try {
> availableNodes = countNumOfAvailableNodes(scope, excludedNodes) -
> countNumOfAvailableNodes(excludedScope, excludedNodes);
> } finally {
> netlock.readLock().unlock();
> }
> } {code}
> All the places where called `chooseRandom` have the global read lock, so the
> internal read lock is duplicated.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]