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

Merged
merged 3 commits into from Sep 18, 2017

Conversation

Projects
None yet
4 participants
@disksing
Copy link
Member

disksing commented Sep 18, 2017

Sometime we want to recover store from wrong state. Sometime we want to cancel removing a store.

@disksing disksing requested review from nolouch and huachaohuang Sep 18, 2017

// NewSetStoreStateCommand returns a state subcommand of storeCmd.
func NewSetStoreStateCommand() *cobra.Command {
d := &cobra.Command{
Use: "state <store_id> [Up|Offline|Tombstone]",

This comment has been minimized.

@siddontang

siddontang Sep 18, 2017

Member

can we set the tombstone state directly? Seem it is dangerous.

This comment has been minimized.

@disksing

disksing Sep 18, 2017

Member

We already have API to let user to set a store's state to 'Tombstone' (from any state)... See:

pd/server/cluster.go

Lines 486 to 490 in 73fa4c4

// BuryStore marks a store as tombstone in cluster.
// State transition:
// Case 1: Up -> Tombstone (if force is true);
// Case 2: Offline -> Tombstone.
func (c *RaftCluster) BuryStore(storeID uint64, force bool) error {

This comment has been minimized.

@siddontang

siddontang Sep 18, 2017

Member

Got it.

This comment has been minimized.

@siddontang

siddontang Sep 18, 2017

Member

But can we transfer a tombstone store to up again?

This comment has been minimized.

@disksing

disksing Sep 18, 2017

Member

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.

@siddontang

This comment has been minimized.

Copy link
Member

siddontang commented Sep 18, 2017

/run-integration-test

@nolouch
Copy link
Member

nolouch left a comment

rest LGTM

fmt.Println("store_id should be a number")
return
}
prefix := fmt.Sprintf(storePrefix+"/state?state=%s", args[0], args[1])

This comment has been minimized.

@nolouch

nolouch Sep 18, 2017

Member

I think this way more like GET

@siddontang

This comment has been minimized.

Copy link
Member

siddontang commented Sep 18, 2017

LGTM
PTAL @huachaohuang

@disksing disksing changed the title api, pdctl: support set store state. api: support set store state. Sep 18, 2017

@huachaohuang

This comment has been minimized.

Copy link
Member

huachaohuang commented Sep 18, 2017

LGTM

@disksing

This comment has been minimized.

Copy link
Member

disksing commented Sep 18, 2017

/run-all-test

@disksing disksing merged commit 53c32f0 into master Sep 18, 2017

8 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
jenkins-ci-pd/build Jenkins job succeeded.
Details
jenkins-ci-pd/integration-common-test Jenkins job succeeded.
Details
jenkins-ci-pd/integration-ddl-test Jenkins job succeeded.
Details
jenkins-ci-pd/unit-test Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

@disksing disksing deleted the disksing/store-state branch Sep 18, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment