mirror of https://github.com/milvus-io/milvus.git
fix: Add IndexList check for load segment request (#28601)
See also #28022 #28034 The load segment may reaches before watch dml channel, so the index meta may be empty as well --------- Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/28702/head
parent
a2fe9dad49
commit
098c1c926d
|
@ -446,6 +446,12 @@ func (node *QueryNode) LoadSegments(ctx context.Context, req *querypb.LoadSegmen
|
|||
return merr.Status(err), nil
|
||||
}
|
||||
|
||||
// check index
|
||||
if len(req.GetIndexInfoList()) == 0 {
|
||||
err := merr.WrapErrIndexNotFoundForCollection(req.GetSchema().GetName())
|
||||
return merr.Status(err), nil
|
||||
}
|
||||
|
||||
// Delegates request to workers
|
||||
if req.GetNeedTransfer() {
|
||||
delegator, ok := node.delegators.Get(segment.GetInsertChannel())
|
||||
|
|
|
@ -567,6 +567,9 @@ func (suite *ServiceSuite) TestLoadSegments_Int64() {
|
|||
Schema: schema,
|
||||
DeltaPositions: []*msgpb.MsgPosition{{Timestamp: 20000}},
|
||||
NeedTransfer: true,
|
||||
IndexInfoList: []*indexpb.IndexInfo{
|
||||
{},
|
||||
},
|
||||
}
|
||||
|
||||
// LoadSegment
|
||||
|
@ -603,6 +606,7 @@ func (suite *ServiceSuite) TestLoadSegments_VarChar() {
|
|||
DeltaPositions: []*msgpb.MsgPosition{{Timestamp: 20000}},
|
||||
NeedTransfer: true,
|
||||
LoadMeta: loadMeta,
|
||||
IndexInfoList: []*indexpb.IndexInfo{{}},
|
||||
}
|
||||
|
||||
// LoadSegment
|
||||
|
@ -628,6 +632,7 @@ func (suite *ServiceSuite) TestLoadDeltaInt64() {
|
|||
Schema: schema,
|
||||
NeedTransfer: true,
|
||||
LoadScope: querypb.LoadScope_Delta,
|
||||
IndexInfoList: []*indexpb.IndexInfo{{}},
|
||||
}
|
||||
|
||||
// LoadSegment
|
||||
|
@ -652,6 +657,7 @@ func (suite *ServiceSuite) TestLoadDeltaVarchar() {
|
|||
Schema: schema,
|
||||
NeedTransfer: true,
|
||||
LoadScope: querypb.LoadScope_Delta,
|
||||
IndexInfoList: []*indexpb.IndexInfo{{}},
|
||||
}
|
||||
|
||||
// LoadSegment
|
||||
|
@ -687,6 +693,7 @@ func (suite *ServiceSuite) TestLoadIndex_Success() {
|
|||
Schema: schema,
|
||||
NeedTransfer: false,
|
||||
LoadScope: querypb.LoadScope_Full,
|
||||
IndexInfoList: []*indexpb.IndexInfo{{}},
|
||||
}
|
||||
|
||||
// Load segment
|
||||
|
@ -711,6 +718,7 @@ func (suite *ServiceSuite) TestLoadIndex_Success() {
|
|||
Schema: schema,
|
||||
NeedTransfer: false,
|
||||
LoadScope: querypb.LoadScope_Index,
|
||||
IndexInfoList: []*indexpb.IndexInfo{{}},
|
||||
}
|
||||
|
||||
// Load segment
|
||||
|
@ -755,6 +763,7 @@ func (suite *ServiceSuite) TestLoadIndex_Failed() {
|
|||
Schema: schema,
|
||||
NeedTransfer: false,
|
||||
LoadScope: querypb.LoadScope_Index,
|
||||
IndexInfoList: []*indexpb.IndexInfo{{}},
|
||||
}
|
||||
|
||||
// Load segment
|
||||
|
@ -787,6 +796,7 @@ func (suite *ServiceSuite) TestLoadIndex_Failed() {
|
|||
Schema: schema,
|
||||
NeedTransfer: false,
|
||||
LoadScope: querypb.LoadScope_Index,
|
||||
IndexInfoList: []*indexpb.IndexInfo{{}},
|
||||
}
|
||||
|
||||
// Load segment
|
||||
|
@ -810,6 +820,9 @@ func (suite *ServiceSuite) TestLoadSegments_Failed() {
|
|||
Infos: suite.genSegmentLoadInfos(schema),
|
||||
Schema: schema,
|
||||
NeedTransfer: true,
|
||||
IndexInfoList: []*indexpb.IndexInfo{
|
||||
{},
|
||||
},
|
||||
}
|
||||
|
||||
// Delegator not found
|
||||
|
@ -817,10 +830,18 @@ func (suite *ServiceSuite) TestLoadSegments_Failed() {
|
|||
suite.NoError(err)
|
||||
suite.ErrorIs(merr.Error(status), merr.ErrChannelNotFound)
|
||||
|
||||
// IndexIndex not found
|
||||
nonIndexReq := typeutil.Clone(req)
|
||||
nonIndexReq.IndexInfoList = nil
|
||||
status, err = suite.node.LoadSegments(ctx, nonIndexReq)
|
||||
suite.NoError(err)
|
||||
suite.ErrorIs(merr.Error(status), merr.ErrIndexNotFound)
|
||||
|
||||
// target not match
|
||||
req.Base.TargetID = -1
|
||||
status, err = suite.node.LoadSegments(ctx, req)
|
||||
suite.NoError(err)
|
||||
suite.T().Log(merr.Error(status))
|
||||
suite.ErrorIs(merr.Error(status), merr.ErrNodeNotMatch)
|
||||
|
||||
// node not healthy
|
||||
|
@ -851,6 +872,7 @@ func (suite *ServiceSuite) TestLoadSegments_Transfer() {
|
|||
Infos: suite.genSegmentLoadInfos(schema),
|
||||
Schema: schema,
|
||||
NeedTransfer: true,
|
||||
IndexInfoList: []*indexpb.IndexInfo{{}},
|
||||
}
|
||||
|
||||
// LoadSegment
|
||||
|
@ -872,6 +894,7 @@ func (suite *ServiceSuite) TestLoadSegments_Transfer() {
|
|||
Infos: suite.genSegmentLoadInfos(schema),
|
||||
Schema: schema,
|
||||
NeedTransfer: true,
|
||||
IndexInfoList: []*indexpb.IndexInfo{{}},
|
||||
}
|
||||
|
||||
// LoadSegment
|
||||
|
@ -898,9 +921,9 @@ func (suite *ServiceSuite) TestLoadSegments_Transfer() {
|
|||
Infos: suite.genSegmentLoadInfos(schema),
|
||||
Schema: schema,
|
||||
NeedTransfer: true,
|
||||
IndexInfoList: []*indexpb.IndexInfo{{}},
|
||||
}
|
||||
|
||||
// LoadSegment
|
||||
// LoadSegment
|
||||
status, err := suite.node.LoadSegments(ctx, req)
|
||||
suite.NoError(err)
|
||||
|
|
Loading…
Reference in New Issue