Skip to content

Commit

Permalink
tools: fix store statistics (#7771)
Browse files Browse the repository at this point in the history
ref #7703

Signed-off-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
rleungx committed Jan 29, 2024
1 parent 5b939c6 commit 7142cf4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tools/pd-heartbeat-bench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,14 @@ func (s *Stores) update(rs *Regions) {
},
}
}
for _, region := range rs.regions {
var toUpdate []*pdpb.RegionHeartbeatRequest
updatedRegions := rs.awakenRegions.Load()
if updatedRegions == nil {
toUpdate = rs.regions
} else {
toUpdate = updatedRegions.([]*pdpb.RegionHeartbeatRequest)
}
for _, region := range toUpdate {
for _, peer := range region.Region.Peers {
store := stats[peer.StoreId]
store.UsedSize += region.ApproximateSize
Expand Down

0 comments on commit 7142cf4

Please sign in to comment.