From 6252a281b5020d28685777c11ee27688a9db3d66 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 8 Dec 2022 17:43:59 +0100 Subject: MDEV-28910 remove the 5.5.5- version hack no longer needed, MySQL replication was fixed meanwhile. client code still can recognize and strip the prefix though. --- include/mysql_com.h | 21 --------------------- sql-common/client.c | 5 +++-- sql/mysqld.cc | 2 -- sql/mysqld.h | 1 - sql/sql_acl.cc | 7 +------ 5 files changed, 4 insertions(+), 32 deletions(-) diff --git a/include/mysql_com.h b/include/mysql_com.h index a2befe2d324..b0e96caddf7 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -41,27 +41,6 @@ #define MYSQL50_TABLE_NAME_PREFIX_LENGTH (sizeof(MYSQL50_TABLE_NAME_PREFIX)-1) #define SAFE_NAME_LEN (NAME_LEN + MYSQL50_TABLE_NAME_PREFIX_LENGTH) -/* - MDEV-4088 - - MySQL (and MariaDB 5.x before the fix) was using the first character of the - server version string (as sent in the first handshake protocol packet) to - decide on the replication event formats. And for 10.x the first character - is "1", which the slave thought comes from some ancient 1.x version - (ignoring the fact that the first ever MySQL version was 3.x). - - To support replication to these old clients, we fake the version in the - first handshake protocol packet to start from "5.5.5-" (for example, - it might be "5.5.5-10.0.1-MariaDB-debug-log". - - On the client side we remove this fake version prefix to restore the - correct server version. The version "5.5.5" did not support - pluggable authentication, so any version starting from "5.5.5-" and - claiming to support pluggable auth, must be using this fake prefix. -*/ -/* this version must be the one that *does not* support pluggable auth */ -#define RPL_VERSION_HACK "5.5.5-" - #define SERVER_VERSION_LENGTH 60 #define SQLSTATE_LENGTH 5 #define LIST_PROCESS_HOST_LEN 64 diff --git a/sql-common/client.c b/sql-common/client.c index 916abdea190..f58601055f0 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -3070,9 +3070,10 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, mysql->port=port; /* - remove the rpl hack from the version string, - see RPL_VERSION_HACK comment + remove the rpl hack from the version string, in case we're connecting + to a pre-11.0 server */ +#define RPL_VERSION_HACK "5.5.5-" if ((mysql->server_capabilities & CLIENT_PLUGIN_AUTH) && strncmp(mysql->server_version, RPL_VERSION_HACK, sizeof(RPL_VERSION_HACK) - 1) == 0) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 8922186ab8a..d7543d86ec1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -594,7 +594,6 @@ extern "C" { char server_version[SERVER_VERSION_LENGTH]; } char *server_version_ptr; -bool using_custom_server_version= false; char *mysqld_unix_port, *opt_mysql_tmpdir; ulong thread_handling; @@ -8051,7 +8050,6 @@ mysqld_get_one_option(const struct my_option *opt, const char *argument, strmake(server_version, argument, sizeof(server_version) - 1); set_sys_var_value_origin(&server_version_ptr, *filename ? sys_var::CONFIG : sys_var::COMMAND_LINE, filename); - using_custom_server_version= true; } #ifndef EMBEDDED_LIBRARY else diff --git a/sql/mysqld.h b/sql/mysqld.h index 2d9a4842d8c..449c2e50a58 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -740,7 +740,6 @@ extern const char *mysql_real_data_home_ptr; extern ulong thread_handling; extern "C" MYSQL_PLUGIN_IMPORT char server_version[SERVER_VERSION_LENGTH]; extern char *server_version_ptr; -extern bool using_custom_server_version; extern MYSQL_PLUGIN_IMPORT char mysql_real_data_home[]; extern char mysql_unpacked_real_data_home[]; extern MYSQL_PLUGIN_IMPORT struct system_variables global_system_variables; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index f686d12b9ea..1ba056ff89e 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -13307,12 +13307,7 @@ static bool send_server_handshake_packet(MPVIO_EXT *mpvio, data_len= SCRAMBLE_LENGTH; } - /* When server version is specified in config file, don't include - the replication hack prefix. */ - if (using_custom_server_version) - end= strnmov(end, server_version, SERVER_VERSION_LENGTH) + 1; - else - end= strxnmov(end, SERVER_VERSION_LENGTH, RPL_VERSION_HACK, server_version, NullS) + 1; + end= strnmov(end, server_version, SERVER_VERSION_LENGTH) + 1; int4store((uchar*) end, mpvio->auth_info.thd->thread_id); end+= 4; -- cgit v1.2.1