xxubai commented on code in PR #4278:
URL: https://github.com/apache/amoro/pull/4278#discussion_r3637766313
##########
amoro-format-iceberg/src/main/java/org/apache/amoro/formats/iceberg/utils/RollingFileCleaner.java:
##########
@@ -110,27 +113,34 @@ private void doCleanFiles() {
}
}
}
- // Try to delete empty parent directories. Skipped automatically by
- // TableFileUtil.deleteEmptyDirectory when the underlying FileIO is an
object store.
- if (fileIO.supportFileSystemOperations()) {
- for (String parentDir : parentDirectories) {
- try {
- TableFileUtil.deleteEmptyDirectory(fileIO, parentDir,
excludeFiles);
- } catch (Exception e) {
- LOG.warn("Failed to delete empty parent directory: {}", parentDir,
e);
- }
- }
- }
LOG.debug("Cleaned expired a file group, total files: {}",
collectedFiles.size());
} finally {
- // Always drop both buffers so a failure in directory cleanup does not
cause the
- // already-deleted files to be re-submitted on the next batch.
- parentDirectories.clear();
collectedFiles.clear();
}
}
+ public void doCleanParentDirectory() {
Review Comment:
nit: can you limit the method scope? such as `private`
##########
amoro-format-iceberg/src/main/java/org/apache/amoro/formats/iceberg/utils/RollingFileCleaner.java:
##########
@@ -110,27 +113,34 @@ private void doCleanFiles() {
}
}
}
- // Try to delete empty parent directories. Skipped automatically by
- // TableFileUtil.deleteEmptyDirectory when the underlying FileIO is an
object store.
- if (fileIO.supportFileSystemOperations()) {
- for (String parentDir : parentDirectories) {
- try {
- TableFileUtil.deleteEmptyDirectory(fileIO, parentDir,
excludeFiles);
- } catch (Exception e) {
- LOG.warn("Failed to delete empty parent directory: {}", parentDir,
e);
- }
- }
- }
LOG.debug("Cleaned expired a file group, total files: {}",
collectedFiles.size());
} finally {
- // Always drop both buffers so a failure in directory cleanup does not
cause the
- // already-deleted files to be re-submitted on the next batch.
- parentDirectories.clear();
collectedFiles.clear();
}
}
+ public void doCleanParentDirectory() {
Review Comment:
nit: can you limit the method scope? such as `private`
##########
amoro-format-iceberg/src/main/java/org/apache/amoro/formats/iceberg/utils/RollingFileCleaner.java:
##########
@@ -110,27 +113,34 @@ private void doCleanFiles() {
}
}
}
- // Try to delete empty parent directories. Skipped automatically by
- // TableFileUtil.deleteEmptyDirectory when the underlying FileIO is an
object store.
- if (fileIO.supportFileSystemOperations()) {
- for (String parentDir : parentDirectories) {
- try {
- TableFileUtil.deleteEmptyDirectory(fileIO, parentDir,
excludeFiles);
- } catch (Exception e) {
- LOG.warn("Failed to delete empty parent directory: {}", parentDir,
e);
- }
- }
- }
LOG.debug("Cleaned expired a file group, total files: {}",
collectedFiles.size());
} finally {
- // Always drop both buffers so a failure in directory cleanup does not
cause the
- // already-deleted files to be re-submitted on the next batch.
- parentDirectories.clear();
collectedFiles.clear();
}
}
+ public void doCleanParentDirectory() {
Review Comment:
nit: can you limit the method scope? such as `private`
##########
amoro-format-iceberg/src/main/java/org/apache/amoro/utils/TableFileUtil.java:
##########
@@ -75,15 +76,24 @@ public static String getFileDir(String filePath) {
return filePath.substring(0, lastSlash);
}
+ public static void deleteEmptyDirectory(
+ AuthenticatedFileIO io, String directoryPath, Set<String> exclude) {
+ deleteEmptyDirectory(io, directoryPath, exclude, new HashSet<>());
+ }
+
/**
* Try to recursiveDelete the empty directory
*
* @param io mixed-format file io
* @param directoryPath directory location
- * @param exclude the directory will not be deleted
+ * @param exclude the directory will not be deleted @Param
directoriesToBeDeleted: all the
Review Comment:
```suggestion
* @param exclude the directory will not be deleted
* @Param directoriesToBeDeleted: all the directories that need to be
deleted
```
##########
amoro-format-iceberg/src/main/java/org/apache/amoro/utils/TableFileUtil.java:
##########
@@ -75,15 +76,24 @@ public static String getFileDir(String filePath) {
return filePath.substring(0, lastSlash);
}
+ public static void deleteEmptyDirectory(
+ AuthenticatedFileIO io, String directoryPath, Set<String> exclude) {
+ deleteEmptyDirectory(io, directoryPath, exclude, new HashSet<>());
+ }
+
/**
* Try to recursiveDelete the empty directory
*
* @param io mixed-format file io
* @param directoryPath directory location
- * @param exclude the directory will not be deleted
+ * @param exclude the directory will not be deleted @Param
directoriesToBeDeleted: all the
Review Comment:
```suggestion
* @param exclude the directory will not be deleted
* @Param directoriesToBeDeleted: all the
```
--
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]