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 399edc7c62)
This commit is contained in:
Sergei Golubchik 2025-10-06 10:53:05 +02:00 committed by Oleg Smirnov
parent 155ed2c579
commit a18f8d3856
7 changed files with 18 additions and 23 deletions

View File

@ -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";

View File

@ -0,0 +1,2 @@
call mtr.add_suppression('new_mode=TEST_WARNING1');
FOUND 1 /new_mode=TEST_WARNING1/ in mysqld.1.err

View File

@ -0,0 +1 @@
--new-mode=TEST_WARNING1

View File

@ -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

View File

@ -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)
{

View File

@ -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"

View File

@ -4091,19 +4091,10 @@ void check_new_mode_value(THD *thd, ulonglong *v)
{
if ((1ULL<<i) & vl)
{
char buf1[NAME_CHAR_LEN*2 + 3];
strxnmov(buf1, sizeof(buf1)-1, "new_mode=", new_mode_default_names[i], 0);
my_error(ER_VARIABLE_IGNORED, MYF(ME_WARNING), buf1);
(*v)&= ~(1ULL << (i+NEW_MODE_MAX));
if (thd)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_DEFAULT_SYNTAX,
ER_THD(thd, ER_WARN_DEFAULT_SYNTAX),
new_mode_default_names[i]);
}
else
{
sql_print_warning("--new-mode='%s' is now default",
new_mode_default_names[i]);
}
}
}
}