Skip to content

Commit a18f8d3

Browse files
vuvovaOlernov
authored andcommitted
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 399edc7)
1 parent 155ed2c commit a18f8d3

File tree

7 files changed

+18
-23
lines changed

7 files changed

+18
-23
lines changed

mysql-test/suite/sys_vars/r/new_mode.result

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ SELECT @@session.new_mode;
1515

1616
SET @@session.new_mode = "TEST_WARNING1";
1717
Warnings:
18-
Warning 4206 'TEST_WARNING1' is default and ignored
18+
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
1919
SET @@session.new_mode = "TEST_WARNING1,TEST_WARNING2";
2020
Warnings:
21-
Warning 4206 'TEST_WARNING1' is default and ignored
22-
Warning 4206 'TEST_WARNING2' is default and ignored
21+
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
22+
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
2323
SET @@session.new_mode = "TEST_WARNING1,TEST_WARNING2,TEST_WARNING3";
2424
ERROR 42000: Variable 'new_mode' can't be set to the value of 'TEST_WARNING3'
2525
SET @@session.new_mode = "ALL";
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
call mtr.add_suppression('new_mode=TEST_WARNING1');
2+
FOUND 1 /new_mode=TEST_WARNING1/ in mysqld.1.err
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--new-mode=TEST_WARNING1
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
--source include/have_debug.inc
2+
--source include/not_embedded.inc
3+
4+
call mtr.add_suppression('new_mode=TEST_WARNING1');
5+
--let SEARCH_PATTERN=new_mode=TEST_WARNING1
6+
--let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err
7+
--source include/search_pattern_in_file.inc

sql/mysqld.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4182,6 +4182,7 @@ static int init_common_variables()
41824182
global_system_variables.lc_messages= my_default_lc_messages;
41834183
global_system_variables.errmsgs= my_default_lc_messages->errmsgs->errmsgs;
41844184
init_client_errs();
4185+
check_new_mode_value(NULL, &global_system_variables.new_behavior);
41854186
mysql_library_init(unused,unused,unused); /* for replication */
41864187
lex_init();
41874188
if (item_create_init())
@@ -8733,8 +8734,6 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
87338734
"release. Please use --old-mode instead. ");
87348735
}
87358736

8736-
check_new_mode_value(NULL, &global_system_variables.new_behavior);
8737-
87388737
if (global_system_variables.net_buffer_length >
87398738
global_system_variables.max_allowed_packet)
87408739
{

sql/share/errmsg-utf8.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12277,7 +12277,7 @@ ER_SEQUENCE_TABLE_CANNOT_HAVE_ANY_CONSTRAINTS
1227712277
ER_SEQUENCE_TABLE_ORDER_BY
1227812278
eng "ORDER BY"
1227912279
ER_VARIABLE_IGNORED
12280-
eng "The variable '%s' is ignored. It only exists for compatibility with old installations and will be removed in a future release"
12280+
eng "The setting '%s' is ignored. It only exists for compatibility with old installations and will be removed in a future release"
1228112281
ER_INCORRECT_COLUMN_NAME_COUNT
1228212282
eng "Incorrect column name count for derived table"
1228312283
chi "派生表的列名计数不正确"
@@ -12292,8 +12292,3 @@ ER_VECTOR_FORMAT_INVALID
1229212292
eng "Invalid vector format at offset: %d for '%-.100s'. Must be a valid JSON array of numbers."
1229312293
ER_PSEUDO_THREAD_ID_OVERWRITE
1229412294
eng "Pseudo thread id should not be modified by the client as it will be overwritten"
12295-
ER_WARN_DEFAULT_SYNTAX
12296-
chi "'%s' 默认并被忽略"
12297-
eng "'%s' is default and ignored"
12298-
ger "'%s' ist Standard und wird ignoriert"
12299-
spa "'%s' Es predeterminado e ignorado"

sql/sys_vars.cc

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4091,19 +4091,10 @@ void check_new_mode_value(THD *thd, ulonglong *v)
40914091
{
40924092
if ((1ULL<<i) & vl)
40934093
{
4094+
char buf1[NAME_CHAR_LEN*2 + 3];
4095+
strxnmov(buf1, sizeof(buf1)-1, "new_mode=", new_mode_default_names[i], 0);
4096+
my_error(ER_VARIABLE_IGNORED, MYF(ME_WARNING), buf1);
40944097
(*v)&= ~(1ULL << (i+NEW_MODE_MAX));
4095-
if (thd)
4096-
{
4097-
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
4098-
ER_WARN_DEFAULT_SYNTAX,
4099-
ER_THD(thd, ER_WARN_DEFAULT_SYNTAX),
4100-
new_mode_default_names[i]);
4101-
}
4102-
else
4103-
{
4104-
sql_print_warning("--new-mode='%s' is now default",
4105-
new_mode_default_names[i]);
4106-
}
41074098
}
41084099
}
41094100
}

0 commit comments

Comments
 (0)