Skip to content

api/store:set state do not support set from or to Tombstone anymore#3407

Merged
ti-chi-bot merged 4 commits into
tikv:masterfrom
AndreMouche:api/set_state
Feb 3, 2021
Merged

api/store:set state do not support set from or to Tombstone anymore#3407
ti-chi-bot merged 4 commits into
tikv:masterfrom
AndreMouche:api/set_state

Conversation

@AndreMouche
Copy link
Copy Markdown
Member

@AndreMouche AndreMouche commented Feb 1, 2021

Signed-off-by: shirly AndreMouche@126.com

What problem does this PR solve?

To close issue #3076

This PR does not support setting a store's state to or from Tombstone by the API set store state

What is changed and how it works?

  • the API to update the store's state does not support Tombstone anymore:
POST /store/{id}/state?state=${state}

state query string true "state" Enums(Up, Offline), Tombstone is not supported anymore. Also, this PR does not support to up a store from tombstone or physically destroyed

Check List

Tests

  • Unit test

Related changes

Release note

  • No release note

Signed-off-by: shirly <AndreMouche@126.com>
@ti-chi-bot ti-chi-bot requested review from nolouch and rleungx February 1, 2021 04:04
@sre-bot
Copy link
Copy Markdown
Contributor

sre-bot commented Feb 1, 2021

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 1, 2021

Codecov Report

Merging #3407 (43d76eb) into master (4eae255) will increase coverage by 0.18%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3407      +/-   ##
==========================================
+ Coverage   74.84%   75.02%   +0.18%     
==========================================
  Files         243      243              
  Lines       23422    23431       +9     
==========================================
+ Hits        17530    17580      +50     
+ Misses       4311     4283      -28     
+ Partials     1581     1568      -13     
Flag Coverage Δ
unittests 75.02% <100.00%> (+0.18%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/mock/mockcluster/mockcluster.go 94.41% <100.00%> (ø)
server/api/store.go 65.34% <100.00%> (+2.65%) ⬆️
server/cluster/cluster.go 83.85% <100.00%> (+1.27%) ⬆️
server/core/store_option.go 100.00% <100.00%> (ø)
pkg/dashboard/adapter/manager.go 84.78% <0.00%> (-7.61%) ⬇️
server/handler.go 41.97% <0.00%> (-0.50%) ⬇️
server/grpc_service.go 57.42% <0.00%> (+0.16%) ⬆️
server/server.go 73.17% <0.00%> (+0.93%) ⬆️
server/schedule/operator/step.go 68.43% <0.00%> (+0.99%) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4eae255...5330b18. Read the comment docs.

@sre-bot
Copy link
Copy Markdown
Contributor

sre-bot commented Feb 1, 2021

Copy link
Copy Markdown
Member

@HunDunDM HunDunDM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest LGTM

func TombstoneStore() StoreCreateOption {
return func(store *StoreInfo) {
meta := proto.Clone(store.meta).(*metapb.Store)
meta.State = metapb.StoreState_Tombstone
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should PhysicallyDestroyed be changed to false? And maybe we should use func setStoreState(state metapb.StoreState, physicallyDestroyed bool) StoreCreateOption to reduce redundant code.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, the api design lgtm while we can use setStoreState to reduce the duplicated code.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As PR #3388 discussed, SetStoreState are replaced by following StoreCreateOptions:

- UpStore() 
- OfflineStore(physicallyDestroyed bool)
- TombstoneStore()

which have clearer definition and logic for each StoreCreateOption

Copy link
Copy Markdown
Contributor

@Yisaer Yisaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

Comment thread server/api/store.go Outdated
func TombstoneStore() StoreCreateOption {
return func(store *StoreInfo) {
meta := proto.Clone(store.meta).(*metapb.Store)
meta.State = metapb.StoreState_Tombstone
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, the api design lgtm while we can use setStoreState to reduce the duplicated code.

Signed-off-by: shirly <AndreMouche@126.com>
@sre-bot
Copy link
Copy Markdown
Contributor

sre-bot commented Feb 2, 2021

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 2, 2021
Copy link
Copy Markdown
Contributor

@Yisaer Yisaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot
Copy link
Copy Markdown
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • HunDunDM
  • Yisaer

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Details

Reviewer can indicate their review by writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 3, 2021
@Yisaer
Copy link
Copy Markdown
Contributor

Yisaer commented Feb 3, 2021

/merge

@ti-chi-bot
Copy link
Copy Markdown
Member

@Yisaer: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Copy Markdown
Member

This pull request has been accepted and is ready to merge.

DetailsCommit hash: e3dbdde

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 3, 2021
@ti-chi-bot
Copy link
Copy Markdown
Member

@AndreMouche: Your PR has out-of-dated, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

Copy link
Copy Markdown
Contributor

@nolouch nolouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest LGTM.

@@ -185,7 +185,7 @@ func (mc *Cluster) SetStoreDisconnect(storeID uint64) {
func (mc *Cluster) SetStoreDown(storeID uint64) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the function name is correct, but the implementation is incorrect before:(

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

Labels

status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants