暂无图片
mysql mgr group_replication_consistency默认为EVENTUAL,但是实际还是等待了之前的事务apply完毕才提供写功能
我来答
分享
StartupForce
2020-12-15
mysql mgr group_replication_consistency默认为EVENTUAL,但是实际还是等待了之前的事务apply完毕才提供写功能

group_replication_consistency参数为EVENTUAL时,RO和RW事务都不等待执行之前的事务。但是我实际测试会呢,在压测期间,stop group_replication后,其中要给secondary变成primary,而在该primary上执行创建表操作报错,说super_read_only开启了,确实是开启的 。这就不能写了,跟官方文档表述不一样呢?
官方文档关于该参数说明

EVENTUAL

Both RO and RW transactions do not wait for preceding transactions to be applied before executing. This was the behavior of Group Replication before the group_replication_consistency variable was added. A RW transaction does not wait for other members to apply a transaction. This means that a transaction could be externalized on one member before the others. This also means that in the event of a primary failover, the new primary can accept new RO and RW transactions before the previous primary transactions are all applied. RO transactions could result in outdated values, RW transactions could result in a rollback due to conflicts.

实际新选primary日志也表述会在应用完所有日之后才 开启写,如下:
16:04 mgrb02离开集群,他是primary
16:04 开始选举新的primary
16:05 mgrb01为新的primary,并且说明:The new primary will execute all previous group transactions before allowing writes
28:57 12分钟后,mgrb01关闭super_read_only开始 提供写功能。io较差,压测比较厉害,所以时间这么长。

2020-12-15T07:16:04.098052Z 0 [Warning] [MY-011499] [Repl] Plugin group_replication reported: 'Members removed from the group: mgrb02:3308'
2020-12-15T07:16:04.098147Z 0 [System] [MY-011500] [Repl] Plugin group_replication reported: 'Primary server with address mgrb02:3308 left the group. Electing new Primary.'
2020-12-15T07:16:05.099153Z 0 [System] [MY-011507] [Repl] Plugin group_replication reported: 'A new primary with address mgrb01:3308 was elected. The new primary will execute all previous group transactions before allowing writes.'
2020-12-15T07:16:05.099671Z 0 [System] [MY-011503] [Repl] Plugin group_replication reported: 'Group membership changed to mgrb01:3308, mgrb03:3306 on view 16075037194539719:48.'
2020-12-15T07:28:57.125015Z 8261 [System] [MY-011566] [Repl] Plugin group_replication reported: 'Setting super_read_only=OFF.'
2020-12-15T07:28:57.126748Z 8261 [System] [MY-011510] [Repl] Plugin group_replication reported: 'This server is working as primary member.'

我来答
添加附件
收藏
分享
问题补充
2条回答
默认
最新
Cui Hulong

1.EVENTUAL翻译下来 意思就是 开启该级别的事务(T2),事务执行前不会等待先序事务(T1)的回放完成,也不会影响后序事务等待该事务回放完成。
2.这部分也是验证过的。可能也存在一些缺陷
3.看下面实际测试情况,因为切换机制导致,出现read onley末及时切换情况。是不是要找个好的服务器再测试看看。

暂无图片 评论
暂无图片 有用 0
StartupForce

我有一个跟他几乎同步的机器,在切换时日志也会提示这个:The new primary will execute all previous group transactions before allowing writes

也就是在之前组的事务没有应用完成之前是不能写入的。感觉跟机器好坏没关系哦,他就是切换的时候要把之前组的事务应用完成才会将super_read_only关闭,然后提供写功能。

暂无图片 评论
暂无图片 有用 0
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏