From 561e2f5fc8202d2e451cfdac51b4fed9a5e09b9d Mon Sep 17 00:00:00 2001 From: Zhiru Zhu Date: Tue, 10 Mar 2020 21:07:11 +0800 Subject: [PATCH 1/4] update Signed-off-by: Zhiru Zhu --- core/src/scheduler/task/SearchTask.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/src/scheduler/task/SearchTask.cpp b/core/src/scheduler/task/SearchTask.cpp index 5e71b803e1..857965dd2d 100644 --- a/core/src/scheduler/task/SearchTask.cpp +++ b/core/src/scheduler/task/SearchTask.cpp @@ -266,14 +266,19 @@ XSearchTask::Execute() { // step 3: pick up topk result auto spec_k = file_->row_count_ < topk ? file_->row_count_ : topk; + if (spec_k == 0) { + ENGINE_LOG_WARNING << "Searching in an empty file. file location = " << file_->location_; + } { std::unique_lock lock(search_job->mutex()); - if (search_job->GetResultIds().front() == -1 && search_job->GetResultIds().size() > spec_k) { - // initialized results set - search_job->GetResultIds().resize(spec_k); - search_job->GetResultDistances().resize(spec_k); + if (search_job->GetResultIds().size() > spec_k) { + if (search_job->GetResultIds().front() == -1) { + // initialized results set + search_job->GetResultIds().resize(spec_k * nq); + search_job->GetResultDistances().resize(spec_k * nq); + } } XSearchTask::MergeTopkToResultSet(output_ids, output_distance, spec_k, nq, topk, ascending_reduce, From 404d607eb6c8bead85811025fbeae7299259626e Mon Sep 17 00:00:00 2001 From: Zhiru Zhu Date: Tue, 10 Mar 2020 21:34:47 +0800 Subject: [PATCH 2/4] update Signed-off-by: Zhiru Zhu --- core/src/scheduler/job/BuildIndexJob.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/scheduler/job/BuildIndexJob.cpp b/core/src/scheduler/job/BuildIndexJob.cpp index 35af905a75..0da63214be 100644 --- a/core/src/scheduler/job/BuildIndexJob.cpp +++ b/core/src/scheduler/job/BuildIndexJob.cpp @@ -10,10 +10,11 @@ // or implied. See the License for the specific language governing permissions and limitations under the License. #include "scheduler/job/BuildIndexJob.h" -#include "utils/Log.h" #include +#include "utils/Log.h" + namespace milvus { namespace scheduler { @@ -34,7 +35,8 @@ BuildIndexJob::AddToIndexFiles(const engine::meta::TableFileSchemaPtr& to_index_ return false; } - SERVER_LOG_DEBUG << "BuildIndexJob " << id() << " add to_index file: " << to_index_file->id_; + SERVER_LOG_DEBUG << "BuildIndexJob " << id() << " add to_index file: " << to_index_file->id_ + << ", location: " << to_index_file->location_; to_index_files_[to_index_file->id_] = to_index_file; } From 5b0b226bc42293a39b79b7317b3aeba50f96b78e Mon Sep 17 00:00:00 2001 From: Zhiru Zhu Date: Tue, 10 Mar 2020 22:03:17 +0800 Subject: [PATCH 3/4] update Signed-off-by: Zhiru Zhu --- core/src/db/DBImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/db/DBImpl.cpp b/core/src/db/DBImpl.cpp index f83c0d2b5a..f6cf189432 100644 --- a/core/src/db/DBImpl.cpp +++ b/core/src/db/DBImpl.cpp @@ -666,7 +666,7 @@ DBImpl::Compact(const std::string& table_id) { WaitBuildIndexFinish(); - std::lock_guard index_lock(index_result_mutex_); + const std::lock_guard index_lock(build_index_mutex_); const std::lock_guard merge_lock(flush_merge_compact_mutex_); ENGINE_LOG_DEBUG << "Compacting table: " << table_id; From 50804ecaf5d84b19c0630db19efd7e4102f1bdac Mon Sep 17 00:00:00 2001 From: Zhiru Zhu Date: Tue, 10 Mar 2020 22:42:59 +0800 Subject: [PATCH 4/4] update Signed-off-by: Zhiru Zhu --- core/src/db/DBImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/db/DBImpl.cpp b/core/src/db/DBImpl.cpp index f6cf189432..7aab810987 100644 --- a/core/src/db/DBImpl.cpp +++ b/core/src/db/DBImpl.cpp @@ -664,7 +664,7 @@ DBImpl::Compact(const std::string& table_id) { ENGINE_LOG_DEBUG << "Before compacting, wait for build index thread to finish..."; - WaitBuildIndexFinish(); + // WaitBuildIndexFinish(); const std::lock_guard index_lock(build_index_mutex_); const std::lock_guard merge_lock(flush_merge_compact_mutex_);