pingcap / tiflow

This repo maintains DM (a data migration platform) and TiCDC (change data capture for TiDB)
Apache License 2.0
416 stars 273 forks source link

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

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. Just like the binlog issue https://github.com/pingcap/tidb-binlog/issues/970, the cdc would not sync in the same situation either
create database cy;
create database cy1
use cy;
create table p (a int primary key);
create table cy1.p like p;
  1. What did you expect to see? cy1.p created on both upstream and downstream TiDB

  2. What did you see instead? cy1.p created on upstream TiDB

cdc server error:

[2020/05/21 16:56:45.534 +08:00] [INFO] [mysql.go:130] ["execute DDL failed, but error can be ignored"] [query="create table cy1.p like p"] [error="Error 1146: Table 'cy1.p' doesn't exist"] [errorVerbose="Error 1146: Table 'cy1.p' doesn't exist\ngithub.com/pingcap/errors.AddStack\n\tgithub.com/pingcap/errors@v0.11.5-0.20190809092503-95897b64e011/errors.go:174\ngithub.com/pingcap/errors.Trace\n\tgithub.com/pingcap/errors@v0.11.5-0.20190809092503-95897b64e011/juju_adaptor.go:15\ngithub.com/pingcap/ticdc/cdc/sink.(*mysqlSink).execDDL\n\tgithub.com/pingcap/ticdc@/cdc/sink/mysql.go:165\ngithub.com/pingcap/ticdc/cdc/sink.(*mysqlSink).execDDLWithMaxRetries.func1\n\tgithub.com/pingcap/ticdc@/cdc/sink/mysql.go:128\ngithub.com/pingcap/ticdc/pkg/retry.Run.func1\n\tgithub.com/pingcap/ticdc@/pkg/retry/retry.go:31\ngithub.com/cenkalti/backoff.RetryNotify\n\tgithub.com/cenkalti/backoff@v2.2.1+incompatible/retry.go:37\ngithub.com/cenkalti/backoff.Retry\n\tgithub.com/cenkalti/backoff@v2.2.1+incompatible/retry.go:24\ngithub.com/pingcap/ticdc/pkg/retry.Run\n\tgithub.com/pingcap/ticdc@/pkg/retry/retry.go:30\ngithub.com/pingcap/ticdc/cdc/sink.(*mysqlSink).execDDLWithMaxRetries\n\tgithub.com/pingcap/ticdc@/cdc/sink/mysql.go:126\ngithub.com/pingcap/ticdc/cdc/sink.(*mysqlSink).EmitDDLEvent\n\tgithub.com/pingcap/ticdc@/cdc/sink/mysql.go:121\ngithub.com/pingcap/ticdc/cdc.(*changeFeed).handleDDL\n\tgithub.com/pingcap/ticdc@/cdc/changefeed.go:446\ngithub.com/pingcap/ticdc/cdc.(*Owner).handleDDL\n\tgithub.com/pingcap/ticdc@/cdc/owner.go:359\ngithub.com/pingcap/ticdc/cdc.(*Owner).run\n\tgithub.com/pingcap/ticdc@/cdc/owner.go:599\ngithub.com/pingcap/ticdc/cdc.(*Owner).Run\n\tgithub.com/pingcap/ticdc@/cdc/owner.go:536\ngithub.com/pingcap/ticdc/cdc.(*Server).campaignOwnerLoop\n\tgithub.com/pingcap/ticdc@/cdc/server.go:167\ngithub.com/pingcap/ticdc/cdc.(*Server).run.func1\n\tgithub.com/pingcap/ticdc@/cdc/server.go:199\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/sync@v0.0.0-20190911185100-cd5d95a43a6e/errgroup/errgroup.go:57\nruntime.goexit\n\truntime/asm_amd64.s:1357"]
[2020/05/21 16:56:45.534 +08:00] [INFO] [changefeed.go:457] ["Execute DDL succeeded"] [ChangeFeedID=7e3a84e0-04f9-4d3e-82f7-6c5c34b090f8] [ddlJob="{\"id\":205,\"type\":3,\"schema_id\":186,\"table_id\":204,\"schema_name\":\"cy1\",\"state\":4,\"err\":null,\"err_count\":0,\"row_count\":0,\"raw_args\":[{\"id\":204,\"name\":{\"O\":\"p\",\"L\":\"p\"},\"charset\":\"utf8mb4\",\"collate\":\"utf8mb4_bin\",\"cols\":[{\"id\":1,\"name\":{\"O\":\"a\",\"L\":\"a\"},\"offset\":0,\"origin_default\":null,\"default\":null,\"default_bit\":null,\"default_is_expr\":false,\"generated_expr_string\":\"\",\"generated_stored\":false,\"dependences\":null,\"type\":{\"Tp\":3,\"Flag\":3,\"Flen\":11,\"Decimal\":0,\"Charset\":\"binary\",\"Collate\":\"binary\",\"Elems\":null},\"state\":5,\"comment\":\"\",\"hidden\":false,\"version\":2}],\"index_info\":[{\"id\":1,\"idx_name\":{\"O\":\"PRIMARY\",\"L\":\"primary\"},\"tbl_name\":{\"O\":\"\",\"L\":\"\"},\"idx_cols\":[{\"name\":{\"O\":\"a\",\"L\":\"a\"},\"offset\":0,\"length\":-1}],\"state\":5,\"comment\":\"\",\"index_type\":1,\"is_unique\":true,\"is_primary\":true,\"is_invisible\":false}],\"fk_info\":null,\"state\":5,\"pk_is_handle\":false,\"comment\":\"\",\"auto_inc_id\":0,\"auto_id_cache\":0,\"auto_rand_id\":0,\"max_col_id\":1,\"max_idx_id\":1,\"update_timestamp\":416822435045703683,\"ShardRowIDBits\":0,\"max_shard_row_id_bits\":0,\"auto_random_bits\":0,\"pre_split_regions\":0,\"partition\":null,\"compression\":\"\",\"view\":null,\"sequence\":null,\"Lock\":null,\"version\":3,\"tiflash_replica\":null}],\"schema_state\":5,\"snapshot_ver\":0,\"start_ts\":416822434993274886,\"dependency_id\":0,\"query\":\"create table cy1.p like p\",\"binlog\":{\"SchemaVersion\":192,\"DBInfo\":null,\"TableInfo\":{\"id\":204,\"name\":{\"O\":\"p\",\"L\":\"p\"},\"charset\":\"utf8mb4\",\"collate\":\"utf8mb4_bin\",\"cols\":[{\"id\":1,\"name\":{\"O\":\"a\",\"L\":\"a\"},\"offset\":0,\"origin_default\":null,\"default\":null,\"default_bit\":null,\"default_is_expr\":false,\"generated_expr_string\":\"\",\"generated_stored\":false,\"dependences\":null,\"type\":{\"Tp\":3,\"Flag\":3,\"Flen\":11,\"Decimal\":0,\"Charset\":\"binary\",\"Collate\":\"binary\",\"Elems\":null},\"state\":5,\"comment\":\"\",\"hidden\":false,\"version\":2}],\"index_info\":[{\"id\":1,\"idx_name\":{\"O\":\"PRIMARY\",\"L\":\"primary\"},\"tbl_name\":{\"O\":\"\",\"L\":\"\"},\"idx_cols\":[{\"name\":{\"O\":\"a\",\"L\":\"a\"},\"offset\":0,\"length\":-1}],\"state\":5,\"comment\":\"\",\"index_type\":1,\"is_unique\":true,\"is_primary\":true,\"is_invisible\":false}],\"fk_info\":null,\"state\":5,\"pk_is_handle\":false,\"comment\":\"\",\"auto_inc_id\":0,\"auto_id_cache\":0,\"max_col_id\":1,\"max_idx_id\":1,\"update_timestamp\":416822435045703683,\"ShardRowIDBits\":0,\"max_shard_row_id_bits\":0,\"auto_random_bits\":0,\"pre_split_regions\":0,\"partition\":null,\"compression\":\"\",\"view\":null,\"sequence\":null,\"Lock\":null,\"version\":3,\"tiflash_replica\":null},\"FinishedTS\":416822435045703685},\"version\":1,\"reorg_meta\":null,\"priority\":0}"]
  1. Versions of the cluster

    • Upstream TiDB cluster version (execute SELECT tidb_version(); in a MySQL client):
+-------------------------------------------------------------------+
| tidb_version()                                                    |
+-------------------------------------------------------------------+
| Release Version: v4.0.0-rc.2-12-g6098373                          |
| Edition: Community                                                |
| Git Commit Hash: 6098373c11a94eeb114a6c106f297e3b1498b158         |
| Git Branch: HEAD                                                  |
| UTC Build Time: 2020-05-19 04:19:09                               |
| GoVersion: go1.13.7                                               |
| Race Enabled: false                                               |
| TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306 |
| Check Table Before Drop: false                                    |
+-------------------------------------------------------------------+
- TiCDC version (execute `cdc version`):
Release Version: v4.0.0-rc.2
Git Commit Hash: 961d4c87562ccab8273c6aa220e665664862e9f6
Git Branch: HEAD
UTC Build Time: 2020-05-20 09:12:18
Go Version: go version go1.13.7 linux/amd64
overvenus commented 2 years ago

It's more like a feature-request. We will add it to TiCDC roadmap, thanks!