-
Notifications
You must be signed in to change notification settings - Fork 714
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
api: support set store state. #757
Conversation
pdctl/command/store_command.go
Outdated
// NewSetStoreStateCommand returns a state subcommand of storeCmd. | ||
func NewSetStoreStateCommand() *cobra.Command { | ||
d := &cobra.Command{ | ||
Use: "state <store_id> [Up|Offline|Tombstone]", |
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 set the tombstone state directly? Seem it is dangerous.
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.
We already have API to let user to set a store's state to 'Tombstone' (from any state)... See: https://github.com/pingcap/pd/blob/73fa4c4f2c394817fbb511afb06a5933b845167e/server/cluster.go#L486-L490
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.
Got 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.
But can we transfer a tombstone store to up again?
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. The 'tombstone' is just a flag in pd-server that prevent data been transferred to the store, and make the store ignored by any balancers.
/run-integration-test |
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.
rest LGTM
pdctl/command/store_command.go
Outdated
fmt.Println("store_id should be a number") | ||
return | ||
} | ||
prefix := fmt.Sprintf(storePrefix+"/state?state=%s", args[0], args[1]) |
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 this way more like GET
LGTM |
LGTM |
/run-all-test |
I saw the original commit to add state set command in |
@cofyc It's a dangerous feature. We only want experts to use it. |
Sometime we want to recover store from wrong state. Sometime we want to cancel removing a store.