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

raftstore: Implement coprocessor observer pre(post)_apply_snapshot #12889

Merged
merged 42 commits into from Aug 23, 2022

Conversation

CalvinNeo
Copy link
Member

@CalvinNeo CalvinNeo commented Jun 23, 2022

What is changed and how it works?

Issue Number: ref #12849

What's Changed:

Support new observers pre(post)_apply_snapshot.

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

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

Side effects

  • Performance regression
    • Consumes more CPU
    • Consumes more MEM
  • Breaking backward compatibility

Release note

None

Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jun 23, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • BusyJay
  • breezewish

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.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
f
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
f
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
@CalvinNeo CalvinNeo changed the title raftstore: Implement coprocessor observer pre_apply_snapshot raftstore: Implement coprocessor observer pre(post)_apply_snapshot Jun 24, 2022
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
Copy link
Contributor

@tonyxuqqi tonyxuqqi left a comment

Choose a reason for hiding this comment

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

Generally LGTM

Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
@CalvinNeo CalvinNeo requested a review from tonyxuqqi June 29, 2022 03:39
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
f
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
f
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
f
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
f
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
f
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
f
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
f
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
Copy link
Member

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

components/raftstore/src/store/worker/region.rs Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added the status/LGT1 Status: PR - There is already 1 approval label Aug 19, 2022
f
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
CalvinNeo and others added 4 commits August 22, 2022 16:40
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
f
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
f
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
Copy link
Member

@breezewish breezewish left a comment

Choose a reason for hiding this comment

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

the rest LGTM

@@ -763,6 +817,14 @@ where
}
task @ Task::Apply { .. } => {
fail_point!("on_region_worker_apply", true, |_| {});
if self.ctx.coprocessor_host.should_pre_apply_snapshot() {
if let Err(e) = self.ctx.pre_apply_snapshot(&task) {
info!(
Copy link
Member

Choose a reason for hiding this comment

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

maybe warn?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think maybe we can just remove this log. Since:

  1. If the error is raised by check_abort, which means we just quit applying this snapshot, it is in expectation.
  2. If the error is because we have not finished receiving/persisting snapshot for now, it is also in expectation.

For the rear case, we can have a pre_apply_snapshot(.., None) to notify, so we can print if we need in proxy code, though currently this is not necessary.

@@ -763,6 +817,14 @@ where
}
task @ Task::Apply { .. } => {
fail_point!("on_region_worker_apply", true, |_| {});
if self.ctx.coprocessor_host.should_pre_apply_snapshot() {
if let Err(e) = self.ctx.pre_apply_snapshot(&task) {
Copy link
Member

Choose a reason for hiding this comment

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

these pre-apply-snapshots are handled in serial instead of concurrently?

Copy link
Member Author

Choose a reason for hiding this comment

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

They are handled in parallel

@ti-chi-bot ti-chi-bot added status/LGT2 Status: PR - There are already 2 approvals and removed status/LGT1 Status: PR - There is already 1 approval labels Aug 23, 2022
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
@breezewish
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

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

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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
Member

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

Commit hash: 62a3e8e

@ti-chi-bot ti-chi-bot added the status/can-merge Status: Can merge to base branch label Aug 23, 2022
@ti-chi-bot
Copy link
Member

@CalvinNeo: Your PR was out of date, I have automatically updated it for you.

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

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 ti-chi-bot merged commit 6dcd0b3 into tikv:master Aug 23, 2022
@ti-chi-bot ti-chi-bot added this to the Pool milestone Aug 23, 2022
CalvinNeo added a commit to CalvinNeo/tidb-engine-ext that referenced this pull request Aug 23, 2022
…ikv#12889)

ref tikv#12849

Support new observers pre(post)_apply_snapshot.

Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
TonsnakeLin pushed a commit to TonsnakeLin/tikv that referenced this pull request Aug 26, 2022
…ikv#12889)

ref tikv#12849

Support new observers pre(post)_apply_snapshot.

Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
Signed-off-by: TonsnakeLin <lpbgytong@163.com>
TonsnakeLin pushed a commit to TonsnakeLin/tikv that referenced this pull request Aug 29, 2022
…ikv#12889)

ref tikv#12849

Support new observers pre(post)_apply_snapshot.

Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
Signed-off-by: TonsnakeLin <lpbgytong@163.com>
fengou1 pushed a commit to fengou1/tikv that referenced this pull request Aug 30, 2022
…ikv#12889)

ref tikv#12849

Support new observers pre(post)_apply_snapshot.

Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
Signed-off-by: fengou1 <feng.ou@pingcap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution Type: PR - From contributors release-note-none size/XL status/can-merge Status: Can merge to base branch status/LGT2 Status: PR - There are already 2 approvals
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants