Skip to content

Commit

Permalink
store/helper, infoschema: fix the bug that cannot find down-peer (#24881
Browse files Browse the repository at this point in the history
)
  • Loading branch information
HunDunDM committed May 27, 2021
1 parent 2f96bc7 commit 96ab4a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions executor/infoschema_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions store/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 96ab4a3

Please sign in to comment.