fix: Remove duplicated Macro definition (#39076)

Issue: #39102

Signed-off-by: Cai Yudong <yudong.cai@zilliz.com>
pull/39000/head
Cai Yudong 2025-01-09 15:26:56 +08:00 committed by GitHub
parent 8abf6c9149
commit d6206ad2de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 12 deletions

View File

@ -22,10 +22,10 @@
namespace milvus {
#define THROW_FILE_WRITE_ERROR \
#define THROW_FILE_WRITE_ERROR(path) \
PanicInfo(ErrorCode::FileWriteFailed, \
fmt::format("write data to file {} failed, error code {}", \
file_.Path(), \
path, \
strerror(errno)));
class File {
@ -145,7 +145,7 @@ class BufferedWriter {
flush();
ssize_t written_data_size = file_.FWrite(data, size);
if (written_data_size != size) {
THROW_FILE_WRITE_ERROR
THROW_FILE_WRITE_ERROR(file_.Path())
}
return;
}
@ -170,7 +170,7 @@ class BufferedWriter {
if (buffer_pos_ > 0) {
ssize_t written_data_size = file_.FWrite(buffer_, buffer_pos_);
if (written_data_size != buffer_pos_) {
THROW_FILE_WRITE_ERROR
THROW_FILE_WRITE_ERROR(file_.Path())
}
buffer_pos_ = 0;
}

View File

@ -33,12 +33,6 @@
namespace milvus {
#define THROW_FILE_WRITE_ERROR \
PanicInfo(ErrorCode::FileWriteFailed, \
fmt::format("write data to file {} failed, error code {}", \
file.Path(), \
strerror(errno)));
/*
* If string field's value all empty, need a string padding to avoid
* mmap failing because size_ is zero which causing invalid argument
@ -78,7 +72,7 @@ WriteFieldPadding(File& file, DataType data_type, uint64_t& total_written) {
std::vector<char> padding(padding_size, 0);
ssize_t written = file.Write(padding.data(), padding_size);
if (written < padding_size) {
THROW_FILE_WRITE_ERROR
THROW_FILE_WRITE_ERROR(file.Path())
}
total_written += written;
}
@ -163,7 +157,7 @@ WriteFieldData(File& file,
// write as: data|data|data|data|data|data......
size_t written = file.FWrite(data->Data(), data->DataSize());
if (written < data->DataSize()) {
THROW_FILE_WRITE_ERROR
THROW_FILE_WRITE_ERROR(file.Path())
}
for (auto i = 0; i < data->get_num_rows(); i++) {
indices.emplace_back(total_written);