duongkame commented on code in PR #3912:
URL: https://github.com/apache/ozone/pull/3912#discussion_r1010099530


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java:
##########
@@ -396,8 +396,26 @@ private OmKeyInfo readKeyInfo(OmKeyArgs args) throws 
IOException {
     return value;
   }
 
+  private OmKeyInfo getOmKeyInfoDirectoryAware(String volumeName,
+            String bucketName, String keyName) throws IOException {
+    OmKeyInfo keyInfo = getOmKeyInfo(volumeName, bucketName, keyName);
+
+    // Check if the key is a directory.
+    if (keyInfo != null) {
+      keyInfo.setFile(true);
+      return keyInfo;
+    }
+
+    String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
+    OmKeyInfo dirKeyInfo = getOmKeyInfo(volumeName, bucketName, dirKey);
+    if (dirKeyInfo != null) {

Review Comment:
   That also works, just like the `lookupFile` does today. Yet, I think 
`getKeyInfo` should be a generic API that provide key information, like its 
name.
   
   The decision of how to use that information should be in the hands of OM's 
clients. E.g. RpcClient should know it's looking for a file instead of relying 
on OM to decide.



-- 
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