Skip to content

Commit 20aeda5

Browse files
devmadhuudeveshsingh
andauthored
HDDS-12601. Unknown tarball cleanup for Recon OM DB snapshot. (#8084)
Co-authored-by: deveshsingh <devmadhu@[email protected]>
1 parent 93cd5aa commit 20aeda5

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconUtils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
6464
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
6565
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
66+
import org.apache.commons.io.FileUtils;
6667
import org.apache.commons.lang3.StringUtils;
6768
import org.apache.hadoop.hdds.HddsConfigKeys;
6869
import org.apache.hadoop.hdds.HddsUtils;
@@ -555,6 +556,7 @@ public File getLastKnownDB(File reconDbDir, String fileNamePrefix) {
555556
}
556557
} catch (NumberFormatException nfEx) {
557558
log.warn("Unknown file found in Recon DB dir : {}", fileName);
559+
FileUtils.deleteQuietly(snapshotFile);
558560
}
559561
}
560562
}

hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/OzoneManagerServiceProviderImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,6 @@ connectionFactory, getOzoneManagerSnapshotUrl(),
408408
// Untar the checkpoint file.
409409
Path untarredDbDir = Paths.get(omSnapshotDBParentDir.getAbsolutePath(), snapshotFileName);
410410
reconUtils.untarCheckpointFile(targetFile, untarredDbDir);
411-
FileUtils.deleteQuietly(targetFile);
412411

413412
// Validate the presence of required SST files
414413
File[] sstFiles = untarredDbDir.toFile().listFiles((dir, name) -> name.endsWith(".sst"));
@@ -430,6 +429,8 @@ connectionFactory, getOzoneManagerSnapshotUrl(),
430429
LOG.error("Unable to obtain Ozone Manager DB Snapshot. ", e);
431430
reconContext.updateHealthStatus(new AtomicBoolean(false));
432431
reconContext.updateErrors(ReconContext.ErrorCode.GET_OM_DB_SNAPSHOT_FAILED);
432+
} finally {
433+
FileUtils.deleteQuietly(targetFile);
433434
}
434435
return null;
435436
}

0 commit comments

Comments
 (0)