mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
Invalidate cache first when shard leader list contains error (#21451)
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
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…
x
Reference in New Issue
Block a user