diff --git a/executor/infoschema_reader.go b/executor/infoschema_reader.go index fdd0e843b556f..3041bb4c15602 100644 --- a/executor/infoschema_reader.go +++ b/executor/infoschema_reader.go @@ -1378,7 +1378,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)) @@ -1395,11 +1395,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 71ddb5c942a9e..e474cc2150912 100644 --- a/store/helper/helper.go +++ b/store/helper/helper.go @@ -467,8 +467,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.