-
Notifications
You must be signed in to change notification settings - Fork 721
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
server: fix frequent alloc id #1013
Conversation
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
server/schedule/replica_checker.go
Outdated
@@ -83,7 +83,7 @@ func (r *ReplicaChecker) Check(region *core.RegionInfo) *Operator { | |||
|
|||
// SelectBestReplacedPeerToAddReplica returns a new peer that to be used to replace the old peer and distinct score. | |||
func (r *ReplicaChecker) SelectBestReplacedPeerToAddReplica(region *core.RegionInfo, oldPeer *metapb.Peer, filters ...Filter) *metapb.Peer { | |||
storeID, _ := r.selectBestReplacementStore(region, oldPeer, filters...) | |||
storeID, _ := r.SelectBestReplacementStore(region, oldPeer, filters...) |
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 think we can remove the function SelectBestReplacedPeerToAddReplica
to prevent we misuse it later.
server/schedule/replica_checker.go
Outdated
} | ||
newPeer, err := r.cluster.AllocPeer(storeID) | ||
if err != nil { | ||
log.Info("alloc peer meet error:", err) |
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 think we can use log.Error.
server/schedule/replica_checker.go
Outdated
@@ -228,6 +219,7 @@ func (r *ReplicaChecker) checkBestReplacement(region *core.RegionInfo) *Operator | |||
} | |||
newPeer, err := r.cluster.AllocPeer(storeID) | |||
if err != nil { | |||
log.Info("alloc peer meet error:", err) |
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.
ditto.
PTAL @disksing |
@@ -154,6 +154,10 @@ func (s *balanceRegionScheduler) transferPeer(cluster schedule.Cluster, region * | |||
schedulerCounter.WithLabelValues(s.GetName(), "skip").Inc() | |||
return nil | |||
} | |||
newPeer, err := cluster.AllocPeer(storeID) | |||
if err != nil { | |||
schedulerCounter.WithLabelValues(s.GetName(), "no_peer").Inc() |
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.
return nil?
server/schedule/replica_checker.go
Outdated
} | ||
newPeer, err := r.cluster.AllocPeer(storeID) | ||
if err != nil { | ||
log.Error("alloc peer meet error:", err) |
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 have a second thought here. It seems better to move the log into AllocPeer
function.
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.
yeah, I check that found has already printed.
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.
/run-all-tests |
…1.11.1 in /tools/pd-tso-bench (#5990) ref #897, ref #962, ref #969, ref #974, ref #975, ref #976, ref #986, ref prometheus/client_golang#987, ref #987, ref #989, ref #998, ref #1013, ref #1014, ref #1025, ref #1028, ref #1031, ref #1043, ref #1055, ref #1075, ref #1091, ref #1094, ref #1102, ref #1103, ref #1118, ref #1146, ref #1148, ref #1150 Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…1.11.1 in /tests/client (#5992) ref #897, ref #962, ref #969, ref #974, ref #975, ref #976, ref #986, ref #987, ref prometheus/client_golang#987, ref #989, ref #998, ref #1013, ref #1014, ref #1025, ref #1028, ref #1031, ref #1043, ref #1055, ref #1075, ref #1091, ref #1094, ref #1102, ref #1103, ref #1118, ref #1146, ref #1148, ref #1150, ref #4399 Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…1.11.1 in /tests/mcs (#5993) ref #897, ref #962, ref #969, ref #974, ref #975, ref #976, ref #986, ref #987, ref prometheus/client_golang#987, ref #989, ref #998, ref #1013, ref #1014, ref #1025, ref #1028, ref #1031, ref #1043, ref #1055, ref #1075, ref #1091, ref #1094, ref #1102, ref #1103, ref #1118, ref #1146, ref #1148, ref #1150, ref #4399 Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ti Chi Robot <[email protected]>
…1.11.1 in /client (#5991) ref #897, ref #962, ref #969, ref #974, ref #975, ref #976, ref #986, ref #987, ref prometheus/client_golang#987, ref #989, ref #998, ref #1013, ref #1014, ref #1025, ref #1028, ref #1031, ref #1043, ref #1055, ref #1075, ref #1091, ref #1094, ref #1102, ref #1103, ref #1118, ref #1146, ref #1148, ref #1150, ref #4399 Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ti Chi Robot <[email protected]>
the balance region may alloc peer but do not produce operator.