diff --git a/core/src/db/DBImpl.cpp b/core/src/db/DBImpl.cpp index 37a2b5f3e5c2b6bb80cdcf51f90e1c55064b04ee..bab1f83614ac3f104ec2fcb005fe0ad40ef7997c 100644 --- a/core/src/db/DBImpl.cpp +++ b/core/src/db/DBImpl.cpp @@ -664,9 +664,9 @@ DBImpl::Compact(const std::string& table_id) { ENGINE_LOG_DEBUG << "Before compacting, wait for build index thread to finish..."; - WaitBuildIndexFinish(); + // 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; diff --git a/core/src/scheduler/job/BuildIndexJob.cpp b/core/src/scheduler/job/BuildIndexJob.cpp index 35af905a75ef56ca4259105ea01bfec4f78ff948..0da63214be29a98edc5e0a7709732a95622e3edc 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; } diff --git a/core/src/scheduler/task/SearchTask.cpp b/core/src/scheduler/task/SearchTask.cpp index 5e71b803e18215d0b0b97073cad44c2581f2bc3e..857965dd2dbaff2e760eb3c59ab8d25994e56b96 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,