-
Notifications
You must be signed in to change notification settings - Fork 725
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
grpc_service: add ManuallyChangePeer
and ManuallyChangeMultiPeers
.
#8266
Conversation
make `grpc_service` support manually add / remove peers by `ManuallyChangePeer` and `ManuallyChangeMultiPeers`. Signed-off-by: lucasliang <[email protected]>
[REVIEW NOTIFICATION] This pull request has not been approved. To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/cc @nolouch |
@@ -2,6 +2,8 @@ module github.com/tikv/pd/client | |||
|
|||
go 1.21 | |||
|
|||
replace github.com/pingcap/kvproto => github.com/LykxSassinator/kvproto v0.0.0-20240605160713-4dfe4594d6ca |
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.
Will be cleared after pingcap/kvproto#1250 is merged.
@@ -6,6 +6,7 @@ go 1.21 | |||
// kvproto at the same time. You can run `go mod tidy` to make it replaced with go-mod style specification. | |||
// After the PR to kvproto is merged, remember to comment this out and run `go mod tidy`. | |||
// replace github.com/pingcap/kvproto => github.com/$YourPrivateRepo $YourPrivateBranch | |||
replace github.com/pingcap/kvproto => github.com/LykxSassinator/kvproto v0.0.0-20240605160713-4dfe4594d6ca |
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.
@@ -3,6 +3,7 @@ module github.com/tikv/pd/tools | |||
go 1.21 | |||
|
|||
replace ( | |||
github.com/pingcap/kvproto => github.com/LykxSassinator/kvproto v0.0.0-20240605160713-4dfe4594d6ca |
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.
@@ -3000,6 +3001,78 @@ func (s *GrpcServer) GetExternalTimestamp(ctx context.Context, request *pdpb.Get | |||
}, nil | |||
} | |||
|
|||
// ManuallyChangePeer implements gRPC PDServer. | |||
func (s *GrpcServer) ManuallyChangePeer(ctx context.Context, request *pdpb.ChangePeerRequest) (*pdpb.ChangePeerResponse, error) { |
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.
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.
Can we only report the purpose then PD generates operators, like call interface as "ReportDamagedPeer"?
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.
Do u mean using GetDamagedRegionsId
?
Not appropriate. The DamagedRegionsId
just records the abnormal region, and it's used to delete all of the peers of this region.
But what we need now is "add / remove" a single peer.
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 mean the TiKV tells PD which peer is damaged or needs to be cleaned. then PD will log it(better with the
caller source) and add an operator to add/remove it.
Do not directly guide PD on how to do it, tell PD your purpose, and then PD makes the decisions. it prevents some unknown source from abusing it.
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.
It just needs a simple way to let PD trigger the operator on add
or remove
peer here. And we've already have Restful API used for add
& remove
peer, gRPC API is intended to be used as the same purpose here.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -133,6 +134,11 @@ type RPCClient interface { | |||
// SetExternalTimestamp sets external timestamp | |||
SetExternalTimestamp(ctx context.Context, timestamp uint64) error | |||
|
|||
// ManuallyChangePeer manually changes the peer of a region. | |||
ManuallyChangePeer(ctx context.Context, regionID uint64, changeType eraftpb.ConfChangeType, peer *metapb.Peer) error |
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.
Is it necessary? Why not let TiKV handle it? If we are going to use RPC to solve the snapshot problem, we still can not ensure that the operator is executed successfully.
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.
It's used to make the operation on add peer
/ remove peer
managed by PD uniformly.
If let TiKV handle it directly, the scheduling on add peer
or remove peer
will not be perceived by PD, and the check of the scheduler cannot be validated by the store limit
and other checking mechanisms.
As for
ensure that the operator is executed successfully.
TiKV will retry the remove peer
RPC if the operator does not make senses until this peer is cleared.
[FORMAT CHECKER NOTIFICATION] Notice: To remove the 📖 For more info, you can check the "Linking issues" section in the CONTRIBUTING.md. |
This pr can be closed as this RPC is not necessary. |
What problem does this PR solve?
Issue Number: Ref tikv/tikv#15292 proto: pingcap/kvproto#1250
What is changed and how does it work?
Check List
Tests
Code changes
Side effects
Related changes
pingcap/docs
/pingcap/docs-cn
:pingcap/tiup
:Release note