table route: add the table route core functionality#4659
table route: add the table route core functionality#46593AceShowHand wants to merge 4 commits intopingcap:masterfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 9 minutes and 41 seconds. ⌛ 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 (34)
✨ 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 |
|
@3AceShowHand: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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 kubernetes-sigs/prow repository. I understand the commands that are listed here. |
There was a problem hiding this comment.
Code Review
This pull request implements table routing functionality, allowing users to map source schema and table names to different target names in the downstream using configurable rules and placeholders like {schema} and {table}. The changes introduce a new routing package for name mapping and DDL query rewriting, update event structures to carry routed metadata, and ensure thread-safe handling of shared TableInfo objects through cloning. Review feedback highlights opportunities to optimize performance by reusing parser instances during DDL processing and identifies a potential issue where foreign key references are currently excluded from the routing logic.
| } | ||
|
|
||
| // Parse the DDL query using TiDB parser | ||
| p := parser.New() |
| if _, ok := in.(*ast.ReferenceDef); ok { | ||
| return in, true | ||
| } |
There was a problem hiding this comment.
Skipping ReferenceDef nodes means that foreign key references in DDL statements (like CREATE TABLE or ALTER TABLE) will not have routing rules applied to them. If a referenced table is also being routed to a different name in the downstream, the resulting DDL might fail because it points to a non-existent source table name. Consider if foreign key references should also be matched against routing rules.
| } | ||
|
|
||
| func extractRenameTargetExtraFromQuery(query string) (string, string) { | ||
| stmt, err := parser.New().ParseOneStmt(query, "", "") |
|
[FORMAT CHECKER NOTIFICATION] Notice: To remove the 📖 For more info, you can check the "Contribute Code" section in the development guide. |
What problem does this PR solve?
Issue Number: close #xxx
What is changed and how it works?
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