chungen0126 commented on code in PR #11547:
URL: https://github.com/apache/ozone/pull/11547#discussion_r4493656242
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerReader.java:
##########
@@ -103,6 +108,29 @@ public void run() {
}
}
+ private void cleanupContainerCopyDir() {
+ // Startup loads containers before starting the replication server, so no
imports can be in progress here.
+ try {
+ File copyDir = ContainerImporter.getUntarDirectory(hddsVolume).toFile();
+ if (copyDir.exists()) {
+ File[] files = copyDir.listFiles();
+ if (files == null) {
+ throw new IOException("Failed to list " + copyDir);
+ }
+ for (File file : files) {
+ try {
+ FileUtils.forceDelete(file);
+ } catch (IOException | RuntimeException e) {
+ LOG.warn("Failed to remove leftover container import file {}",
file.getAbsolutePath(), e);
+ }
+ }
+ }
+ } catch (IOException | RuntimeException e) {
+ LOG.warn("Failed to remove leftover container import files under {}: {}",
+ hddsVolume.getVolumeRootDir(), e.getMessage(), e);
Review Comment:
I don't think we need to log here. Simply logging when `files == null` and
returning there should be enough.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]