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

Sunil G commented on YARN-7764:
-------------------------------

Resources and DominantResourceCalculator are two classes which provide basic 
ops on Resource object. To support add/subtract/multiply etc, each 
ResourceInformation object of Resource has to be iterated. getResourcesArray is 
used for this. Hence if this getter is costlier interms of operation, it will 
impact basic ops on Resource, and hence impact CS performance. You can refer 
the recent tight loop UT performance test cases added CS.

 

Now coming to getResources, its still used in various places but not much as 
getResourcesArray. Hence I was reserved to make a copy on each return. Another 
way of fixing is having a readOnly mapper and populate that as well. however 
findbug ll still return same error. But we can internally assume a read only 
map is returned.

> Findbugs warning: Resource#getResources may expose internal representation
> --------------------------------------------------------------------------
>
>                 Key: YARN-7764
>                 URL: https://issues.apache.org/jira/browse/YARN-7764
>             Project: Hadoop YARN
>          Issue Type: Bug
>          Components: api
>    Affects Versions: 3.0.0, 3.1.0
>            Reporter: Weiwei Yang
>            Priority: Minor
>              Labels: findbugs
>
> Hadoop qbt report:
> {noformat}
> FindBugs :
>        module:hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api 
>        org.apache.hadoop.yarn.api.records.Resource.getResources() may expose 
> internal representation by returning Resource.resources At Resource.java:by 
> returning Resource.resources At Resource.java:[line 234]
> {noformat}
> Introduced by YARN-7136.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to