-
Notifications
You must be signed in to change notification settings - Fork 188
master: add metric indicate number of pending DDL state (pessimistic only) #791
Conversation
Codecov Report
@@ Coverage Diff @@
## master #791 +/- ##
===========================================
Coverage 56.0734% 56.0734%
===========================================
Files 212 212
Lines 22121 22121
===========================================
Hits 12404 12404
Misses 8496 8496
Partials 1221 1221 |
dm/master/election.go
Outdated
@@ -152,4 +153,5 @@ func (s *Server) retireLeader() { | |||
s.leader = "" | |||
s.closeLeaderClient() | |||
s.Unlock() | |||
metrics.RemoveDDLPendingInMetrics() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this metric will reset to 0 when the leader is changed, may puzzles users 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how we supposed to use HA metrics. I think we could collect all dm-master's counter and add them, so non-leader should output zero.
Maybe we could forward metric requests to leader 😂 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about wait Xuecheng give some suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe PD needs to solve the same problem, can we refer to it?
or just show value for leader (introduce a role
for DM-master nodes in metrics) in Grafana?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PD use a reversed proxy (not understand) to forward every http request to leader, so this PR should be updated (but after I figure it out)
seems there're many PRs editing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What problem does this PR solve?
part of #543. Note this PR only deal with pessimistic shard DDL lock, optimistic is more complicated and will be cover in another PR
What is changed and how it works?
show number of pending DDLs, in types of "Un-synced" and "Synced". Only leader of dm-master will take count, so we could collect from dm-masters and calculate sums to get current pending DDL number.
Check List
Tests
shardddl1
and check metrics workCode changes
Side effects
Related changes