This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 73f010133de [fix](clone) Increase robustness for clone (#36642)
73f010133de is described below
commit 73f010133deedae92afe81950b3e5421420c91fe
Author: deardeng <[email protected]>
AuthorDate: Fri Jun 21 20:40:07 2024 +0800
[fix](clone) Increase robustness for clone (#36642)
---
be/src/io/cache/fs_file_cache_storage.cpp | 7 ++++++-
be/src/olap/single_replica_compaction.cpp | 7 ++++++-
be/src/olap/task/engine_clone_task.cpp | 16 ++++++++++++++--
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/be/src/io/cache/fs_file_cache_storage.cpp
b/be/src/io/cache/fs_file_cache_storage.cpp
index c66c7351644..b829573a56d 100644
--- a/be/src/io/cache/fs_file_cache_storage.cpp
+++ b/be/src/io/cache/fs_file_cache_storage.cpp
@@ -463,7 +463,12 @@ void
FSFileCacheStorage::load_cache_info_into_memory(BlockFileCache* _mgr) const
if (key_prefix_it->path().filename().native().size() !=
KEY_PREFIX_LENGTH) {
LOG(WARNING) << "Unknown directory " <<
key_prefix_it->path().native()
<< ", try to remove it";
- std::filesystem::remove(key_prefix_it->path());
+ std::error_code ec;
+ std::filesystem::remove(key_prefix_it->path(), ec);
+ if (ec) {
+ LOG(WARNING) << "failed to remove=" <<
key_prefix_it->path()
+ << " msg=" << ec.message();
+ }
continue;
}
std::filesystem::directory_iterator key_it {key_prefix_it->path(),
ec};
diff --git a/be/src/olap/single_replica_compaction.cpp
b/be/src/olap/single_replica_compaction.cpp
index 42d5a417409..571156e721c 100644
--- a/be/src/olap/single_replica_compaction.cpp
+++ b/be/src/olap/single_replica_compaction.cpp
@@ -582,7 +582,12 @@ Status SingleReplicaCompaction::_finish_clone(const
string& clone_dir,
}
// clear clone dir
std::filesystem::path clone_dir_path(clone_dir);
- std::filesystem::remove_all(clone_dir_path);
+ std::error_code ec;
+ std::filesystem::remove_all(clone_dir_path, ec);
+ if (ec) {
+ LOG(WARNING) << "failed to remove=" << clone_dir_path << " msg=" <<
ec.message();
+ return Status::IOError("failed to remove {}, due to {}", clone_dir,
ec.message());
+ }
LOG(INFO) << "finish to clone data, clear downloaded data. res=" << res
<< ", tablet=" << _tablet->tablet_id() << ", clone_dir=" <<
clone_dir;
return res;
diff --git a/be/src/olap/task/engine_clone_task.cpp
b/be/src/olap/task/engine_clone_task.cpp
index 776dc308d46..590fdd1b4a7 100644
--- a/be/src/olap/task/engine_clone_task.cpp
+++ b/be/src/olap/task/engine_clone_task.cpp
@@ -621,7 +621,13 @@ Status EngineCloneTask::_download_files(DataDir* data_dir,
const std::string& re
/// 2. Call _finish_xx_clone() to revise the tablet meta.
Status EngineCloneTask::_finish_clone(Tablet* tablet, const std::string&
clone_dir, int64_t version,
bool is_incremental_clone) {
- Defer remove_clone_dir {[&]() { std::filesystem::remove_all(clone_dir); }};
+ Defer remove_clone_dir {[&]() {
+ std::error_code ec;
+ std::filesystem::remove_all(clone_dir, ec);
+ if (ec) {
+ LOG(WARNING) << "failed to remove=" << clone_dir << " msg=" <<
ec.message();
+ }
+ }};
// check clone dir existed
bool exists = true;
@@ -652,7 +658,13 @@ Status EngineCloneTask::_finish_clone(Tablet* tablet,
const std::string& clone_d
bool contain_binlog = false;
RowsetBinlogMetasPB rowset_binlog_metas_pb;
if (binlog_metas_file_exists) {
- auto binlog_meta_filesize =
std::filesystem::file_size(binlog_metas_file);
+ std::error_code ec;
+ auto binlog_meta_filesize =
std::filesystem::file_size(binlog_metas_file, ec);
+ if (ec) {
+ LOG(WARNING) << "get file size error" << ec.message();
+ return Status::IOError("can't retrive file_size of {}, due to {}",
binlog_metas_file,
+ ec.message());
+ }
if (binlog_meta_filesize > 0) {
contain_binlog = true;
RETURN_IF_ERROR(read_pb(binlog_metas_file,
&rowset_binlog_metas_pb));
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]