Fix QueryNode panic while upgrading (#28034)

Signed-off-by: yah01 <yah2er0ne@outlook.com>
pull/28042/head
yah01 2023-10-31 15:50:13 +08:00 committed by GitHub
parent ab6dbf7659
commit 1b9b8a31a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 1 deletions

View File

@ -248,7 +248,7 @@ class IndexingRecord {
if (field_meta.get_data_type() == DataType::VECTOR_BINARY) {
continue;
}
//Small-Index disabled, create index for vector field only
//Small-Index enabled, create index for vector field only
if (index_meta_->GetIndexMaxRowCount() > 0 &&
index_meta_->HasFiled(field_id)) {
auto vec_filed_meta =

View File

@ -224,6 +224,12 @@ func (node *QueryNode) WatchDmChannels(ctx context.Context, req *querypb.WatchDm
return merr.Status(err), nil
}
// check index
if len(req.GetIndexInfoList()) == 0 {
err := merr.WrapErrIndexNotFoundForCollection(req.GetSchema().GetName())
return merr.Status(err), nil
}
if !node.subscribingChannels.Insert(channel.GetChannelName()) {
msg := "channel subscribing..."
log.Warn(msg)

View File

@ -36,6 +36,7 @@ import (
"github.com/milvus-io/milvus-proto/go-api/v2/msgpb"
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
"github.com/milvus-io/milvus/internal/proto/datapb"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/proto/planpb"
"github.com/milvus-io/milvus/internal/proto/querypb"
@ -279,6 +280,9 @@ func (suite *ServiceSuite) TestWatchDmChannelsInt64() {
PartitionIDs: suite.partitionIDs,
MetricType: defaultMetricType,
},
IndexInfoList: []*indexpb.IndexInfo{
{},
},
}
// mocks
@ -328,6 +332,9 @@ func (suite *ServiceSuite) TestWatchDmChannelsVarchar() {
PartitionIDs: suite.partitionIDs,
MetricType: defaultMetricType,
},
IndexInfoList: []*indexpb.IndexInfo{
{},
},
}
// mocks
@ -374,6 +381,9 @@ func (suite *ServiceSuite) TestWatchDmChannels_Failed() {
LoadMeta: &querypb.LoadMetaInfo{
MetricType: defaultMetricType,
},
IndexInfoList: []*indexpb.IndexInfo{
{},
},
}
// test channel is unsubscribing
@ -393,6 +403,12 @@ func (suite *ServiceSuite) TestWatchDmChannels_Failed() {
suite.NoError(err)
suite.Equal(commonpb.ErrorCode_UnexpectedError, status.GetErrorCode())
// empty index
req.IndexInfoList = nil
status, err = suite.node.WatchDmChannels(ctx, req)
err = merr.CheckRPCCall(status, err)
suite.ErrorIs(err, merr.ErrIndexNotFound)
// target not match
req.Base.TargetID = -1
status, err = suite.node.WatchDmChannels(ctx, req)