smengcl commented on a change in pull request #2489:
URL: https://github.com/apache/ozone/pull/2489#discussion_r683759950
##########
File path:
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/NSSummaryEndpoint.java
##########
@@ -267,26 +368,69 @@ public Response getDiskUsage(@QueryParam("path") String
path)
// reformat the response
diskUsage.setSubpath(subpath);
long dataSize = getTotalSize(subdirObjectId);
+ dirDataSize += dataSize;
+
+ if (withReplica) {
+ long subdirDU = 0;
+ List<OmKeyInfo> keys = listKeysUnderDirectory(subdirObjectId);
+ for (OmKeyInfo keyInfo: keys) {
+ subdirDU += getKeySizeWithReplication(keyInfo);
+ }
+ diskUsage.setSizeWithReplica(subdirDU);
+ dirDataSizeWithReplica += subdirDU;
+ }
+
diskUsage.setSize(dataSize);
subdirDUData.add(diskUsage);
}
+
+ // handle direct keys under directory
+ if (listFile || withReplica) {
+ List<OmKeyInfo> directKeys = listDirectKeys(dirObjectId);
Review comment:
Same here. We can calculate the replica directly here without gathering
all `OmKeyInfo`s
##########
File path:
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/NSSummaryEndpoint.java
##########
@@ -267,26 +368,69 @@ public Response getDiskUsage(@QueryParam("path") String
path)
// reformat the response
diskUsage.setSubpath(subpath);
long dataSize = getTotalSize(subdirObjectId);
+ dirDataSize += dataSize;
+
+ if (withReplica) {
+ long subdirDU = 0;
+ List<OmKeyInfo> keys = listKeysUnderDirectory(subdirObjectId);
+ for (OmKeyInfo keyInfo: keys) {
+ subdirDU += getKeySizeWithReplication(keyInfo);
+ }
+ diskUsage.setSizeWithReplica(subdirDU);
+ dirDataSizeWithReplica += subdirDU;
+ }
+
diskUsage.setSize(dataSize);
subdirDUData.add(diskUsage);
}
+
+ // handle direct keys under directory
+ if (listFile || withReplica) {
+ List<OmKeyInfo> directKeys = listDirectKeys(dirObjectId);
+
+ for (OmKeyInfo directKey: directKeys) {
Review comment:
```suggestion
for (OmKeyInfo directKey : directKeys) {
```
--
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]