Skip to content

关于 canal 里表结构改变的疑问 #427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
huangjunwen opened this issue Sep 13, 2019 · 2 comments
Closed

关于 canal 里表结构改变的疑问 #427

huangjunwen opened this issue Sep 13, 2019 · 2 comments

Comments

@huangjunwen
Copy link
Contributor

huangjunwen commented Sep 13, 2019

按我阅读代码的理解, 现在每当遇到 repliacation.QueryEvent 的时候会清除 table 的缓存, 然后触发 OnTableChangedOnDDL, 那么怎么能够重新获得这个表的定义呢?

如果直接使用 Canal.GetTable, 它应该获得的是当前表的定义, 而不是 binlog 事件发生时的定义吧?

假如 binlog 同步中断了一段时间, 而在这段时间里表结构改变了(例如两列位置交换了), 再次重新开始同步时, 用新的表结构套旧的数据很可能会有问题吧?

不知道理解得对不对

@tinybit
Copy link
Contributor

tinybit commented Sep 25, 2019

Using english would be a good start...

@dhlin
Copy link
Contributor

dhlin commented Oct 19, 2019

你的理解是对的, MySQL 8.0.1 才在 TABLE_MAP_EVENT 里加了column name, 这样就可以仅仅依靠binlog来实现准确复制, 尤其是复制到其他类型的系统
参见: shyiko/mysql-binlog-connector-java#24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants