Closed tangenta closed 3 years ago
[REVIEW NOTIFICATION]
This pull request has been approved by:
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.
what is the reason removing SpecialCommentsController
and exposing the SpecialComments
map directly 🤔
(i mean i don't really like to keep SpecialCommentsController
, but allowing anyone to modify the global SpecialComments
sounds prone to abuse)
Thanks. TODO: DM needs to revert https://github.com/pingcap/dm/pull/1823 after update parser dependency
/merge
@tangenta: Your PR was out of date, I have automatically updated it for you.
/merge cancel
/merge
This pull request has been accepted and is ready to merge.
What problem does this PR solve?
TiDB Binlog and Lightning use regex to substitute the TiDB-specific keyword with special comments:
The regex is fragile because it is easy to get things wrong when the table names or column names contain these keywords, for example:
is incorrectly rewritten to
Comparing with pattern matching, using
ast.Restore
to wrap special comments is not prone to error.What is changed and how it works?
tidb/features.go
as the single source of truth.RestoreTiDBSpecialComment
, support wrapping with TiDB special comment.SpecialCommentsController
.Check List
Tests
Code changes
Side effects
NA
Related changes