go-mysql-org / go-mysql

a powerful mysql toolset with Go
MIT License
4.52k stars 967 forks source link

to exclude databases with ExcludeTableRegex #873

Closed gaojijun closed 2 months ago

gaojijun commented 2 months ago

I want to exclude some database when do mysql replication. So I set ExcludeTableRegex to ["mysql\..*"], and IncludeTableRegex is nil. As a result, non databases are synced. Is this expected?

// IncludeTableRegex or ExcludeTableRegex should contain database name
    // Only a table which matches IncludeTableRegex and dismatches ExcludeTableRegex will be processed
    // eg, IncludeTableRegex : [".*\\.canal"], ExcludeTableRegex : ["mysql\\..*"]
    //     this will include all database's 'canal' table, except database 'mysql'
    // Default IncludeTableRegex and ExcludeTableRegex are empty, this will include all tables
    IncludeTableRegex []string `toml:"include_table_regex"`
    ExcludeTableRegex []string `toml:"exclude_table_regex"`