Skip to content

Optimize DDLGuard to remove useless two-level mapping#7699

Merged
ti-chi-bot[bot] merged 9 commits intopingcap:masterfrom
hongyunyan:hongyunyan_ddlguard
Jun 29, 2023
Merged

Optimize DDLGuard to remove useless two-level mapping#7699
ti-chi-bot[bot] merged 9 commits intopingcap:masterfrom
hongyunyan:hongyunyan_ddlguard

Conversation

@hongyunyan
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #7636

Problem Summary:

What is changed and how it works?

We don't need the two-level mapping database -> table -> exception_message for DDLGuard, because the table(with table_id and keyspace_id) is a global unique.
Thus, we optimize it to simplify the code.

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

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 27, 2023
@hongyunyan
Copy link
Contributor Author

/rebuild

@hongyunyan
Copy link
Contributor Author

/cc @JaySon-Huang @flowbehappy @lidezhu

Comment on lines +113 to +114
context.getDDLGuard(drop.table,
"Table " + database_name + "." + drop.table + " is dropping or detaching right now"));
Copy link
Contributor

Choose a reason for hiding this comment

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

use fmt::format instead

to.table_name,
"Some table right now is being renamed to " + to.database_name + "." + to.table_name));
context.getDDLGuard(to.table_name,
"Some table right now is being renamed to " + to.database_name + "." + to.table_name));
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor

@lidezhu lidezhu 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 bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Jun 28, 2023
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jun 28, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jun 28, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-06-28 05:23:11.53788146 +0000 UTC m=+771556.939131892: ☑️ agreed by lidezhu.
  • 2023-06-28 07:17:36.889476346 +0000 UTC m=+778422.290726813: ☑️ agreed by Lloyd-Pottiger.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jun 28, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JaySon-Huang, lidezhu, Lloyd-Pottiger

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [JaySon-Huang,Lloyd-Pottiger,lidezhu]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hongyunyan
Copy link
Contributor Author

/merge

@JaySon-Huang
Copy link
Contributor

/run-all-tests

1 similar comment
@hongyunyan
Copy link
Contributor Author

/run-all-tests

@JaySon-Huang
Copy link
Contributor

/run-integration-test

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jun 28, 2023

@hongyunyan: 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

trigger some heavy tests which will not run always when PR updated.

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.

Details

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.

@hongyunyan
Copy link
Contributor Author

/run-all-tests

@hongyunyan
Copy link
Contributor Author

/run-unit-test

@hongyunyan
Copy link
Contributor Author

/run-all-tests

@hongyunyan
Copy link
Contributor Author

/run-integration-test

@ti-chi-bot ti-chi-bot bot merged commit f9ad808 into pingcap:master Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize DDLGuard

4 participants