diff --git a/internal/core/src/query/SearchOnSealed.cpp b/internal/core/src/query/SearchOnSealed.cpp index 8bc806062a4d2..98ee7c071eddb 100644 --- a/internal/core/src/query/SearchOnSealed.cpp +++ b/internal/core/src/query/SearchOnSealed.cpp @@ -42,7 +42,8 @@ SearchOnSealedIndex(const Schema& schema, // Keep the field_indexing smart pointer, until all reference by raw dropped. auto field_indexing = record.get_field_indexing(field_id); AssertInfo(field_indexing->metric_type_ == search_info.metric_type_, - "Metric type of field index isn't the same with search info"); + "Metric type of field index isn't the same with search info," + "field index: {}, search info: {}", field_indexing->metric_type_, search_info.metric_type_); auto dataset = knowhere::GenDataSet(num_queries, dim, query_data); dataset->SetIsSparse(is_sparse); diff --git a/internal/core/src/segcore/ConcurrentVector.h b/internal/core/src/segcore/ConcurrentVector.h index a4cb72d986fc4..3591758d0292a 100644 --- a/internal/core/src/segcore/ConcurrentVector.h +++ b/internal/core/src/segcore/ConcurrentVector.h @@ -71,7 +71,7 @@ class ThreadSafeVector { int64_t size() const { - std::lock_guard lck(mutex_); + std::shared_lock lck(mutex_); return size_; } diff --git a/internal/querycoordv2/task/executor.go b/internal/querycoordv2/task/executor.go index ff74e8acada22..3196c4ccbc657 100644 --- a/internal/querycoordv2/task/executor.go +++ b/internal/querycoordv2/task/executor.go @@ -35,6 +35,7 @@ import ( . "github.com/milvus-io/milvus/internal/querycoordv2/params" "github.com/milvus-io/milvus/internal/querycoordv2/session" "github.com/milvus-io/milvus/internal/querycoordv2/utils" + "github.com/milvus-io/milvus/pkg/common" "github.com/milvus-io/milvus/pkg/log" "github.com/milvus-io/milvus/pkg/util/commonpbutil" "github.com/milvus-io/milvus/pkg/util/funcutil" @@ -197,6 +198,8 @@ func (ex *Executor) loadSegment(task *SegmentTask, step int) error { return err } + ex.setMetricTypeForMetaInfo(loadMeta, indexInfos) + req := packLoadSegmentRequest( task, action, @@ -550,6 +553,8 @@ func (ex *Executor) setDistribution(task *LeaderTask, step int) error { return err } + ex.setMetricTypeForMetaInfo(loadMeta, indexInfo) + req := &querypb.SyncDistributionRequest{ Base: commonpbutil.NewMsgBase( commonpbutil.WithMsgType(commonpb.MsgType_LoadSegments), @@ -722,3 +727,15 @@ func (ex *Executor) getLoadInfo(ctx context.Context, collectionID, segmentID int loadInfo := utils.PackSegmentLoadInfo(segment, channel.GetSeekPosition(), indexes) return loadInfo, indexInfos, nil } + +// setMetricTypeForMetaInfo it's a compatibility method for rolling upgrade from 2.3.x to 2.4 +func (ex *Executor) setMetricTypeForMetaInfo(metaInfo *querypb.LoadMetaInfo, indexInfos []*indexpb.IndexInfo) { + for _, info := range indexInfos { + for _, param := range info.IndexParams { + if param.GetKey() == common.MetricTypeKey { + metaInfo.MetricType = param.GetValue() + return + } + } + } +}