diff --git a/CHANGELOG.md b/CHANGELOG.md index 6aa63d30ab..b4846ab931 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Please mark all change in change log and use the issue from GitHub - \#1518 Table count did not match after deleting vectors and compact - \#1521 Make cache_insert_data take effect in-service - \#1525 Add setter API for config preload_table +- \#1529 Fix server crash when cache_insert_data enabled - \#1530 Set table file with correct engine type in meta - \#1535 Degradation searching performance with metric_type: binary_idmap diff --git a/core/src/db/engine/ExecutionEngineImpl.cpp b/core/src/db/engine/ExecutionEngineImpl.cpp index 8bd16fdc34..eb7b41d5d6 100644 --- a/core/src/db/engine/ExecutionEngineImpl.cpp +++ b/core/src/db/engine/ExecutionEngineImpl.cpp @@ -431,6 +431,7 @@ ExecutionEngineImpl::Load(bool to_cache) { auto vectors_uids = vectors->GetUids(); index_->SetUids(vectors_uids); + ENGINE_LOG_DEBUG << "set uids " << index_->GetUids().size() << " for index " << location_; auto vectors_data = vectors->GetData(); @@ -510,6 +511,7 @@ ExecutionEngineImpl::Load(bool to_cache) { std::vector uids; segment_reader_ptr->LoadUids(uids); index_->SetUids(uids); + ENGINE_LOG_DEBUG << "set uids " << index_->GetUids().size() << " for index " << location_; ENGINE_LOG_DEBUG << "Finished loading index file from segment " << segment_dir; } @@ -734,12 +736,19 @@ ExecutionEngineImpl::BuildIndex(const std::string& location, EngineType engine_t throw Exception(DB_ERROR, "Illegal index params"); } ENGINE_LOG_DEBUG << "Index config: " << conf.dump(); + auto status = Status::OK(); + std::vector uids; if (from_index) { status = to_index->BuildAll(Count(), from_index->GetRawVectors(), from_index->GetRawIds(), conf); + uids = from_index->GetUids(); } else if (bin_from_index) { status = to_index->BuildAll(Count(), bin_from_index->GetRawVectors(), bin_from_index->GetRawIds(), conf); + uids = bin_from_index->GetUids(); } + to_index->SetUids(uids); + ENGINE_LOG_DEBUG << "set uids " << to_index->GetUids().size() << " for " << location; + if (!status.ok()) { throw Exception(DB_ERROR, status.message()); } @@ -838,6 +847,7 @@ ExecutionEngineImpl::Search(int64_t n, const float* data, int64_t k, const milvu rc.RecordSection("search done"); // map offsets to ids + ENGINE_LOG_DEBUG << "get uids " << index_->GetUids().size() << " from index " << location_; MapUids(index_->GetUids(), labels, n * k); rc.RecordSection("map uids " + std::to_string(n * k)); @@ -879,6 +889,7 @@ ExecutionEngineImpl::Search(int64_t n, const uint8_t* data, int64_t k, const mil rc.RecordSection("search done"); // map offsets to ids + ENGINE_LOG_DEBUG << "get uids " << index_->GetUids().size() << " from index " << location_; MapUids(index_->GetUids(), labels, n * k); rc.RecordSection("map uids " + std::to_string(n * k)); @@ -962,6 +973,7 @@ ExecutionEngineImpl::Search(int64_t n, const std::vector& ids, int64_t rc.RecordSection("search done"); // map offsets to ids + ENGINE_LOG_DEBUG << "get uids " << index_->GetUids().size() << " from index " << location_; MapUids(uids, labels, offsets.size() * k); rc.RecordSection("map uids " + std::to_string(offsets.size() * k)); diff --git a/core/src/index/knowhere/knowhere/index/vector_index/helpers/Cloner.cpp b/core/src/index/knowhere/knowhere/index/vector_index/helpers/Cloner.cpp index 80409ede09..330ee79978 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/helpers/Cloner.cpp +++ b/core/src/index/knowhere/knowhere/index/vector_index/helpers/Cloner.cpp @@ -24,7 +24,10 @@ namespace cloner { VectorIndexPtr CopyGpuToCpu(const VectorIndexPtr& index, const Config& config) { if (auto device_index = std::dynamic_pointer_cast(index)) { - return device_index->CopyGpuToCpu(config); + VectorIndexPtr result = device_index->CopyGpuToCpu(config); + auto uids = index->GetUids(); + result->SetUids(uids); + return result; } else { KNOWHERE_THROW_MSG("index type is not gpuindex"); }