Hexiaoqiao commented on code in PR #5582:
URL: https://github.com/apache/hadoop/pull/5582#discussion_r1174505099
##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDistributedFileSystem.java:
##########
@@ -110,6 +113,8 @@
import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsDatasetSpi;
import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsVolumeSpi;
import org.apache.hadoop.hdfs.server.namenode.ErasureCodingPolicyManager;
+import org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer;
Review Comment:
Please remove the unused import.
##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDistributedFileSystem.java:
##########
@@ -674,6 +679,40 @@ public void testClearStatistics() throws Exception {
}
}
+ @Test
Review Comment:
Suggest to add some javadoc for this unit and notice what it will cover.
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirStatAndListingOp.java:
##########
@@ -262,13 +262,24 @@ private static DirectoryListing getListing(FSDirectory
fsd, INodesInPath iip,
needLocation, false);
listingCnt++;
if (listing[i] instanceof HdfsLocatedFileStatus) {
- // Once we hit lsLimit locations, stop.
+ // Once we hit lsLimit locations, stop.
// This helps to prevent excessively large response payloads.
- // Approximate #locations with locatedBlockCount() * repl_factor
LocatedBlocks blks =
((HdfsLocatedFileStatus)listing[i]).getLocatedBlocks();
- locationBudget -= (blks == null) ? 0 :
- blks.locatedBlockCount() * listing[i].getReplication();
+ if (blks != null) {
+ ErasureCodingPolicy ecPolicy =
+ listing[i].getErasureCodingPolicy();
+ if (ecPolicy != null && !ecPolicy.isReplicationPolicy()) {
+ // Approximate #locations with locatedBlockCount() *
+ // internalBlocksNum.
+ locationBudget -= blks.locatedBlockCount() *
+ (ecPolicy.getNumDataUnits() +
ecPolicy.getNumParityUnits());
+ } else {
+ // Approximate #locations with locatedBlockCount() *
repl_factor
Review Comment:
The current comment is OK for me, let's wait what @ayushtkn will think
about. BTW, `repl_factor`, this name is very c/c++ style-ly, what about
`replicationFactor`? Suggest add period at the end of the sentence.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]