From 0aaf372c5afbc006c9dcf192e053ce6501f000b7 Mon Sep 17 00:00:00 2001 From: Wei-Chiu Chuang Date: Tue, 9 Apr 2024 10:55:39 -0700 Subject: [PATCH] HBASE-28448 CompressionTest hangs when run over a Ozone ofs path (#5771) This bug was found via HDDS-10564. (cherry picked from commit adc79a0a9c2b579915a902f611a66edfddf3149c) --- .../hadoop/hbase/util/CompressionTest.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/CompressionTest.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/CompressionTest.java index 0870dbe6f9bc..9065ebf116b7 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/CompressionTest.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/CompressionTest.java @@ -152,17 +152,18 @@ public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); Path path = new Path(args[0]); - FileSystem fs = path.getFileSystem(conf); - if (fs.exists(path)) { - System.err.println("The specified path exists, aborting!"); - System.exit(1); - } + try (FileSystem fs = path.getFileSystem(conf)) { + if (fs.exists(path)) { + System.err.println("The specified path exists, aborting!"); + System.exit(1); + } - try { - doSmokeTest(fs, path, args[1]); - } finally { - fs.delete(path, false); + try { + doSmokeTest(fs, path, args[1]); + } finally { + fs.delete(path, false); + } + System.out.println("SUCCESS"); } - System.out.println("SUCCESS"); } }