fix: bypass growing index if no index meta (#28791)

we shouldn't panic if no index meta, just skip building it
fix #28022

Signed-off-by: yah01 <yang.cen@zilliz.com>
This commit is contained in:
yah01 2023-11-30 14:10:27 +08:00 committed by GitHub
parent 43680043e3
commit d69440524b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -11,6 +11,7 @@
#pragma once
#include <cstddef>
#include <optional>
#include <map>
#include <memory>
@ -24,6 +25,7 @@
#include "common/Schema.h"
#include "common/IndexMeta.h"
#include "IndexConfigGenerator.h"
#include "log/Log.h"
#include "segcore/SegcoreConfig.h"
#include "index/VectorIndex.h"
@ -248,6 +250,12 @@ class IndexingRecord {
if (field_meta.get_data_type() == DataType::VECTOR_BINARY) {
continue;
}
if (index_meta_ == nullptr) {
LOG_SEGCORE_INFO_
<< "miss index meta for growing interim index";
continue;
}
//Small-Index enabled, create index for vector field only
if (index_meta_->GetIndexMaxRowCount() > 0 &&
index_meta_->HasFiled(field_id)) {

View File

@ -125,6 +125,20 @@ TEST(GrowingIndex, Correctness) {
}
}
TEST(GrowingIndex, MissIndexMeta) {
auto schema = std::make_shared<Schema>();
auto pk = schema->AddDebugField("pk", DataType::INT64);
auto random = schema->AddDebugField("random", DataType::DOUBLE);
auto vec = schema->AddDebugField(
"embeddings", DataType::VECTOR_FLOAT, 128, knowhere::metric::L2);
schema->set_primary_field_id(pk);
auto& config = SegcoreConfig::default_config();
config.set_chunk_rows(1024);
config.set_enable_interim_segment_index(true);
auto segment = CreateGrowingSegment(schema, nullptr);
}
using Param = const char*;
class GrowingIndexGetVectorTest : public ::testing::TestWithParam<Param> {