################################################################################ # This test checks the server default user for the SQL session server is not # affected by GR, and GR fails when it is not there. # # Test: # 0. The test requires one server. # - Install plugin at startup. # 1. On server assert check the GR user 'mysql.session' exists after install. # 2. Bootstrap start a group. Assert check the GR user 'mysql.session' exists. # 3. Drop the user. Bootstrap start GR and check the start fails # 4. Uninstall the plugin and verify that user is still there # 5. Cleanup ################################################################################ --source include/big_test.inc --let $rpl_skip_group_replication_start= 1 --source include/have_group_replication_plugin.inc --source include/force_restart.inc --source include/group_replication.inc --let $rpl_connection_name= server1 --source include/rpl_connection.inc SET SESSION sql_log_bin= 0; call mtr.add_suppression(".*The group replication user is not present in the server *.*"); SET SESSION sql_log_bin= 1; --echo # --echo # Assert the user exist from the start --echo # --let $rpl_connection_name= server1 --source include/rpl_connection.inc --let $assert_text= The group replication user should exist in this member --let $assert_cond= [SELECT COUNT(*) FROM mysql.user WHERE user="mysql.session"] = 1; --source include/assert.inc --echo # --echo # Start group replication and check all is OK --echo # --source include/start_and_bootstrap_group_replication.inc --let $assert_text= The group replication user should exist in this member --let $assert_cond= [SELECT COUNT(*) FROM mysql.user WHERE user="mysql.session"] = 1; --source include/assert.inc --echo # --echo # Delete the user and watch GR fail at start --echo # --source include/stop_group_replication.inc 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'`; DROP USER "mysql.session"@"localhost"; --error ER_GROUP_REPLICATION_CONFIGURATION START GROUP_REPLICATION; --echo # --echo # Recreate the user with an upgrade and see that GR works --echo # -- source include/mysql_upgrade_preparation.inc --echo Run mysql_upgrade --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_group_name=$group_replication_group_name --group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --upgrade=FORCE --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS --source include/restart_mysqld.inc # Needed as we are not using rpl_restart_server.inc --let $rpl_server_number= 1 --source include/rpl_reconnect.inc --source include/start_and_bootstrap_group_replication.inc --echo # --echo # Uninstall plugin and verify that user is still there --echo # --source include/uninstall_group_replication_plugin.inc --let $assert_text= The group replication user should exist after install --let $assert_cond= [SELECT COUNT(*) FROM mysql.user WHERE user="mysql.session"] = 1; --source include/assert.inc --echo # --echo # Cleaning --echo # --source include/install_group_replication_plugin.inc 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("Error calling group communication interfaces while trying to leave the group"); call mtr.add_suppression("On plugin shutdown it was not possible to reset the server read mode settings. Try to reset it manually."); SET SESSION sql_log_bin= 1; --disable_query_log ONCE --eval UPDATE mysql.tables_priv SET timestamp ='$date_to_restore_priv' WHERE USER= 'mysql.session' --disable_query_log ONCE --eval UPDATE mysql.user SET password_last_changed= '$date_to_restore' WHERE USER= 'mysql.session' --source include/group_replication_end.inc