Maintain compatibility of GetFlushState with old client (#27077)

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
This commit is contained in:
yihao.dai 2023-09-14 19:57:20 +08:00 committed by GitHub
parent 6f2c1214ed
commit fe5781e2b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 15 deletions

View File

@ -3607,7 +3607,7 @@ func TestGetFlushState(t *testing.T) {
assert.NoError(t, err)
assert.EqualValues(t, &milvuspb.GetFlushStateResponse{
Status: &commonpb.Status{ErrorCode: commonpb.ErrorCode_Success},
Flushed: false,
Flushed: true,
}, resp)
})
}

View File

@ -1309,10 +1309,10 @@ func (s *Server) GetFlushState(ctx context.Context, req *datapb.GetFlushStateReq
channels = append(channels, channelNames...)
}
if len(channels) == 0 {
resp.Flushed = false
if len(channels) == 0 { // For compatibility with old client
resp.Flushed = true
resp.Status.ErrorCode = commonpb.ErrorCode_Success
log.Warn("GetFlushState failed, no channels found")
log.Info("GetFlushState all flushed without checking flush ts")
return resp, nil
}

View File

@ -3617,21 +3617,23 @@ func (node *Proxy) GetFlushState(ctx context.Context, req *milvuspb.GetFlushStat
return resp, nil
}
if err = validateCollectionName(req.GetCollectionName()); err != nil {
resp.Status = merr.Status(err)
return resp, nil
}
collectionID, err := globalMetaCache.GetCollectionID(ctx, req.GetDbName(), req.GetCollectionName())
if err != nil {
resp.Status = merr.Status(err)
return resp, nil
}
stateReq := &datapb.GetFlushStateRequest{
SegmentIDs: req.GetSegmentIDs(),
FlushTs: req.GetFlushTs(),
}
stateReq.CollectionID = collectionID
if len(req.GetCollectionName()) > 0 { // For compatibility with old client
if err = validateCollectionName(req.GetCollectionName()); err != nil {
resp.Status = merr.Status(err)
return resp, nil
}
collectionID, err := globalMetaCache.GetCollectionID(ctx, req.GetDbName(), req.GetCollectionName())
if err != nil {
resp.Status = merr.Status(err)
return resp, nil
}
stateReq.CollectionID = collectionID
}
resp, err = node.dataCoord.GetFlushState(ctx, stateReq)
if err != nil {