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

sumitagrawal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 20aeda57f3 HDDS-12601. Unknown tarball cleanup for Recon OM DB 
snapshot. (#8084)
20aeda57f3 is described below

commit 20aeda57f3bab756ad67c013ce822a1643210b8d
Author: Devesh Kumar Singh <[email protected]>
AuthorDate: Wed Mar 19 17:49:25 2025 +0530

    HDDS-12601. Unknown tarball cleanup for Recon OM DB snapshot. (#8084)
    
    Co-authored-by: deveshsingh <devmadhu@[email protected]>
---
 .../recon/src/main/java/org/apache/hadoop/ozone/recon/ReconUtils.java  | 2 ++
 .../hadoop/ozone/recon/spi/impl/OzoneManagerServiceProviderImpl.java   | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconUtils.java
 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconUtils.java
index c80bcaa1ab..5786702bfc 100644
--- 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconUtils.java
+++ 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconUtils.java
@@ -63,6 +63,7 @@
 import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
 import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
 import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.hadoop.hdds.HddsConfigKeys;
 import org.apache.hadoop.hdds.HddsUtils;
@@ -555,6 +556,7 @@ public File getLastKnownDB(File reconDbDir, String 
fileNamePrefix) {
             }
           } catch (NumberFormatException nfEx) {
             log.warn("Unknown file found in Recon DB dir : {}", fileName);
+            FileUtils.deleteQuietly(snapshotFile);
           }
         }
       }
diff --git 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/OzoneManagerServiceProviderImpl.java
 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/OzoneManagerServiceProviderImpl.java
index 455dabf6ac..8dd33fdb39 100644
--- 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/OzoneManagerServiceProviderImpl.java
+++ 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/OzoneManagerServiceProviderImpl.java
@@ -408,7 +408,6 @@ connectionFactory, getOzoneManagerSnapshotUrl(),
       // Untar the checkpoint file.
       Path untarredDbDir = Paths.get(omSnapshotDBParentDir.getAbsolutePath(), 
snapshotFileName);
       reconUtils.untarCheckpointFile(targetFile, untarredDbDir);
-      FileUtils.deleteQuietly(targetFile);
 
       // Validate the presence of required SST files
       File[] sstFiles = untarredDbDir.toFile().listFiles((dir, name) -> 
name.endsWith(".sst"));
@@ -430,6 +429,8 @@ connectionFactory, getOzoneManagerSnapshotUrl(),
       LOG.error("Unable to obtain Ozone Manager DB Snapshot. ", e);
       reconContext.updateHealthStatus(new AtomicBoolean(false));
       
reconContext.updateErrors(ReconContext.ErrorCode.GET_OM_DB_SNAPSHOT_FAILED);
+    } finally {
+      FileUtils.deleteQuietly(targetFile);
     }
     return null;
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to