为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
- 【TiDB 版本】:3.0.5
- 【问题描述】:Drainer不支持rename table t1 to db2.x_t1语句
若提问为性能优化、故障排查类问题,请下载脚本运行。终端输出的打印结果,请务必全选并复制粘贴上传。
已经做好TiDB->MySQL的同步, 开启了pump, drainer
问题复现
在TiDB创建fanboshi表
root@10.152.x.150 17:53:27 [sysbench]> show tables;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 76
Current database: sysbench
+--------------------+
| Tables_in_sysbench |
+--------------------+
| sbtest1 |
| sbtest10 |
| sbtest2 |
| sbtest3 |
| sbtest4 |
| sbtest5 |
| sbtest6 |
| sbtest7 |
| sbtest8 |
| sbtest9 |
+--------------------+
10 rows in set (0.01 sec)
root@10.152.x.150 18:31:19 [sysbench]> create table fanboshi like sbtest1;
Query OK, 0 rows affected (0.13 sec)
root@10.152.x.150 18:31:24 [sysbench]> select count(*) from sbtest1;
+----------+
| count(*) |
+----------+
| 500456 |
+----------+
1 row in set (0.31 sec)
root@10.152.x.150 18:31:42 [sysbench]> select count(*) from sbtest1;
+----------+
| count(*) |
+----------+
| 500757 |
+----------+
1 row in set (0.30 sec)
在下游MySQL查看, 同步没有问题
root@localhost 18:59:35 [sysbench]> show tables;
+--------------------+
| Tables_in_sysbench |
+--------------------+
| fanboshi |
| sbtest1 |
| sbtest10 |
| sbtest2 |
| sbtest3 |
| sbtest4 |
| sbtest5 |
| sbtest6 |
| sbtest7 |
| sbtest8 |
| sbtest9 |
+--------------------+
11 rows in set (0.00 sec)
root@localhost 18:59:37 [sysbench]> select count(*) from sbtest1;
+----------+
| count(*) |
+----------+
| 500757 |
+----------+
1 row in set (0.13 sec)
在TiDB执行
root@10.152.x.150 18:57:59 [sysbench]> create database tidb_sysbench;
Query OK, 0 rows affected (0.10 sec)
root@10.152.x.150 18:58:09 [sysbench]> rename table fanboshi to tidb_sysbench.tidb_fanboshi;
Query OK, 0 rows affected (0.10 sec)
Drainer报错退出
[2019/12/02 18:59:14.979 +08:00] [INFO] [collector.go:284] ["get ddl job"] [job="ID:79, Type:rename table, State:synced, SchemaState:public, SchemaID:77, TableID:75, RowCount:0, ArgLen:0, start time: 2019-12-02 18:59:14.012 +0800 CST, Err:<nil>, ErrCount:0, SnapshotVersion:0"]
[2019/12/02 18:59:14.979 +08:00] [INFO] [syncer.go:400] ["add ddl item to syncer, you can add this commit ts to `ignore-txn-commit-ts` to skip this ddl if needed"] [sql="rename table fanboshi to tidb_sysbench.tidb_fanboshi"] ["commit ts"=412951341698121738]
[2019/12/02 18:59:19.993 +08:00] [ERROR] [load.go:594] ["exec failed"] [sql="rename table fanboshi to tidb_sysbench.tidb_fanboshi"] [error="Error 1017: Can't find file: './tidb_sysbench/fanboshi.frm' (errno: 2 - No such file or directory)"] [errorVerbose="Error 1017: Can't find file: './tidb_sysbench/fanboshi.frm' (errno: 2 - No such file or directory)
github.com/pingcap/errors.AddStack
/home/jenkins/agent/workspace/release_tidb_3.0/go/pkg/mod/github.com/pingcap/errors@v0.11.4/errors.go:174
github.com/pingcap/errors.Trace
/home/jenkins/agent/workspace/release_tidb_3.0/go/pkg/mod/github.com/pingcap/errors@v0.11.4/juju_adaptor.go:15
github.com/pingcap/tidb-binlog/pkg/loader.(*loaderImpl).execDDL
/home/jenkins/agent/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb-binlog/pkg/loader/load.go:337
github.com/pingcap/tidb-binlog/pkg/loader.(*batchManager).execDDL
/home/jenkins/agent/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb-binlog/pkg/loader/load.go:592
github.com/pingcap/tidb-binlog/pkg/loader.(*batchManager).put
/home/jenkins/agent/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb-binlog/pkg/loader/load.go:615
github.com/pingcap/tidb-binlog/pkg/loader.(*loaderImpl).Run
/home/jenkins/agent/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb-binlog/pkg/loader/load.go:478
github.com/pingcap/tidb-binlog/drainer/sync.(*MysqlSyncer).run
/home/jenkins/agent/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb-binlog/drainer/sync/mysql.go:121
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1337"]
[2019/12/02 18:59:19.994 +08:00] [INFO] [load.go:435] ["Run()... in Loader quit"]
[2019/12/02 18:59:19.994 +08:00] [INFO] [load.go:715] ["txnManager has been closed"]
[2019/12/02 18:59:19.994 +08:00] [INFO] [load.go:659] ["run()... in txnManager quit"]
[2019/12/02 18:59:19.994 +08:00] [INFO] [mysql.go:117] ["Successes chan quit"]
[2019/12/02 18:59:19.994 +08:00] [INFO] [syncer.go:251] ["write save point"] [ts=412951341357334529]
[2019/12/02 18:59:19.994 +08:00] [ERROR] [syncer.go:416] ["Failed to close syncer"] [error="Error 1017: Can't find file: './tidb_sysbench/fanboshi.frm' (errno: 2 - No such file or directory)"] [errorVerbose="Error 1017: Can't find file: './tidb_sysbench/fanboshi.frm' (errno: 2 - No such file or directory)
github.com/pingcap/errors.AddStack
/home/jenkins/agent/workspace/release_tidb_3.0/go/pkg/mod/github.com/pingcap/errors@v0.11.4/errors.go:174
github.com/pingcap/errors.Trace
/home/jenkins/agent/workspace/release_tidb_3.0/go/pkg/mod/github.com/pingcap/errors@v0.11.4/juju_adaptor.go:15
github.com/pingcap/tidb-binlog/pkg/loader.(*loaderImpl).execDDL
/home/jenkins/agent/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb-binlog/pkg/loader/load.go:337
github.com/pingcap/tidb-binlog/pkg/loader.(*batchManager).execDDL
/home/jenkins/agent/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb-binlog/pkg/loader/load.go:592
github.com/pingcap/tidb-binlog/pkg/loader.(*batchManager).put
/home/jenkins/agent/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb-binlog/pkg/loader/load.go:615
github.com/pingcap/tidb-binlog/pkg/loader.(*loaderImpl).Run
/home/jenkins/agent/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb-binlog/pkg/loader/load.go:478
github.com/pingcap/tidb-binlog/drainer/sync.(*MysqlSyncer).run
/home/jenkins/agent/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb-binlog/drainer/sync/mysql.go:121
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1337"]
[2019/12/02 18:59:19.996 +08:00] [INFO] [syncer.go:243] ["handleSuccess quit"]
[2019/12/02 18:59:19.996 +08:00] [ERROR] [server.go:270] ["syncer exited abnormal"] [error="Error 1017: Can't find file: './tidb_sysbench/fanboshi.frm' (errno: 2 - No such file or directory)"] [errorVerbose="Error 1017: Can't find file: './tidb_sysbench/fanboshi.frm' (errno: 2 - No such file or directory)
github.com/pingcap/errors.AddStack
/home/jenkins/agent/workspace/release_tidb_3.0/go/pkg/mod/github.com/pingcap/errors@v0.11.4/errors.go:174
github.com/pingcap/errors.Trace
/home/jenkins/agent/workspace/release_tidb_3.0/go/pkg/mod/github.com/pingcap/errors@v0.11.4/juju_adaptor.go:15
github.com/pingcap/tidb-binlog/pkg/loader.(*loaderImpl).execDDL
/home/jenkins/agent/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb-binlog/pkg/loader/load.go:337
github.com/pingcap/tidb-binlog/pkg/loader.(*batchManager).execDDL
/home/jenkins/agent/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb-binlog/pkg/loader/load.go:592
github.com/pingcap/tidb-binlog/pkg/loader.(*batchManager).put
/home/jenkins/agent/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb-binlog/pkg/loader/load.go:615
github.com/pingcap/tidb-binlog/pkg/loader.(*loaderImpl).Run
/home/jenkins/agent/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb-binlog/pkg/loader/load.go:478
github.com/pingcap/tidb-binlog/drainer/sync.(*MysqlSyncer).run
/home/jenkins/agent/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb-binlog/drainer/sync/mysql.go:121
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1337"]
[2019/12/02 18:59:19.997 +08:00] [INFO] [util.go:66] [Exit] [name=syncer]
[2019/12/02 18:59:19.997 +08:00] [INFO] [server.go:406] ["begin to close drainer server"]
[2019/12/02 18:59:20.001 +08:00] [INFO] [server.go:371] ["has already update status"] [id=knode10-152-x-166:8249]
[2019/12/02 18:59:20.001 +08:00] [INFO] [server.go:410] ["commit status done"]
[2019/12/02 18:59:20.001 +08:00] [INFO] [util.go:66] [Exit] [name=heartbeat]
[2019/12/02 18:59:20.001 +08:00] [INFO] [collector.go:130] ["publishBinlogs quit"]
[2019/12/02 18:59:20.001 +08:00] [INFO] [pump.go:72] ["pump is closing"] [id=knode10-152-x-166:8250]
[2019/12/02 18:59:20.001 +08:00] [INFO] [pump.go:72] ["pump is closing"] [id=knode10-152-x-150:8250]
[2019/12/02 18:59:20.001 +08:00] [INFO] [util.go:66] [Exit] [name=collect]
[2019/12/02 18:59:20.001 +08:00] [INFO] [main.go:73] ["drainer exit"]