schemastore: fix exchange partition name unquoting#4449
Conversation
|
Warning Gemini encountered an error creating the summary. You can try again by commenting |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/gemini summary |
Summary of ChangesThis pull request resolves a bug in the handling of Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
|
|
|
||
| assert.Equal(t, | ||
| "ALTER TABLE `part``db`.`pt``x` EXCHANGE PARTITION `p0` WITH TABLE `normal``db`.`normal``t` WITHOUT VALIDATION", | ||
| "ALTER TABLE `part``db`.`pt``x` EXCHANGE PARTITION `p``0` WITH TABLE `normal``db`.`normal``t` WITHOUT VALIDATION", |
| } | ||
|
|
||
| // UnquoteName removes one layer of MySQL identifier quoting and unescapes doubled backticks. | ||
| func UnquoteName(name string) string { |
There was a problem hiding this comment.
I think there exists a similar function, and the function is duplicate
| t.Run("exchange partition", func(t *testing.T) { | ||
| job := buildExchangePartitionJobForTest(100, 200, 300, "pt`x", []int64{301}, 1000) | ||
| job.Query = "ALTER TABLE `ignored`.`ignored` EXCHANGE PARTITION `p0` WITH TABLE `ignored2`.`ignored2` WITHOUT VALIDATION" | ||
| job.Query = "ALTER TABLE `ignored`.`ignored` EXCHANGE PARTITION `p``0` WITH TABLE `ignored2`.`ignored2` WITHOUT VALIDATION" |
There was a problem hiding this comment.
No. It is p``0, this pr is to avoid corrupting names like this.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tenfyzhong, wk989898 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
|
/run-cherry-picker |
|
In response to a cherrypick label: new pull request created to branch |
What problem does this PR solve?
Issue Number: close #4450
What is changed and how it works?
This pull request resolves a bug in the handling of
EXCHANGE PARTITIONDDL statements where partition names, especially those containing escaped backticks, were not being unquoted correctly. By implementing a robustUnquoteNameutility and applying it to the relevant DDL parsing paths, the change ensures accurate processing of schema changes, preventing potential data inconsistencies or errors in schema replication.Highlights
UnquoteNameutility function in thepkg/commonpackage to correctly handle MySQL identifier unquoting, including the unescaping of doubled backticks.UnquoteNamefunction into the DDL handling logic forEXCHANGE PARTITIONstatements within theschemastoreandeventpackages, ensuring proper parsing of partition names that may contain escaped backticks.UnquoteNamefunction to validate its correctness across various scenarios, including unquoted, quoted, and quoted names with escaped backticks.Check List
Tests
Questions
Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?
Release note