remove retry in getShards (#28011)

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
pull/28042/head
wei liu 2023-10-31 16:16:14 +08:00 committed by GitHub
parent 1b9b8a31a8
commit 0677d2623d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 20 deletions

View File

@ -44,7 +44,6 @@ import (
"github.com/milvus-io/milvus/pkg/util/funcutil"
"github.com/milvus-io/milvus/pkg/util/merr"
"github.com/milvus-io/milvus/pkg/util/paramtable"
"github.com/milvus-io/milvus/pkg/util/retry"
"github.com/milvus-io/milvus/pkg/util/timerecord"
"github.com/milvus-io/milvus/pkg/util/typeutil"
)
@ -797,26 +796,9 @@ func (m *MetaCache) GetShards(ctx context.Context, withCache bool, database, col
CollectionID: info.collID,
}
// retry until service available or context timeout
var resp *querypb.GetShardLeadersResponse
childCtx, cancel := context.WithTimeout(ctx, time.Second*10)
defer cancel()
tr := timerecord.NewTimeRecorder("UpdateShardCache")
err = retry.Do(childCtx, func() error {
resp, err = m.queryCoord.GetShardLeaders(ctx, req)
if err != nil {
return retry.Unrecoverable(err)
}
if resp.GetStatus().GetErrorCode() == commonpb.ErrorCode_Success {
return nil
}
// do not retry unless got NoReplicaAvailable from querycoord
err2 := merr.Error(resp.GetStatus())
if resp.GetStatus().GetErrorCode() != commonpb.ErrorCode_NoReplicaAvailable {
return retry.Unrecoverable(err2)
}
return err2
})
var resp *querypb.GetShardLeadersResponse
resp, err = m.queryCoord.GetShardLeaders(ctx, req)
if err != nil {
return nil, err
}