提交 f3c481dd 编写于 作者: P peng.xu

Merge branch 'be_stable' into 'branch-0.3.1-xiaojun'

Be stable

See merge request megasearch/milvus!226

Former-commit-id: 54f4aba3c250a2c715f61028c73b965fad9986d7
......@@ -229,7 +229,6 @@ void DBImpl::BackgroundTimerTask() {
Status status;
server::SystemInfo::GetInstance().Init();
while (true) {
if (!bg_error_.ok()) break;
if (shutting_down_.load(std::memory_order_acquire)){
for(auto& iter : compact_thread_results_) {
iter.wait();
......@@ -392,7 +391,7 @@ void DBImpl::BackgroundCompaction(std::set<std::string> table_ids) {
for (auto& table_id : table_ids) {
status = BackgroundMergeFiles(table_id);
if (!status.ok()) {
bg_error_ = status;
ENGINE_LOG_ERROR << "Merge files for table " << table_id << " failed: " << status.ToString();
return;
}
}
......@@ -498,7 +497,7 @@ void DBImpl::BackgroundBuildIndex() {
/* ENGINE_LOG_DEBUG << "Buiding index for " << file.location; */
status = BuildIndex(file);
if (!status.ok()) {
bg_error_ = status;
ENGINE_LOG_ERROR << "Building index for " << file.id_ << " failed: " << status.ToString();
return;
}
......
......@@ -114,10 +114,8 @@ class DBImpl : public DB {
BuildIndex(const meta::TableFileSchema &);
private:
const Options options_;
Status bg_error_;
std::atomic<bool> shutting_down_;
std::thread bg_timer_thread_;
......
......@@ -37,14 +37,17 @@ VecIndexPtr ExecutionEngineImpl::CreatetVecIndex(EngineType type) {
std::shared_ptr<VecIndex> index;
switch (type) {
case EngineType::FAISS_IDMAP: {
ENGINE_LOG_DEBUG << "Build Index: IDMAP";
index = GetVecIndexFactory(IndexType::FAISS_IDMAP);
break;
}
case EngineType::FAISS_IVFFLAT_GPU: {
ENGINE_LOG_DEBUG << "Build Index: IVFMIX";
index = GetVecIndexFactory(IndexType::FAISS_IVFFLAT_MIX);
break;
}
case EngineType::FAISS_IVFFLAT_CPU: {
ENGINE_LOG_DEBUG << "Build Index: IVFCPU";
index = GetVecIndexFactory(IndexType::FAISS_IVFFLAT_CPU);
break;
}
......@@ -135,6 +138,7 @@ ExecutionEngineImpl::BuildIndex(const std::string &location) {
auto from_index = std::dynamic_pointer_cast<BFIndex>(index_);
auto to_index = CreatetVecIndex(build_type);
ENGINE_LOG_DEBUG << "Build Params: [gpu_id] " << gpu_num;
to_index->BuildAll(Count(),
from_index->GetRawVectors(),
from_index->GetRawIds(),
......@@ -148,6 +152,7 @@ Status ExecutionEngineImpl::Search(long n,
long k,
float *distances,
long *labels) const {
ENGINE_LOG_DEBUG << "Search Params: [k] " << k << " [nprobe] " << nprobe_;
index_->Search(n, data, distances, labels, Config::object{{"k", k}, {"nprobe", nprobe_}});
return Status::OK();
}
......@@ -169,7 +174,7 @@ Status ExecutionEngineImpl::Init() {
}
case EngineType::FAISS_IVFFLAT_CPU: {
ConfigNode engine_config = config.GetConfig(CONFIG_ENGINE);
nprobe_ = engine_config.GetInt32Value(CONFIG_NPROBE, 1000);
nprobe_ = engine_config.GetInt32Value(CONFIG_NPROBE, 1);
break;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册