| 1 |
# Variable Name: replication_optimize_for_static_plugin_config |
| 2 |
# Scope: Global |
| 3 |
# Access Type: Static |
| 4 |
# Data Type: boolean |
| 5 |
# |
| 6 |
# Creation Date: 2019-12-22 |
| 7 |
# Author : Pedro Figueiredo |
| 8 |
|
| 9 |
--source include/have_semisync_plugin.inc |
| 10 |
|
| 11 |
--let $saved_global_replication_optimize_for_static_plugin_config = `SELECT @@global.replication_optimize_for_static_plugin_config` |
| 12 |
|
| 13 |
#################################################################### |
| 14 |
# Displaying default value # |
| 15 |
#################################################################### |
| 16 |
|
| 17 |
--let $assert_text = Default GLOBAL value is FALSE |
| 18 |
--let $assert_cond = [SELECT @@global.replication_optimize_for_static_plugin_config = 0] |
| 19 |
--source include/assert.inc |
| 20 |
|
| 21 |
#################################################################### |
| 22 |
# Check if Value can set and that P_S reports the correct value # |
| 23 |
#################################################################### |
| 24 |
|
| 25 |
# 1, TRUE, ON, 0, FALSE, OFF |
| 26 |
--let $j=6 |
| 27 |
|
| 28 |
while($j>0) |
| 29 |
{ |
| 30 |
if ($j == 6) |
| 31 |
{ |
| 32 |
--let $to_set = OFF |
| 33 |
--let $expected = OFF |
| 34 |
} |
| 35 |
if ($j == 5) |
| 36 |
{ |
| 37 |
--let $to_set = FALSE |
| 38 |
--let $expected = OFF |
| 39 |
} |
| 40 |
if ($j == 4) |
| 41 |
{ |
| 42 |
--let $to_set = 0 |
| 43 |
--let $expected = OFF |
| 44 |
} |
| 45 |
if ($j == 3) |
| 46 |
{ |
| 47 |
--let $to_set = ON |
| 48 |
--let $expected = ON |
| 49 |
} |
| 50 |
if ($j == 2) |
| 51 |
{ |
| 52 |
--let $to_set = TRUE |
| 53 |
--let $expected = ON |
| 54 |
} |
| 55 |
if ($j == 1) |
| 56 |
{ |
| 57 |
--let $to_set = 1 |
| 58 |
--let $expected = ON |
| 59 |
} |
| 60 |
|
| 61 |
--let $scope = GLOBAL |
| 62 |
--let $ps_table = global_variables |
| 63 |
|
| 64 |
--eval SET @@$scope.replication_optimize_for_static_plugin_config = $to_set |
| 65 |
--let $reported=`SELECT variable_value FROM performance_schema.$ps_table WHERE variable_name = 'replication_optimize_for_static_plugin_config'` |
| 66 |
|
| 67 |
--let $assert_text= Reported value matches the one set (set $to_set in $scope scope) |
| 68 |
--let $assert_cond = "$reported" = "$expected" |
| 69 |
--source include/assert.inc |
| 70 |
|
| 71 |
--dec $j |
| 72 |
} |
| 73 |
|
| 74 |
#################################################################### |
| 75 |
# Privileges # |
| 76 |
#################################################################### |
| 77 |
|
| 78 |
CREATE USER user1; |
| 79 |
--connect(conn_user1,localhost,user1,,) |
| 80 |
|
| 81 |
# assert that one cannot change the value without privileges |
| 82 |
--error ER_SPECIFIC_ACCESS_DENIED_ERROR |
| 83 |
SET GLOBAL replication_optimize_for_static_plugin_config = 1; |
| 84 |
|
| 85 |
# assert that one can change the value if SUPER is given |
| 86 |
--connection default |
| 87 |
GRANT SUPER ON *.* TO user1@'%'; |
| 88 |
FLUSH PRIVILEGES; |
| 89 |
--connect(conn2_user1,localhost,user1,,) |
| 90 |
SET GLOBAL replication_optimize_for_static_plugin_config = 1; |
| 91 |
|
| 92 |
--connection default |
| 93 |
DROP USER user1; |
| 94 |
|
| 95 |
#################################################################### |
| 96 |
# Transactional context # |
| 97 |
#################################################################### |
| 98 |
|
| 99 |
BEGIN; |
| 100 |
|
| 101 |
# can change the variable's value in global scope while inside a transaction |
| 102 |
SET GLOBAL replication_optimize_for_static_plugin_config = ON; |
| 103 |
|
| 104 |
ROLLBACK; |
| 105 |
|
| 106 |
#################################################################### |
| 107 |
# SQL statement # |
| 108 |
#################################################################### |
| 109 |
|
| 110 |
SET GLOBAL replication_optimize_for_static_plugin_config = 1; |
| 111 |
--replace_result $SEMISYNC_SOURCE_PLUGIN SEMISYNC_MASTER_LIB |
| 112 |
--eval INSTALL PLUGIN rpl_semi_sync_source SONAME '$SEMISYNC_SOURCE_PLUGIN' |
| 113 |
UNINSTALL PLUGIN rpl_semi_sync_source; |
| 114 |
--let $plugin_count= `SELECT COUNT(*) FROM information_schema.plugins WHERE plugin_name = 'rpl_semi_sync_source' AND plugin_status = 'DELETED'` |
| 115 |
--let $assert_cond= $plugin_count = 1 |
| 116 |
--let $assert_text= Semi-sync not disposed because it is in use |
| 117 |
--source include/assert.inc |
| 118 |
|
| 119 |
SET GLOBAL replication_optimize_for_static_plugin_config = 0; |
| 120 |
--let $plugin_count= `SELECT COUNT(*) FROM information_schema.plugins WHERE plugin_name = 'rpl_semi_sync_source' AND plugin_status = 'DELETED'` |
| 121 |
--let $assert_cond= $plugin_count = 0 |
| 122 |
--let $assert_text= Semi-sync disposed because it is no longer in use |
| 123 |
--source include/assert.inc |
| 124 |
|
| 125 |
--replace_result $SEMISYNC_SOURCE_PLUGIN SEMISYNC_MASTER_LIB |
| 126 |
--eval INSTALL PLUGIN rpl_semi_sync_source SONAME '$SEMISYNC_SOURCE_PLUGIN' |
| 127 |
UNINSTALL PLUGIN rpl_semi_sync_source; |
| 128 |
--let $plugin_count= `SELECT COUNT(*) FROM information_schema.plugins WHERE plugin_name = 'rpl_semi_sync_source' AND plugin_status = 'DELETED'` |
| 129 |
--let $assert_cond= $plugin_count = 0 |
| 130 |
--let $assert_text= Semi-sync disposed because it is no longer in use |
| 131 |
--source include/assert.inc |
| 132 |
|
| 133 |
#################################################################### |
| 134 |
# End of tests # |
| 135 |
#################################################################### |
| 136 |
|
| 137 |
--eval SET @@global.replication_optimize_for_static_plugin_config = $saved_global_replication_optimize_for_static_plugin_config |