Skip to content

Commit

Permalink
fix: crash when startup if the milvus volume is on-operation concurre…
Browse files Browse the repository at this point in the history
…ntly (milvus-io#37312)

issue: milvus-io#37311

Signed-off-by: chyezh <[email protected]>
  • Loading branch information
chyezh authored Nov 4, 2024
1 parent ba9f36b commit 0c4321c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion internal/core/src/storage/LocalChunkManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// limitations under the License.

#include "LocalChunkManager.h"
#include "log/Log.h"

#include <boost/filesystem.hpp>
#include <boost/system/error_code.hpp>
Expand Down Expand Up @@ -232,7 +233,17 @@ LocalChunkManager::GetSizeOfDir(const std::string& dir) {
it != v.end();
++it) {
if (boost::filesystem::is_regular_file(it->path())) {
total_file_size += boost::filesystem::file_size(it->path());
boost::system::error_code ec;
auto file_size = boost::filesystem::file_size(it->path(), ec);
if (ec) {
// The file may be removed concurrently by other threads.
// So the file size cannot be obtained, just ignore it.
LOG_INFO("size of file {} cannot be obtained with error: {}",
it->path().string(),
ec.message());
continue;
}
total_file_size += file_size;
}
if (boost::filesystem::is_directory(it->path())) {
total_file_size += GetSizeOfDir(it->path().string());
Expand Down

0 comments on commit 0c4321c

Please sign in to comment.