You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by fo...@apache.org on 2023/02/11 02:33:45 UTC

[hudi] 18/20: [HUDI-5286] UnsupportedOperationException throws when enabling filesystem retry (#7313)

This is an automated email from the ASF dual-hosted git repository.

forwardxu pushed a commit to branch release-0.12.1
in repository https://gitbox.apache.org/repos/asf/hudi.git

commit 0f056e52e583828a7fbbb21454e60d1a9b74d48d
Author: Danny Chan <yu...@gmail.com>
AuthorDate: Tue Nov 29 10:20:41 2022 +0800

    [HUDI-5286] UnsupportedOperationException throws when enabling filesystem retry (#7313)
    
    (cherry picked from commit e88b4748127c45f287e45a11dda9183e29ad87d5)
---
 .../hudi/common/fs/HoodieRetryWrapperFileSystem.java       |  5 +++++
 .../hudi/common/fs/TestFSUtilsWithRetryWrapperEnable.java  | 14 ++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/hudi-common/src/main/java/org/apache/hudi/common/fs/HoodieRetryWrapperFileSystem.java b/hudi-common/src/main/java/org/apache/hudi/common/fs/HoodieRetryWrapperFileSystem.java
index 075f811a42e..051cece84fe 100644
--- a/hudi-common/src/main/java/org/apache/hudi/common/fs/HoodieRetryWrapperFileSystem.java
+++ b/hudi-common/src/main/java/org/apache/hudi/common/fs/HoodieRetryWrapperFileSystem.java
@@ -254,4 +254,9 @@ public class HoodieRetryWrapperFileSystem extends FileSystem {
   public Configuration getConf() {
     return fileSystem.getConf();
   }
+
+  @Override
+  public String getScheme() {
+    return fileSystem.getScheme();
+  }
 }
diff --git a/hudi-common/src/test/java/org/apache/hudi/common/fs/TestFSUtilsWithRetryWrapperEnable.java b/hudi-common/src/test/java/org/apache/hudi/common/fs/TestFSUtilsWithRetryWrapperEnable.java
index 0b849ebec81..1c5447751f7 100644
--- a/hudi-common/src/test/java/org/apache/hudi/common/fs/TestFSUtilsWithRetryWrapperEnable.java
+++ b/hudi-common/src/test/java/org/apache/hudi/common/fs/TestFSUtilsWithRetryWrapperEnable.java
@@ -38,6 +38,7 @@ import java.net.URI;
 import java.util.Arrays;
 import java.util.List;
 
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
 /**
@@ -80,6 +81,14 @@ public class TestFSUtilsWithRetryWrapperEnable extends TestFSUtils {
     folders.forEach(f -> assertThrows(RuntimeException.class, () -> metaClient.getFs().mkdirs(new Path(new Path(basePath), f))));
   }
 
+  @Test
+  public void testGetSchema() {
+    FakeRemoteFileSystem fakeFs = new FakeRemoteFileSystem(FSUtils.getFs(metaClient.getMetaPath(), metaClient.getHadoopConf()), 100);
+    FileSystem fileSystem = new HoodieRetryWrapperFileSystem(fakeFs, maxRetryIntervalMs, maxRetryNumbers, initialRetryIntervalMs, "");
+    HoodieWrapperFileSystem fs = new HoodieWrapperFileSystem(fileSystem, new NoOpConsistencyGuard());
+    assertDoesNotThrow(fs::getScheme, "Method #getSchema does not implement correctly");
+  }
+
   /**
    * Fake remote FileSystem which will throw RuntimeException something like AmazonS3Exception 503.
    */
@@ -206,5 +215,10 @@ public class TestFSUtilsWithRetryWrapperEnable extends TestFSUtils {
     public Configuration getConf() {
       return fs.getConf();
     }
+
+    @Override
+    public String getScheme() {
+      return fs.getScheme();
+    }
   }
 }