# ==== Purpose ==== # # Verify that UNINSTALL PLUGIN is blocked for semisync plugins, when # the plugins are active. # # ==== Requirements ==== # # R1. Installation of source plugins should be disallowed if there are # running dump threads having semi-sync replicas. # # R2. Installation of replica plugins should be disallowed if there are # running receiver threads where semi-sync is enabled. # # R3. The above should hold both for old-named plugins and for new-named # plugins. # # ==== References ==== # # BUG#17638477 UNINSTALL AND INSTALL SEMI-SYNC PLUGIN CAUSES SLAVES TO BREAK # Uninstallation was not blocked before this bugfix. # # BUG#33270401: Uninstall not blocked for active old-named semi-sync replication plugins # Uninstallation was not blocked on old-named plugins before this bugfix. --source include/have_semisync_plugin.inc --source include/have_binlog_format_statement.inc --source include/master-slave.inc --let $status = _status --let $clients = _clients --let $enabled = _enabled --let $old_names = 0 while ($old_names < 2) { if ($old_names == 0) { --let $source = source --let $replica = replica --let $source_plugin = $SEMISYNC_SOURCE_PLUGIN --let $replica_plugin = $SEMISYNC_REPLICA_PLUGIN } if ($old_names == 1) { --let $source = master --let $replica = slave --let $source_plugin = $SEMISYNC_MASTER_PLUGIN --let $replica_plugin = $SEMISYNC_SLAVE_PLUGIN } --let $use_old_semisync_plugin_names = $old_names --echo ==== Step $old_names: Using $source/$replica terminology ==== --source include/rpl_connection_master.inc ############################################################################# --echo # Case 1: Uninstallation of semi sync plugins should be allowed when it is --echo # not in use i.e., when asynchronous replication is active. # Step 1.1: Install semi sync master plugin on master --replace_result $source_plugin SEMISYNC_SOURCE_PLUGIN eval INSTALL PLUGIN rpl_semi_sync_$source SONAME '$source_plugin'; # Step 1.2: Install semi sync slave plugin on slave --connection slave --replace_result $replica_plugin SEMISYNC_REPLICA_PLUGIN eval INSTALL PLUGIN rpl_semi_sync_$replica SONAME '$replica_plugin'; # Step 1.3: Uninstallation of semisync plugin on master and slave should be # allowed at this state as there is no semi sync replication enabled between # master and slave. eval UNINSTALL PLUGIN rpl_semi_sync_$replica; --connection master eval UNINSTALL PLUGIN rpl_semi_sync_$source; # Step 1.4: Check that replication is working fine at the end of the test case. CREATE TABLE t1(i int); INSERT INTO t1 values (1); DROP TABLE t1; --sync_slave_with_master ############################################################################# --echo # Case 2: Uninstallation of semi sync plugins should be disallowed --echo # when it is in use i.e., when semi sync replication is active # Step 2.1: Install and enable semi sync replication between master and slave --source include/install_semisync.inc # Step 2.2: Check that rpl_semi_sync_replica uninstallation on Slave is not # possible at this state --connection slave eval call mtr.add_suppression("Plugin 'rpl_semi_sync_$replica' cannot be uninstalled now"); --error ER_PLUGIN_CANNOT_BE_UNINSTALLED eval UNINSTALL PLUGIN rpl_semi_sync_$replica; # Step 2.3: Check that rpl_semi_sync_source uninstallation on Master is not # possible at this state --connection master eval call mtr.add_suppression("Plugin 'rpl_semi_sync_$source' cannot be uninstalled now"); --error ER_PLUGIN_CANNOT_BE_UNINSTALLED eval UNINSTALL PLUGIN rpl_semi_sync_$source; # Step 2.4: Check that replication is working fine at the end of the test case. CREATE TABLE t1(i int); INSERT INTO t1 values (2); DROP TABLE t1; --sync_slave_with_master # Step 2.5: Make sure rpl_semi_sync_source_status on Master and # rpl_semi_sync_replica_staus on Slave are ON --let $slave_status=[show status like "Rpl_semi_sync_$replica$status", Value, 1] --let assert_cond= "$slave_status" = "ON" --let assert_text= semi sync slave status should be ON. --source include/assert.inc --connection master --let $master_status=[show status like "Rpl_semi_sync_$source$status", Value, 1] --let assert_cond= "$master_status" = "ON" --let assert_text= semi sync master status should be ON. --source include/assert.inc --let $master_clients=[show status like "Rpl_semi_sync_$source$clients", Value, 1] --let assert_cond= $master_clients = 1 --let assert_text= semi sync master clients should be 1. --source include/assert.inc ############################################################################# --echo # Case 3: Uninstallation of semi sync plugin should be disallowed when there --echo # are semi sync slaves even though rpl_semi_sync_source_enabled= OFF;. # Step 3.1: Disable semi sync on master --connection master eval SET GLOBAL rpl_semi_sync_$source$enabled = OFF; # Step 3.2: Check that still Rpl_semi_sync_source_clients is 1 --let $master_clients=[show status like "Rpl_semi_sync_$source$clients", Value, 1] --let assert_cond= $master_clients = 1 --let assert_text= semi sync master clients should be 1. --source include/assert.inc # Step 3.3: Since Rpl_semi_sync_source_clients is 1, uninstallation of # rpl_semi_sync_source should be disallowed. --error ER_PLUGIN_CANNOT_BE_UNINSTALLED eval UNINSTALL PLUGIN rpl_semi_sync_$source; ############################################################################# --echo # Case 4: Uninstallation of semi sync plugin should be allowed when it is not --echo # in use. Same as Case 1 but this case is to check the case after enabling and --echo # disabling semi sync replication. # Step 4.1: Stop IO thread on slave. --connection slave --source include/stop_slave.inc # Step 4.2: Disable semi sync on slave. eval SET GLOBAL rpl_semi_sync_$replica$enabled = OFF; # Step 4.3: Start IO thread on slave. --source include/start_slave.inc # Step 4.4: Uninstall semi sync plugin, it should be successful now. eval UNINSTALL PLUGIN rpl_semi_sync_$replica; # Step 4.5: On Master, wait until semi sync slaves is '0'. --connection master --let $status_var= Rpl_semi_sync_$source$clients --let $status_var_value= 0 --source include/wait_for_status_var.inc # Step 4.6: So uninstalling semi sync plugin should be allowed eval UNINSTALL PLUGIN rpl_semi_sync_$source; # Step 4.7: Check that replication is working fine at the end of the test case CREATE TABLE t1(i int); INSERT INTO t1 values (3); DROP TABLE t1; --sync_slave_with_master --inc $old_names } # Cleanup source include/rpl_end.inc;