bharatviswa504 commented on a change in pull request #1451:
URL: https://github.com/apache/hadoop-ozone/pull/1451#discussion_r499805554



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
##########
@@ -919,12 +920,32 @@ private boolean isKeyEmpty(OmKeyInfo keyInfo) {
     // underlying table using an iterator. That automatically creates a
     // snapshot of the data, so we don't need these locks at a higher level
     // when we iterate.
+
+    startKey = normalizeListKeyPath(startKey);
+    keyPrefix = normalizeListKeyPath(keyPrefix);
+
     List<OmKeyInfo> keyList = metadataManager.listKeys(volumeName, bucketName,
         startKey, keyPrefix, maxKeys);
     refreshPipeline(keyList);
     return keyList;
   }
 
+  private String normalizeListKeyPath(String keyPath) {
+
+    String normalizeKeyPath = keyPath;
+    if (enableFileSystemPaths) {
+      // For empty strings do nothing.
+      if (StringUtils.isBlank(keyPath)) {

Review comment:
       For key ending with "/" after normalizing it will return the key without 
trailing "/". As here the key intended to be searched is, I have added it back 
here. In my view removing "/" at the end when the user explicitly asked to 
search for keys end with "/", it might return results differently, as I don't 
want to change current semantics.
   
   Example:
   the prefix is "/a/b/c/d/" -> after Normalize "/a/b/c/d"
   So if we don't add "/" back, it will return keys with prefix "/a/b/c/d", but 
user intention here is to get keys in "/a/b/c/d/" so not to change semantics 
for this case handled in this method instead of common method used by all 
classes.
   
   And also for null not calling OmUtils.normalizeKey(keyPath), the Paths 
method will fail with NPE, so this is also considered a special case and 
handled it in this method.
   
   
   




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org

Reply via email to