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

ddl: implement backoff pool for TiFlash Cluster Management #32317

Merged
merged 32 commits into from
Mar 4, 2022

Conversation

CalvinNeo
Copy link
Member

@CalvinNeo CalvinNeo commented Feb 14, 2022

What problem does this PR solve?

Issue Number: ref #32254

Problem Summary:
This PR is part of batch setting TiFlash replica in one database. It sorts out big tables that takes long time to be available into a backoff pool, in order to avoid checking every tick.

What is changed and how it works?

When a table is to be checked for availability, we will firstly find if it is in backoff pool, and is determined not to be handled in this round.
When a table is checked to be not available for the first time, it will be added into backoff pool.
When a table is available, it will be removed from backoff pool.

Check List

Tests

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

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

implement backoff pool for TiFlash Cluster Management

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>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Feb 14, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • xhebox
  • zimulala

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.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Feb 14, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Feb 14, 2022

Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 14, 2022
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
@CalvinNeo
Copy link
Member Author

/run_unit-test

1 similar comment
@CalvinNeo
Copy link
Member Author

/run_unit-test

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 18, 2022
CalvinNeo and others added 5 commits February 18, 2022 17:01
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 22, 2022
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 23, 2022
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
ddl/ddl_tiflash_api.go Outdated Show resolved Hide resolved
ddl/ddl_tiflash_api.go Outdated Show resolved Hide resolved
ddl/ddl_tiflash_api.go Outdated Show resolved Hide resolved
ddl/ddl_tiflash_api.go Show resolved Hide resolved
}

// NeedGrow returns if we need to grow
func (e *PollTiFlashBackoffElement) NeedGrow() bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we remove this function? It only used in one place and only one line.

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 need to export this for testing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it.

ddl/ddl_tiflash_api.go Outdated Show resolved Hide resolved
ddl/ddl_tiflash_api.go Show resolved Hide resolved
ddl/ddl_tiflash_api.go Outdated Show resolved Hide resolved
ddl/ddl_tiflash_api.go Outdated Show resolved Hide resolved
Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
ddl/ddl_tiflash_api.go Show resolved Hide resolved
ddl/ddl_tiflash_api.go Show resolved Hide resolved
@@ -258,6 +400,11 @@ func (d *ddl) pollTiFlashReplicaStatus(ctx sessionctx.Context, pollTiFlashContex
// We only check unavailable tables here, so doesn't include blocked add partition case.
if !available {
allReplicaReady = false
grown, inqueue, _ := pollTiFlashContext.Backoff.Tick(tb.ID)
if inqueue && !grown {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to sleep here or out of for statement?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sleeps are in PollTiFlashRoutine, this is a plug-in backoffer.

Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
@CalvinNeo CalvinNeo requested a review from zimulala March 3, 2022 14:39
Copy link
Contributor

@zimulala zimulala 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 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 Mar 4, 2022
@zimulala
Copy link
Contributor

zimulala commented Mar 4, 2022

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 9791471

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 4, 2022
@hawkingrei
Copy link
Member

/run-unit-test

@ti-chi-bot ti-chi-bot merged commit 55d0f12 into pingcap:master Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. 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