dm创建冗余的空库

DM全量同步的时候,配置的是tdehr库同步到tidb_tdehr库,但是目标地址总会多余的创建tdehr这个空库,但同步结果没问题
配置:
name: tdehr
task-mode: all
is-sharding: true
shard-mode: pessimistic
ignore-checking-items: []
meta-schema: dm_meta
enable-heartbeat: false
heartbeat-update-interval: 0
heartbeat-report-interval: 0
timezone: “”
case-sensitive: false
collation_compatible: loose
target-database:
host: tidb-bigdata.hz.td
port: 4000
user: root
password: Rk2s49@
max-allowed-packet: null
session: {}
security: null
mysql-instances:

  • source-id: tdehr
    meta: null
    filter-rules: []
    column-mapping-rules: []
    route-rules:
    • route-01
      expression-filters: []
      black-white-list: “”
      block-allow-list: balist-01
      mydumper-config-name: dump-01
      mydumper:
      mydumper-path: ./bin/mydumper
      threads: 4
      chunk-filesize: “64”
      statement-size: 0
      rows: 0
      where: “”
      skip-tz-utc: true
      extra-args: “”
      mydumper-thread: 0
      loader-config-name: load-01
      loader:
      pool-size: 16
      dir: ./dumped_data
      import-mode: sql
      on-duplicate: replace
      loader-thread: 0
      syncer-config-name: sync-01
      syncer:
      meta-file: “”
      worker-count: 16
      batch: 100
      queue-size: 1024
      checkpoint-flush-interval: 30
      compact: false
      multiple-rows: false
      max-retry: 0
      auto-fix-gtid: false
      enable-gtid: false
      disable-detect: false
      safe-mode: false
      enable-ansi-quotes: false
      syncer-thread: 0
      continuous-validator-config-name: validator-01
      online-ddl: true
      shadow-table-rules: []
      trash-table-rules: []
      online-ddl-scheme: “”
      routes:
      route-01:
      schema-pattern: tdehr
      table-pattern: ‘*’
      target-schema: tidb_tdehr
      target-table: “”
      filters: {}
      column-mappings: {}
      expression-filter: {}
      black-white-list: {}
      block-allow-list:
      balist-01:
      do-tables:
      • db-name: tdehr
        tbl-name: ‘*’
        do-dbs: []
        ignore-tables: []
        ignore-dbs: []
        mydumpers:
        dump-01:
        mydumper-path: ./bin/mydumper
        threads: 4
        chunk-filesize: “64”
        statement-size: 0
        rows: 0
        where: “”
        skip-tz-utc: true
        extra-args: “”
        loaders:
        load-01:
        pool-size: 16
        dir: ./dumped_data
        import-mode: sql
        on-duplicate: replace
        syncers:
        sync-01:
        meta-file: “”
        worker-count: 16
        batch: 100
        queue-size: 1024
        checkpoint-flush-interval: 30
        compact: false
        multiple-rows: false
        max-retry: 0
        auto-fix-gtid: false
        enable-gtid: false
        disable-detect: false
        safe-mode: false
        enable-ansi-quotes: false
        validators:
        validator-01:
        mode: none
        worker-count: 4
        validate-interval: 10s
        check-interval: 5s
        row-error-delay: 30m0s
        meta-flush-interval: 1m0s
        batch-query-size: 100
        clean-dump-file: false
        ansi-quotes: false
        remove-meta: false
        experimental:
        async-checkpoint-flush: false

这是表级别的路由规则(虽然 * 已经匹配了这个库里的所有表,但是 dm 不知道)。如果这个库里有其他表而没有命中这个表级别的路由规则,而我们又没有创建这个“冗余”的库,那么迁移就会报错。

要不想创建这个冗余的库,可以加一个库级别的路由规则:

schema-pattern: tdehr
target-schema: tidb_tdehr

感觉这是一个可以优化的地方,帮您记一个 issue 吧。

要是你想要全库同步的话,可以同步库级别就行,不用table-pattern: ‘*’,

此话题已在最后回复的 60 天后被自动关闭。不再允许新回复。