From 2bcb4955a2ccd6941719380a636739b52e0a3e1c Mon Sep 17 00:00:00 2001 From: HeYuchen <377710264@qq.com> Date: Wed, 28 Apr 2021 19:22:16 +0800 Subject: [PATCH] fix(bulk_load): remove possible old directory when start bulk load (#828) --- src/replica/bulk_load/replica_bulk_loader.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/replica/bulk_load/replica_bulk_loader.cpp b/src/replica/bulk_load/replica_bulk_loader.cpp index dc2c51951e..726191c2e5 100644 --- a/src/replica/bulk_load/replica_bulk_loader.cpp +++ b/src/replica/bulk_load/replica_bulk_loader.cpp @@ -342,6 +342,11 @@ error_code replica_bulk_loader::start_download(const std::string &remote_dir, } // reset local bulk load context and state + if (_status == bulk_load_status::BLS_INVALID) { + // try to remove possible garbage bulk load data when actually starting bulk load + remove_local_bulk_load_dir(utils::filesystem::path_combine( + _replica->_dir, bulk_load_constant::BULK_LOAD_LOCAL_ROOT_DIR)); + } if (status() == partition_status::PS_PRIMARY) { _replica->_primary_states.cleanup_bulk_load_states(); }