[ https://issues.apache.org/jira/browse/HDFS-9441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15035916#comment-15035916 ]
Kihwal Lee commented on HDFS-9441: ---------------------------------- bq. It is actually a common practice. It makes sense if the method isn't going to interpret the argument and Object is the correct level of abstraction for those methods. If the path argument is strictly for logging in block placement policy, it might be an acceptable design. But if there is a possibility of an implementation interpreting the path to influence block placement, this is not desirable. If we believe path should only be used for logging, we should document it. bq. It may declare a third method with an Object parameter. This is the same solution as the patch! It is not. The abstract class, {{BlockPlacementPolicy}}, has tighter type definitions and using Object will be internal to the implementation in this case. And it doesn't even have to use Object internally. Along with the tighter type definition, the interpretation of the argument can be provided in the abstract class by adding methods such as {code:java} String getFullPath(String path) { return path; } String getFullPath(BlockCollection bc) { return bc.getName(); } {code} > Do not construct path string when choosing block placement targets > ------------------------------------------------------------------ > > Key: HDFS-9441 > URL: https://issues.apache.org/jira/browse/HDFS-9441 > Project: Hadoop HDFS > Issue Type: Improvement > Components: namenode > Reporter: Tsz Wo Nicholas Sze > Assignee: Tsz Wo Nicholas Sze > Priority: Minor > Attachments: h9441_20151118.patch, h9441_20151119.patch > > > - INodeFile.getName() is expensive since it involves quite a few string > operations. The method is called in both ReplicationWork and > ErasureCodingWork but the default BlockPlacementPolicy does not use the > returned string. We should simply pass BlockCollection to reduce unnecessary > computation when using the default BlockPlacementPolicy. > - Another improvement: the return type of FSNamesystem.getBlockCollection > should be changed to INodeFile since it always returns an INodeFile object. -- This message was sent by Atlassian JIRA (v6.3.4#6332)