pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
37.11k stars 5.83k forks source link

Drainer skip handling some DDL #9173

Closed alex-lx closed 5 years ago

alex-lx commented 5 years ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? Started drainer..

  2. What did you expect to see?

The drainer process started successfully

  1. What did you see instead?

It exited and print the following log

2019/01/24 18:08:52 server.go:248: [error] syncer exited, error /home/jenkins/workspace/build_tidb_binlog_2.1/go/src/github.com/pingcap/tidb-binlog/drainer/schema.go:300: schema 2637 not found
/home/jenkins/workspace/build_tidb_binlog_2.1/go/src/github.com/pingcap/tidb-binlog/drainer/schema.go:233: 
/home/jenkins/workspace/build_tidb_binlog_2.1/go/src/github.com/pingcap/tidb-binlog/drainer/syncer.go:468: 
/home/jenkins/workspace/build_tidb_binlog_2.1/go/src/github.com/pingcap/tidb-binlog/drainer/syncer.go:100: 

After setting log level to DEBUG, we can see the caused binlog is a ddl. ( We hide the real db name for privacy )

alter table db1.tbl1 rename  db2.tbl1

and the drainer has receive the ddl to create db2

2019/01/24 18:08:52 syncer.go:416: [debug] get ddl binlog job:  {"id":2638,"type":1,"schema_id":2637,"table_id":0,"state":6,"err":null,"err_count":0,"row_count":0,"raw_args":null,"schema_state":5,"snapshot_ver":0,"start_ts":405741719074373658,"dependency_id":0,"query":"create database official_site_spider","binlog":{"SchemaVersion":3195,"DBInfo":{"id":2637,"db_name":{"O":"db2","L":"db2"},"charset":"utf8mb4","collate":"utf8mb4_bin","state":5},"TableInfo":null,"FinishedTS":405741719323410441},"version":1,"reorg_meta":null,"priority":0} 

But it skip executing it without any log

  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?

v2.1.2

alivxxx commented 5 years ago

Thanks for your feedback! PTAL @WangXiangUSTC

july2993 commented 5 years ago

@alex-lx maybe a known issue fixed in later version, you can try to use the latest version from http://download.pingcap.org/tidb-binlog-cluster-latest-linux-amd64.tar.gz

alex-lx commented 5 years ago

@july2993 thanks for your kind help.

Since we use tidb-binlog in our production, is the latest version production-ready? Is there any roadmap to release the fixed version and if any plan to backport the fix to v2.1.x?

WangXiangUSTC commented 5 years ago

already cherry pick this fix in v2.1.6, you can download from https://download.pingcap.org/tidb-v2.1.6-linux-amd64.tar.gz