|
| 1 | +############################################################################### |
| 2 | +# Bug#17638477 UNINSTALL AND INSTALL SEMI-SYNC PLUGIN CAUSES SLAVES TO BREAK |
| 3 | +# Problem: Uninstallation of Semi sync plugin should be blocked when it is |
| 4 | +# in use. |
| 5 | +# Test case: Uninstallation of semi sync should be allowed |
| 6 | +# On Master: |
| 7 | +# 1) When there is no dump thread |
| 8 | +# 2) When there are no semi sync slaves (i.e., async replication). |
| 9 | +# On Slave: |
| 10 | +# 1) When there is no I/O thread |
| 11 | +# 2) When there are no semi sync enabled I/O thread (i.e.,async replication). |
| 12 | +############################################################################### |
| 13 | + |
| 14 | +--source include/have_semisync_plugin.inc |
| 15 | +--source include/not_embedded.inc |
| 16 | +--source include/have_binlog_format_statement.inc |
| 17 | +--source include/master-slave.inc |
| 18 | + |
| 19 | +############################################################################### |
| 20 | +# Case 1: Uninstallation of semi sync plugins should be allowed when it is |
| 21 | +# not in use i.e., when asynchronous replication is active. |
| 22 | +############################################################################### |
| 23 | +# Step 1.1: Install semi sync master plugin on master |
| 24 | +eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_PLUGIN'; |
| 25 | + |
| 26 | +# Step 1.2: Install semi sync slave plugin on slave |
| 27 | +--connection slave |
| 28 | +eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_PLUGIN'; |
| 29 | + |
| 30 | +# Step 1.3: Uninstallation of semisync plugin on master and slave should be |
| 31 | +# allowed at this state as there is no semi sync replication enabled between |
| 32 | +# master and slave. |
| 33 | +UNINSTALL PLUGIN rpl_semi_sync_slave; |
| 34 | +--connection master |
| 35 | +UNINSTALL PLUGIN rpl_semi_sync_master; |
| 36 | + |
| 37 | +# Step 1.4: Check that replication is working fine at the end of the test case. |
| 38 | +CREATE TABLE t1(i int); |
| 39 | +INSERT INTO t1 values (1); |
| 40 | +DROP TABLE t1; |
| 41 | +--sync_slave_with_master |
| 42 | + |
| 43 | +############################################################################### |
| 44 | +# Case 2: Uninstallation of semi sync plugins should be disallowed |
| 45 | +# when it is in use i.e., when semi sync replication is active |
| 46 | +############################################################################### |
| 47 | +# Step 2.1: Install and enable semi sync replication between master and slave |
| 48 | +--source include/install_semisync.inc |
| 49 | + |
| 50 | +# Step 2.2: Check that rpl_semi_sync_slave uninstallation on Slave is not |
| 51 | +# possible at this state |
| 52 | +--connection slave |
| 53 | +call mtr.add_suppression("Plugin 'rpl_semi_sync_slave' cannot be uninstalled now"); |
| 54 | +--error ER_PLUGIN_CANNOT_BE_UNINSTALLED |
| 55 | +UNINSTALL PLUGIN rpl_semi_sync_slave; |
| 56 | + |
| 57 | +# Step 2.3: Check that rpl_semi_sync_master uninstallation on Master is not |
| 58 | +# possible at this state |
| 59 | +--connection master |
| 60 | +call mtr.add_suppression("Plugin 'rpl_semi_sync_master' cannot be uninstalled now"); |
| 61 | +--error ER_PLUGIN_CANNOT_BE_UNINSTALLED |
| 62 | +UNINSTALL PLUGIN rpl_semi_sync_master; |
| 63 | + |
| 64 | +# Step 2.4: Check that replication is working fine at the end of the test case. |
| 65 | +CREATE TABLE t1(i int); |
| 66 | +INSERT INTO t1 values (2); |
| 67 | +DROP TABLE t1; |
| 68 | +--sync_slave_with_master |
| 69 | + |
| 70 | +# Step 2.5: Make sure rpl_semi_sync_master_status on Master and |
| 71 | +# rpl_semi_sync_slave_staus on Slave are ON |
| 72 | +--let $slave_status=[show status like "Rpl_semi_sync_slave_status", Value, 1] |
| 73 | +--let assert_cond= "$slave_status" = "ON" |
| 74 | +--let assert_text= semi sync slave status should be ON. |
| 75 | +--source include/assert.inc |
| 76 | + |
| 77 | +--connection master |
| 78 | +--let $master_status=[show status like "Rpl_semi_sync_master_status", Value, 1] |
| 79 | +--let assert_cond= "$master_status" = "ON" |
| 80 | +--let assert_text= semi sync master status should be ON. |
| 81 | +--source include/assert.inc |
| 82 | + |
| 83 | +--let $master_clients=[show status like "Rpl_semi_sync_master_clients", Value, 1] |
| 84 | +--let assert_cond= $master_clients = 1 |
| 85 | +--let assert_text= semi sync master clients should be 1. |
| 86 | +--source include/assert.inc |
| 87 | + |
| 88 | +############################################################################### |
| 89 | +# Case 3: Uninstallation of semi sync plugin should be disallowed when there |
| 90 | +# are semi sync slaves even though rpl_semi_sync_master_enabled= OFF;. |
| 91 | +############################################################################### |
| 92 | +# Step 3.1: Disable semi sync on master |
| 93 | +--connection master |
| 94 | +SET GLOBAL rpl_semi_sync_master_enabled = OFF; |
| 95 | + |
| 96 | +# Step 3.2: Check that still Rpl_semi_sync_master_clients is 1 |
| 97 | +--let $master_clients=[show status like "Rpl_semi_sync_master_clients", Value, 1] |
| 98 | +--let assert_cond= $master_clients = 1 |
| 99 | +--let assert_text= semi sync master clients should be 1. |
| 100 | +--source include/assert.inc |
| 101 | + |
| 102 | +# Step 3.3: Since Rpl_semi_sync_master_clients is 1, uninstallation of |
| 103 | +# rpl_semi_sync_master should be disallowed. |
| 104 | +--error ER_PLUGIN_CANNOT_BE_UNINSTALLED |
| 105 | +UNINSTALL PLUGIN rpl_semi_sync_master; |
| 106 | + |
| 107 | +############################################################################### |
| 108 | +# Case 4: Uninstallation of semi sync plugin should be allowed when it is not |
| 109 | +# in use. Same as Case 1 but this case is to check the case after enabling and |
| 110 | +# disabling semi sync replication. |
| 111 | +############################################################################### |
| 112 | + |
| 113 | +# Step 4.1: Stop IO thread on slave. |
| 114 | +--connection slave |
| 115 | +--source include/stop_slave.inc |
| 116 | + |
| 117 | +# Step 4.2: Disable semi sync on slave. |
| 118 | +SET GLOBAL rpl_semi_sync_slave_enabled = OFF; |
| 119 | + |
| 120 | +# Step 4.3: Start IO thread on slave. |
| 121 | +--source include/start_slave.inc |
| 122 | + |
| 123 | +# Step 4.4: Uninstall semi sync plugin, it should be successful now. |
| 124 | +UNINSTALL PLUGIN rpl_semi_sync_slave; |
| 125 | + |
| 126 | +# Step 4.5: On Master, check that semi sync slaves are now '0'. |
| 127 | +--connection master |
| 128 | +--let $master_clients=[show status like "Rpl_semi_sync_master_clients", Value, 1] |
| 129 | +--let assert_cond= $master_clients = 0 |
| 130 | +--let assert_text= semi sync master clients should be 0. |
| 131 | +--source include/assert.inc |
| 132 | + |
| 133 | +# Step 4.6: So uninstalling semi sync plugin should be allowed |
| 134 | +UNINSTALL PLUGIN rpl_semi_sync_master; |
| 135 | + |
| 136 | +# Step 4.7: Check that replication is working fine at the end of the test case |
| 137 | +CREATE TABLE t1(i int); |
| 138 | +INSERT INTO t1 values (3); |
| 139 | +DROP TABLE t1; |
| 140 | +--sync_slave_with_master |
| 141 | + |
| 142 | +# Cleanup |
| 143 | +source include/rpl_end.inc; |
0 commit comments