You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/05/17 14:24:00 UTC

[jira] [Work logged] (HADOOP-18236) Remove duplicate locks in NetworkTopology

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

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

                Author: ASF GitHub Bot
            Created on: 17/May/22 14:23
            Start Date: 17/May/22 14:23
    Worklog Time Spent: 10m 
      Work Description: ZanderXu opened a new pull request, #4320:
URL: https://github.com/apache/hadoop/pull/4320

    Remove duplicate locks in NetworkTopology




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

            Worklog Id:     (was: 771383)
    Remaining Estimate: 0h
            Time Spent: 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
>          Time Spent: 10m
>  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: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org