# Diff Configuration.

######################### Global config #########################

# 日志级别，可以设置为 info、debug
log-level = "info"

# sync-diff-inspector 根据主键／唯一键／索引将数据划分为多个 chunk，
# 对每一个 chunk 的数据进行对比。使用 chunk-size 设置 chunk 的大小
# 建议 chunk size  1000-10000
chunk-size = 10000

# 检查数据的线程数量
check-thread-count = 128

# 数据 checksum 检查失败，重试次数
# use-checksum = true 必须选项
failed-retry-times = 3

# 数据 checksum 检查失败，重试间隔 单位：秒
# use-checksum = true 必须选项
failed-retry-sleep = 10

# 下游 checkpoint 元数据库
checkpoint-schema = "sync_diff_inspector"

# 抽样检查的比例，如果设置为 100 则检查全部数据
sample-percent = 100

# 通过计算 chunk 的 checksum 来对比数据，如果不开启则逐行对比数据
use-checksum = true

# 如果设置为 true 则只会通过计算 checksum 来校验数据，如果上下游的 checksum 不一致也不会查出数据再进行校验
only-use-checksum = false

# 是否使用上次校验的 checkpoint，如果开启，则只校验上次未校验以及校验失败的 chunk
use-checkpoint = false

# 不对比数据
ignore-data-check = false

# 不对比表结构
ignore-struct-check = false

# fix 修复 sql
fix-sql-file = "fix_single.sql"

######################### Tables config #########################

# 配置需要对比的目标数据库 tidb 中的表
[[check-tables]]
# 库的名称
schema = "sbtest"
# 需要检查的表的名称
tables = ["sbtest1"]

# 配置该表对应分表配置
# [[table-config]]
# tidb 目标库名
# schema = "sbtest"
# tidb 目标库表名
# table = "sbtest1"
# 是否是分库分表场景
# is-sharding = true
# 对比查询范围
# range = "id >= 3"

# 源数据表的配置 mysql
#[[table-config.source-tables]]
#instance-id = "MySQL-1"
#schema = "sbtest"
#table = "sbtest1"

#[[table-config.source-tables]]
#instance-id = "MySQL-2"
#schema = "sbtest"
#table = "sbtest1"

# 通过 table-rule 来设置上游分表与下游总表的映射关系。可以只配置 schema 或者 table 的映射关系，也可以都配置
[[table-rules]]
    # schema-pattern 和 table-pattern 支持通配符 *?
    # 在 source-db 中配置的上游数据库中所有满足 schema-pattern 和 table-pattern 规则的表都为 target-schema.target-table 的分表
    schema-pattern = "test"
    table-pattern = "table-*"
    target-schema = "test"
    target-table = "table-0"


######################### Databases config #########################

# 源数据库实例的配置
[[source-db]]
    host = "172.16.4.79"
    port = 3307
    user = "root"
    password = "marvin"
    instance-id = "MySQL-1"

# 源数据库实例的配置
[[source-db]]
    host = "172.16.4.95"
    port = 3308
    user = "root"
    password = "marvin"
    instance-id = "MySQL-2"

# 目标数据库实例的配置
[target-db]
    host = "172.16.4.59"
    port = 5000
    user = "root"
    password = ""
    instance-id = "target-1"