mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-02-04 11:18:44 +08:00
Check component state before get index files (#13578)
Signed-off-by: Cai.Zhang <cai.zhang@zilliz.com>
This commit is contained in:
parent
a0cf85b264
commit
2ef2228ad0
@ -541,6 +541,17 @@ func (i *IndexCoord) DropIndex(ctx context.Context, req *indexpb.DropIndexReques
|
||||
// GetIndexFilePaths gets the index file paths from IndexCoord.
|
||||
func (i *IndexCoord) GetIndexFilePaths(ctx context.Context, req *indexpb.GetIndexFilePathsRequest) (*indexpb.GetIndexFilePathsResponse, error) {
|
||||
log.Debug("IndexCoord GetIndexFilePaths", zap.Int64s("IndexBuildIds", req.IndexBuildIDs))
|
||||
if !i.isHealthy() {
|
||||
errMsg := "IndexCoord is not healthy"
|
||||
log.Warn(errMsg)
|
||||
return &indexpb.GetIndexFilePathsResponse{
|
||||
Status: &commonpb.Status{
|
||||
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
||||
Reason: errMsg,
|
||||
},
|
||||
FilePaths: nil,
|
||||
}, nil
|
||||
}
|
||||
sp, _ := trace.StartSpanFromContextWithOperationName(ctx, "IndexCoord-BuildIndex")
|
||||
defer sp.Finish()
|
||||
var indexPaths []*indexpb.IndexFilePathInfo
|
||||
|
||||
@ -277,4 +277,11 @@ func TestIndexCoord_NotHealthy(t *testing.T) {
|
||||
resp2, err := ic.GetIndexStates(context.Background(), req3)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, commonpb.ErrorCode_UnexpectedError, resp2.Status.ErrorCode)
|
||||
|
||||
req4 := &indexpb.GetIndexFilePathsRequest{
|
||||
IndexBuildIDs: []UniqueID{1, 2},
|
||||
}
|
||||
resp4, err := ic.GetIndexFilePaths(context.Background(), req4)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, commonpb.ErrorCode_UnexpectedError, resp4.Status.ErrorCode)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user