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

Daniel Templeton commented on YARN-7270:
----------------------------------------

Thanks, [~yufeigu].  My comments:
# You're missing a space after the _if_ in your method.
# Since it's now static, can we name it more appropriately, like 
{{castToIntSafely()}} or some such?  (I don't see any reason for it to be 
non-static.)
# Assert messages would be nice.
# I don't mind adding the {{TestResource}} class just for this.  Maybe name it 
something more specific, though, like {{TestResourceLongCast}} or something?
# You should also test that the {{getMemory()}} and {{getVirtualCores()}} 
methods behave correctly in the impl classes.

> Resource#getVirtualCores() does unsafe casting from long to int.
> ----------------------------------------------------------------
>
>                 Key: YARN-7270
>                 URL: https://issues.apache.org/jira/browse/YARN-7270
>             Project: Hadoop YARN
>          Issue Type: Bug
>          Components: resourcemanager
>    Affects Versions: 3.1.0
>            Reporter: Yufei Gu
>            Assignee: Yufei Gu
>         Attachments: YARN-7270.001.patch
>
>
> Class {{Resource}} has three sub classes(FixedValueResource, 
> LightWeightResource, and ResourcePBImpl). Only FixedValueResource handle 
> long-to-int casting nicely. The other two didn't. This bug is introduced by 
> resource type feature and causes several unit test failures. For example:
> {code}
> Error Message
> expected:<<memory:4096, vCores:4>> but was:<<memory:4096, vCores:-1>>
> Stacktrace
> java.lang.AssertionError: expected:<<memory:4096, vCores:4>> but 
> was:<<memory:4096, vCores:-1>>
>       at org.junit.Assert.fail(Assert.java:88)
>       at org.junit.Assert.failNotEquals(Assert.java:743)
>       at org.junit.Assert.assertEquals(Assert.java:118)
>       at org.junit.Assert.assertEquals(Assert.java:144)
>       at 
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.TestFSAppAttempt.testHeadroomWithBlackListedNodes(TestFSAppAttempt.java:325)
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to