From 20f4ff87a8342cb07c238f296a058dc53e6dd9cb Mon Sep 17 00:00:00 2001 From: Wei-Chiu Chuang Date: Thu, 21 Mar 2024 16:37:34 -0700 Subject: [PATCH] HBASE-28448 CompressionTest hangs when run over a Ozone ofs path Change-Id: I92fdc0d1ceda10b25a1b7469b49e14a25f3a10bd --- .../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"); } }