mirror of https://github.com/milvus-io/milvus.git
Invalidate cache first when shard leader list contains error (#21451)
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/21459/head
parent
037ccccfcc
commit
daa4492e95
|
@ -336,6 +336,8 @@ func (t *queryTask) Execute(ctx context.Context) error {
|
|||
if err != nil {
|
||||
log.Warn("invalid shard leaders cache, updating shardleader caches and retry query",
|
||||
zap.Error(err))
|
||||
// invalidate cache first, since ctx may be canceled or timeout here
|
||||
globalMetaCache.ClearShards(t.collectionName)
|
||||
err = executeQuery(WithoutCache)
|
||||
}
|
||||
if err != nil {
|
||||
|
|
|
@ -410,6 +410,8 @@ func (t *searchTask) Execute(ctx context.Context) error {
|
|||
if err != nil {
|
||||
log.Warn("first search failed, updating shardleader caches and retry search",
|
||||
zap.Error(err))
|
||||
// invalidate cache first, since ctx may be canceled or timeout here
|
||||
globalMetaCache.ClearShards(t.collectionName)
|
||||
err = executeSearch(WithoutCache)
|
||||
}
|
||||
if err != nil {
|
||||
|
|
|
@ -285,6 +285,8 @@ func (g *getStatisticsTask) getStatisticsFromQueryNode(ctx context.Context) erro
|
|||
if errors.Is(err, errInvalidShardLeaders) || funcutil.IsGrpcErr(err) || errors.Is(err, grpcclient.ErrConnect) {
|
||||
log.Warn("first get statistics failed, updating shard leader caches and retry",
|
||||
zap.Error(err))
|
||||
// invalidate cache first, since ctx may be canceled or timeout here
|
||||
globalMetaCache.ClearShards(g.collectionName)
|
||||
err = executeGetStatistics(WithoutCache)
|
||||
}
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue