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

br: reused table id is disabled when restore a brand-new cluster #41358

Merged
merged 17 commits into from Feb 14, 2023

Conversation

fengou1
Copy link
Contributor

@fengou1 fengou1 commented Feb 13, 2023

What problem does this PR solve?

Issue Number: close #41333

Problem Summary:
when restoring to a brand-new cluster, reused table id was disabled, which caused restore to consume more resources.

What is changed and how it works?

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

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 Feb 13, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • 3pointer
  • YuJuncen

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 the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 13, 2023
Copy link
Contributor

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

br/pkg/gluetidb/glue_test.go Show resolved Hide resolved
br/pkg/gluetidb/glue_test.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 13, 2023
fengou1 and others added 3 commits February 13, 2023 22:51
Co-authored-by: 山岚 <36239017+YuJuncen@users.noreply.github.com>
@fengou1 fengou1 added component/br This issue is related to BR of TiDB. and removed do-not-merge/needs-triage-completed labels Feb 13, 2023
@fengou1 fengou1 self-assigned this Feb 13, 2023
@@ -226,11 +226,11 @@ func (gs *tidbSession) SplitBatchCreateTable(schema model.CIStr, info []*model.T
return err
}
mid := len(info) / 2
err = gs.SplitBatchCreateTable(schema, info[:mid])
err = gs.SplitBatchCreateTable(schema, info[:mid], cs...)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe do not use optional arguments here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

remote opt parameter in dd7388a

d := dom.DDL()
require.NotNil(t, d)

infos1 := []*model.TableInfo{}
Copy link
Contributor

Choose a reason for hiding this comment

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

and also add a case that len(infos)==0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

add new case in dd7388a

err = d.BatchCreateTableWithInfo(gs.se, schema, infos, append(cs, ddl.OnExistIgnore)...)
failpoint.Inject("RestoreBatchCreateTableEntryTooLarge", func(val failpoint.Value) {
if val.(bool) {
if len(infos) > 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if len(infos) > 1 {


require.NoError(t, err)

require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/br/pkg/gluetidb/RestoreBatchCreateTableEntryTooLarge"))
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add a check that id has reused?

@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 Feb 14, 2023
@fengou1
Copy link
Contributor Author

fengou1 commented Feb 14, 2023

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 4694132

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 14, 2023
@YuJuncen
Copy link
Contributor

/test unit-test

1 similar comment
@fengou1
Copy link
Contributor Author

fengou1 commented Feb 14, 2023

/test unit-test

@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Feb 14, 2023
@fengou1
Copy link
Contributor Author

fengou1 commented Feb 14, 2023

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 594db2b

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 14, 2023
@ti-chi-bot ti-chi-bot merged commit 41c1250 into pingcap:master Feb 14, 2023
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.6: #41404.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.1: #42822.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #42823.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Apr 6, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Apr 6, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/br This issue is related to BR of TiDB. needs-cherry-pick-release-6.1 needs-cherry-pick-release-6.5 release-note-none size/L Denotes a PR that changes 100-499 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.

br: v6.6 restore performance degradation 22%
4 participants