You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/09/22 12:06:09 UTC

[GitHub] [ozone] xichen01 opened a new pull request, #3774: HDDS-7253. Fix exception when '/' in key name

xichen01 opened a new pull request, #3774:
URL: https://github.com/apache/ozone/pull/3774

   ## What changes were proposed in this pull request?
   
   Fix exception when '/' in key name
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-7253
   
   ## How was this patch tested?
   
   How to reproduce the bug
   
   - First put a key that containing '/'
   
   ```bash
   [root@Linux /root/ozone]% bin/ozone sh key put s3v/testbucket/dir1/dir2/key1 ~/testfile
   [root@Linux /root/ozone]% bin/ozone sh key ls s3v/testbucket/ | grep name
     "name" : "dir1/dir2/key1"
   ```
   - Execute command
   
   `ls` command for keys containing '/'
   before this commit
   ```bash
   [root@Linux /root/ozone]% bin/ozone fs -ls ofs://localhost/s3v/testbucket/
   Found 1 items
   drwxrwxrwx   - root root          0 2022-09-19 14:11 ofs://localhost/s3v/testbucket/dir1
   [root@Linux /root/ozone]% bin/ozone fs -ls ofs://localhost/s3v/testbucket/dir1
   ls: `ofs://localhost/s3v/testbucket/dir1': No such file or directory
   ```
   after this commit
   ```bash
   [root@Linux /root/ozone]% bin/ozone fs -ls ofs://localhost/s3v/testbucket/
   Found 1 items
   drwxrwxrwx   - root root          0 2022-09-19 14:37 ofs://localhost/s3v/testbucket/dir1
   [root@Linux /root/ozone]% bin/ozone fs -ls ofs://localhost/s3v/testbucket/dir1
   Found 1 items
   drwxrwxrwx   - root root          0 2022-09-19 14:37 ofs://localhost/s3v/testbucket/dir1/dir2
   ```
   
   for `mv`, `mkdir`, `count` command for keys containing '/' 
   
   
   
   before this commit 
   ```bash
   [root@Linux /root/ozone]% bin/ozone fs -count ofs://localhost/s3v/testbucket/
   count: dir1: No such file or directory!
   [root@Linux /root/ozone]% bin/ozone fs -mv ofs://localhost/s3v/testbucket/dir1 ofs://localhost/s3v/testbucket/dir2
   mv: `ofs://localhost/s3v/testbucket/dir1': No such file or directory
   [root@Linux /root/ozone]% bin/ozone fs -mkdir ofs://localhost/s3v/testbucket/dir1/dir2/key2
   mkdir: `ofs://localhost/s3v/testbucket/dir1/dir2': No such file or directory
   ```
   after this commit
   ```bash
   [root@Linux /root/ozone]% bin/ozone fs -count ofs://localhost/s3v/testbucket/
              3            1            1048576 ofs://localhost/s3v/testbucket
   [root@Linux /root/ozone]% bin/ozone fs -mv ofs://localhost/s3v/testbucket/dir1 ofs://localhost/s3v/testbucket/newdir1
   [root@Linux /root/ozone]% bin/ozone fs -ls ofs://localhost/s3v/testbucket/
   Found 1 items
   drwxrwxrwx   - root root          0 2022-09-19 14:39 ofs://localhost/s3v/testbucket/newdir1
   [root@Linux /root/ozone]% bin/ozone fs -mkdir ofs://localhost/s3v/testbucket/newdir1/dir2/dir3
   [root@Linux /root/ozone]% bin/ozone fs -ls ofs://localhost/s3v/testbucket/newdir1/dir2/
   Found 2 items
   drwxrwxrwx   - root root          0 2022-09-19 14:43 ofs://localhost/s3v/testbucket/newdir1/dir2/dir3
   -rw-rw-rw-   3 root root    1048576 2022-09-19 14:39 ofs://localhost/s3v/testbucket/newdir1/dir2/key1
   ```
   


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] sadanand48 commented on a diff in pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
sadanand48 commented on code in PR #3774:
URL: https://github.com/apache/ozone/pull/3774#discussion_r979021851


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java:
##########
@@ -1262,44 +1264,70 @@ private OzoneFileStatus getOzoneFileStatus(OmKeyArgs args,
       // Check if the key is a file.
       String fileKeyBytes = metadataManager.getOzoneKey(
               volumeName, bucketName, keyName);
-      fileKeyInfo = metadataManager
-          .getKeyTable(getBucketLayout(metadataManager, volumeName, bucketName))
-          .get(fileKeyBytes);
+      BucketLayout layout =
+          getBucketLayout(metadataManager, volumeName, bucketName);
+      fileKeyInfo = metadataManager.getKeyTable(layout).get(fileKeyBytes);
+      String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
 
       // Check if the key is a directory.
       if (fileKeyInfo == null) {
-        String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
         String dirKeyBytes = metadataManager.getOzoneKey(
                 volumeName, bucketName, dirKey);
-        OmKeyInfo dirKeyInfo = metadataManager.getKeyTable(
-                getBucketLayout(metadataManager, volumeName, bucketName))
-            .get(dirKeyBytes);
-        if (dirKeyInfo != null) {
-          return new OzoneFileStatus(dirKeyInfo, scmBlockSize, true);
+        dirKeyInfo = metadataManager.getKeyTable(layout).get(dirKeyBytes);
+
+        // Check if the key is a prefix.
+        // Some keys may contain '/' Ozone will treat '/' as directory separator
+        // such as : key name is 'a/b/c', 'a' and 'b' may not really exist,
+        // but Ozone treats 'a' and 'b' as a directory.
+        // we need create a fake directory 'a' or 'a/b'
+        if (dirKeyInfo == null) {
+          Table.KeyValue<String, OmKeyInfo> keyValue =
+              metadataManager.getKeyTable(layout).iterator().seek(fileKeyBytes);
+          if (keyValue != null) {
+            Path fullPath = Paths.get(keyValue.getValue().getKeyName());
+            Path subPath = Paths.get(dirKey);
+            OmKeyInfo omKeyInfo = keyValue.getValue();
+            if (fullPath.startsWith(subPath)) {
+              // create fake directory
+              fakeDirKeyInfo = createDirectoryKey(
+                  omKeyInfo.getVolumeName(),
+                  omKeyInfo.getBucketName(),
+                  dirKey,
+                  omKeyInfo.getAcls());
+            }
+          }
         }
       }
     } finally {
       metadataManager.getLock().releaseReadLock(BUCKET_LOCK, volumeName,
               bucketName);
+    }
 
+    if (fileKeyInfo != null) {

Review Comment:
   `if (fileKeyInfo != null) {
           metadataManager.getLock().releaseReadLock(BUCKET_LOCK, volumeName,
               bucketName);`
   In this case we would need to re-acquire lock while iterating the table in the below condition which is not desirable as acquiring lock is expensive.
   



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] kaijchen commented on pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
kaijchen commented on PR #3774:
URL: https://github.com/apache/ozone/pull/3774#issuecomment-1330008135

   @xichen01 FYI, here is ITestOzoneContractMkdir repeated 100x with this PR merged.
   https://github.com/kaijchen/ozone/actions/runs/3570532658


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] kaijchen commented on pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
kaijchen commented on PR #3774:
URL: https://github.com/apache/ozone/pull/3774#issuecomment-1291668912

   > @kaijchen Are there some failed operations I can refer to them? So I can find out which tests are flaky.
   
   Here is one of the failing case, but not the only one. Please run ITestOzoneContractMkdir multiple times to find out more.
   https://github.com/apache/ozone/actions/runs/3322837635/jobs/5492873757


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] sadanand48 commented on a diff in pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
sadanand48 commented on code in PR #3774:
URL: https://github.com/apache/ozone/pull/3774#discussion_r991928728


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java:
##########
@@ -1221,28 +1223,46 @@ private OzoneFileStatus getOzoneFileStatus(OmKeyArgs args,
       // Check if the key is a file.
       String fileKeyBytes = metadataManager.getOzoneKey(
               volumeName, bucketName, keyName);
-      fileKeyInfo = metadataManager
-          .getKeyTable(getBucketLayout(metadataManager, volumeName, bucketName))
-          .get(fileKeyBytes);
+      BucketLayout layout =
+          getBucketLayout(metadataManager, volumeName, bucketName);
+      fileKeyInfo = metadataManager.getKeyTable(layout).get(fileKeyBytes);
+      String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
 
       // Check if the key is a directory.
       if (fileKeyInfo == null) {
-        String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
         String dirKeyBytes = metadataManager.getOzoneKey(
                 volumeName, bucketName, dirKey);
-        OmKeyInfo dirKeyInfo = metadataManager.getKeyTable(
-                getBucketLayout(metadataManager, volumeName, bucketName))
-            .get(dirKeyBytes);
-        if (dirKeyInfo != null) {
-          return new OzoneFileStatus(dirKeyInfo, scmBlockSize, true);
+        dirKeyInfo = metadataManager.getKeyTable(layout).get(dirKeyBytes);
+
+        // Check if the key is a prefix.
+        // Some keys may contain '/' Ozone will treat '/' as directory separator
+        // such as : key name is 'a/b/c', 'a' and 'b' may not really exist,
+        // but Ozone treats 'a' and 'b' as a directory.
+        // we need create a fake directory 'a' or 'a/b'
+        if (dirKeyInfo == null) {
+          Table.KeyValue<String, OmKeyInfo> keyValue =
+              metadataManager.getKeyTable(layout).iterator().seek(fileKeyBytes);
+          if (keyValue != null) {
+            Path fullPath = Paths.get(keyValue.getValue().getKeyName());
+            Path subPath = Paths.get(dirKey);
+            OmKeyInfo omKeyInfo = keyValue.getValue();
+            if (fullPath.startsWith(subPath)) {
+              // create fake directory
+              fakeDirKeyInfo = createDirectoryKey(
+                  omKeyInfo,
+                  dirKey);
+            }
+          }
         }
       }
+    } catch (Exception e) {

Review Comment:
   Let's remove this catch as the method already throws IOException and the caller will have to catch the exception.



##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerImpl.java:
##########
@@ -1273,6 +1273,67 @@ public void testListStatus() throws IOException {
     }
   }
 
+  @Test
+  public void testGetFileStatus() throws IOException {
+    // create a key
+    String keyName = RandomStringUtils.randomAlphabetic(5);
+    OmKeyArgs keyArgs = createBuilder()
+        .setKeyName(keyName)
+        .setLatestVersionLocation(true)
+        .build();
+    writeClient.createFile(keyArgs, false, false);
+    OpenKeySession keySession = writeClient.createFile(keyArgs, true, true);
+    keyArgs.setLocationInfoList(
+        keySession.getKeyInfo().getLatestVersionLocations().getLocationList());
+    writeClient.commitKey(keyArgs, keySession.getId());
+    OzoneFileStatus ozoneFileStatus = keyManager.getFileStatus(keyArgs);
+    Assert.assertEquals(keyName, ozoneFileStatus.getKeyInfo().getFileName());
+  }
+
+  @Test
+  public void testGetFileStatusWithFakeDir() throws IOException {
+    String parentDir = "dir1";
+    String key = "key1";
+    String fullKeyName = parentDir + OZONE_URI_DELIMITER + key;
+    OzoneFileStatus ozoneFileStatus;
+
+    // create a key "dir1/key1"
+    OmKeyArgs keyArgs = createBuilder().setKeyName(fullKeyName).build();
+    OpenKeySession keySession = writeClient.createFile(keyArgs, true, true);

Review Comment:
   ```suggestion
       OpenKeySession keySession = writeClient.openKey(keyArgs);
   ```
   createFile will create an intermediate dir instead openKey should be used here



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] kaijchen commented on pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
kaijchen commented on PR #3774:
URL: https://github.com/apache/ozone/pull/3774#issuecomment-1328950133

   @xichen01 I can help take a look if you need.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] xichen01 commented on a diff in pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
xichen01 commented on code in PR #3774:
URL: https://github.com/apache/ozone/pull/3774#discussion_r978932970


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java:
##########
@@ -1262,44 +1264,70 @@ private OzoneFileStatus getOzoneFileStatus(OmKeyArgs args,
       // Check if the key is a file.
       String fileKeyBytes = metadataManager.getOzoneKey(
               volumeName, bucketName, keyName);
-      fileKeyInfo = metadataManager
-          .getKeyTable(getBucketLayout(metadataManager, volumeName, bucketName))
-          .get(fileKeyBytes);
+      BucketLayout layout =
+          getBucketLayout(metadataManager, volumeName, bucketName);
+      fileKeyInfo = metadataManager.getKeyTable(layout).get(fileKeyBytes);
+      String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
 
       // Check if the key is a directory.
       if (fileKeyInfo == null) {
-        String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
         String dirKeyBytes = metadataManager.getOzoneKey(
                 volumeName, bucketName, dirKey);
-        OmKeyInfo dirKeyInfo = metadataManager.getKeyTable(
-                getBucketLayout(metadataManager, volumeName, bucketName))
-            .get(dirKeyBytes);
-        if (dirKeyInfo != null) {
-          return new OzoneFileStatus(dirKeyInfo, scmBlockSize, true);
+        dirKeyInfo = metadataManager.getKeyTable(layout).get(dirKeyBytes);
+
+        // Check if the key is a prefix.
+        // Some keys may contain '/' Ozone will treat '/' as directory separator
+        // such as : key name is 'a/b/c', 'a' and 'b' may not really exist,
+        // but Ozone treats 'a' and 'b' as a directory.
+        // we need create a fake directory 'a' or 'a/b'
+        if (dirKeyInfo == null) {
+          Table.KeyValue<String, OmKeyInfo> keyValue =
+              metadataManager.getKeyTable(layout).iterator().seek(fileKeyBytes);
+          if (keyValue != null) {
+            Path fullPath = Paths.get(keyValue.getValue().getKeyName());
+            Path subPath = Paths.get(dirKey);
+            OmKeyInfo omKeyInfo = keyValue.getValue();
+            if (fullPath.startsWith(subPath)) {
+              // create fake directory
+              fakeDirKeyInfo = createDirectoryKey(
+                  omKeyInfo.getVolumeName(),
+                  omKeyInfo.getBucketName(),
+                  dirKey,
+                  omKeyInfo.getAcls());
+            }
+          }
         }
       }
     } finally {
       metadataManager.getLock().releaseReadLock(BUCKET_LOCK, volumeName,
               bucketName);
+    }
 
+    if (fileKeyInfo != null) {

Review Comment:
   how about like that:
   ```java
     private OzoneFileStatus getOzoneFileStatus(OmKeyArgs args,
         String clientAddress) throws IOException {
   
       Preconditions.checkNotNull(args, "Key args can not be null");
       final String volumeName = args.getVolumeName();
       final String bucketName = args.getBucketName();
       final String keyName = args.getKeyName();
   
       OmKeyInfo fileKeyInfo = null;
       OmKeyInfo dirKeyInfo = null;
       OmKeyInfo fakeDirKeyInfo = null;
       metadataManager.getLock().acquireReadLock(BUCKET_LOCK, volumeName,
           bucketName);
       String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
       String fileKeyBytes = metadataManager.getOzoneKey(
           volumeName, bucketName, keyName);
       BucketLayout layout =
           getBucketLayout(metadataManager, volumeName, bucketName);
       try {
         // Check if this is the root of the filesystem.
         if (keyName.length() == 0) {
           OMFileRequest.validateBucket(metadataManager, volumeName, bucketName);
           return new OzoneFileStatus();
         }
   
         // Check if the key is a file.
         fileKeyInfo = metadataManager.getKeyTable(layout).get(fileKeyBytes);
         } catch (Exception e) {
           LOG.error("", e);
         }
         if (fileKeyInfo != null) {
           metadataManager.getLock().releaseReadLock(BUCKET_LOCK, volumeName,
               bucketName);
           // if the key is a file then do refresh pipeline info in OM by asking SCM
           if (args.getLatestVersionLocation()) {
             slimLocationVersion(fileKeyInfo);
           }
           // If operation is head, do not perform any additional steps
           // As head operation does not need any of those details.
           if (!args.isHeadOp()) {
             // refreshPipeline flag check has been removed as part of
             // https://issues.apache.org/jira/browse/HDDS-3658.
             // Please refer this jira for more details.
             refresh(fileKeyInfo);
             if (args.getSortDatanodes()) {
               sortDatanodes(clientAddress, fileKeyInfo);
             }
           }
           return new OzoneFileStatus(fileKeyInfo, scmBlockSize, false);
         } else {
           try {
             // Check if the key is a directory.
             String dirKeyBytes = metadataManager.getOzoneKey(
                 volumeName, bucketName, dirKey);
             dirKeyInfo = metadataManager.getKeyTable(layout).get(dirKeyBytes);
   
             // Check if the key is a prefix.
             // Some keys may contain '/' Ozone will treat '/' as directory separator
             // such as : key name is 'a/b/c', 'a' and 'b' may not really exist,
             // but Ozone treats 'a' and 'b' as a directory.
             // we need create a fake directory 'a' or 'a/b'
             if (dirKeyInfo == null) {
               Table.KeyValue<String, OmKeyInfo> keyValue =
                   metadataManager.getKeyTable(layout).iterator().seek(fileKeyBytes);
               if (keyValue != null) {
                 Path fullPath = Paths.get(keyValue.getValue().getKeyName());
                 Path subPath = Paths.get(dirKey);
                 OmKeyInfo omKeyInfo = keyValue.getValue();
                 if (fullPath.startsWith(subPath)) {
                   // create fake directory
                   fakeDirKeyInfo = createDirectoryKey(
                       omKeyInfo.getVolumeName(),
                       omKeyInfo.getBucketName(),
                       dirKey,
                       omKeyInfo.getAcls());
                 }
               }
             }
           } finally {
             metadataManager.getLock().releaseReadLock(BUCKET_LOCK, volumeName,
                 bucketName);
         }
       }
   
       if (dirKeyInfo != null) {
         return new OzoneFileStatus(dirKeyInfo, scmBlockSize, true);
       }
   
       if (fakeDirKeyInfo != null) {
         return new OzoneFileStatus(fakeDirKeyInfo, scmBlockSize, true);
       }
   
       // Key is not found, throws exception
       if (LOG.isDebugEnabled()) {
         LOG.debug("Unable to get file status for the key: volume: {}, bucket:" +
                 " {}, key: {}, with error: No such file exists.",
             volumeName, bucketName, keyName);
       }
       throw new OMException("Unable to get file status: volume: " +
           volumeName + " bucket: " + bucketName + " key: " + keyName,
           FILE_NOT_FOUND);
    }
   ```



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] xichen01 commented on pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
xichen01 commented on PR #3774:
URL: https://github.com/apache/ozone/pull/3774#issuecomment-1273596459

   @sadanand48 PTAL Thanks.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] sadanand48 commented on pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
sadanand48 commented on PR #3774:
URL: https://github.com/apache/ozone/pull/3774#issuecomment-1328745934

   @xichen01 I think it would be better to have this fix, could you please take a look at the failures.
   
   
   
   


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] xichen01 commented on pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
xichen01 commented on PR #3774:
URL: https://github.com/apache/ozone/pull/3774#issuecomment-1336192888

   @kaijchen I think the issue of  `ITestOzoneContractMkdir` should have been fixed, can you run it multiple times to confirm the fix, I have run it multiple times on my Linux and have not reproduced the issue again, thanks a lot.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] kaijchen commented on pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
kaijchen commented on PR #3774:
URL: https://github.com/apache/ozone/pull/3774#issuecomment-1291454315

   Sorry I have to revert this commit because it's making `ITestOzoneContractMkdir` flaky.
   Please take a look and submit another PR for this fix.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] kaijchen merged pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
kaijchen merged PR #3774:
URL: https://github.com/apache/ozone/pull/3774


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] duongkame commented on a diff in pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
duongkame commented on code in PR #3774:
URL: https://github.com/apache/ozone/pull/3774#discussion_r995034619


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java:
##########
@@ -1221,28 +1223,44 @@ private OzoneFileStatus getOzoneFileStatus(OmKeyArgs args,
       // Check if the key is a file.
       String fileKeyBytes = metadataManager.getOzoneKey(
               volumeName, bucketName, keyName);
-      fileKeyInfo = metadataManager
-          .getKeyTable(getBucketLayout(metadataManager, volumeName, bucketName))
-          .get(fileKeyBytes);
+      BucketLayout layout =
+          getBucketLayout(metadataManager, volumeName, bucketName);
+      fileKeyInfo = metadataManager.getKeyTable(layout).get(fileKeyBytes);
+      String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
 
       // Check if the key is a directory.
       if (fileKeyInfo == null) {
-        String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
         String dirKeyBytes = metadataManager.getOzoneKey(
                 volumeName, bucketName, dirKey);
-        OmKeyInfo dirKeyInfo = metadataManager.getKeyTable(
-                getBucketLayout(metadataManager, volumeName, bucketName))
-            .get(dirKeyBytes);
-        if (dirKeyInfo != null) {
-          return new OzoneFileStatus(dirKeyInfo, scmBlockSize, true);
+        dirKeyInfo = metadataManager.getKeyTable(layout).get(dirKeyBytes);
+
+        // Check if the key is a prefix.
+        // Some keys may contain '/' Ozone will treat '/' as directory separator
+        // such as : key name is 'a/b/c', 'a' and 'b' may not really exist,
+        // but Ozone treats 'a' and 'b' as a directory.
+        // we need create a fake directory 'a' or 'a/b'
+        if (dirKeyInfo == null) {

Review Comment:
   The method `getFileStatus` is getting longer. Maybe it's worth pulling this snippet as a function.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] xichen01 commented on pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
xichen01 commented on PR #3774:
URL: https://github.com/apache/ozone/pull/3774#issuecomment-1329390520

   > @xichen01 I can help take a look if you need.
   
   yeah, thank you, I think it would be helpful, and if you have time, I will prioritize this issue as well


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] xichen01 commented on a diff in pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
xichen01 commented on code in PR #3774:
URL: https://github.com/apache/ozone/pull/3774#discussion_r978893335


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java:
##########
@@ -1262,44 +1264,70 @@ private OzoneFileStatus getOzoneFileStatus(OmKeyArgs args,
       // Check if the key is a file.
       String fileKeyBytes = metadataManager.getOzoneKey(
               volumeName, bucketName, keyName);
-      fileKeyInfo = metadataManager
-          .getKeyTable(getBucketLayout(metadataManager, volumeName, bucketName))
-          .get(fileKeyBytes);
+      BucketLayout layout =
+          getBucketLayout(metadataManager, volumeName, bucketName);
+      fileKeyInfo = metadataManager.getKeyTable(layout).get(fileKeyBytes);
+      String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
 
       // Check if the key is a directory.
       if (fileKeyInfo == null) {
-        String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
         String dirKeyBytes = metadataManager.getOzoneKey(
                 volumeName, bucketName, dirKey);
-        OmKeyInfo dirKeyInfo = metadataManager.getKeyTable(
-                getBucketLayout(metadataManager, volumeName, bucketName))
-            .get(dirKeyBytes);
-        if (dirKeyInfo != null) {
-          return new OzoneFileStatus(dirKeyInfo, scmBlockSize, true);
+        dirKeyInfo = metadataManager.getKeyTable(layout).get(dirKeyBytes);
+
+        // Check if the key is a prefix.
+        // Some keys may contain '/' Ozone will treat '/' as directory separator
+        // such as : key name is 'a/b/c', 'a' and 'b' may not really exist,
+        // but Ozone treats 'a' and 'b' as a directory.
+        // we need create a fake directory 'a' or 'a/b'
+        if (dirKeyInfo == null) {
+          Table.KeyValue<String, OmKeyInfo> keyValue =
+              metadataManager.getKeyTable(layout).iterator().seek(fileKeyBytes);
+          if (keyValue != null) {
+            Path fullPath = Paths.get(keyValue.getValue().getKeyName());
+            Path subPath = Paths.get(dirKey);
+            OmKeyInfo omKeyInfo = keyValue.getValue();
+            if (fullPath.startsWith(subPath)) {
+              // create fake directory
+              fakeDirKeyInfo = createDirectoryKey(
+                  omKeyInfo.getVolumeName(),
+                  omKeyInfo.getBucketName(),
+                  dirKey,
+                  omKeyInfo.getAcls());
+            }
+          }
         }
       }
     } finally {
       metadataManager.getLock().releaseReadLock(BUCKET_LOCK, volumeName,
               bucketName);
+    }
 
+    if (fileKeyInfo != null) {

Review Comment:
   I want to avoid return in finally here, return in finally is not a good practice, but I didn't find a better way to deal with it. do you have any suggestions?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] kaijchen commented on pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
kaijchen commented on PR #3774:
URL: https://github.com/apache/ozone/pull/3774#issuecomment-1290444547

   Thanks @xichen01 for the work, @duongkame and @sadanand48 for the review.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] xichen01 commented on pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
xichen01 commented on PR #3774:
URL: https://github.com/apache/ozone/pull/3774#issuecomment-1329385579

   @sadanand48 @kaijchen Okay, I'll check this PR, I've looked at it briefly before, but I haven't identified possible reasons causing ITestOzoneContractMkdir flaky.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] sadanand48 commented on a diff in pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
sadanand48 commented on code in PR #3774:
URL: https://github.com/apache/ozone/pull/3774#discussion_r978381297


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerImpl.java:
##########
@@ -1272,6 +1272,67 @@ public void testListStatus() throws IOException {
     }
   }
 
+  @Test
+  public void testGetFileStatus() throws IOException {
+    // create a key
+    String keyName = RandomStringUtils.randomAlphabetic(5);
+    OmKeyArgs keyArgs = createBuilder()
+        .setKeyName(keyName)
+        .setLatestVersionLocation(true)
+        .build();
+    writeClient.createFile(keyArgs, false, false);
+    OpenKeySession keySession = writeClient.createFile(keyArgs, true, true);
+    keyArgs.setLocationInfoList(
+        keySession.getKeyInfo().getLatestVersionLocations().getLocationList());
+    writeClient.commitKey(keyArgs, keySession.getId());
+    OzoneFileStatus ozoneFileStatus = keyManager.getFileStatus(keyArgs);
+    Assert.assertEquals(keyName, ozoneFileStatus.getKeyInfo().getFileName());
+  }
+
+  @Test
+  public void testGetFileStatusWithFakeDir() throws IOException {
+    String parentDir = "dir1";
+    String key = "key1";
+    String fullKeyName = parentDir + OZONE_URI_DELIMITER + key;
+    OzoneFileStatus ozoneFileStatus;
+
+    // create a key "dir1/key1"
+    OmKeyArgs keyArgs = createBuilder().setKeyName(fullKeyName).build();
+    OpenKeySession keySession = writeClient.createFile(keyArgs, true, true);
+    keyArgs.setLocationInfoList(
+        keySession.getKeyInfo().getLatestVersionLocations().getLocationList());
+    writeClient.commitKey(keyArgs, keySession.getId());
+
+    // verify
+    String keyArg;
+    keyArg = metadataManager.getOzoneKey(VOLUME_NAME, BUCKET_NAME, parentDir);
+    Assert.assertNull(
+        metadataManager.getKeyTable(getDefaultBucketLayout()).get(keyArg));

Review Comment:
   The key table will have an entry for the parentDir here prefixed with "/" since we are using createFile i.e  the below code would throw exception as the parentDir is present in keyTable. Using `openKey` should solve this
   ```
   keyArg = metadataManager.getOzoneKey(VOLUME_NAME, BUCKET_NAME, parentDir + "/" );
   Assert.assertNull(
           metadataManager.getKeyTable(getDefaultBucketLayout()).get(keyArg));
   ```
   



##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerImpl.java:
##########
@@ -1272,6 +1272,67 @@ public void testListStatus() throws IOException {
     }
   }
 
+  @Test
+  public void testGetFileStatus() throws IOException {
+    // create a key
+    String keyName = RandomStringUtils.randomAlphabetic(5);
+    OmKeyArgs keyArgs = createBuilder()
+        .setKeyName(keyName)
+        .setLatestVersionLocation(true)
+        .build();
+    writeClient.createFile(keyArgs, false, false);
+    OpenKeySession keySession = writeClient.createFile(keyArgs, true, true);
+    keyArgs.setLocationInfoList(
+        keySession.getKeyInfo().getLatestVersionLocations().getLocationList());
+    writeClient.commitKey(keyArgs, keySession.getId());
+    OzoneFileStatus ozoneFileStatus = keyManager.getFileStatus(keyArgs);
+    Assert.assertEquals(keyName, ozoneFileStatus.getKeyInfo().getFileName());
+  }
+
+  @Test
+  public void testGetFileStatusWithFakeDir() throws IOException {
+    String parentDir = "dir1";
+    String key = "key1";
+    String fullKeyName = parentDir + OZONE_URI_DELIMITER + key;
+    OzoneFileStatus ozoneFileStatus;
+
+    // create a key "dir1/key1"
+    OmKeyArgs keyArgs = createBuilder().setKeyName(fullKeyName).build();
+    OpenKeySession keySession = writeClient.createFile(keyArgs, true, true);

Review Comment:
   `writeClient.createFile` would always create intermediate dirs so the dirs returned by getFileStatus are not fake.
   Instead we should use `writeClient.openKey` to test this correctly



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java:
##########
@@ -1262,44 +1264,70 @@ private OzoneFileStatus getOzoneFileStatus(OmKeyArgs args,
       // Check if the key is a file.
       String fileKeyBytes = metadataManager.getOzoneKey(
               volumeName, bucketName, keyName);
-      fileKeyInfo = metadataManager
-          .getKeyTable(getBucketLayout(metadataManager, volumeName, bucketName))
-          .get(fileKeyBytes);
+      BucketLayout layout =
+          getBucketLayout(metadataManager, volumeName, bucketName);
+      fileKeyInfo = metadataManager.getKeyTable(layout).get(fileKeyBytes);
+      String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
 
       // Check if the key is a directory.
       if (fileKeyInfo == null) {
-        String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
         String dirKeyBytes = metadataManager.getOzoneKey(
                 volumeName, bucketName, dirKey);
-        OmKeyInfo dirKeyInfo = metadataManager.getKeyTable(
-                getBucketLayout(metadataManager, volumeName, bucketName))
-            .get(dirKeyBytes);
-        if (dirKeyInfo != null) {
-          return new OzoneFileStatus(dirKeyInfo, scmBlockSize, true);
+        dirKeyInfo = metadataManager.getKeyTable(layout).get(dirKeyBytes);
+
+        // Check if the key is a prefix.
+        // Some keys may contain '/' Ozone will treat '/' as directory separator
+        // such as : key name is 'a/b/c', 'a' and 'b' may not really exist,
+        // but Ozone treats 'a' and 'b' as a directory.
+        // we need create a fake directory 'a' or 'a/b'
+        if (dirKeyInfo == null) {
+          Table.KeyValue<String, OmKeyInfo> keyValue =
+              metadataManager.getKeyTable(layout).iterator().seek(fileKeyBytes);
+          if (keyValue != null) {
+            Path fullPath = Paths.get(keyValue.getValue().getKeyName());
+            Path subPath = Paths.get(dirKey);
+            OmKeyInfo omKeyInfo = keyValue.getValue();
+            if (fullPath.startsWith(subPath)) {
+              // create fake directory
+              fakeDirKeyInfo = createDirectoryKey(
+                  omKeyInfo.getVolumeName(),
+                  omKeyInfo.getBucketName(),
+                  dirKey,
+                  omKeyInfo.getAcls());
+            }
+          }
         }
       }
     } finally {
       metadataManager.getLock().releaseReadLock(BUCKET_LOCK, volumeName,
               bucketName);
+    }
 
+    if (fileKeyInfo != null) {

Review Comment:
   It's better to keep these below conditions inside the finally block, as they were earlier.



##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystem.java:
##########
@@ -1033,6 +1084,18 @@ public void testRenameFileToDir() throws Exception {
             "file1")));
   }
 
+  @Test
+  public void testRenameContainDelimiterFile() throws Exception {
+    String sourceKeyName = "dir1/dir2/key1";
+    String targetKeyName = "dir1/dir2/key2";
+    TestDataUtil.createKey(ozoneBucket, sourceKeyName, "");
+
+    Path sourcePath = new Path(fs.getUri().toString() + "/" + sourceKeyName);
+    Path targetPath = new Path(fs.getUri().toString() + "/" + targetKeyName);
+    assertTrue(fs.rename(sourcePath, targetPath));

Review Comment:
   We could also check if `fs.rename `created intermediate dirs or not.



##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystem.java:
##########
@@ -335,6 +335,26 @@ public void testMakeDirsWithAnExistingDirectoryPath() throws Exception {
     assertTrue("Shouldn't send error if dir exists", status);
   }
 
+  @Test
+  public void testMakeDirsWithAnFakeDirectory() throws Exception {
+    /*
+     * Op 1. commit a key -> "dir1/dir2/key1"
+     * Op 2. create dir -> "dir1/testDir", the dir1 is a fake dir,
+     *  "dir1/testDir" can be created normal
+     */
+
+    String fakeParentKey = "dir1/dir2";
+    String fullKeyName = fakeParentKey + "/key1";
+    TestDataUtil.createKey(ozoneBucket, fullKeyName, "");
+
+    // /dir1/dir2 should not exist
+    assertFalse(fs.exists(new Path(fakeParentKey)));
+
+    // /dir1/dir2/key2 should be created because has a fake parent directory
+    Path subdir = new Path(fakeParentKey, "key2");
+    assertTrue(fs.mkdirs(subdir));

Review Comment:
   In here we can check `fs.exists` for dir1 & dir2.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] sadanand48 commented on a diff in pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
sadanand48 commented on code in PR #3774:
URL: https://github.com/apache/ozone/pull/3774#discussion_r979038472


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java:
##########
@@ -1262,44 +1264,70 @@ private OzoneFileStatus getOzoneFileStatus(OmKeyArgs args,
       // Check if the key is a file.
       String fileKeyBytes = metadataManager.getOzoneKey(
               volumeName, bucketName, keyName);
-      fileKeyInfo = metadataManager
-          .getKeyTable(getBucketLayout(metadataManager, volumeName, bucketName))
-          .get(fileKeyBytes);
+      BucketLayout layout =
+          getBucketLayout(metadataManager, volumeName, bucketName);
+      fileKeyInfo = metadataManager.getKeyTable(layout).get(fileKeyBytes);
+      String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
 
       // Check if the key is a directory.
       if (fileKeyInfo == null) {
-        String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
         String dirKeyBytes = metadataManager.getOzoneKey(
                 volumeName, bucketName, dirKey);
-        OmKeyInfo dirKeyInfo = metadataManager.getKeyTable(
-                getBucketLayout(metadataManager, volumeName, bucketName))
-            .get(dirKeyBytes);
-        if (dirKeyInfo != null) {
-          return new OzoneFileStatus(dirKeyInfo, scmBlockSize, true);
+        dirKeyInfo = metadataManager.getKeyTable(layout).get(dirKeyBytes);
+
+        // Check if the key is a prefix.
+        // Some keys may contain '/' Ozone will treat '/' as directory separator
+        // such as : key name is 'a/b/c', 'a' and 'b' may not really exist,
+        // but Ozone treats 'a' and 'b' as a directory.
+        // we need create a fake directory 'a' or 'a/b'
+        if (dirKeyInfo == null) {
+          Table.KeyValue<String, OmKeyInfo> keyValue =
+              metadataManager.getKeyTable(layout).iterator().seek(fileKeyBytes);
+          if (keyValue != null) {
+            Path fullPath = Paths.get(keyValue.getValue().getKeyName());
+            Path subPath = Paths.get(dirKey);
+            OmKeyInfo omKeyInfo = keyValue.getValue();
+            if (fullPath.startsWith(subPath)) {
+              // create fake directory
+              fakeDirKeyInfo = createDirectoryKey(
+                  omKeyInfo.getVolumeName(),
+                  omKeyInfo.getBucketName(),
+                  dirKey,
+                  omKeyInfo.getAcls());
+            }
+          }
         }
       }
     } finally {
       metadataManager.getLock().releaseReadLock(BUCKET_LOCK, volumeName,
               bucketName);
+    }
 
+    if (fileKeyInfo != null) {

Review Comment:
   > how about like that:
   
   Looks ok, let's even add the last two conditions for dirKeyInfo & fakeDirKeyInfo inside the try block as there is no catch block for the 2nd try and if exception occurs , statements after finally may not be reachable.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] xichen01 commented on pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
xichen01 commented on PR #3774:
URL: https://github.com/apache/ozone/pull/3774#issuecomment-1255763985

   when '/' in key name the `listSatus` will create a `fake directory` return to the client. The client will get the fake directory info through `getfileStatus`, but currently `getfileStatus` has no logic for `fake directory`, this is inconsistent with `listStatus `behavior, So some exceptions occur.
   This PR is to make `listStatus` and `getFileStatus` have the same behavior.
   https://github.com/apache/ozone/blob/6c1a5ee07eedfee3e40405bc2d36a7c07e66ab76/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java#L1700-L1711
   
   The problem I'm currently having is that I can't use the `-du/-count` command. Since some keys have '/' in their names.
   For some already created and used buckets whose layout is LEGACY, some file system commands cannot be used due to the `fake directory` returned by `listStatus`. This should not be expected behavior, we should be able to handle this situation correctly
   


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] kerneltime commented on pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
kerneltime commented on PR #3774:
URL: https://github.com/apache/ozone/pull/3774#issuecomment-1258262533

   cc @duongkame 


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] xichen01 commented on pull request #3774: HDDS-7253. Fix exception when '/' in key name

Posted by GitBox <gi...@apache.org>.
xichen01 commented on PR #3774:
URL: https://github.com/apache/ozone/pull/3774#issuecomment-1291665880

   @kaijchen  Are there some failed operations I can refer to them? So I can find out which tests are flaky.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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