Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM: Inconsistency applies to tasks configured with both db and table rules in block-allow-list #11983

Open
OliverS929 opened this issue Jan 7, 2025 · 1 comment
Labels
area/dm Issues or PRs related to DM. type/bug The issue is confirmed as a bug.

Comments

@OliverS929
Copy link
Contributor

What did you do?

Specified in config file:

block-allow-list:
  bw-rule-1:
    do-tables:
      - db-name: db1
        tbl_name: '*'
      - db-name: db2
        tbl_name: t1
     do-dbs:  [db1]

What did you expect to see?

Expect to see all tables in db1 and t1 in db2 are migrated.

What did you see instead?

tables in db1 are handled just fine, but t1 in db2 are ignored.

Versions of the cluster

DM version (run dmctl -V or dm-worker -V or dm-master -V):

8.5

Upstream MySQL/MariaDB server version:

8.0

Downstream TiDB cluster version (execute SELECT tidb_version(); in a MySQL client):

8.5

How did you deploy DM: tiup or manually?

tiup/manually

Other interesting information (system version, hardware config, etc):

>
>

current status of DM cluster (execute query-status <task-name> in dmctl)

Finished
@OliverS929 OliverS929 added area/dm Issues or PRs related to DM. type/bug The issue is confirmed as a bug. labels Jan 7, 2025
@OliverS929
Copy link
Contributor Author

This is likely due to the fact that DM uses ParseMySQLReplicationRules from tidb github.com/pingcap/tidb/pkg/util/table-filter, which utilizebothfilter in table and schema matching and requires both schemaRules and tableRules to be matched at the same time. In our case, migration rule of db2.t1 only exists in tableRules but not tableRules, and therefore would failed in both MatchTable and MatchSchema from bothfilter, implementations of which are:

func (f *bothFilter) MatchTable(schema string, table string) bool {
	return f.a.MatchTable(schema, table) && f.b.MatchTable(schema, table)
}

func (f *bothFilter) MatchSchema(schema string) bool {
	return f.a.MatchSchema(schema) && f.b.MatchSchema(schema)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dm Issues or PRs related to DM. type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

1 participant