mirror of https://github.com/milvus-io/milvus.git
fix: querycoord panic after node down (#31831)
issue: #30519 Signed-off-by: Wei Liu <wei.liu@zilliz.com>pull/22134/head
parent
0feee53631
commit
7471a8005f
|
@ -956,9 +956,11 @@ func (s *Server) GetShardLeaders(ctx context.Context, req *querypb.GetShardLeade
|
|||
addrs := make([]string, 0, len(leaders))
|
||||
for _, leader := range readableLeaders {
|
||||
info := s.nodeMgr.Get(leader.ID)
|
||||
if info != nil {
|
||||
ids = append(ids, info.ID())
|
||||
addrs = append(addrs, info.Addr())
|
||||
}
|
||||
}
|
||||
|
||||
resp.Shards = append(resp.Shards, &querypb.ShardLeadersList{
|
||||
ChannelName: channel.GetChannelName(),
|
||||
|
|
|
@ -198,6 +198,12 @@ func (ex *Executor) loadSegment(task *SegmentTask, step int) error {
|
|||
|
||||
// Get shard leader for the given replica and segment
|
||||
replica := ex.meta.ReplicaManager.GetByCollectionAndNode(task.CollectionID(), action.Node())
|
||||
if replica == nil {
|
||||
msg := "node doesn't belong to any replica"
|
||||
err := merr.WrapErrNodeNotAvailable(action.Node())
|
||||
log.Warn(msg, zap.Error(err))
|
||||
return err
|
||||
}
|
||||
view := ex.dist.LeaderViewManager.GetLatestLeadersByReplicaShard(replica, action.Shard())
|
||||
if view == nil {
|
||||
msg := "no shard leader for the segment to execute loading"
|
||||
|
@ -255,6 +261,12 @@ func (ex *Executor) releaseSegment(task *SegmentTask, step int) {
|
|||
// return
|
||||
// }
|
||||
replica := ex.meta.ReplicaManager.GetByCollectionAndNode(task.CollectionID(), action.Node())
|
||||
if replica == nil {
|
||||
msg := "node doesn't belong to any replica"
|
||||
err := merr.WrapErrNodeNotAvailable(action.Node())
|
||||
log.Warn(msg, zap.Error(err))
|
||||
return
|
||||
}
|
||||
view := ex.dist.LeaderViewManager.GetLatestLeadersByReplicaShard(replica, action.Shard())
|
||||
if view == nil {
|
||||
msg := "no shard leader for the segment to execute releasing"
|
||||
|
|
Loading…
Reference in New Issue