| 1 |
################################################################################ |
| 2 |
# This test checks the server default user for the SQL session server is not |
| 3 |
# affected by GR, and GR fails when it is not there. |
| 4 |
# |
| 5 |
# Test: |
| 6 |
# 0. The test requires one server. |
| 7 |
# - Install plugin at startup. |
| 8 |
# 1. On server assert check the GR user 'mysql.session' exists after install. |
| 9 |
# 2. Bootstrap start a group. Assert check the GR user 'mysql.session' exists. |
| 10 |
# 3. Drop the user. Bootstrap start GR and check the start fails |
| 11 |
# 4. Uninstall the plugin and verify that user is still there |
| 12 |
# 5. Cleanup |
| 13 |
################################################################################ |
| 14 |
|
| 15 |
--source include/big_test.inc |
| 16 |
--let $rpl_skip_group_replication_start= 1 |
| 17 |
--source include/have_group_replication_plugin.inc |
| 18 |
--source include/force_restart.inc |
| 19 |
--source include/group_replication.inc |
| 20 |
|
| 21 |
--let $rpl_connection_name= server1 |
| 22 |
--source include/rpl_connection.inc |
| 23 |
|
| 24 |
SET SESSION sql_log_bin= 0; |
| 25 |
call mtr.add_suppression(".*The group replication user is not present in the server *.*"); |
| 26 |
SET SESSION sql_log_bin= 1; |
| 27 |
|
| 28 |
--echo # |
| 29 |
--echo # Assert the user exist from the start |
| 30 |
--echo # |
| 31 |
|
| 32 |
--let $rpl_connection_name= server1 |
| 33 |
--source include/rpl_connection.inc |
| 34 |
|
| 35 |
--let $assert_text= The group replication user should exist in this member |
| 36 |
--let $assert_cond= [SELECT COUNT(*) FROM mysql.user WHERE user="mysql.session"] = 1; |
| 37 |
--source include/assert.inc |
| 38 |
|
| 39 |
--echo # |
| 40 |
--echo # Start group replication and check all is OK |
| 41 |
--echo # |
| 42 |
|
| 43 |
--source include/start_and_bootstrap_group_replication.inc |
| 44 |
|
| 45 |
--let $assert_text= The group replication user should exist in this member |
| 46 |
--let $assert_cond= [SELECT COUNT(*) FROM mysql.user WHERE user="mysql.session"] = 1; |
| 47 |
--source include/assert.inc |
| 48 |
|
| 49 |
--echo # |
| 50 |
--echo # Delete the user and watch GR fail at start |
| 51 |
--echo # |
| 52 |
|
| 53 |
--source include/stop_group_replication.inc |
| 54 |
|
| 55 |
let $date_to_restore=`SELECT password_last_changed from mysql.user where user='mysql.session'`; |
| 56 |
let $date_to_restore_priv=`SELECT timestamp from mysql.tables_priv where user='mysql.session'`; |
| 57 |
DROP USER "mysql.session"@"localhost"; |
| 58 |
|
| 59 |
--error ER_GROUP_REPLICATION_CONFIGURATION |
| 60 |
START GROUP_REPLICATION; |
| 61 |
|
| 62 |
--echo # |
| 63 |
--echo # Recreate the user with an upgrade and see that GR works |
| 64 |
--echo # |
| 65 |
|
| 66 |
-- source include/mysql_upgrade_preparation.inc |
| 67 |
--echo Run mysql_upgrade |
| 68 |
|
| 69 |
--let $allow_rpl_inited=1 |
| 70 |
--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` |
| 71 |
--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` |
| 72 |
--let $explicit_default_wait_counter = 10000 |
| 73 |
--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 |
| 74 |
--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 |
| 75 |
--source include/restart_mysqld.inc |
| 76 |
|
| 77 |
# Needed as we are not using rpl_restart_server.inc |
| 78 |
--let $rpl_server_number= 1 |
| 79 |
--source include/rpl_reconnect.inc |
| 80 |
|
| 81 |
--source include/start_and_bootstrap_group_replication.inc |
| 82 |
|
| 83 |
--echo # |
| 84 |
--echo # Uninstall plugin and verify that user is still there |
| 85 |
--echo # |
| 86 |
|
| 87 |
--source include/uninstall_group_replication_plugin.inc |
| 88 |
|
| 89 |
--let $assert_text= The group replication user should exist after install |
| 90 |
--let $assert_cond= [SELECT COUNT(*) FROM mysql.user WHERE user="mysql.session"] = 1; |
| 91 |
--source include/assert.inc |
| 92 |
|
| 93 |
--echo # |
| 94 |
--echo # Cleaning |
| 95 |
--echo # |
| 96 |
|
| 97 |
--source include/install_group_replication_plugin.inc |
| 98 |
|
| 99 |
SET SESSION sql_log_bin= 0; |
| 100 |
call mtr.add_suppression("There was an error when trying to access the server with user: mysql.session.*"); |
| 101 |
call mtr.add_suppression("Failed to establish an internal server connection to execute plugin operations"); |
| 102 |
call mtr.add_suppression("On plugin shutdown it was not possible to reset the server read mode settings. Try to reset it manually."); |
| 103 |
SET SESSION sql_log_bin= 1; |
| 104 |
|
| 105 |
--disable_query_log ONCE |
| 106 |
--eval UPDATE mysql.tables_priv SET timestamp ='$date_to_restore_priv' WHERE USER= 'mysql.session' |
| 107 |
--disable_query_log ONCE |
| 108 |
--eval UPDATE mysql.user SET password_last_changed= '$date_to_restore' WHERE USER= 'mysql.session' |
| 109 |
|
| 110 |
--source include/group_replication_end.inc |