################################################################################ # This test proves that the server cannot start when the mysql.session # is not present. # # 0) Start with GR stopped in both servers # 1) Remove the mysql.session # 2) Start group replication and see the command errors out # 3) Restart the server and check the it errors out # 4) Restore the user # ################################################################################ --source include/have_group_replication_plugin.inc --let $rpl_skip_group_replication_start= 1 --source include/group_replication.inc --echo # --echo # Delete the user and check the start fails --echo # --let $rpl_connection_name= server1 --source include/rpl_connection.inc #save user timestamps for later restore let $date_to_restore=`SELECT password_last_changed from mysql.user where user='mysql.session'`; let $date_to_restore_priv=`SELECT timestamp from mysql.tables_priv where user='mysql.session'`; USE test; CREATE TABLE test.tmp_user AS SELECT * FROM mysql.user; INSERT INTO tmp_user SELECT * FROM mysql.user; CREATE TABLE tmp_global_grants AS SELECT * FROM mysql.global_grants; INSERT INTO tmp_global_grants SELECT * FROM mysql.global_grants; DROP USER "mysql.session"@"localhost"; --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name" --error ER_GROUP_REPLICATION_CONFIGURATION START GROUP_REPLICATION; --let $assert_text= Member 1 is OFFLINE --let $assert_cond= [SELECT COUNT(*) FROM performance_schema.replication_group_members WHERE member_state="OFFLINE"] = 1 --source include/assert.inc --let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err --let $assert_count = 1 --let $assert_select = There was an error when trying to access the server with user: mysql.session. Make --let $assert_text = Found the expected error about the missing user in server log --source include/assert_grep.inc --echo # --echo # Restart the server --echo # Check the plugin is not running --echo # --let $allow_rpl_inited=1 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` --let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_start_on_boot=1 --group_replication_group_name=$group_replication_group_name --replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME --source include/restart_mysqld.inc --let $rpl_server_number= 1 --source include/rpl_reconnect.inc --let $assert_text= Member 1 is OFFLINE --let $assert_cond= [SELECT COUNT(*) FROM performance_schema.replication_group_members WHERE member_state="OFFLINE"] = 1 --source include/assert.inc --echo # --echo # Restore the user --echo # --disable_query_log --disable_result_log TRUNCATE TABLE mysql.user; INSERT IGNORE INTO mysql.user SELECT * FROM tmp_user; DROP TABLE tmp_user; TRUNCATE TABLE mysql.global_grants; INSERT IGNORE INTO mysql.global_grants SELECT * FROM tmp_global_grants; DROP TABLE tmp_global_grants; --enable_result_log --eval INSERT IGNORE INTO mysql.tables_priv VALUES ('localhost', 'mysql', 'mysql.session', 'user', 'root\@localhost', "$date_to_restore_priv", 'Select', ''); INSERT IGNORE INTO mysql.db VALUES ('localhost', 'performance_schema', 'mysql.session','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N'); --enable_query_log FLUSH PRIVILEGES; --echo # --echo # Suppress errors --echo # SET SESSION sql_log_bin= 0; call mtr.add_suppression("There was an error when trying to access the server with user: mysql.session.*"); call mtr.add_suppression("Failed to establish an internal server connection to execute plugin operations"); call mtr.add_suppression("It was not possible to establish a connection to server SQL service"); call mtr.add_suppression("On plugin shutdown it was not possible to reset the server read mode settings."); SET SESSION sql_log_bin= 1; --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` --let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_start_on_boot=0 --group_replication_group_name=$group_replication_group_name --replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME --source include/restart_mysqld.inc --let $rpl_server_number= 1 --source include/rpl_reconnect.inc --source include/group_replication_end.inc