Merge branch 'branch-0.3.0' into 'branch-0.3.0'

MS-76 fix pipeline crash bug

See merge request megasearch/vecwise_engine!82

Former-commit-id: 4bfb462d7762632499a1170c20280874df61362f
This commit is contained in:
jinhai 2019-06-13 14:33:47 +08:00
commit 2f6ad0dfc6
2 changed files with 19 additions and 17 deletions

View File

@ -34,6 +34,7 @@ Please mark all change in change log and use the ticket from JIRA.
- MS-32 - Fix thrift error - MS-32 - Fix thrift error
- MS-34 - Fix prometheus-cpp thirdparty - MS-34 - Fix prometheus-cpp thirdparty
- MS-67 - Fix license check bug - MS-67 - Fix license check bug
- MS-76 - Fix pipeline crash bug
## Improvement ## Improvement

View File

@ -21,7 +21,7 @@ void ClusterResult(const std::vector<long> &output_ids,
for (auto i = 0; i < nq; i++) { for (auto i = 0; i < nq; i++) {
SearchContext::Id2ScoreMap id_score; SearchContext::Id2ScoreMap id_score;
for (auto k = 0; k < topk; k++) { for (auto k = 0; k < topk; k++) {
uint64_t index = i * nq + k; uint64_t index = i * topk + k;
id_score.push_back(std::make_pair(output_ids[index], output_distence[index])); id_score.push_back(std::make_pair(output_ids[index], output_distence[index]));
} }
result_set.emplace_back(id_score); result_set.emplace_back(id_score);
@ -125,11 +125,6 @@ bool SearchTask::DoSearch() {
try { try {
index_engine_->Search(context->nq(), context->vectors(), inner_k, output_distence.data(), index_engine_->Search(context->nq(), context->vectors(), inner_k, output_distence.data(),
output_ids.data()); output_ids.data());
} catch (std::exception& ex) {
SERVER_LOG_ERROR << "SearchTask encounter exception: " << ex.what();
context->IndexSearchDone(index_id_);//mark as done avoid dead lock, even search failed
continue;
}
rc.Record("do search"); rc.Record("do search");
@ -147,6 +142,12 @@ bool SearchTask::DoSearch() {
context->GetResult().swap(result_set); context->GetResult().swap(result_set);
rc.Record("calculate score"); rc.Record("calculate score");
} catch (std::exception& ex) {
SERVER_LOG_ERROR << "SearchTask encounter exception: " << ex.what();
context->IndexSearchDone(index_id_);//mark as done avoid dead lock, even search failed
continue;
}
//step 6: notify to send result to client //step 6: notify to send result to client
context->IndexSearchDone(index_id_); context->IndexSearchDone(index_id_);
} }