Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:add more info to local chunk manager log #38357

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions internal/core/src/storage/LocalChunkManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@
#include "common/EasyAssert.h"
#include "common/Exception.h"

#define THROWLOCALERROR(code, FUNCTION) \
do { \
std::stringstream err_msg; \
err_msg << "Error:" << #FUNCTION << ":" << err.message(); \
throw SegcoreError(code, err_msg.str()); \
} while (0)

namespace milvus::storage {

bool
Expand All @@ -40,7 +33,10 @@
boost::system::error_code err;
bool isExist = boost::filesystem::exists(absPath, err);
if (err && err.value() != boost::system::errc::no_such_file_or_directory) {
THROWLOCALERROR(FileReadFailed, Exist);
PanicInfo(FileReadFailed,

Check warning on line 36 in internal/core/src/storage/LocalChunkManager.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/storage/LocalChunkManager.cpp#L36

Added line #L36 was not covered by tests
fmt::format("local file {} exist interface failed, error: {}",
filepath,
err.message()));
}
return isExist;
}
Expand All @@ -55,7 +51,10 @@
boost::system::error_code err;
int64_t size = boost::filesystem::file_size(absPath, err);
if (err) {
THROWLOCALERROR(FileReadFailed, FileSize);
PanicInfo(FileReadFailed,

Check warning on line 54 in internal/core/src/storage/LocalChunkManager.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/storage/LocalChunkManager.cpp#L54

Added line #L54 was not covered by tests
fmt::format("get local file {} size failed, error: {}",
filepath,
err.message()));
}
return size;
}
Expand All @@ -66,7 +65,10 @@
boost::system::error_code err;
boost::filesystem::remove(absPath, err);
if (err) {
THROWLOCALERROR(FileWriteFailed, Remove);
PanicInfo(FileWriteFailed,
fmt::format("remove local file {} failed, error: {}",
filepath,
err.message()));
}
}

Expand Down Expand Up @@ -187,7 +189,11 @@
boost::system::error_code err;
bool isExist = boost::filesystem::exists(dirPath, err);
if (err && err.value() != boost::system::errc::no_such_file_or_directory) {
THROWLOCALERROR(FileReadFailed, DirExist);
PanicInfo(

Check warning on line 192 in internal/core/src/storage/LocalChunkManager.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/storage/LocalChunkManager.cpp#L192

Added line #L192 was not covered by tests
FileWriteFailed,
fmt::format("local directory {} exist interface failed, error: {}",
dir,
err.message()));
}
return isExist;
}
Expand All @@ -201,7 +207,7 @@
boost::filesystem::path dirPath(dir);
auto create_success = boost::filesystem::create_directories(dirPath);
if (!create_success) {
PanicInfo(FileCreateFailed, "create dir failed" + dir);
PanicInfo(FileCreateFailed, "create dir:" + dir + " failed");
}
}

Expand All @@ -211,7 +217,10 @@
boost::system::error_code err;
boost::filesystem::remove_all(dirPath, err);
if (err) {
THROWLOCALERROR(FileCreateFailed, RemoveDir);
PanicInfo(FileWriteFailed,
fmt::format("remove local directory:{} failed, error: {}",
dir,
err.message()));
}
}

Expand Down
Loading