zhangshuyan0 commented on code in PR #6608:
URL: https://github.com/apache/hadoop/pull/6608#discussion_r1533779361


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java:
##########
@@ -88,13 +96,19 @@ private static void verifyQuotaForRename(FSDirectory fsd, 
INodesInPath src,
     final QuotaCounts delta = src.getLastINode()
         .computeQuotaUsage(bsps, storagePolicyID, false,
             Snapshot.CURRENT_STATE_ID);
+    srcDelta = Optional.of(delta.negation().negation());

Review Comment:
   Why call negation() twice here?



##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java:
##########
@@ -88,13 +96,19 @@ private static void verifyQuotaForRename(FSDirectory fsd, 
INodesInPath src,
     final QuotaCounts delta = src.getLastINode()
         .computeQuotaUsage(bsps, storagePolicyID, false,

Review Comment:
   I'm curious why caching is not allowed here.



##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java:
##########
@@ -88,13 +96,19 @@ private static void verifyQuotaForRename(FSDirectory fsd, 
INodesInPath src,
     final QuotaCounts delta = src.getLastINode()
         .computeQuotaUsage(bsps, storagePolicyID, false,
             Snapshot.CURRENT_STATE_ID);
+    srcDelta = Optional.of(delta.negation().negation());
 
     // Reduce the required quota by dst that is being removed
     final INode dstINode = dst.getLastINode();
     if (dstINode != null) {
-      delta.subtract(dstINode.computeQuotaUsage(bsps));
+      QuotaCounts quotaCounts = dstINode.computeQuotaUsage(bsps);
+      dstDelta = dstINode.isQuotaSet() ?
+          dstDelta : Optional.of(quotaCounts.negation().negation());

Review Comment:
   Same as 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]

Reply via email to