mirror of https://github.com/milvus-io/milvus.git
fix get replica return wrong node list (#23792)
Signed-off-by: Wei Liu <wei.liu@zilliz.com>pull/23817/head
parent
9d35a5f943
commit
b6ae70db43
|
@ -311,10 +311,10 @@ func (s *Server) tryGetNodesMetrics(ctx context.Context, req *milvuspb.GetMetric
|
|||
}
|
||||
|
||||
func (s *Server) fillReplicaInfo(replica *meta.Replica, withShardNodes bool) (*milvuspb.ReplicaInfo, error) {
|
||||
nodeIDs := typeutil.NewUniqueSet(replica.GetNodes()...)
|
||||
info := &milvuspb.ReplicaInfo{
|
||||
ReplicaID: replica.GetID(),
|
||||
CollectionID: replica.GetCollectionID(),
|
||||
NodeIds: replica.GetNodes(),
|
||||
ResourceGroupName: replica.GetResourceGroup(),
|
||||
NumOutboundNode: s.meta.GetOutgoingNodeNumByReplica(replica),
|
||||
}
|
||||
|
@ -355,8 +355,7 @@ func (s *Server) fillReplicaInfo(replica *meta.Replica, withShardNodes bool) (*m
|
|||
}
|
||||
return 0, false
|
||||
})
|
||||
nodeIDs.Insert(shardNodes...)
|
||||
shard.NodeIds = nodeIDs.Collect()
|
||||
shard.NodeIds = typeutil.NewUniqueSet(shardNodes...).Collect()
|
||||
}
|
||||
info.ShardReplicas = append(info.ShardReplicas, shard)
|
||||
}
|
||||
|
|
|
@ -1380,7 +1380,12 @@ func (suite *ServiceSuite) TestGetReplicas() {
|
|||
for _, shardReplica := range replica.GetShardReplicas() {
|
||||
gotNodeIDsSet := typeutil.NewUniqueSet(shardReplica.GetNodeIds()...)
|
||||
suite.Equal(len(shardReplica.GetNodeIds()), gotNodeIDsSet.Len())
|
||||
if len(resp.GetReplicas()) > 0 {
|
||||
suite.True(gotNodeIDsSet.Len() < len(replica.GetNodeIds()))
|
||||
}
|
||||
}
|
||||
|
||||
suite.Equal(len(replica.GetNodeIds()), len(suite.meta.ReplicaManager.Get(replica.ReplicaID).GetNodes()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue