---
name: test
task-mode: all
is-sharding: true
meta-schema: "dm_meta"
enable-heartbeat: false
online-ddl: true

target-database:
  host: "127.0.0.1"
  port: 4000
  user: "root"
  password: ""

mysql-instances:
  - source-id: "mysql-replica-01"
    block-allow-list:  "instance"
    route-rules: ["gho-sharding-route-rules-table", "pt-sharding-route-rules-table", "sharding-route-rules-schema"]
    mydumper-config-name: "global"
    loader-config-name: "global"
    syncer-config-name: "global"
    filter-rules: ["filter-rule-index"]

  - source-id: "mysql-replica-02"
    meta:
      binlog-name: binlog.000001
      binlog-pos: 4
    block-allow-list:  "instance"
    route-rules: ["gho-sharding-route-rules-table", "pt-sharding-route-rules-table", "sharding-route-rules-schema"]
    mydumper-config-name: "global"
    loader-config-name: "global"
    syncer-config-name: "global"
    filter-rules: ["filter-rule-index"]

block-allow-list:
  instance:
    do-dbs: ["online_ddl"]
    do-tables:
    -  db-name: "online_ddl"
       tbl-name: "~^((pt)|(gho))_t[1-3]$"

routes:
  gho-sharding-route-rules-table:
    schema-pattern: online_ddl
    table-pattern: gho_t*
    target-schema: online_ddl
    target-table: gho_t_target

  pt-sharding-route-rules-table:
    schema-pattern: online_ddl
    table-pattern: pt_t*
    target-schema: online_ddl
    target-table: pt_t_target

  sharding-route-rules-schema:
    schema-pattern: online_ddl
    target-schema: online_ddl
  
filters:
  filter-rule-index:
    schema-pattern: "*"
    table-pattern: "*"
    events: ["create index","drop index"]
    sql-pattern: ["ALTER\\s.*TABLE[\\s\\S]*ADD\\s+KEY\\s+NAME", "ALTER\\s.*TABLE[\\s\\S]*DROP\\s+KEY"]
    action: Ignore

mydumpers:
  global:
    threads: 4
    chunk-filesize: 64
    skip-tz-utc: true
    extra-args: ""

loaders:
  global:
    pool-size: 16
    dir: "./dumped_data"

syncers:
  global:
    worker-count: 16
    batch: 100
