diff --git a/VERSION b/VERSION index 0f8a4608896..e7b29db2217 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=5 -MYSQL_VERSION_PATCH=23 +MYSQL_VERSION_PATCH=24 SERVER_MATURITY=stable diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 60eb61938d4..617d5464e34 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -1155,6 +1155,8 @@ static int install_used_plugin_data_types(void) DYNAMIC_STRING ds_result; const char *query = "SELECT table_comment FROM information_schema.tables" " WHERE table_comment LIKE 'Unknown data type: %'"; + if (opt_systables_only) + return 0; if (init_dynamic_string(&ds_result, "", 512, 512)) die("Out of memory"); run_query(query, &ds_result, TRUE); diff --git a/mysql-test/include/delete_anonymous_users.inc b/mysql-test/include/delete_anonymous_users.inc index 704e74ae4a3..cc44a01fe8d 100644 --- a/mysql-test/include/delete_anonymous_users.inc +++ b/mysql-test/include/delete_anonymous_users.inc @@ -1,7 +1,7 @@ # Remove anonymous users added by add_anonymous_users.inc disable_warnings; disable_query_log; -DELETE FROM mysql.user where host='localhost' and user=''; +DELETE FROM mysql.global_priv where host='localhost' and user=''; FLUSH PRIVILEGES; enable_query_log; enable_warnings; diff --git a/mysql-test/main/mysql_json_mysql_upgrade.result b/mysql-test/main/mysql_upgrade_mysql_json.result similarity index 100% rename from mysql-test/main/mysql_json_mysql_upgrade.result rename to mysql-test/main/mysql_upgrade_mysql_json.result diff --git a/mysql-test/main/mysql_json_mysql_upgrade.test b/mysql-test/main/mysql_upgrade_mysql_json.test similarity index 100% rename from mysql-test/main/mysql_json_mysql_upgrade.test rename to mysql-test/main/mysql_upgrade_mysql_json.test diff --git a/mysql-test/main/mysql_upgrade_mysql_json_system_tables.result b/mysql-test/main/mysql_upgrade_mysql_json_system_tables.result new file mode 100644 index 00000000000..95ca68f43a6 --- /dev/null +++ b/mysql-test/main/mysql_upgrade_mysql_json_system_tables.result @@ -0,0 +1,93 @@ +# +# MDEV-32462: mysql_upgrade -s still checks for non system tables +# +call mtr.add_suppression("Table rebuild required"); +SET NAMES utf8; +# mariadb_upgrade on system and user table +show tables from mysql like '%json%'; +Tables_in_mysql (%json%) +mysql_json_test +use mysql; +show create table mysql.mysql_json_test; +ERROR HY000: Unknown data type: 'MYSQL_JSON' +show create table test.mysql_json_test; +ERROR HY000: Unknown data type: 'MYSQL_JSON' +SET @old_general_log= @@global.general_log; +SET @old_log_output= @@global.log_output; +SET @@global.general_log = ON; +SET @@global.log_output = "TABLE"; +The --upgrade-system-tables option was used, user tables won't be touched. +Phase 1/7: Checking and upgrading mysql database +Processing databases +mysql +mysql.column_stats OK +mysql.columns_priv OK +mysql.db OK +mysql.event OK +mysql.func OK +mysql.global_priv OK +mysql.gtid_slave_pos OK +mysql.help_category OK +mysql.help_keyword OK +mysql.help_relation OK +mysql.help_topic OK +mysql.index_stats OK +mysql.innodb_index_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.innodb_table_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.mysql_json_test +Error : Unknown data type: 'MYSQL_JSON' +error : Corrupt +mysql.plugin OK +mysql.proc OK +mysql.procs_priv OK +mysql.proxies_priv OK +mysql.roles_mapping OK +mysql.servers OK +mysql.table_stats OK +mysql.tables_priv OK +mysql.time_zone OK +mysql.time_zone_leap_second OK +mysql.time_zone_name OK +mysql.time_zone_transition OK +mysql.time_zone_transition_type OK +mysql.transaction_registry +Error : Unknown storage engine 'InnoDB' +error : Corrupt + +Repairing tables +mysql.innodb_index_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.innodb_table_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.mysql_json_test +Error : Unknown data type: 'MYSQL_JSON' +error : Corrupt +mysql.transaction_registry +Error : Unknown storage engine 'InnoDB' +error : Corrupt +Phase 2/7: Installing used storage engines... Skipped +Phase 3/7: Fixing views... Skipped +Phase 4/7: Running 'mysql_fix_privilege_tables' +Phase 5/7: Fixing table and database names ... Skipped +Phase 6/7: Checking and upgrading tables... Skipped +Phase 7/7: Running 'FLUSH PRIVILEGES' +OK +SET @@global.general_log = @old_general_log; +SET @@global.log_output = @old_log_output; +select command_type, argument from mysql.general_log where argument like "%SELECT table_comment FROM information_schema.tables%"; +command_type argument +show create table mysql.mysql_json_test; +ERROR HY000: Unknown data type: 'MYSQL_JSON' +show create table test.mysql_json_test; +ERROR HY000: Unknown data type: 'MYSQL_JSON' +drop table mysql.mysql_json_test; +drop table test.mysql_json_test; +# +# End of 10.5 tests +# diff --git a/mysql-test/main/mysql_upgrade_mysql_json_system_tables.test b/mysql-test/main/mysql_upgrade_mysql_json_system_tables.test new file mode 100644 index 00000000000..6ae3e8ddea1 --- /dev/null +++ b/mysql-test/main/mysql_upgrade_mysql_json_system_tables.test @@ -0,0 +1,52 @@ +--echo # +--echo # MDEV-32462: mysql_upgrade -s still checks for non system tables +--echo # + +# Let's now load plugin first +--source include/have_utf8.inc +--source include/not_embedded.inc + +--source include/mysql_upgrade_preparation.inc +call mtr.add_suppression("Table rebuild required"); + +SET NAMES utf8; + +let $MYSQLD_DATADIR= `select @@datadir`; + +--echo # mariadb_upgrade on system and user table +--copy_file std_data/mysql_json/mysql_json_test.frm $MYSQLD_DATADIR/mysql/mysql_json_test.frm +--copy_file std_data/mysql_json/mysql_json_test.MYI $MYSQLD_DATADIR/mysql/mysql_json_test.MYI +--copy_file std_data/mysql_json/mysql_json_test.MYD $MYSQLD_DATADIR/mysql/mysql_json_test.MYD +--copy_file std_data/mysql_json/mysql_json_test.frm $MYSQLD_DATADIR/test/mysql_json_test.frm +--copy_file std_data/mysql_json/mysql_json_test.MYI $MYSQLD_DATADIR/test/mysql_json_test.MYI +--copy_file std_data/mysql_json/mysql_json_test.MYD $MYSQLD_DATADIR/test/mysql_json_test.MYD + +show tables from mysql like '%json%'; +use mysql; +--error ER_UNKNOWN_DATA_TYPE +show create table mysql.mysql_json_test; +--error ER_UNKNOWN_DATA_TYPE +show create table test.mysql_json_test; + +SET @old_general_log= @@global.general_log; +SET @old_log_output= @@global.log_output; +SET @@global.general_log = ON; +SET @@global.log_output = "TABLE"; +--exec $MYSQL_UPGRADE -s --force 2>&1 +--remove_file $MYSQLD_DATADIR/mysql_upgrade_info +SET @@global.general_log = @old_general_log; +SET @@global.log_output = @old_log_output; + +select command_type, argument from mysql.general_log where argument like "%SELECT table_comment FROM information_schema.tables%"; + +# User table is not upgraded in `mysql\test` DB, so we cannot see it. +--error ER_UNKNOWN_DATA_TYPE +show create table mysql.mysql_json_test; +--error ER_UNKNOWN_DATA_TYPE +show create table test.mysql_json_test; +drop table mysql.mysql_json_test; +drop table test.mysql_json_test; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/main/mysql_json_mysql_upgrade_with_plugin_loaded.result b/mysql-test/main/mysql_upgrade_mysql_json_with_plugin_loaded.result similarity index 100% rename from mysql-test/main/mysql_json_mysql_upgrade_with_plugin_loaded.result rename to mysql-test/main/mysql_upgrade_mysql_json_with_plugin_loaded.result diff --git a/mysql-test/main/mysql_json_mysql_upgrade_with_plugin_loaded.test b/mysql-test/main/mysql_upgrade_mysql_json_with_plugin_loaded.test similarity index 100% rename from mysql-test/main/mysql_json_mysql_upgrade_with_plugin_loaded.test rename to mysql-test/main/mysql_upgrade_mysql_json_with_plugin_loaded.test diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index b948e62d3cb..55ee7159fb9 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -14,6 +14,12 @@ galera_as_slave_ctas : MDEV-28378 timeout galera_pc_recovery : MDEV-25199 cluster fails to start up galera_sst_encrypted : MDEV-29876 Galera test failure on galera_sst_encrypted galera_var_node_address : MDEV-20485 Galera test failure -versioning_trx_id : MDEV-18590: galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch -galera_sequences : MDEV-32024 +galera_sequences : MDEV-32561 WSREP FSM failure: no such a transition REPLICATING -> COMMITTED +galera_shutdown_nonprim : MDEV-32635 galera_shutdown_nonprim: mysql_shutdown failed +versioning_trx_id : MDEV-18590 : galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch +galera_concurrent_ctas : MDEV-32779 galera_concurrent_ctas: assertion in the galera::ReplicatorSMM::finish_cert() +galera_as_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback() +galera_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback() +galera_bf_lock_wait : MDEV-32781 galera_bf_lock_wait test failed +galera_sst_mysqldump_with_key : MDEV-32782 galera_sst_mysqldump_with_key test failed mdev-31285 : MDEV-25089 Assertion `error.len > 0' failed in galera::ReplicatorSMM::handle_apply_error() diff --git a/mysql-test/suite/galera/t/galera_restart_replica.test b/mysql-test/suite/galera/t/galera_restart_replica.test index 2cc3a1dcff2..37cfd9bc0f9 100644 --- a/mysql-test/suite/galera/t/galera_restart_replica.test +++ b/mysql-test/suite/galera/t/galera_restart_replica.test @@ -3,9 +3,9 @@ # # The galera/galera_2node_slave.cnf describes the setup of the nodes # ---source include/big_test.inc --source include/force_restart.inc --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_sequence.inc # As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index dc08e0981bd..3986bc69dcf 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -10,8 +10,7 @@ # ############################################################################## - -galera_2_cluster : MDEV-29877 Galera test failure on galera_2_cluster -galera_gtid_2_cluster : MDEV-29877 Galera test failure on galera_2_cluster +galera_2_cluster : MDEV-32631 galera_2_cluster: before_rollback(): Assertion `0' failed +galera_gtid_2_cluster : MDEV-32633 galera_gtid_2_cluster: Assertion `thd->wsrep_next_trx_id() != (0x7fffffffffffffffLL * 2ULL + 1)' galera_vote_rejoin_mysqldump : MDEV-24481: galera_3nodes.galera_vote_rejoin_mysqldump MTR failed: mysql_shutdown failed -galera_ssl_reload : MDEV-30172 At line 50: mysql_shutdown failed +galera_ssl_reload : MDEV-32778 galera_ssl_reload failed with warning message diff --git a/mysql-test/suite/galera_3nodes_sr/disabled.def b/mysql-test/suite/galera_3nodes_sr/disabled.def index df2277fb8ad..4472d960d9f 100644 --- a/mysql-test/suite/galera_3nodes_sr/disabled.def +++ b/mysql-test/suite/galera_3nodes_sr/disabled.def @@ -10,4 +10,4 @@ # ############################################################################## -galera_sr_kill_slave_after_apply_rollback2 : MDEV-29892 Galera test failure on galera_sr_kill_slave_after_apply_rollback2 \ No newline at end of file +galera_sr_kill_slave_after_apply_rollback2 : MDEV-29892 Galera test failure on galera_sr_kill_slave_after_apply_rollback2 diff --git a/mysql-test/suite/galera_sr/disabled.def b/mysql-test/suite/galera_sr/disabled.def index 1132a0097c4..fa62168d474 100644 --- a/mysql-test/suite/galera_sr/disabled.def +++ b/mysql-test/suite/galera_sr/disabled.def @@ -10,6 +10,5 @@ # ############################################################################## -GCF-1060 : MDEV-26528 wrong usage of mutex LOCK_thd_kill and LOCK_thd_kill +GCF-1060 : MDEV-32160 GCF-1060 test failure due to wsrep MDL conflict galera_sr_cc_master : MDEV-29882 Galera test failure on galera_sr_cc_master -mysql-wsrep-features#138 : At line 25: query 'DROP TABLE t1' failed: 2013: Lost connection to MySQL server during query diff --git a/mysql-test/suite/innodb/t/log_file_name.test b/mysql-test/suite/innodb/t/log_file_name.test index c153c38e54b..11eca0a7a12 100644 --- a/mysql-test/suite/innodb/t/log_file_name.test +++ b/mysql-test/suite/innodb/t/log_file_name.test @@ -170,6 +170,8 @@ call mtr.add_suppression("InnoDB: Plugin initialization aborted"); call mtr.add_suppression("Plugin 'InnoDB' \(init function returned error\|registration as a STORAGE ENGINE failed\)"); call mtr.add_suppression("InnoDB: Table test/u[123] in the InnoDB data dictionary has tablespace id [1-9][0-9]*, but tablespace with that id or name does not exist\\. Have you deleted or moved \\.ibd files\\?"); call mtr.add_suppression("InnoDB: Cannot replay rename of tablespace.*"); +call mtr.add_suppression("InnoDB: Attempted to open a previously opened tablespace"); +call mtr.add_suppression("InnoDB: Recovery cannot access file"); FLUSH TABLES; --enable_query_log diff --git a/mysql-test/suite/perfschema/r/mdl_func.result b/mysql-test/suite/perfschema/r/mdl_func.result index 4887b15efa5..f3fc0d10a96 100644 --- a/mysql-test/suite/perfschema/r/mdl_func.result +++ b/mysql-test/suite/perfschema/r/mdl_func.result @@ -1,3 +1,4 @@ +# restart UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES'; UPDATE performance_schema.setup_instruments SET enabled = 'YES' WHERE name in ('wait/io/table/sql/handler', diff --git a/mysql-test/suite/perfschema/t/mdl_func.test b/mysql-test/suite/perfschema/t/mdl_func.test index c7f5585a5c2..209c2f112af 100644 --- a/mysql-test/suite/perfschema/t/mdl_func.test +++ b/mysql-test/suite/perfschema/t/mdl_func.test @@ -1,5 +1,11 @@ --source include/not_embedded.inc --source include/have_perfschema.inc +# This test needs a fresh restart. The table performance_schema.table_handles +# can otherwise contain extra rows left from previous testcases. +# For example the test case main.long_unique_delayed, which uses +# INSERT DELAYED, will leave extra rows in this table if run just before this +# test, causing .result diff failure. +--source include/restart_mysqld.inc UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES'; diff --git a/mysql-test/suite/roles/set_default_role_for.result b/mysql-test/suite/roles/set_default_role_for.result index 57a1471126c..1b133b1baae 100644 --- a/mysql-test/suite/roles/set_default_role_for.result +++ b/mysql-test/suite/roles/set_default_role_for.result @@ -14,7 +14,7 @@ set default role role_a for user_a@localhost; set default role invalid_role for user_a@localhost; ERROR OP000: Invalid role specification `invalid_role` set default role role_b for user_a@localhost; -ERROR OP000: User `root`@`localhost` has not been granted role `role_b` +ERROR OP000: User `user_a`@`localhost` has not been granted role `role_b` set default role role_b for user_b@localhost; show grants; Grants for user_a@localhost diff --git a/mysql-test/suite/roles/set_default_role_invalid.result b/mysql-test/suite/roles/set_default_role_invalid.result index 12e2c035a7d..2cd84cf2ff0 100644 --- a/mysql-test/suite/roles/set_default_role_invalid.result +++ b/mysql-test/suite/roles/set_default_role_invalid.result @@ -48,7 +48,7 @@ CREATE USER b; CREATE ROLE r1; CREATE ROLE r2; SET DEFAULT ROLE r1 FOR a; -ERROR OP000: User `root`@`localhost` has not been granted role `r1` +ERROR OP000: User `a`@`%` has not been granted role `r1` GRANT r1 TO b; GRANT r2 TO b; SET DEFAULT ROLE r1 FOR b; @@ -100,7 +100,7 @@ GRANT USAGE ON *.* TO `b`@`%` GRANT SELECT, UPDATE ON `mysql`.* TO `b`@`%` SET DEFAULT ROLE `r2` FOR `b`@`%` SET DEFAULT ROLE r1 FOR a; -ERROR OP000: User `b`@`%` has not been granted role `r1` +ERROR OP000: User `a`@`%` has not been granted role `r1` SET DEFAULT ROLE invalid_role; ERROR OP000: Invalid role specification `invalid_role` SET DEFAULT ROLE invalid_role FOR a; @@ -117,7 +117,7 @@ SET DEFAULT ROLE None; # Change user b (session 3: role granted to user a) SET DEFAULT ROLE r1 FOR a; SET DEFAULT ROLE r2 FOR a; -ERROR OP000: User `b`@`%` has not been granted role `r2` +ERROR OP000: User `a`@`%` has not been granted role `r2` SET DEFAULT ROLE invalid_role; ERROR OP000: Invalid role specification `invalid_role` SET DEFAULT ROLE invalid_role FOR a; diff --git a/mysql-test/suite/roles/set_default_role_invalid.test b/mysql-test/suite/roles/set_default_role_invalid.test index 02fca1107e2..d2ef01b8f88 100644 --- a/mysql-test/suite/roles/set_default_role_invalid.test +++ b/mysql-test/suite/roles/set_default_role_invalid.test @@ -70,7 +70,6 @@ CREATE USER a; CREATE USER b; CREATE ROLE r1; CREATE ROLE r2; -# Role has not been granted to user a, but the role is visible to current_user --error ER_INVALID_ROLE SET DEFAULT ROLE r1 FOR a; # Granting roles to user b diff --git a/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve-master.opt b/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve-master.opt new file mode 100644 index 00000000000..ec008a812ce --- /dev/null +++ b/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve-master.opt @@ -0,0 +1 @@ +--skip-name-resolve \ No newline at end of file diff --git a/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve.result b/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve.result new file mode 100644 index 00000000000..a267e114012 --- /dev/null +++ b/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve.result @@ -0,0 +1,85 @@ +# +# MDEV-26875: Wrong user in SET DEFAULT ROLE error +# +create user test_user; +create role test_role; +show grants for test_user; +Grants for test_user@% +GRANT USAGE ON *.* TO `test_user`@`%` +set default role test_role for test_user; +ERROR OP000: User `test_user`@`%` has not been granted role `test_role` +grant test_role to test_user; +set default role test_role for test_user; +show grants for test_user; +Grants for test_user@% +GRANT `test_role` TO `test_user`@`%` +GRANT USAGE ON *.* TO `test_user`@`%` +SET DEFAULT ROLE `test_role` FOR `test_user`@`%` +set default role none for test_user; +# +# Try to set default role to role(`test_role`). +-------------------------------------------------------------- +show grants for test_role; +Grants for test_role +GRANT USAGE ON *.* TO `test_role` +create role new_role; +grant new_role to test_role; +show grants for test_role; +Grants for test_role +GRANT `new_role` TO `test_role` +GRANT USAGE ON *.* TO `test_role` +GRANT USAGE ON *.* TO `new_role` +set default role new_role for test_role; +ERROR OP000: User `test_role`@`%` has not been granted role `new_role` +# +# Test of errors, where hostname cannot be resolved `test_user` +-------------------------------------------------------------- +grant test_role to test_user@'%'; +set default role test_role for test_user@'%'; +connect con_test_user,127.0.0.1,test_user,,,$MASTER_MYPORT; +show grants; +Grants for test_user@% +GRANT `test_role` TO `test_user`@`%` +GRANT USAGE ON *.* TO `test_user`@`%` +GRANT `new_role` TO `test_role` +GRANT USAGE ON *.* TO `test_role` +GRANT USAGE ON *.* TO `new_role` +SET DEFAULT ROLE `test_role` FOR `test_user`@`%` +select current_role; +current_role +test_role +set role `new_role`; +ERROR OP000: User `test_user`@`%` has not been granted role `new_role` +connection default; +set default role none for test_user; +disconnect con_test_user; +connect con_test_user,127.0.0.1,test_user,,,$MASTER_MYPORT; +select current_role; +current_role +NULL +set role `new_role`; +ERROR OP000: User `test_user`@`%` has not been granted role `new_role` +connection default; +disconnect con_test_user; +# +# Test of anonymous user connection +-------------------------------------------------------------- +grant test_role to ''@localhost; +connect con1,localhost,'',,,$MASTER_MYPORT; +SELECT CURRENT_ROLE; +CURRENT_ROLE +NULL +SET role test_role; +SELECT CURRENT_ROLE; +CURRENT_ROLE +test_role +SET role new_role; +ERROR OP000: User ``@`localhost` has not been granted role `new_role` +set default role test_role for ''@localhost; +ERROR 42000: You are using MariaDB as an anonymous user and anonymous users are not allowed to modify user settings +connection default; +disconnect con1; +REVOKE all privileges, grant option from ''@localhost; +drop role new_role; +drop role test_role; +drop user test_user; diff --git a/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve.test b/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve.test new file mode 100644 index 00000000000..5b4b14d3377 --- /dev/null +++ b/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve.test @@ -0,0 +1,78 @@ +source include/not_embedded.inc; + +--echo # +--echo # MDEV-26875: Wrong user in SET DEFAULT ROLE error +--echo # +create user test_user; +create role test_role; +show grants for test_user; +--error ER_INVALID_ROLE +set default role test_role for test_user; +grant test_role to test_user; +set default role test_role for test_user; +show grants for test_user; +set default role none for test_user; + +--echo # +--echo # Try to set default role to role(`test_role`). +--echo -------------------------------------------------------------- +show grants for test_role; +create role new_role; +grant new_role to test_role; +show grants for test_role; +# One can not set role to a role +--error ER_INVALID_ROLE +set default role new_role for test_role; + +--echo # +--echo # Test of errors, where hostname cannot be resolved `test_user` +--echo -------------------------------------------------------------- +# `new_role` is granted to `test_role` +grant test_role to test_user@'%'; +set default role test_role for test_user@'%'; + +connect con_test_user,127.0.0.1,test_user,,,$MASTER_MYPORT; +show grants; +select current_role; +# `test_user` indirectly granted `new_role` +--error ER_INVALID_ROLE +set role `new_role`; + +connection default; +set default role none for test_user; +disconnect con_test_user; + +connect con_test_user,127.0.0.1,test_user,,,$MASTER_MYPORT; +select current_role; +--error ER_INVALID_ROLE +set role `new_role`; + +connection default; +disconnect con_test_user; + +--echo # +--echo # Test of anonymous user connection +--echo -------------------------------------------------------------- +--source include/add_anonymous_users.inc +# Skip windows, since it uses current user `Administrator` in buildbot. +--source include/not_windows.inc +grant test_role to ''@localhost; + +connect(con1,localhost,'',,,$MASTER_MYPORT); +SELECT CURRENT_ROLE; +SET role test_role; +SELECT CURRENT_ROLE; +# user cannot set subset role, since it is not granted explicitly +--error ER_INVALID_ROLE +SET role new_role; +--error ER_PASSWORD_ANONYMOUS_USER +set default role test_role for ''@localhost; + +connection default; +disconnect con1; +REVOKE all privileges, grant option from ''@localhost; +--source include/delete_anonymous_users.inc + +drop role new_role; +drop role test_role; +drop user test_user; diff --git a/sql/log.cc b/sql/log.cc index c559eb62ddb..f8eac66deca 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -8558,13 +8558,10 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader) DEBUG_SYNC(leader->thd, "commit_loop_entry_commit_ordered"); ++num_commits; + set_current_thd(current->thd); if (current->cache_mngr->using_xa && likely(!current->error) && DBUG_EVALUATE_IF("skip_commit_ordered", 0, 1)) - { - mysql_mutex_lock(¤t->thd->LOCK_thd_data); run_commit_ordered(current->thd, current->all); - mysql_mutex_unlock(¤t->thd->LOCK_thd_data); - } current->thd->wakeup_subsequent_commits(current->error); /* @@ -8581,6 +8578,7 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader) } current= next; } + set_current_thd(leader->thd); DEBUG_SYNC(leader->thd, "commit_after_group_run_commit_ordered"); mysql_mutex_unlock(&LOCK_commit_ordered); DEBUG_SYNC(leader->thd, "commit_after_group_release_commit_ordered"); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index f08238fb947..15b6874538e 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -3339,10 +3339,18 @@ end: check_role_is_granted_callback, NULL) == -1)) { - /* Role is not granted but current user can see the role */ - my_printf_error(ER_INVALID_ROLE, "User %`s@%`s has not been granted role %`s", - MYF(0), thd->security_ctx->priv_user, - thd->security_ctx->priv_host, rolename); + /* This happens for SET ROLE case and when `--skip-name-resolve` option + is used. In that situation host can be NULL and current user is always + target user, so printing `priv_user@priv_host` is not incorrect. + */ + if (!host) + my_printf_error(ER_INVALID_ROLE, "User %`s@%`s has not been granted role %`s", + MYF(0), thd->security_ctx->priv_user, + thd->security_ctx->priv_host, rolename); + else + /* Role is not granted but current user can see the role */ + my_printf_error(ER_INVALID_ROLE, "User %`s@%`s has not been granted role %`s", + MYF(0), user, host, rolename); } else { diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 8c10e5277d5..d52a62cec99 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -3203,7 +3203,6 @@ recv_group_scan_log_recs( log_sys.log.scanned_lsn = end_lsn = *contiguous_lsn = ut_uint64_align_down(*contiguous_lsn, OS_FILE_LOG_BLOCK_SIZE); - ut_d(recv_sys.after_apply = last_phase); do { if (last_phase && store == STORE_NO) { @@ -3226,6 +3225,7 @@ recv_group_scan_log_recs( DBUG_RETURN(false); } + ut_d(recv_sys.after_apply = last_phase); DBUG_PRINT("ib_log", ("%s " LSN_PF " completed", last_phase ? "rescan" : "scan", log_sys.log.scanned_lsn));