diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index d02f504a32d..88b3eb69377 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -93,7 +93,6 @@ INSERT INTO global_suppressions VALUES ("Enabling keys got errno"), ("Error reading master configuration"), ("Error reading packet"), - ("Event Scheduler"), ("Failed to open log"), ("Failed to open the existing master info file"), ("Forcing shutdown of [0-9]* plugins"), diff --git a/mysql-test/main/alter_events.result b/mysql-test/main/alter_events.result index b3bd8d26fe6..41d5f7a65ef 100644 --- a/mysql-test/main/alter_events.result +++ b/mysql-test/main/alter_events.result @@ -1,3 +1,4 @@ +call mtr.add_suppression('Event Scheduler: .* Duplicate entry'); SET GLOBAL event_scheduler=1; CREATE TABLE t1 (a int primary key, b int) engine=innodb; insert into t1 values (1,1),(2,2),(3,3); diff --git a/mysql-test/main/alter_events.test b/mysql-test/main/alter_events.test index 309a0ce06ce..beaffb5a398 100644 --- a/mysql-test/main/alter_events.test +++ b/mysql-test/main/alter_events.test @@ -2,6 +2,7 @@ --source include/have_innodb.inc #--source include/have_metadata_lock_info.inc +call mtr.add_suppression('Event Scheduler: .* Duplicate entry'); # # Testing of problems with ALTER TABLE and events on the same table(s) # diff --git a/mysql-test/main/events_skip_grant_tables.result b/mysql-test/main/events_skip_grant_tables.result deleted file mode 100644 index 2bd2e383a23..00000000000 --- a/mysql-test/main/events_skip_grant_tables.result +++ /dev/null @@ -1,8 +0,0 @@ -call mtr.add_suppression("Event Scheduler will not function when starting with --skip-grant-tables or --bootstrap."); -CREATE EVENT test ON SCHEDULE AT CURRENT_TIMESTAMP DO DO NULL; -ERROR HY000: Event scheduler cannot function with --skip-grant-tables, --bootstrap, or embedded build -select (@@global.event_scheduler='DISABLED') as expect_1; -expect_1 -1 -set global event_scheduler=1; -ERROR HY000: The MariaDB server is running with the --event-scheduler=DISABLED or --skip-grant-tables option so it cannot execute this statement diff --git a/mysql-test/main/mysql_upgrade-6984.result b/mysql-test/main/mysql_upgrade-6984.result index 0b636b93eb4..4da47975d7d 100644 --- a/mysql-test/main/mysql_upgrade-6984.result +++ b/mysql-test/main/mysql_upgrade-6984.result @@ -1,3 +1,6 @@ +# +# MDEV-6984 Can't migrate from MySQL 5.6.21 to MariaDB 10 +# update mysql.global_priv set priv=json_set(priv, '$.plugin', 'mysql_native_password', '$.authentication_string', password('foo')) where user='root'; Phase 1/8: Checking and upgrading mysql database Processing databases diff --git a/mysql-test/main/mysql_upgrade-6984.test b/mysql-test/main/mysql_upgrade-6984.test index 93888d556d4..53b1f1800e8 100644 --- a/mysql-test/main/mysql_upgrade-6984.test +++ b/mysql-test/main/mysql_upgrade-6984.test @@ -1,9 +1,9 @@ -# -# MDEV-6984 Can't migrate from MySQL 5.6.21 to MariaDB 10 -# --source include/not_embedded.inc --source include/have_perfschema.inc +--echo # +--echo # MDEV-6984 Can't migrate from MySQL 5.6.21 to MariaDB 10 +--echo # # # When 'root' account is password protected and MYSQL_UPGRADE doesn't # know the password (meaning, MYSQL_UPGRADE is run automatically diff --git a/mysql-test/main/skip_grants.result b/mysql-test/main/skip_grants.result index 292358fad4c..2b3f42e3324 100644 --- a/mysql-test/main/skip_grants.result +++ b/mysql-test/main/skip_grants.result @@ -1,4 +1,3 @@ -call mtr.add_suppression("Event Scheduler will not function when starting with --skip-grant-tables or --bootstrap."); use test; CREATE TABLE t1(c INT); CREATE TRIGGER t1_bi BEFORE INSERT ON t1 @@ -53,7 +52,7 @@ DROP FUNCTION f3; # Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server # set global event_scheduler=1; -ERROR HY000: The MariaDB server is running with the --event-scheduler=DISABLED or --skip-grant-tables option so it cannot execute this statement +ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement # # Bug#26285 Selecting information_schema crahes server # diff --git a/mysql-test/main/skip_grants.test b/mysql-test/main/skip_grants.test index db2d24bc760..7b49d75e85a 100644 --- a/mysql-test/main/skip_grants.test +++ b/mysql-test/main/skip_grants.test @@ -1,6 +1,5 @@ # This tests not performed with embedded server -- source include/not_embedded.inc -call mtr.add_suppression("Event Scheduler will not function when starting with --skip-grant-tables or --bootstrap."); -- disable_ps_protocol use test; diff --git a/mysql-test/suite/events/events_1.result b/mysql-test/suite/events/events_1.result index 2f2a951158c..24f3aa35b56 100644 --- a/mysql-test/suite/events/events_1.result +++ b/mysql-test/suite/events/events_1.result @@ -1,6 +1,7 @@ set sql_mode=""; call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted"); call mtr.add_suppression("Incorrect definition of table mysql.event:.*"); +call mtr.add_suppression("Event Scheduler: .* DROP command denied to user"); drop database if exists events_test; drop database if exists db_x; drop database if exists mysqltest_db2; diff --git a/mysql-test/suite/events/events_1.test b/mysql-test/suite/events/events_1.test index ba8a2059e2d..63b0c50909f 100644 --- a/mysql-test/suite/events/events_1.test +++ b/mysql-test/suite/events/events_1.test @@ -9,6 +9,7 @@ set sql_mode=""; call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted"); call mtr.add_suppression("Incorrect definition of table mysql.event:.*"); +call mtr.add_suppression("Event Scheduler: .* DROP command denied to user"); --disable_warnings drop database if exists events_test; diff --git a/mysql-test/suite/events/events_bugs.result b/mysql-test/suite/events/events_bugs.result index 0615dac53b1..ee4411e6dbf 100644 --- a/mysql-test/suite/events/events_bugs.result +++ b/mysql-test/suite/events/events_bugs.result @@ -1,3 +1,4 @@ +call mtr.add_suppression('Event Scheduler:'); SET SQL_MODE=""; drop database if exists events_test; drop database if exists mysqltest_db1; diff --git a/mysql-test/suite/events/events_bugs.test b/mysql-test/suite/events/events_bugs.test index fe744de86c9..04ce048a364 100644 --- a/mysql-test/suite/events/events_bugs.test +++ b/mysql-test/suite/events/events_bugs.test @@ -1,7 +1,7 @@ # Tests will be skipped for the view protocol because the view protocol creates # an additional util connection and other statistics data -- source include/no_view_protocol.inc - +call mtr.add_suppression('Event Scheduler:'); #### t/events_bugs.test # # Last change: diff --git a/mysql-test/suite/events/events_restart.result b/mysql-test/suite/events/events_restart.result index 58401c7be80..6099414e727 100644 --- a/mysql-test/suite/events/events_restart.result +++ b/mysql-test/suite/events/events_restart.result @@ -1,6 +1,6 @@ -call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted"); +call mtr.add_suppression('Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted'); +call mtr.add_suppression('Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler'); set global event_scheduler=off; -drop database if exists events_test; create database events_test; use events_test; create table execution_log(name char(10)); @@ -20,7 +20,7 @@ create table event_like like mysql.event; insert into event_like select * from mysql.event; alter table mysql.event change column body body longtext character set utf8 collate utf8_bin; -"Now we restart the server" +# Now we restart the server call mtr.add_suppression("Incorrect definition of table mysql.event:.*"); # restart use events_test; @@ -54,8 +54,8 @@ ERROR HY000: Event Scheduler: An error occurred when initializing system tables. show variables like 'event_scheduler'; Variable_name Value event_scheduler OFF -Make sure that we still can create and drop databases, -and no warnings are produced. +# Make sure that we still can create and drop databases, +# and no warnings are produced. drop database if exists mysqltest_database_not_exists; Warnings: Note 1008 Can't drop database 'mysqltest_database_not_exists'; database doesn't exist @@ -63,10 +63,10 @@ create database mysqltest_db1; drop database mysqltest_db1; Warnings: Error 1545 Failed to open mysql.event -Restore the original mysql.event table +# Restore the original mysql.event table drop table mysql.event; rename table event_like to mysql.event; -check that we can now enable events without restart +# check that we can now enable events without restart set global event_scheduler=original; Warnings: Note 1408 Event Scheduler: Loaded 3 events @@ -82,7 +82,7 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E events_test abc1 root@localhost SYSTEM RECURRING # 1 SECOND # # ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci events_test abc2 root@localhost SYSTEM RECURRING # 1 SECOND # # ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci events_test abc3 root@localhost SYSTEM RECURRING # 1 SECOND # # ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci -Now let's restart the server again +# Now let's restart the server again # restart use events_test; select @@event_scheduler; @@ -103,7 +103,7 @@ CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO SELECT 1; SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation test e1 root@localhost SYSTEM RECURRING # 1 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci -"Now we restart the server" +# Now we restart the server # restart USE test; SELECT @@event_scheduler; diff --git a/mysql-test/suite/events/events_restart.test b/mysql-test/suite/events/events_restart.test index 6f7c01d81c2..e1db3d0c3d7 100644 --- a/mysql-test/suite/events/events_restart.test +++ b/mysql-test/suite/events/events_restart.test @@ -1,6 +1,7 @@ # Can't test with embedded server that doesn't support grants -- source include/not_embedded.inc -call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted"); +call mtr.add_suppression('Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted'); +call mtr.add_suppression('Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler'); let $collation_server=`select @@collation_server`; # @@ -11,9 +12,6 @@ let $collation_server=`select @@collation_server`; # Switch off the scheduler for now. set global event_scheduler=off; ---disable_warnings -drop database if exists events_test; ---enable_warnings create database events_test; use events_test; create table execution_log(name char(10)); @@ -43,7 +41,7 @@ insert into event_like select * from mysql.event; # Now let's alter the table and restart the server alter table mysql.event change column body body longtext character set utf8 collate utf8_bin; ---echo "Now we restart the server" +--echo # Now we restart the server call mtr.add_suppression("Incorrect definition of table mysql.event:.*"); --source include/restart_mysqld.inc @@ -77,16 +75,16 @@ set global event_scheduler=on; --error ER_STARTUP set global event_scheduler=off; show variables like 'event_scheduler'; ---echo Make sure that we still can create and drop databases, ---echo and no warnings are produced. +--echo # Make sure that we still can create and drop databases, +--echo # and no warnings are produced. drop database if exists mysqltest_database_not_exists; create database mysqltest_db1; drop database mysqltest_db1; ---echo Restore the original mysql.event table +--echo # Restore the original mysql.event table drop table mysql.event; rename table event_like to mysql.event; ---echo check that we can now enable events without restart +--echo # check that we can now enable events without restart set global event_scheduler=original; select @@global.event_scheduler; set global event_scheduler=on; @@ -96,7 +94,7 @@ select @@global.event_scheduler; --replace_result $collation_server latin1_swedish_ci show events; ---echo Now let's restart the server again +--echo # Now let's restart the server again --source include/restart_mysqld.inc @@ -132,7 +130,7 @@ CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO SELECT 1; --replace_column 6 # 9 # 10 # SHOW EVENTS; ---echo "Now we restart the server" +--echo # Now we restart the server --source include/restart_mysqld.inc USE test; SELECT @@event_scheduler; diff --git a/mysql-test/suite/events/events_scheduling.result b/mysql-test/suite/events/events_scheduling.result index 262caea3d7f..1739c607e4f 100644 --- a/mysql-test/suite/events/events_scheduling.result +++ b/mysql-test/suite/events/events_scheduling.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("Event Scheduler: .* Table 'events_test.t1' doesn't exist"); CREATE DATABASE IF NOT EXISTS events_test; USE events_test; SET @event_scheduler=@@global.event_scheduler; diff --git a/mysql-test/suite/events/events_scheduling.test b/mysql-test/suite/events/events_scheduling.test index 5f16f8bea6a..fee6274ed00 100644 --- a/mysql-test/suite/events/events_scheduling.test +++ b/mysql-test/suite/events/events_scheduling.test @@ -1,6 +1,8 @@ # Can't test with embedded server that doesn't support events -- source include/not_embedded.inc +call mtr.add_suppression("Event Scheduler: .* Table 'events_test.t1' doesn't exist"); + CREATE DATABASE IF NOT EXISTS events_test; USE events_test; diff --git a/mysql-test/main/events_skip_grant_tables-master.opt b/mysql-test/suite/events/events_skip_grant_tables.opt similarity index 100% rename from mysql-test/main/events_skip_grant_tables-master.opt rename to mysql-test/suite/events/events_skip_grant_tables.opt diff --git a/mysql-test/suite/events/events_skip_grant_tables.result b/mysql-test/suite/events/events_skip_grant_tables.result new file mode 100644 index 00000000000..beaeaa50c15 --- /dev/null +++ b/mysql-test/suite/events/events_skip_grant_tables.result @@ -0,0 +1,12 @@ +call mtr.add_suppression("Event Scheduler will not function when starting with --skip-grant-tables"); +# +# MDEV-29827 Misleading error messages about event scheduler when using --skip-grant-tables +# +FOUND 1 /Event Scheduler will not function when starting with --skip-grant-tables/ in mysqld.1.err +CREATE EVENT test ON SCHEDULE AT CURRENT_TIMESTAMP DO DO NULL; +ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement +select (@@global.event_scheduler='DISABLED') as expect_1; +expect_1 +1 +set global event_scheduler=1; +ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement diff --git a/mysql-test/main/events_skip_grant_tables.test b/mysql-test/suite/events/events_skip_grant_tables.test similarity index 60% rename from mysql-test/main/events_skip_grant_tables.test rename to mysql-test/suite/events/events_skip_grant_tables.test index b19178294b8..843ead2b98e 100644 --- a/mysql-test/main/events_skip_grant_tables.test +++ b/mysql-test/suite/events/events_skip_grant_tables.test @@ -1,12 +1,20 @@ # Can't test with embedded server that doesn't support grants -- source include/not_embedded.inc -call mtr.add_suppression("Event Scheduler will not function when starting with --skip-grant-tables or --bootstrap."); +call mtr.add_suppression("Event Scheduler will not function when starting with --skip-grant-tables"); -# [MARIADB-29827] Verify that if server is started with +--echo # +--echo # MDEV-29827 Misleading error messages about event scheduler when using --skip-grant-tables +--echo # + +# Verify that if server is started with # --event-scheduler=ON --skip-grant-tables, we get an error # with a distinct explanation that the latter disables the former. ---error ER_EVENTS_NO_ACL +let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err; +let SEARCH_PATTERN=Event Scheduler will not function when starting with --skip-grant-tables; +source include/search_pattern_in_file.inc; + +--error ER_OPTION_PREVENTS_STATEMENT CREATE EVENT test ON SCHEDULE AT CURRENT_TIMESTAMP DO DO NULL; # Although --event-scheduler=ON was specified (see -master.opt), it should diff --git a/mysql-test/suite/roles/definer.result b/mysql-test/suite/roles/definer.result index f7cc9684ce5..0ff6a67b966 100644 --- a/mysql-test/suite/roles/definer.result +++ b/mysql-test/suite/roles/definer.result @@ -1,3 +1,4 @@ +call mtr.add_suppression('Event Scheduler:'); create database mysqltest1; use mysqltest1; create table t1 (a int, b int, c int); diff --git a/mysql-test/suite/roles/definer.test b/mysql-test/suite/roles/definer.test index 4cd42d59b24..c08df87ab3b 100644 --- a/mysql-test/suite/roles/definer.test +++ b/mysql-test/suite/roles/definer.test @@ -7,6 +7,8 @@ --source include/not_embedded.inc --source include/default_charset.inc +call mtr.add_suppression('Event Scheduler:'); + let MYSQLD_DATADIR=`select @@datadir`; create database mysqltest1; diff --git a/sql/events.cc b/sql/events.cc index 45f99435348..e3b921c0ccf 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -121,7 +121,8 @@ bool Events::check_if_system_tables_error() if (opt_noacl) { - my_error(ER_EVENTS_NO_ACL, MYF(0)); + my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), + opt_bootstrap ? "--bootstrap" : "--skip-grant-tables"); DBUG_RETURN(TRUE); } else if (!inited) @@ -404,13 +405,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data) char buffer[1024]; String log_query(buffer, sizeof(buffer), &my_charset_bin); if (create_query_string(thd, &log_query)) - { - my_message_sql(ER_STARTUP, - "Event Error: An error occurred while creating query " - "string, before writing it into binary log.", - MYF(ME_ERROR_LOG)); - ret= true; - } + ret= true; // EE_OUTOFMEMORY set by my_malloc() else { /* @@ -895,10 +890,9 @@ Events::init(THD *thd, bool opt_noacl_or_bootstrap) DBUG_RETURN(FALSE); else if (opt_noacl_or_bootstrap) { - my_message(ER_STARTUP, - "Event Scheduler will not function when starting " - "with --skip-grant-tables or --bootstrap.", - MYF(ME_ERROR_LOG)); + if (opt_event_scheduler == Events::EVENTS_ON) + sql_print_error("Event Scheduler will not function when starting with %s", + opt_bootstrap ? "--bootstrap" : "--skip-grant-tables"); opt_event_scheduler= EVENTS_DISABLED; DBUG_RETURN(FALSE); } @@ -944,7 +938,7 @@ Events::init(THD *thd, bool opt_noacl_or_bootstrap) } /* - Since we allow event DDL even if the scheduler is disabled, + Since we allow event DDL even if the scheduler is off, check the system tables, as we might need them. If run with --skip-grant-tables or --bootstrap, we have already @@ -963,7 +957,6 @@ Events::init(THD *thd, bool opt_noacl_or_bootstrap) goto end; } - DBUG_ASSERT(opt_event_scheduler == Events::EVENTS_ON || opt_event_scheduler == Events::EVENTS_OFF); @@ -1305,9 +1298,7 @@ Events::load_events_from_db(THD *thd) } my_printf_error(ER_STARTUP, "Event Scheduler: Loaded %d event%s", - MYF(ME_ERROR_LOG | - (global_system_variables.log_warnings) ? - ME_NOTE: 0), + MYF(ME_ERROR_LOG | ME_NOTE), count, (count == 1) ? "" : "s"); ret= FALSE; diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 8bd961ee140..9cc20462371 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -10784,5 +10784,3 @@ ER_JSON_INVALID_VALUE_FOR_KEYWORD eng "Invalid value for keyword %s" ER_JSON_SCHEMA_KEYWORD_UNSUPPORTED eng "%s keyword is not supported" -ER_EVENTS_NO_ACL - eng "Event scheduler cannot function with --skip-grant-tables, --bootstrap, or embedded build" diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index c98a8b60746..62f231bff7d 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1133,7 +1133,7 @@ static bool event_scheduler_check(sys_var *self, THD *thd, set_var *var) if (Events::opt_event_scheduler == Events::EVENTS_DISABLED) { my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), - "--event-scheduler=DISABLED or --skip-grant-tables"); + opt_noacl ? "--skip-grant-tables" : "--event-scheduler=DISABLED"); return true; } /* DISABLED is only accepted on the command line */