diff --git a/executor/infoschema_reader.go b/executor/infoschema_reader.go index ee5b4af84b574..d049fb3eb39e8 100644 --- a/executor/infoschema_reader.go +++ b/executor/infoschema_reader.go @@ -1410,7 +1410,7 @@ func (e *memtableRetriever) setNewTiKVRegionPeersCols(region *helper.RegionInfo) } downPeerMap := make(map[int64]int64, len(region.DownPeers)) for _, peerStat := range region.DownPeers { - downPeerMap[peerStat.ID] = peerStat.DownSec + downPeerMap[peerStat.Peer.ID] = peerStat.DownSec } for _, peer := range region.Peers { row := make([]types.Datum, len(infoschema.TableTiKVRegionPeersCols)) @@ -1427,11 +1427,11 @@ func (e *memtableRetriever) setNewTiKVRegionPeersCols(region *helper.RegionInfo) } else { row[4].SetInt64(0) } - if pendingPeerIDSet.Exist(peer.ID) { - row[5].SetString(pendingPeer, mysql.DefaultCollationName) - } else if downSec, ok := downPeerMap[peer.ID]; ok { + if downSec, ok := downPeerMap[peer.ID]; ok { row[5].SetString(downPeer, mysql.DefaultCollationName) row[6].SetInt64(downSec) + } else if pendingPeerIDSet.Exist(peer.ID) { + row[5].SetString(pendingPeer, mysql.DefaultCollationName) } else { row[5].SetString(normalPeer, mysql.DefaultCollationName) } diff --git a/store/helper/helper.go b/store/helper/helper.go index 52100e472cbb2..53525f9687fa2 100644 --- a/store/helper/helper.go +++ b/store/helper/helper.go @@ -539,8 +539,8 @@ type RegionEpoch struct { // RegionPeerStat stores one field `DownSec` which indicates how long it's down than `RegionPeer`. type RegionPeerStat struct { - RegionPeer - DownSec int64 `json:"down_seconds"` + Peer RegionPeer `json:"peer"` + DownSec int64 `json:"down_seconds"` } // RegionInfo stores the information of one region.