pingcap / pingcap/tidb-binlog

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

Open
#970 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

severity/moderate type/bug
Dominant language
Go
Stars
291
Forks
131
Avg merge
5m
Merged PRs (30d)
2

Description

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;
  1. What did you expect to see?
    CY1.t4 created both on upstream and downstream TiDB

  2. 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported CREATE TABLE ... LIKE case on TiDB, then inspect pkg/loader/load.go around the reported execDDL failure and the syncer path referenced in syncer.go. Verify the fix by confirming CY1.t4 is created downstream without the Error 1146 ignore-DDL warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.