jojochuang commented on code in PR #3912:
URL: https://github.com/apache/ozone/pull/3912#discussion_r1009952338
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmKeyInfo.java:
##########
@@ -61,6 +61,10 @@ public final class OmKeyInfo extends WithParentObjectId {
private ReplicationConfig replicationConfig;
private FileEncryptionInfo encInfo;
private FileChecksum fileChecksum;
+ /**
+ * Support OSF use-case to identify if the key is a file or a directory.
Review Comment:
OFS?
##########
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:
how about adding an assertion here that dirKeyInfo.isFile() is false?
--
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]