mysql8复制新特性_MySQL 8.0复制新特性

原标题:MySQL 8.0复制新特性

导读

MySQL 8.0 复制功能有很大改进提升,并行复制性能与5.7相比可能提高数倍,是不是很期待?

翻译团队:知数堂藏经阁项目 - 琅琊阁

团队成员:琅琊阁-小剑伯、 琅琊阁-江b 、琅琊阁-简小鹿

原文出处:https://severalnines.com/blog/what-s-new-mysql-replication-mysql-80

原文作者:Krzysztof Ksiazek

备注:发稿时,小编发现作者修改了原文,略尴尬哈

截止目前(2017年8月),MySQL 8.0 仍然是 beta 版本,复制功能有一些很棒的改进。最初,这些改进是为组复制(GR)开发的,但由于 GR 在底层使用常规复制,所以传统的 MySQL 复制也能由此获益。

我们这里提到的改进是存储在binlog中的依赖关系跟踪信息。MySQL 8.0 使用某种方法来存储那些受事务影响的行的相关信息(这些行被称为writeset),且它会比较来自不同事务中的writesets。这样就能识别出那些修改的数据行没有交集的事务,那么这些事务就可以在从库上被并行回放。与 MySQL 5.7 的实现相比,这也许能增加数倍的并行化程度。

要注意,从库上可能会出现与在主库上出现的不一样的数据视图(比如查询数据时默认的显示顺序和在主库上查询结果不同)。这是因为事务可能被按照与主库不同的顺序去回放。当然,这其实没有什么问题。目前在 MySQL 5.7 中实现的多线程复制也可能会导致这个问题,除非您明确地启用 slave-preserve-commit-order 参数。

MySQL 8.0, which as of now (August 2017) is still in beta state, brings some nice improvements to replication.Originally, it was developed for Group Replication (GR), but as GR uses regular replication under the hood, “normal” MySQL replication benefited from it.

The improvement we mentioned is dependency tracking information stored in the binary log. What happens is that MySQL 8.0 now has a way to store information about which rows were affected by a given transaction (so called writeset), and it compares writesets from different transactions. This makes it possible to identify those transactions which did not work on the same subset of rows and, therefore, these may be applied in parallel. This may allow to increase the parallelization level by several times compared to the implementation from MySQL 5.7.

What you need to keep in mind is that, eventually, a slave will see a different view of the data, one that never appeared on the master. This is because transactions may be applied in a different order than on the master. This should not be a problem though.

The current implementation of multithreaded replication in MySQL 5.7 may also cause this issue unless you explicitly enable slave-preserve-commit-order.

为了控制这个新的行为(从库上数据回放顺序),可新增选项"binlog_transaction_dependency_tracking”,它可

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值