Skip to content

canal: fix ignore_tables separator and accept quoted identifiers#1145

Open
dveeden wants to merge 4 commits into
go-mysql-org:masterfrom
dveeden:fix-1143-ignore-tables-separator
Open

canal: fix ignore_tables separator and accept quoted identifiers#1145
dveeden wants to merge 4 commits into
go-mysql-org:masterfrom
dveeden:fix-1143-ignore-tables-separator

Conversation

@dveeden

@dveeden dveeden commented May 20, 2026

Copy link
Copy Markdown
Collaborator

The DumpConfig.IgnoreTables docs say entries use the form db.table, but the parser split on "," instead of ".", so the setting never took effect. Parse entries with a small MySQL identifier parser so the documented db.table form works, along with backtick-quoted identifiers like db.table that may contain dots or other special characters.

Fixes #1143

The DumpConfig.IgnoreTables docs say entries use the form db.table, but
the parser split on "," instead of ".", so the setting never took
effect. Parse entries with a small MySQL identifier parser so the
documented db.table form works, along with backtick-quoted identifiers
like `db`.`table` that may contain dots or other special characters.

Fixes go-mysql-org#1143

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the parsing of the IgnoreTables configuration by introducing a more robust parser that supports MySQL-quoted identifiers, including backticks and escaped backticks. It replaces the previous comma-based splitting with dedicated splitDBTable and parseIdent functions and adds comprehensive unit tests. Review feedback suggests logging a warning when configuration entries fail to parse to improve observability and recommends optimizing strings.Builder usage by pre-allocating memory to reduce allocations during identifier reconstruction.

Comment thread canal/canal.go
Comment thread canal/canal.go
@dveeden

dveeden commented May 20, 2026

Copy link
Copy Markdown
Collaborator Author

@gemini could you review again?

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the ignored tables parsing logic to support MySQL-style backtick-quoted identifiers, replacing the previous comma-based split. It introduces robust parsing functions and corresponding unit tests to handle various identifier formats, including escaped backticks and Unicode characters. The feedback suggests using the configured logger instance rather than the global logger for reporting parsing errors to maintain consistency with the application's logging configuration.

Comment thread canal/canal.go Outdated

@lance6716 lance6716 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I prefer #1146 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DumpConfig 配置的解析问题

2 participants