New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HDFS-15783. Speed up BlockPlacementPolicyRackFaultTolerant#verifyBlockPlacement #2626
Conversation
💔 -1 overall
This message was automatically generated. |
// Count locations on different racks. | ||
final long rackCount = Arrays.stream(locs) | ||
.map(DatanodeInfo::getNetworkLocation).distinct().count(); | ||
return new BlockPlacementStatusDefault(Math.toIntExact(rackCount), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are following the same as in HDFS-14102 but I'd prefer extracting the int casting instead of doing it in the call.
A little more verbose but I would extract it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the casting. Thank you @goiri.
💔 -1 overall
This message was automatically generated. |
Merged. Thanks @goiri. |
JIRA: https://issues.apache.org/jira/browse/HDFS-15783
TreeSet#add
, its time complexity isO(logN)
.This fix is similar to https://issues.apache.org/jira/browse/HDFS-14102