mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
MS-543 send error status to sdk when load index fail
Former-commit-id: a62922b904c7f7d478f5211b4d215d387ea23ae2
This commit is contained in:
parent
90cd973587
commit
f136df4aaa
@ -34,6 +34,7 @@ Please mark all change in change log and use the ticket from JIRA.
|
||||
- MS-474 - Create index hang if use branch-0.3.1 server config
|
||||
- MS-510 - unittest out of memory and crashed
|
||||
- MS-507 - Dataset 10m-512, index type sq8,performance in-normal when set CPU_CACHE to 16 or 64
|
||||
- MS-543 - SearchTask fail without exception
|
||||
|
||||
## Improvement
|
||||
- MS-327 - Clean code for milvus
|
||||
|
||||
@ -424,6 +424,9 @@ Status DBImpl::QueryAsync(const std::string& table_id, const meta::TableFilesSch
|
||||
scheduler.Schedule(context);
|
||||
|
||||
context->WaitResult();
|
||||
if (!context->GetStatus().ok()) {
|
||||
return context->GetStatus();
|
||||
}
|
||||
|
||||
//step 3: print time cost information
|
||||
double load_cost = context->LoadCost();
|
||||
|
||||
@ -69,7 +69,7 @@ std::string Status::ToString() const {
|
||||
type = "InvalidPath: ";
|
||||
break;
|
||||
default:
|
||||
snprintf(tmp, sizeof(tmp), "Unkown code(%d): ",
|
||||
snprintf(tmp, sizeof(tmp), "Error code(0x%x): ",
|
||||
static_cast<int>(code()));
|
||||
type = tmp;
|
||||
break;
|
||||
|
||||
@ -38,7 +38,9 @@ public:
|
||||
const ResultSet& GetResult() const { return result_; }
|
||||
ResultSet& GetResult() { return result_; }
|
||||
|
||||
std::string Identity() const { return identity_; }
|
||||
const std::string& Identity() const { return identity_; }
|
||||
const Status& GetStatus() const { return status_; }
|
||||
Status& GetStatus() { return status_; }
|
||||
|
||||
void IndexSearchDone(size_t index_id);
|
||||
void WaitResult();
|
||||
@ -64,6 +66,7 @@ private:
|
||||
std::condition_variable done_cond_;
|
||||
|
||||
std::string identity_; //for debug
|
||||
Status status_;
|
||||
|
||||
double time_cost_load_ = 0.0; //time cost for load all index files, unit: us
|
||||
double time_cost_search_ = 0.0; //time cost for entire search, unit: us
|
||||
|
||||
@ -98,14 +98,18 @@ XSearchTask::Load(LoadType type, uint8_t device_id) {
|
||||
server::TimeRecorder rc("");
|
||||
Status stat = Status::OK();
|
||||
std::string error_msg;
|
||||
std::string type_str;
|
||||
|
||||
try {
|
||||
if (type == LoadType::DISK2CPU) {
|
||||
stat = index_engine_->Load();
|
||||
type_str = "DISK2CPU";
|
||||
} else if (type == LoadType::CPU2GPU) {
|
||||
stat = index_engine_->CopyToGpu(device_id);
|
||||
type_str = "CPU2GPU";
|
||||
} else if (type == LoadType::GPU2CPU) {
|
||||
stat = index_engine_->CopyToCpu();
|
||||
type_str = "GPU2CPU";
|
||||
} else {
|
||||
error_msg = "Wrong load type";
|
||||
stat = Status(SERVER_UNEXPECTED_ERROR, error_msg);
|
||||
@ -117,13 +121,18 @@ XSearchTask::Load(LoadType type, uint8_t device_id) {
|
||||
}
|
||||
|
||||
if (!stat.ok()) {
|
||||
if (error_msg.empty())
|
||||
error_msg = std::string("Failed to load index file: file not available");
|
||||
//typical error: file not available
|
||||
ENGINE_LOG_ERROR << error_msg;
|
||||
Status s;
|
||||
if (stat.ToString().find("out of memory") != std::string::npos) {
|
||||
error_msg = "out of memory: " + type_str;
|
||||
s = Status(SERVER_OUT_OF_MEMORY, error_msg);
|
||||
} else {
|
||||
error_msg = "Failed to load index file: " + type_str;
|
||||
s = Status(SERVER_UNEXPECTED_ERROR, error_msg);
|
||||
}
|
||||
|
||||
for (auto &context : search_contexts_) {
|
||||
context->IndexSearchDone(file_->id_);//mark as done avoid dead lock, even failed
|
||||
context->GetStatus() = s;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@ -66,6 +66,7 @@ constexpr ErrorCode SERVER_INVALID_NPROBE = ToServerErrorCode(113);
|
||||
constexpr ErrorCode SERVER_INVALID_INDEX_NLIST = ToServerErrorCode(114);
|
||||
constexpr ErrorCode SERVER_INVALID_INDEX_METRIC_TYPE = ToServerErrorCode(115);
|
||||
constexpr ErrorCode SERVER_INVALID_INDEX_FILE_SIZE = ToServerErrorCode(116);
|
||||
constexpr ErrorCode SERVER_OUT_OF_MEMORY = ToServerErrorCode(117);
|
||||
|
||||
//db error code
|
||||
constexpr ErrorCode DB_META_TRANSACTION_FAILED = ToDbErrorCode(1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user