Skip to content

Commit 084b3ef

Browse files
authored
fix: [2.4] fill the metric type field in the LoadMetaInfo object (milvus-io#35963)
- issue: milvus-io#35960 - pr: milvus-io#35962 Signed-off-by: SimFG <[email protected]>
1 parent 2c1fa50 commit 084b3ef

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

internal/core/src/query/SearchOnSealed.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ SearchOnSealedIndex(const Schema& schema,
4242
// Keep the field_indexing smart pointer, until all reference by raw dropped.
4343
auto field_indexing = record.get_field_indexing(field_id);
4444
AssertInfo(field_indexing->metric_type_ == search_info.metric_type_,
45-
"Metric type of field index isn't the same with search info");
45+
"Metric type of field index isn't the same with search info,"
46+
"field index: {}, search info: {}", field_indexing->metric_type_, search_info.metric_type_);
4647

4748
auto dataset = knowhere::GenDataSet(num_queries, dim, query_data);
4849
dataset->SetIsSparse(is_sparse);

internal/core/src/segcore/ConcurrentVector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class ThreadSafeVector {
7171

7272
int64_t
7373
size() const {
74-
std::lock_guard lck(mutex_);
74+
std::shared_lock lck(mutex_);
7575
return size_;
7676
}
7777

internal/querycoordv2/task/executor.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
. "github.com/milvus-io/milvus/internal/querycoordv2/params"
3636
"github.com/milvus-io/milvus/internal/querycoordv2/session"
3737
"github.com/milvus-io/milvus/internal/querycoordv2/utils"
38+
"github.com/milvus-io/milvus/pkg/common"
3839
"github.com/milvus-io/milvus/pkg/log"
3940
"github.com/milvus-io/milvus/pkg/util/commonpbutil"
4041
"github.com/milvus-io/milvus/pkg/util/funcutil"
@@ -197,6 +198,8 @@ func (ex *Executor) loadSegment(task *SegmentTask, step int) error {
197198
return err
198199
}
199200

201+
ex.setMetricTypeForMetaInfo(loadMeta, indexInfos)
202+
200203
req := packLoadSegmentRequest(
201204
task,
202205
action,
@@ -550,6 +553,8 @@ func (ex *Executor) setDistribution(task *LeaderTask, step int) error {
550553
return err
551554
}
552555

556+
ex.setMetricTypeForMetaInfo(loadMeta, indexInfo)
557+
553558
req := &querypb.SyncDistributionRequest{
554559
Base: commonpbutil.NewMsgBase(
555560
commonpbutil.WithMsgType(commonpb.MsgType_LoadSegments),
@@ -722,3 +727,15 @@ func (ex *Executor) getLoadInfo(ctx context.Context, collectionID, segmentID int
722727
loadInfo := utils.PackSegmentLoadInfo(segment, channel.GetSeekPosition(), indexes)
723728
return loadInfo, indexInfos, nil
724729
}
730+
731+
// setMetricTypeForMetaInfo it's a compatibility method for rolling upgrade from 2.3.x to 2.4
732+
func (ex *Executor) setMetricTypeForMetaInfo(metaInfo *querypb.LoadMetaInfo, indexInfos []*indexpb.IndexInfo) {
733+
for _, info := range indexInfos {
734+
for _, param := range info.IndexParams {
735+
if param.GetKey() == common.MetricTypeKey {
736+
metaInfo.MetricType = param.GetValue()
737+
return
738+
}
739+
}
740+
}
741+
}

0 commit comments

Comments
 (0)