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

config: support online change lock manager config #6338

Merged
merged 9 commits into from Dec 27, 2019

Conversation

NingLin-P
Copy link
Member

What have you changed?

This pr is part of online change config.
This pr add support for online change lock manager config by adding new tasks to lock manger (
Task::ChangeConfig and Task::ChangeTTL).

What is the type of the changes?

  • New feature (a change which adds functionality)

How is the PR tested?

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Does this PR affect documentation (docs) or should it be mentioned in the release notes?

No

Does this PR affect tidb-ansible?

No

Signed-off-by: linning <linningde25@gmail.com>
Signed-off-by: linning <linningde25@gmail.com>
Signed-off-by: linning <linningde25@gmail.com>
Signed-off-by: linning <linningde25@gmail.com>
@NingLin-P NingLin-P added the component/configuration Component: Configuration label Dec 26, 2019
Copy link
Member

@overvenus overvenus 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

// Create CoprocessorHost.
let mut coprocessor_host =
CoprocessorHost::new(self.config.coprocessor.clone(), self.router.clone());

let lock_mgr = if self.config.pessimistic_txn.enabled {
let lock_mgr = LockManager::new();
cfg_controller.register("pessimistic_txn", Box::new(lock_mgr.config_manager()));
Copy link
Member

Choose a reason for hiding this comment

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

pessimistic_txn or pessimistic-txn?

Copy link
Member Author

Choose a reason for hiding this comment

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

pessimistic_txn same as the TiKvConfig field name.

change.remove("wait_for_lock_timeout").map(Into::into),
change.remove("wake_up_delay_duration").map(Into::into),
) {
(timeout @ Some(_), delay) => {
Copy link
Member

Choose a reason for hiding this comment

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

What if delay is None?

Copy link
Member Author

Choose a reason for hiding this comment

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

WaiterManager need to listening both update of timeout and delay, even one of them are not change (represent as None here), we still need to dispatch the change to it, and WaiterManager::handle_config_change will take care of various situations.

@@ -319,6 +329,9 @@ impl Display for Task {
),
Task::DetectRpc { .. } => write!(f, "Detect Rpc"),
Task::ChangeRole(role) => write!(f, "ChangeRole {{ role: {:?} }}", role),
Task::ChangeTTL(ttl) => write!(f, "ChangeTTL {{ ttl: {:?} }}", ttl),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Task::ChangeTTL(ttl) => write!(f, "ChangeTTL {{ ttl: {:?} }}", ttl),
Task::ChangeTTL(ttl) => write!(f, "ChangeTTL { ttl: {:?} }", ttl),

Copy link
Member Author

Choose a reason for hiding this comment

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

we need {{ here to print out {, so Task::ChangeTTL print something like ChangeTTL { ttl: 100ms }.

src/server/lock_manager/deadlock.rs Show resolved Hide resolved
Copy link
Contributor

@youjiali1995 youjiali1995 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

src/server/lock_manager/deadlock.rs Outdated Show resolved Hide resolved
src/server/lock_manager/waiter_manager.rs Outdated Show resolved Hide resolved
src/server/lock_manager/waiter_manager.rs Outdated Show resolved Hide resolved
src/server/lock_manager/config.rs Show resolved Hide resolved
Copy link
Contributor

@youjiali1995 youjiali1995 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@overvenus overvenus left a comment

Choose a reason for hiding this comment

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

LGTM

@overvenus overvenus added the status/can-merge Status: Can merge to base branch label Dec 27, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Dec 27, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Dec 27, 2019

@NingLin-P merge failed.

@NingLin-P
Copy link
Member Author

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Dec 27, 2019

/run-all-tests

@sre-bot sre-bot merged commit 28d44ce into tikv:master Dec 27, 2019
c1ay pushed a commit to c1ay/tikv that referenced this pull request May 9, 2020
Signed-off-by: linning <linningde25@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/configuration Component: Configuration status/can-merge Status: Can merge to base branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants