用户登录
用户注册

分享至

MySQL 5.7并发复制隐式bug实例分析

  • 作者: ADAMSIR
  • 来源: 51数据库
  • 2021-10-28

前言

我们mysql线上环境大部分使用的是5.7.18的版本,这个版本已修复了很多bug,但针对主从复制的bug还是有很多的,尤其是一些组复制、并行复制的bug尤为突出,在5.7.19版本有做相应改善和修复。所以建议5.7.19之前的版本还是不要使用mgr和并发复制的功能,如使用建议升级至5.7.19(含)以后的版本。

我这里遇到的问题主要是莫名其妙的数据同步出现问题,无法执行stop slave,数据不一致等现象,经过查看发现是版本bug所致,所以对已上线的从库关闭并发复制,对未上线的系统实行版本升级。此风险非常非常高,各位务必重视。

具体5.7.19修复的复制bug如下:

参考手册:https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-19.html

references: see also: bug #84107.

replication: in the case of delayed initialization of the group replication plugin, deployed in single-primary mode, secondaries were able to get writes through an asynchronous replication channel, which is not allowed in normal initialization of the group replication plugin. (bug #26314756)

replication: with gtids generated for incident log events, mysql error code 1590 (er_slave_incident) could not be skipped using the --slave-skip-errors=1590 startup option on a replication slave. (bug #26266758)

replication: a use statement that followed a set gtid_next statement sometimes had no effect. (bug #26128931)

replication: groups can now contain members running different server versions to enable you to do online upgrades of a replication group. the rules for combining members in a group with different versions are:

if you have a group with 8.0 members, you cannot add a 5.7 member

if you have a group with 5.7 members you can add a 8.0 member, but it remains in read-only mode. writing to this member is dangerous while the group contains multiple server versions and should be avoided.

in a single-primary group, if the current primary leaves the group and a new primary must be elected, the primary is first chosen from the lower version members. if no lower version member is found, the primary is chosen from newer version members. (bug #25876807)

replication: when binlog_checksum=none was set on a mysql server after startup, and then group replication was started, if an error occurred, the server remained in recovering state and could not be shut down. (bug #25793366, bug #85667)

replication: in a group replication setup where circular asynchronous replication was implemented between members of different replication groups, view change log events were repeatedly replicated between the groups with new generated gtids each time. the fix ensures that view change log events are ignored outside the named replication group where they occur, and never generate new gtids. (bug #25674926)

references: see also: bug #26049695, bug #25928854, bug #25721175.

replication: when first starting the mysql server following an installation from rpm, passwword validation plugin is activated by default (true only for rpm installations). if binary logging was already enabled at this time, the activation was logged, even though plugin activations should not be recorded in the binary log. (bug #25672750)

replication: in a setup where single-primary group replication was combined with asynchronous replication, for example with s1 and s2 forming a group and with s2 and s3 functioning as master and slave, secondaries such as s2 were accepting transactions and these could then enter the group. the fix prevents secondaries creating an asynchronous replication channel when belonging to a single-primary group, and group replication cannot be started when asynchronous replication is running. (bug #25574200, bug #85047)

references: see also: bug #86325, bug #26078602.

replication: in the event that a member failed to join a group the member was not stopping and continued to accept transactions. to avoid this set your members to have super_read_only=1 in the my.cfg file. group replication now checks for this setting upon successful start up and sets super_read_only=0. this ensures that members which do not successfully join a group cannot accept transactions. (bug #25474736, bug #84728)

replication: if the binary log on a master server was rotated and a full disk condition occurred on the partition where the binary log file was being stored, the server could stop unexpectedly. the fix adds a check for the existence of the binary log when the dump thread switches to next binary log file. if the binary log is disabled, all binary logs up to the current active log are transmitted to slave and an error is returned to the receiver thread. (bug #25076007)

replication: interleaved transactions could sometimes deadlock the slave applier when the transaction isolation level was set to repeatable-read. (bug #25040331)

replication: if a relay log index file named relay log files that did not exist, reset slave all sometimes did not fully clean up properly. (bug #24901077)

replication: the slave_skip_errors system variable did not permit error numbers larger than 3000. thanks to tsubasa tanaka for the patch. (bug #24748639, bug #83184)

replication: mysqlbinlog, if invoked with the --raw option, does not flush the output file until the process terminates. but if also invoked with the --stop-never option, the process never terminates, thus nothing is ever written to the output file. now the output is flushed after each event. (bug #24609402)

replication: a memory leak in mysqlbinlog was fixed. the leak happened when processing fake rotate events, or when using --raw and the destination log file could not be created. the leak only occurred when processing events from a remote server. thanks to laurynas biveinis for his contribution to fixing this bug. (bug #24323288, bug #82283)

replication: a slave server could lose events not yet applied when master_auto_position=0, both replication threads were stopped, and the applier delay was changed using change master to master_delay=n. (bug #23203678, bug #81232)

references: see also: bug #25340185, bug #84375.

replication: transmission of large gcs messages could take so long the sender appeared to have died. (bug #22671846)

replication: multithreaded slaves could not be configured with small queue sizes using slave_pending_jobs_size_max if they ever needed to process transactions larger than that size. any packet larger than slave_pending_jobs_size_max was rejected with the error er_mts_event_bigger_pending_jobs_size_max, even if the packet was smaller than the limit set by slave_max_allowed_packet.

with this fix, slave_pending_jobs_size_max becomes a soft limit rather than a hard limit. if the size of a packet exceeds slave_pending_jobs_size_max but is less than slave_max_allowed_packet, the transaction is held until all the slave workers have empty queues, and then processed. all subsequent transactions are held until the large transaction has been completed. the queue size for slave workers can therefore be limited while still allowing occasional larger transactions. (bug #21280753, bug #77406)

replication: an incident event that broke replication was not written to the binary log with a gtid, so that it was not possible to skip the event using set gtid_next=value. instead, it was necessary to set the relay log file and relay log positions directly; this meant that, when autopositioning was enabled, it was necessary first to disable it, then to set the relay log file and position, and finally to re-enable autopositioning.

now in such cases mysql writes the incident event into the statement cache, so that a gtid is generated and written for it prior to flushing, and that the slave applier works with the change. then users can skip the event using the sql statement set gtid_next=value, followed by begin and commit. (bug #19594845)

replication: in certain cases, the master could write to the binary log a last_committed value which was smaller than it should have been. this could cause the slave to execute in parallel transactions which should not have been, leading to inconsistencies or other errors. (bug #84471, bug #25379659)

replication: when using group_replication_ip_whitelist=automatic, ips in the private network are permitted automatically, but some class c ip addresses were not being permitted correctly. (bug #84329, bug #25503458)

replication: when an existing gtid_next transaction was assigned a conflicting gtid by the server, group replication generated an assert upon detecting two transactions with same gtid. this was because group replication generates the gtid after conflict detection, which is later than with master/slave replication. the fix relaxes some conditions to only be called when commit is done and a message has been added to alert you when a gtid has already been used. (bug #84153, bug #25232042)

replication: the replication applier thread returns error 3002 er_inconsistent_error when there is a difference between an expected error number and the actual error number. it is now possible to ignore this error by using 3002 with slave_skip_errors. (bug #83186, bug #24753281)

replication: mysql lost its gtid position following a restart when a dump from mysqldump had been used to load data.

to keep this problem from occurring, the mysql.gtid_executed table is now excluded automatically from dumps made by mysqldump. (bug #82848, bug #24590891)

references: see also: bug #87455, bug #26643180.

replication: corruption of relay logs for one channel in multi-source replication caused good channels not to be initalized during a server restart. in addition, when run with --skip-slave-start=false, the server also failed to start slave threads for those channels which were in good condition, despite the fact that it should have started the slave threads for all good channels.

now, regardless of any errors on other channels, the server attempts to create and initialize channels that are in good condition, and starts slave threads for the good channels if --skip-slave-start is disabled. as part of this fix, start slave and stop slave, which are intended to operate on all channels, are also modified such that they continue executing on all good channels even if they find bad channels among them. (bug #82209, bug #24285104)

replication: the sql thread was unable to gtid skip a partial transaction. (bug #81119, bug #25800025)

debian client packages were missing information about conflicts with akonadi-backend-mysql packages. (bug #26002288)

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,如果有疑问大家可以留言交流,谢谢大家对的支持。

软件
前端设计
程序设计
Java相关