pingcap / tidb-binlog

A tool used to collect and merge tidb's binlog for real-time data backup and synchronization.
Apache License 2.0
292 stars 131 forks source link

Create table for another database with `like` table in using database will not sync #970

Open cyliu0 opened 4 years ago

cyliu0 commented 4 years ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a recipe for reproducing the error. On the upstream TiDB

    create database cy;
    create database CY1;
    use cy;
    create table t (a int);
    create table CY1.t4 like t;
  2. What did you expect to see? CY1.t4 created both on upstream and downstream TiDB

  3. What did you see instead? CY1.t4 created on upstream.

drainer error:

[2020/05/21 15:58:43.184 +08:00] [INFO] [syncer.go:442] ["add ddl item to syncer, you can add this commit ts to `ignore-txn-commit-ts` to skip this ddl if needed"] [sql="create table CY1.t4 like t"] ["commit ts"=416821521998151686]
[2020/05/21 15:58:48.204 +08:00] [WARN] [load.go:735] ["ignore ddl"] [error="Error 1146: Table 'CY1.t' doesn't exist"] [errorVerbose="Error 1146: Table 'CY1.t' doesn't exist\ngithub.com/pingcap/errors.AddStack\n\t/home/zyguan/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20190809092503-95897b64e011/errors.go:174\ngithub.com/pingcap/errors.Trace\n\t/home/zyguan/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20190809092503-95897b64e011/juju_adaptor.go:15\ngithub.com/pingcap/tidb-binlog/pkg/loader.(*loaderImpl).execDDL\n\t/home/zyguan/tidb-binlog/pkg/loader/load.go:420\ngithub.com/pingcap/tidb-binlog/pkg/loader.(*batchManager).execDDL\n\t/home/zyguan/tidb-binlog/pkg/loader/load.go:730\ngithub.com/pingcap/tidb-binlog/pkg/loader.(*batchManager).put\n\t/home/zyguan/tidb-binlog/pkg/loader/load.go:753\ngithub.com/pingcap/tidb-binlog/pkg/loader.(*loaderImpl).Run\n\t/home/zyguan/tidb-binlog/pkg/loader/load.go:605\ngithub.com/pingcap/tidb-binlog/drainer/sync.(*MysqlSyncer).run\n\t/home/zyguan/tidb-binlog/drainer/sync/mysql.go:232\nruntime.goexit\n\t/usr/local/lib/go1.13.5/src/runtime/asm_amd64.s:1357"] [ddl="create table CY1.t4 like t"]
  1. Please provide the relate downstream type and version of drainer. (run drainer -V in terminal to get drainer's version)
    [upstream@up-n1 drainer-8249]$ bin/drainer -V
    Release Version: v4.0.0-rc.2
    Git Commit Hash: a75036cf8933a581cac42c1007bf92c9e5417b90
    Build TS: 2020-05-20 11:11:57
    Go Version: go1.13.5
    Go OS/Arch: linux/amd64
cyliu0 commented 4 years ago

Got the same issue with

use cy;
create table t1 (a int);
create view cy1.v as select * from t1;
[2020/05/21 16:35:35.048 +08:00] [INFO] [syncer.go:442] ["add ddl item to syncer, you can add this commit ts to `ignore-txn-commit-ts` to skip this ddl if needed"] [sql="create view cy1.v as select * from t1"] ["commit ts"=416822102122823684]
[2020/05/21 16:35:40.065 +08:00] [WARN] [load.go:735] ["ignore ddl"] [error="Error 1146: Table 'cy1.t1' doesn't exist"] [errorVerbose="Error 1146: Table 'cy1.t1' doesn't exist\ngithub.com/pingcap/errors.AddStack\n\t/home/zyguan/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20190809092503-95897b64e011/errors.go:174\ngithub.com/pingcap/errors.Trace\n\t/home/zyguan/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20190809092503-95897b64e011/juju_adaptor.go:15\ngithub.com/pingcap/tidb-binlog/pkg/loader.(*loaderImpl).execDDL\n\t/home/zyguan/tidb-binlog/pkg/loader/load.go:420\ngithub.com/pingcap/tidb-binlog/pkg/loader.(*batchManager).execDDL\n\t/home/zyguan/tidb-binlog/pkg/loader/load.go:730\ngithub.com/pingcap/tidb-binlog/pkg/loader.(*batchManager).put\n\t/home/zyguan/tidb-binlog/pkg/loader/load.go:753\ngithub.com/pingcap/tidb-binlog/pkg/loader.(*loaderImpl).Run\n\t/home/zyguan/tidb-binlog/pkg/loader/load.go:605\ngithub.com/pingcap/tidb-binlog/drainer/sync.(*MysqlSyncer).run\n\t/home/zyguan/tidb-binlog/drainer/sync/mysql.go:232\nruntime.goexit\n\t/usr/local/lib/go1.13.5/src/runtime/asm_amd64.s:1357"] [ddl="create view cy1.v as select * from t1"]