HuaHuaY commented on code in PR #649:
URL: https://github.com/apache/iceberg-cpp/pull/649#discussion_r3382389334
##########
src/iceberg/update/expire_snapshots.cc:
##########
@@ -99,19 +105,52 @@ class FileCleanupStrategy {
}
/// \brief Delete files at the given locations.
+ ///
+ /// Best-effort: errors are suppressed to mirror Java's
suppressFailureWhenFinished.
+ /// When a custom delete function was provided, deletes are invoked one path
at a
+ /// time, optionally parallelized via the strategy's executor. Otherwise the
FileIO
+ /// bulk `DeleteFiles` API is invoked once. In both modes the submitted task
is
+ /// wrapped in a bounded retry that stops on kNotFound.
void DeleteFiles(const std::unordered_set<std::string>& paths) {
- try {
- if (delete_func_) {
- for (const auto& path : paths) {
- delete_func_(path);
- }
- } else {
- std::vector<std::string> path_list(paths.begin(), paths.end());
- std::ignore = file_io_->DeleteFiles(path_list);
+ if (paths.empty()) return;
+ std::vector<std::string> path_list(paths.begin(), paths.end());
Review Comment:
We only need to create the vector when there is not `delete_func_`.
--
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]