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

lightning: support disable scheduler by key range #34130

Merged
merged 22 commits into from
Jun 24, 2022

Conversation

sleepymole
Copy link
Contributor

@sleepymole sleepymole commented Apr 20, 2022

What problem does this PR solve?

Issue Number: close #35148

Problem Summary:

We want to use lightning to import data to an online cluster. To reduce the impact on online services, lightning shouldn't disable the whole scheduler during importing. Instead, lightning should only disable the scheduler on the region that is being imported.

What is changed and how it works?

tikv/pd#4695 supported ttl for region label. We can use the region label to disable scheduler on specific key range, and recover scheduler automatically.

Check List

Tests

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

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Apr 20, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • D3Hunter
  • buchuitoudegou

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 do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 20, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Apr 20, 2022

@sleepymole sleepymole added the component/lightning This issue is related to Lightning of TiDB. label Apr 20, 2022
br/pkg/pdutil/pd.go Outdated Show resolved Hide resolved
@sleepymole sleepymole force-pushed the online-import branch 2 times, most recently from 5d9341b to 4e3adcc Compare April 27, 2022 07:26
@sleepymole sleepymole force-pushed the online-import branch 3 times, most recently from 55d5687 to 886cde5 Compare May 6, 2022 09:33
@sleepymole sleepymole force-pushed the online-import branch 2 times, most recently from 621a0b8 to 38d1f26 Compare June 5, 2022 16:01
@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 Jun 5, 2022
@sleepymole sleepymole changed the title lightning: pause schedulers by key range with ttl lightning: support disable scheduler by key range Jun 5, 2022
@sleepymole sleepymole marked this pull request as ready for review June 5, 2022 16:07
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 5, 2022
@sleepymole
Copy link
Contributor Author

/run-integration-br-test

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 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 Jun 22, 2022
@sleepymole
Copy link
Contributor Author

/run-integration-br-test

Copy link
Contributor

@lichunzhu lichunzhu 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 on lines +345 to 347
zap.Error(err))
}
return nil
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 handle this error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Emm, it's hard to say. Until now, we didn't treat scatter region error as a critical error.

Copy link
Contributor

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

@@ -478,13 +481,9 @@ func (local *local) checkScatterRegionFinishedOrReScatter(ctx context.Context, r
if respErr.GetType() == pdpb.ErrorType_REGION_NOT_FOUND {
return true, nil
}
// don't return error if region replicate not complete
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need to handle this error now, do we?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is moved to retriable errors.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, it's caught by the caller.

br/pkg/pdutil/pd.go Outdated Show resolved Hide resolved
Copy link
Contributor

@buchuitoudegou buchuitoudegou left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -478,13 +481,9 @@ func (local *local) checkScatterRegionFinishedOrReScatter(ctx context.Context, r
if respErr.GetType() == pdpb.ErrorType_REGION_NOT_FOUND {
return true, nil
}
// don't return error if region replicate not complete
Copy link
Contributor

Choose a reason for hiding this comment

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

oh, it's caught by the caller.

@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 Jun 24, 2022
@sleepymole
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: c27bcf8

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 24, 2022
@ti-chi-bot ti-chi-bot merged commit 3dd54b8 into pingcap:master Jun 24, 2022
@sleepymole sleepymole deleted the online-import branch June 24, 2022 07:07
@sre-bot
Copy link
Contributor

sre-bot commented Jun 24, 2022

TiDB MergeCI notify

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci/integration-cdc-test 🟢 all 35 tests passed 28 min Existing passed
idc-jenkins-ci-tidb/integration-common-test 🟢 all 11 tests passed 20 min Existing passed
idc-jenkins-ci-tidb/common-test 🟢 all 12 tests passed 11 min Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 26 tests passed 7 min 31 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 6 min 40 sec Existing passed
idc-jenkins-ci-tidb/integration-ddl-test 🟢 all 6 tests passed 6 min 27 sec Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 5 min 50 sec Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 3 min 28 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 3 min 4 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

morgo added a commit to morgo/tidb that referenced this pull request Jun 24, 2022
* upstream/master: (38 commits)
  planner: disable collate clause support for enum or set column (pingcap#35684)
  *: Provide a util to "pause" session in uint test (pingcap#35529)
  ddl: implement the core for multi-schema change (pingcap#35429)
  parser: XXXDatabaseStmt now use CIStr for DB name (pingcap#35668)
  *: remove real tikv test on github actions (pingcap#35710)
  lightning: support disable scheduler by key range (pingcap#34130)
  Revert "planner: fix the wrong cost formula of MPPExchanger" (pingcap#35707)
  ddl, owner: refresh ddl sequence cache after becoming the owner (pingcap#35516)
  store/copr: fix tiflash integration test by disable paging on tiflash (pingcap#35674)
  planner: new cost formula for IndexJoin (pingcap#35671)
  BR: fix backup ranges total time summary log (pingcap#35552)
  raw_restore: fix the issue that raw restore rewrite the t prefix keys (pingcap#35641)
  table: fix cannot find the temp table when it's created in a transaction (pingcap#35663)
  metrics: replace histogram with counter for  DistSQLCoprCache (pingcap#35514)
  *: enable exportloopref  (pingcap#35680)
  types: fix bad error message for numeric conversion issue#32744 (pingcap#34047)
  *: enable ineffassign (pingcap#35670)
  config, sysvar: map `max-server-connections` to `max_connections` (pingcap#35453)
  *: enable durationcheck for nogo linter (pingcap#35661)
  *: fix issue of cast string as time is incompatible with MySQL (pingcap#35455)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/lightning This issue is related to Lightning of TiDB. release-note-none Denotes a PR that doesn't merit a release note. 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.

lightning: support table-level local-backend
7 participants