Skip to content

canal: parse ignore_tables as a TOML sub-table (#1143)#1146

Open
dveeden wants to merge 1 commit into
go-mysql-org:masterfrom
dveeden:fix-1143-ignore-tables-toml-map
Open

canal: parse ignore_tables as a TOML sub-table (#1143)#1146
dveeden wants to merge 1 commit into
go-mysql-org:masterfrom
dveeden:fix-1143-ignore-tables-toml-map

Conversation

@dveeden

@dveeden dveeden commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Switch DumpConfig.IgnoreTables from []string with home-grown "db,table" splitting to map[string][]string so the TOML decoder handles the db -> tables mapping directly. This also lets db names contain dots when quoted, e.g. "weird.db.name" = ["other"].

Closes #1143

Switch DumpConfig.IgnoreTables from []string with home-grown "db,table"
splitting to map[string][]string so the TOML decoder handles the
db -> tables mapping directly. This also lets db names contain dots
when quoted, e.g. "weird.db.name" = ["other"].

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 updates the IgnoreTables configuration from a slice of strings to a map of string slices, enabling better support for TOML sub-tables and database names containing dots. The logic in canal.go has been updated to iterate through the new map structure, and a unit test was added to verify the configuration parsing. The review feedback identifies this as a breaking change for existing users and recommends documenting it in the release notes or migration guide.

Comment thread canal/config.go
// [dump.ignore_tables]
// mydb = ["t1", "t2"]
// "weird.db.name" = ["other"]
IgnoreTables map[string][]string `toml:"ignore_tables"`

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.

medium

The change from []string to map[string][]string for IgnoreTables is a breaking change for existing configuration files. While this is intentional to support TOML sub-tables and database names with dots, it will cause the TOML decoder to fail for users with the old configuration format. Please ensure this is documented in the release notes or migration guide.

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.

How about we add a new config item to keep compatibility? I think we don't bother fix the , problem of old config, just advise developers to use the new one.

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