From fa033e586a97618c5fe11a9e9b4133ab5df2cc62 Mon Sep 17 00:00:00 2001 From: foxspy Date: Fri, 22 Sep 2023 14:19:24 +0800 Subject: [PATCH] disable growing index for flat (#27309) Signed-off-by: xianliang --- internal/core/src/common/IndexMeta.h | 6 ++++++ internal/core/src/segcore/FieldIndexing.h | 17 +++++++++++------ .../core/thirdparty/knowhere/CMakeLists.txt | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/internal/core/src/common/IndexMeta.h b/internal/core/src/common/IndexMeta.h index 89ad9fd01c..132c1fd34b 100644 --- a/internal/core/src/common/IndexMeta.h +++ b/internal/core/src/common/IndexMeta.h @@ -21,6 +21,7 @@ #include "pb/common.pb.h" #include "pb/segcore.pb.h" +#include "knowhere/utils.h" #include "Types.h" namespace milvus { @@ -44,6 +45,11 @@ class FieldIndexMeta { return index_params_.at(knowhere::meta::INDEX_TYPE); } + bool + IsFlatIndex() const { + return knowhere::IsFlatIndex(GetIndexType()); + } + const std::map& GetIndexParams() const { return index_params_; diff --git a/internal/core/src/segcore/FieldIndexing.h b/internal/core/src/segcore/FieldIndexing.h index 0eb232c48d..fe08bbacd0 100644 --- a/internal/core/src/segcore/FieldIndexing.h +++ b/internal/core/src/segcore/FieldIndexing.h @@ -251,12 +251,17 @@ class IndexingRecord { //Small-Index disabled, create index for vector field only if (index_meta_->GetIndexMaxRowCount() > 0 && index_meta_->HasFiled(field_id)) { - field_indexings_.try_emplace( - field_id, - CreateIndex(field_meta, - index_meta_->GetFieldIndexMeta(field_id), - index_meta_->GetIndexMaxRowCount(), - segcore_config_)); + auto vec_filed_meta = + index_meta_->GetFieldIndexMeta(field_id); + //Disable growing index for flat + if (!vec_filed_meta.IsFlatIndex()) { + field_indexings_.try_emplace( + field_id, + CreateIndex(field_meta, + vec_filed_meta, + index_meta_->GetIndexMaxRowCount(), + segcore_config_)); + } } } } diff --git a/internal/core/thirdparty/knowhere/CMakeLists.txt b/internal/core/thirdparty/knowhere/CMakeLists.txt index 5679e5a1d8..917043ce44 100644 --- a/internal/core/thirdparty/knowhere/CMakeLists.txt +++ b/internal/core/thirdparty/knowhere/CMakeLists.txt @@ -11,7 +11,7 @@ # or implied. See the License for the specific language governing permissions and limitations under the License. #------------------------------------------------------------------------------- -set( KNOWHERE_VERSION 1dcd84b4 ) +set( KNOWHERE_VERSION b724230 ) set( GIT_REPOSITORY "https://github.com/zilliztech/knowhere.git") if ( INDEX_ENGINE STREQUAL "cardinal" ) set( KNOWHERE_VERSION main)