From 626c9bc5939940b247c53ed63d5f79fab64edbef Mon Sep 17 00:00:00 2001 From: Tinkerrr Date: Fri, 6 Mar 2020 21:10:42 +0800 Subject: [PATCH] set size after load (#1539) Signed-off-by: xiaojun.lin --- CHANGELOG.md | 1 + core/src/db/engine/ExecutionEngineImpl.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2df6e52a77..c3350ab651 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,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 - \#1530 Set table file with correct engine type in meta - \#1525 Add setter API for config preload_table +- \#1535 Degradation searching performance with metric_type: binary_idmap ## Feature - \#216 Add CLI to get server info diff --git a/core/src/db/engine/ExecutionEngineImpl.cpp b/core/src/db/engine/ExecutionEngineImpl.cpp index c9243075e5..6992fc6539 100644 --- a/core/src/db/engine/ExecutionEngineImpl.cpp +++ b/core/src/db/engine/ExecutionEngineImpl.cpp @@ -452,6 +452,10 @@ ExecutionEngineImpl::Load(bool to_cache) { status = std::static_pointer_cast(index_)->AddWithoutIds(vectors->GetCount(), float_vectors.data(), Config()); status = std::static_pointer_cast(index_)->SetBlacklist(concurrent_bitset_ptr); + + int64_t index_size = vectors->GetCount() * conf->d * sizeof(float); + int64_t bitset_size = vectors->GetCount() / 8; + index_->set_size(index_size + bitset_size); } else if (index_type_ == EngineType::FAISS_BIN_IDMAP) { ec = std::static_pointer_cast(index_)->Build(conf); if (ec != KNOWHERE_SUCCESS) { @@ -460,6 +464,10 @@ ExecutionEngineImpl::Load(bool to_cache) { status = std::static_pointer_cast(index_)->AddWithoutIds(vectors->GetCount(), vectors_data.data(), Config()); status = std::static_pointer_cast(index_)->SetBlacklist(concurrent_bitset_ptr); + + int64_t index_size = vectors->GetCount() * conf->d * sizeof(uint8_t); + int64_t bitset_size = vectors->GetCount() / 8; + index_->set_size(index_size + bitset_size); } if (!status.ok()) { return status;