[MDEV-31018] Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset Created: 2023-04-06  Updated: 2023-04-21  Resolved: 2023-04-21

Status: Closed
Project: MariaDB Server
Component/s: Character Sets, Replication
Affects Version/s: 10.9.2, 10.3, 10.4, 10.5.19, 10.6.12, 10.10, 10.11
Fix Version/s: 10.10.1, 11.1.1, 10.11.3, 11.0.2, 10.9.6

Type: Bug Priority: Critical
Reporter: Tingyao Nian Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-30824 Binlog contains unsupported statement... Closed

 Description   

10.9.2 introduced a new regression MDEV-30824. When a binlog generated from any engine versions is replayed on 10.9.2+ engines, depends on the character set settings, the replay could be immediately broken. This will break any functionalities relying on binlog such as replication.

Invalid line in binlog:

/*!\C utf8mb4 *//*!*/;
 
SET @@session.character_set_client=224,@@session.collation_connection=224,@@session.collation_server=33/*!*/;

Error:

ERROR 1115 (42000) at line 38: Unknown character set: '224'

This is later fixed with https://github.com/MariaDB/server/pull/2557 merged into 10.5, and is available in the upcoming minors 10.5.20, 10.6.12 etc. The fix prevents the previous releases from generating the invalid binlog that is not recognized by higher releases.

Merging this to latest minors does not address the issue when replicating from older minors to 10.9.2+. That means, any replication from 10.3, 10.4, <10.5.19 and <10.6.12 to 10.9.2, 10.10 and 10.11 will still be broken if non-default character set is used.

IMHO, we should also come up with another solution, that instead of fixing the binlog generation on previous majors, but to fix 10.9.2+, for backward compatibility.



 Comments   
Comment by Alexander Barkov [ 2023-04-10 ]

Hello Elkin,

Can you please review a patch:
https://github.com/MariaDB/server/commit/ef911e08afae4f12ce5c1ea080208f0a7d15c3c7
?

Thanks!

Comment by Tingyao Nian [ 2023-04-10 ]

Thanks Alex for the fast response! I left the same comment in the CR:

Good idea of converting non-default collation to default collation, which IMHO is the root cause of the very original issue MDEV-28769(https://jira.mariadb.org/browse/MDEV-28769), and it does not change system behavior, because eventually the charset are still the same.

I have 1 question/concern, could we apply this logic to all situation? Not just slave thread? If the concern is MDEV-28769(https://jira.mariadb.org/browse/MDEV-28769) may re-appear, I believe converting collation before setting should resolve it. On the other hand, only applying this change to slave thread means we are making assumptions that binlog is only used on slave threads, which may not always be true as sometimes it's also used during recovery?

Generated at Thu Feb 08 10:20:40 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.