Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scheduler: hotspot: add pending influence #1982

Merged
merged 14 commits into from
Dec 6, 2019
11 changes: 11 additions & 0 deletions server/cluster/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ func (c *coordinator) stop() {
type hasHotStatus interface {
GetHotReadStatus() *statistics.StoreHotPeersInfos
GetHotWriteStatus() *statistics.StoreHotPeersInfos
GetWritePendingInfluence() map[uint64]schedulers.Influence
GetReadPendingInfluence() map[uint64]schedulers.Influence
GetStoresScore() map[uint64]float64
}

Expand Down Expand Up @@ -328,6 +330,7 @@ func (c *coordinator) collectHotSpotMetrics() {
}
stores := c.cluster.GetStores()
status := s.Scheduler.(hasHotStatus).GetHotWriteStatus()
pendings := s.Scheduler.(hasHotStatus).GetWritePendingInfluence()
for _, s := range stores {
storeAddress := s.GetAddress()
storeID := s.GetID()
Expand All @@ -349,10 +352,15 @@ func (c *coordinator) collectHotSpotMetrics() {
hotSpotStatusGauge.WithLabelValues(storeAddress, storeLabel, "total_written_bytes_as_leader").Set(0)
hotSpotStatusGauge.WithLabelValues(storeAddress, storeLabel, "hot_write_region_as_leader").Set(0)
}

infl := pendings[storeID]
// TODO: add to tidb-ansible after merging pending influence into operator influence.
hotSpotStatusGauge.WithLabelValues(storeAddress, storeLabel, "write_pending_influence_byte_rate").Set(infl.ByteRate)
}

// Collects hot read region metrics.
status = s.Scheduler.(hasHotStatus).GetHotReadStatus()
pendings = s.Scheduler.(hasHotStatus).GetReadPendingInfluence()
for _, s := range stores {
storeAddress := s.GetAddress()
storeID := s.GetID()
Expand All @@ -365,6 +373,9 @@ func (c *coordinator) collectHotSpotMetrics() {
hotSpotStatusGauge.WithLabelValues(storeAddress, storeLabel, "total_read_bytes_as_leader").Set(0)
hotSpotStatusGauge.WithLabelValues(storeAddress, storeLabel, "hot_read_region_as_leader").Set(0)
}

infl := pendings[storeID]
hotSpotStatusGauge.WithLabelValues(storeAddress, storeLabel, "read_pending_influence_byte_rate").Set(infl.ByteRate)
}

// Collects score of stores stats metrics.
Expand Down
1 change: 0 additions & 1 deletion server/schedule/operator/create_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ func CreateMoveLeaderOperator(desc string, cluster Cluster, region *core.RegionI
return nil, err
}
st := CreateAddPeerSteps(peer)
st = append(st, TransferLeader{ToStore: peer.StoreId, FromStore: oldStore})
lhy1024 marked this conversation as resolved.
Show resolved Hide resolved
steps = append(st, steps...)
brief := fmt.Sprintf("mv leader: store %v to %v", oldStore, peer.StoreId)
return NewOperator(desc, brief, region.GetID(), region.GetRegionEpoch(), removeKind|kind|OpLeader|OpRegion, steps...), nil
Expand Down
Loading