mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-03 17:31:58 +08:00
handle exception in merge file
Former-commit-id: 0b1503599944acafa30e12642c3e00c915afc223
This commit is contained in:
parent
e65c20844f
commit
ce7e835658
@ -363,6 +363,7 @@ Status DBImpl::MergeFiles(const std::string& table_id, const meta::DateT& date,
|
||||
const meta::TableFilesSchema& files) {
|
||||
ENGINE_LOG_DEBUG << "Merge files for table " << table_id;
|
||||
|
||||
//step 1: create table file
|
||||
meta::TableFileSchema table_file;
|
||||
table_file.table_id_ = table_id;
|
||||
table_file.date_ = date;
|
||||
@ -374,6 +375,7 @@ Status DBImpl::MergeFiles(const std::string& table_id, const meta::DateT& date,
|
||||
return status;
|
||||
}
|
||||
|
||||
//step 2: merge files
|
||||
ExecutionEnginePtr index =
|
||||
EngineFactory::Build(table_file.dimension_, table_file.location_, (EngineType)table_file.engine_type_);
|
||||
|
||||
@ -397,9 +399,25 @@ Status DBImpl::MergeFiles(const std::string& table_id, const meta::DateT& date,
|
||||
if (index_size >= options_.index_trigger_size) break;
|
||||
}
|
||||
|
||||
//step 3: serialize to disk
|
||||
try {
|
||||
index->Serialize();
|
||||
} catch (std::exception& ex) {
|
||||
//typical error: out of disk space or permition denied
|
||||
std::string msg = "Serialize merged index encounter exception" + std::string(ex.what());
|
||||
ENGINE_LOG_ERROR << msg;
|
||||
|
||||
index->Serialize();
|
||||
table_file.file_type_ = meta::TableFileSchema::TO_DELETE;
|
||||
status = meta_ptr_->UpdateTableFile(table_file);
|
||||
ENGINE_LOG_DEBUG << "Failed to update file to index, mark file: " << table_file.file_id_ << " to to_delete";
|
||||
|
||||
std::cout << "ERROR: failed to persist merged index file: " << table_file.location_
|
||||
<< ", possible out of disk space" << std::endl;
|
||||
|
||||
return Status::Error(msg);
|
||||
}
|
||||
|
||||
//step 4: update table files state
|
||||
if (index_size >= options_.index_trigger_size) {
|
||||
table_file.file_type_ = meta::TableFileSchema::TO_INDEX;
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user