1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

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

MDEV-28769 earlier disabled the use if IDs with non-default collations
in statements like:

  SET character_set_results=2/*latin2_czech_cs*/;
  SET character_set_client=2/*latin2_czech_cs*/;
  SET character_set_server=2/*latin2_czech_cs*/;
  SET character_set_connection=2/*latin2_czech_cs*/;

MDEV-30824 later fixed "mysqlbinlog" to dump character set names
instead of IDs in these statements:

< SET @@session.character_set_client=33, ... /*!*/;
> SET @@session.character_set_client=utf8mb3, ... /*!*/;

However, mysqlbinlog from old (pre MDEV-30824) distributions can
still produce incorrect statements with numeric non-default
collation IDs.

New servers should still be able to load old dumps.

Allowing the use of "SET @@character_set_xxx=ID" with numeric
non-default collation IDs but only if:

- the current THD is a true slave thread or
- the current THD a pseudo slave thread
  (loading a mysqlbinlog output).
This commit is contained in:
Alexander Barkov
2023-04-10 11:35:38 +04:00
parent 44281b88f3
commit 46af63bfe2
9 changed files with 107 additions and 4 deletions

View File

@@ -486,5 +486,21 @@ SELECT @@session.character_set_server =
WHERE VARIABLE_NAME='character_set_server') AS res;
res
1
#
# 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
#
SET character_set_server=2/*latin2_czech_cs*/;
ERROR 42000: Unknown character set: '2'
SET @@pseudo_slave_mode=1;
SET character_set_server=2/*latin2_czech_cs*/;
SHOW VARIABLES LIKE 'character_set_server';
Variable_name Value
character_set_server latin2
SHOW VARIABLES LIKE 'collation_server';
Variable_name Value
collation_server latin2_general_ci
SET @@pseudo_slave_mode=0;
Warnings:
Warning 1231 Slave applier execution mode not active, statement ineffective.
SET @@global.character_set_server = @global_start_value;
SET @@session.character_set_server = @session_start_value;