Skip to content

Commit

Permalink
[Fix](core) Fix file system scan deleted file (apache#29266)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yukang-Lian authored Dec 29, 2023
1 parent c3679a2 commit 2f29dda
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion be/src/io/fs/local_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <system_error>
#include <utility>

#include "common/exception.h"
#include "gutil/macros.h"
#include "io/fs/err_utils.h"
#include "io/fs/file_system.h"
Expand Down Expand Up @@ -182,7 +183,11 @@ Status LocalFileSystem::directory_size(const Path& dir_path, size_t* dir_size) {
if (std::filesystem::exists(dir_path) && std::filesystem::is_directory(dir_path)) {
for (const auto& entry : std::filesystem::recursive_directory_iterator(dir_path)) {
if (std::filesystem::is_regular_file(entry)) {
*dir_size += std::filesystem::file_size(entry);
try {
*dir_size += std::filesystem::file_size(entry);
} catch (const std::exception& e) {
LOG(INFO) << "{}", e.what();
}
}
}
return Status::OK();
Expand Down

0 comments on commit 2f29dda

Please sign in to comment.