From a18f8d38563be493fcc9445bc25b2f97ce0d6b7a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 6 Oct 2025 10:53:05 +0200 Subject: [PATCH] MDEV-37784 fix the warning cannot add new warnings in 11.8 anymore: * remove ER_WARN_DEFAULT_SYNTAX * use ER_VARIABLE_IGNORED instead * change the wording in it to be more generic * simplified new_mode warning-printing code (cherry picked from commit 399edc7c6205c5a2b4f18ecbfa7c3552a5c3ca15) --- mysql-test/suite/sys_vars/r/new_mode.result | 6 +++--- .../suite/sys_vars/r/new_mode_notembedded.result | 2 ++ .../suite/sys_vars/t/new_mode_notembedded.opt | 1 + .../suite/sys_vars/t/new_mode_notembedded.test | 7 +++++++ sql/mysqld.cc | 3 +-- sql/share/errmsg-utf8.txt | 7 +------ sql/sys_vars.cc | 15 +++------------ 7 files changed, 18 insertions(+), 23 deletions(-) create mode 100644 mysql-test/suite/sys_vars/r/new_mode_notembedded.result create mode 100644 mysql-test/suite/sys_vars/t/new_mode_notembedded.opt create mode 100644 mysql-test/suite/sys_vars/t/new_mode_notembedded.test diff --git a/mysql-test/suite/sys_vars/r/new_mode.result b/mysql-test/suite/sys_vars/r/new_mode.result index bde9c402454..316a48dd2ce 100644 --- a/mysql-test/suite/sys_vars/r/new_mode.result +++ b/mysql-test/suite/sys_vars/r/new_mode.result @@ -15,11 +15,11 @@ SELECT @@session.new_mode; SET @@session.new_mode = "TEST_WARNING1"; Warnings: -Warning 4206 'TEST_WARNING1' is default and ignored +Warning 4200 The setting 'new_mode=TEST_WARNING1' is ignored. It only exists for compatibility with old installations and will be removed in a future release SET @@session.new_mode = "TEST_WARNING1,TEST_WARNING2"; Warnings: -Warning 4206 'TEST_WARNING1' is default and ignored -Warning 4206 'TEST_WARNING2' is default and ignored +Warning 4200 The setting 'new_mode=TEST_WARNING1' is ignored. It only exists for compatibility with old installations and will be removed in a future release +Warning 4200 The setting 'new_mode=TEST_WARNING2' is ignored. It only exists for compatibility with old installations and will be removed in a future release SET @@session.new_mode = "TEST_WARNING1,TEST_WARNING2,TEST_WARNING3"; ERROR 42000: Variable 'new_mode' can't be set to the value of 'TEST_WARNING3' SET @@session.new_mode = "ALL"; diff --git a/mysql-test/suite/sys_vars/r/new_mode_notembedded.result b/mysql-test/suite/sys_vars/r/new_mode_notembedded.result new file mode 100644 index 00000000000..a8576d92599 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/new_mode_notembedded.result @@ -0,0 +1,2 @@ +call mtr.add_suppression('new_mode=TEST_WARNING1'); +FOUND 1 /new_mode=TEST_WARNING1/ in mysqld.1.err diff --git a/mysql-test/suite/sys_vars/t/new_mode_notembedded.opt b/mysql-test/suite/sys_vars/t/new_mode_notembedded.opt new file mode 100644 index 00000000000..7321942b663 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/new_mode_notembedded.opt @@ -0,0 +1 @@ +--new-mode=TEST_WARNING1 diff --git a/mysql-test/suite/sys_vars/t/new_mode_notembedded.test b/mysql-test/suite/sys_vars/t/new_mode_notembedded.test new file mode 100644 index 00000000000..df6b0f81342 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/new_mode_notembedded.test @@ -0,0 +1,7 @@ +--source include/have_debug.inc +--source include/not_embedded.inc + +call mtr.add_suppression('new_mode=TEST_WARNING1'); +--let SEARCH_PATTERN=new_mode=TEST_WARNING1 +--let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err +--source include/search_pattern_in_file.inc diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a1d5d8583e7..9a107906976 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4182,6 +4182,7 @@ static int init_common_variables() global_system_variables.lc_messages= my_default_lc_messages; global_system_variables.errmsgs= my_default_lc_messages->errmsgs->errmsgs; init_client_errs(); + check_new_mode_value(NULL, &global_system_variables.new_behavior); mysql_library_init(unused,unused,unused); /* for replication */ lex_init(); if (item_create_init()) @@ -8733,8 +8734,6 @@ static int get_options(int *argc_ptr, char ***argv_ptr) "release. Please use --old-mode instead. "); } - check_new_mode_value(NULL, &global_system_variables.new_behavior); - if (global_system_variables.net_buffer_length > global_system_variables.max_allowed_packet) { diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 0a86809aa8d..c056e3cacbf 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -12277,7 +12277,7 @@ ER_SEQUENCE_TABLE_CANNOT_HAVE_ANY_CONSTRAINTS ER_SEQUENCE_TABLE_ORDER_BY eng "ORDER BY" ER_VARIABLE_IGNORED - eng "The variable '%s' is ignored. It only exists for compatibility with old installations and will be removed in a future release" + eng "The setting '%s' is ignored. It only exists for compatibility with old installations and will be removed in a future release" ER_INCORRECT_COLUMN_NAME_COUNT eng "Incorrect column name count for derived table" chi "派生表的列名计数不正确" @@ -12292,8 +12292,3 @@ ER_VECTOR_FORMAT_INVALID eng "Invalid vector format at offset: %d for '%-.100s'. Must be a valid JSON array of numbers." ER_PSEUDO_THREAD_ID_OVERWRITE eng "Pseudo thread id should not be modified by the client as it will be overwritten" -ER_WARN_DEFAULT_SYNTAX - chi "'%s' 默认并被忽略" - eng "'%s' is default and ignored" - ger "'%s' ist Standard und wird ignoriert" - spa "'%s' Es predeterminado e ignorado" diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index e1943ae09f3..904650a8607 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -4091,19 +4091,10 @@ void check_new_mode_value(THD *thd, ulonglong *v) { if ((1ULL<