ztzg commented on a change in pull request #934: ZOOKEEPER-3301:Enforce the 
quota limit
URL: https://github.com/apache/zookeeper/pull/934#discussion_r357066484
 
 

 ##########
 File path: 
zookeeper-server/src/main/java/org/apache/zookeeper/server/DataTree.java
 ##########
 @@ -602,11 +584,11 @@ public void deleteNode(String path, long zxid)
         String lastPrefix = getMaxPrefixWithQuota(path);
 
 Review comment:
   (GitHub won't let me add a note on line 577—about something I noticed but 
which was not introduced by this patch.)
   
   Isn't this code slightly wrong?
   
   ```java
           if (parentName.startsWith(procZookeeper) && 
Quotas.limitNode.equals(childName)) {
               // delete the node in the trie.
               // we need to update the trie as well
               pTrie.deletePath(parentName.substring(quotaZookeeper.length()));
           }
   ```
   
   Shouldn't it test for `parentName.startsWith(quotaZookeeper)`, instead of 
`procZookeeper`?
   
   Oh, and `DataTree` is full of `.substring(quotaZookeeper.length())` which 
could be replaced by your `trimQuotaPath` helper :)
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to