This is a story about how replication suddenly stopped when using Amazon Aurora Version 2 (MySQL 5.7 compatible) and MySQL 5.7 on a VM.

This is Onikai (@fat47) from the Service Reliability Group (SRG) of the Technology Division.
#SRGThe Service Reliability Group primarily provides comprehensive support for the infrastructure surrounding our media services, focusing on improving existing services, launching new ones, and contributing to open-source software (OSS).
This article is located within SRG.DBWGThe DB Working Group is releasing database-related materials that it provides to the entire company.
I hope this is of some help.
 
 

Summarize what happened in 3 lines


💡
When replicating from [Aurora v2] to [MySQL 5.7], if you use a MySQL 8.0 client to send an update query to connect to the Aurora v2 cluster, a collation that does not exist in MySQL 5.7 is automatically specified, causing the replication to stop with an error.
 

Regarding the situation


As we proceeded with migrating from our on-premises MySQL environment to Amazon Aurora,
We had built the following configuration:
After the switchover, we implemented reverse replication so that we could revert to the on-premises environment in case of any problems.
 
When using the latter configuration, the on-premises MySQL 5.7 suddenly stopped replicating due to an error.
 

cause


The MySQL Client on the developer's terminal was unintentionally updated to the latest version.MySQL8.0This was because we were using the system.
 
I had encountered a similar error during testing when upgrading to MySQL 8.0, so I suspected it was related to MySQL 8.0.
 
utf8mb4_0900_ai_ci
When I actually connected to a MySQL 5.7 server from a MySQL 8.0 client and checked the Collation settings, they looked like this, and there were no problems.
 
utf8mb4_0900_ai_ci
utf8mb4_0900_ai_ci
If you issue a query in this state, the binary log will
The data was written out, and since this 255 does not exist in the replica's MySQL 5.7, it caused an error and stopped replication.

Reproduction environment


Version Information

Source side: Aurora5.7.mysql_aurora.2.11.0
Replica side EC2MySQL 5.7.41
I used Aurora v2 as the source and created a replica of MySQL 5.7 installed on EC2. I will build binary log replication between these two environments.

Reproduction steps


Create a suitable table in [Aurora v2]
 
Add records as needed
 
Performing an UPDATE operation on an Aurora v2 cluster from a MySQL 5.7 client.
 
Check if the records have been updated on the [MySQL 5.7 replica].
 
Performing an UPDATE operation on an Aurora v2 cluster from a MySQL 8.0 client.
 
When checking the show slave status on the [MySQL 5.7 replica], a replication error occurs.
 

Workaround


I don't think there are many opportunities to use this kind of configuration,
First, all developers should use the MySQL 5.7 client to connect to Aurora v2.
 
skip_character_set_client_handshake
This phenomenon can be avoided for the time being.
However, I would recommend using this setting only as a temporary measure during the migration process.
 

Reference URL


The following article was very helpful.
 
 

In conclusion


SRG is looking for new team members. If you are interested, please contact us here.