zhangshuyan0 commented on code in PR #5582:
URL: https://github.com/apache/hadoop/pull/5582#discussion_r1174496314
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirStatAndListingOp.java:
##########
@@ -262,13 +262,22 @@ 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) {
+ locationBudget -= blks.locatedBlockCount() *
+ (ecPolicy.getNumDataUnits() +
ecPolicy.getNumParityUnits());
+ } else {
+ // Approximate #locations with locatedBlockCount() *
repl_factor
Review Comment:
I think it's not very appropriate to comment the EC case with repl_factor,
I'll add an additional comment for the case above.
--
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]