Skip to content
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/node: allow restart with a StoreIdent when cluster not boostrappped #4334

Merged
merged 13 commits into from Mar 13, 2019

Conversation

overvenus
Copy link
Member

What have you changed? (mandatory)

Allow restart TiKV with a StoreIdent when the cluster is not bootstrapped.

What are the type of the changes? (mandatory)

  • Bug fix (change which fixes an issue)

How has this PR been tested? (mandatory)

Integration test.

Does this PR affect documentation (docs) update? (mandatory)

No.

Does this PR affect tidb-ansible update? (mandatory)

No.

Refer to a related PR or issue link (optional)

Close #4333

…ppped

Signed-off-by: Neil Shen <overvenus@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>
@overvenus

This comment has been minimized.

@overvenus

This comment has been minimized.

@zhouqiang-cl
Copy link
Contributor

/run-integration-common-test

Signed-off-by: Neil Shen <overvenus@gmail.com>
@@ -155,10 +146,18 @@ mod tests {
);
let engines = Engines::new(Arc::clone(&kv_engine), Arc::clone(&raft_engine));

let mut region = metapb::Region::new();
Copy link
Member

Choose a reason for hiding this comment

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

You can use initial_region here too.

.get_msg::<metapb::Region>(keys::PREPARE_BOOTSTRAP_KEY)?;
if res.is_none() {
return Ok(());
.get_msg::<metapb::Region>(keys::PREPARE_BOOTSTRAP_KEY)?
Copy link
Member

Choose a reason for hiding this comment

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

Is the type hint really necessary?

.unwrap();
let store_id = ident.get_store_id();
let sim = Arc::new(RwLock::new(NodeCluster::new(Arc::clone(&pd_client))));
let mut cluster = Cluster::new(0, 5, sim, pd_client);
Copy link
Member

Choose a reason for hiding this comment

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

Why create a new cluster?

node.stop();
fail::remove(fp);

let (_, system) = fsm::create_raft_batch_system(&cfg.raft_store);
Copy link
Member

Choose a reason for hiding this comment

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

Why not add a try_start function to cluster? So that you don't have to repeat the code here.

Signed-off-by: Neil Shen <overvenus@gmail.com>
nolouch
nolouch previously approved these changes Mar 12, 2019
Copy link
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.

LGTM

Signed-off-by: Neil Shen <overvenus@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>
@overvenus
Copy link
Member Author

/run-all-tests

@overvenus overvenus merged commit d5105e5 into tikv:master Mar 13, 2019
@overvenus overvenus deleted the fix/bootstrap branch March 13, 2019 04:09
sticnarf pushed a commit to sticnarf/tikv that referenced this pull request Oct 27, 2019
…ppped (tikv#4334)

Signed-off-by: Neil Shen <overvenus@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TiKV may fail to restart if it fails after writing store ident and before bootstrapping cluster
4 participants