| 1 |
############## mysql-test\t\transaction_write_set_extraction_basic.test################## |
| 2 |
# # |
| 3 |
# This test checks the basics of setting the variable transaction_write_set_extraction # |
| 4 |
# # |
| 5 |
# Variable Name: transaction_write_set_extraction # |
| 6 |
# Scope: GLOBAL | SESSION # |
| 7 |
# Access Type: Dynamic # |
| 8 |
# Data Type: enum # |
| 9 |
# Default Value: XXHASH64 # |
| 10 |
# Allowed value: OFF / MURMUR32 / XXHASH64 or 0 / 1 / 2 # |
| 11 |
# # |
| 12 |
# Description: Test Cases of Dynamic System Variable transaction_write_set_extraction # |
| 13 |
# that checks the behavior of this variable in the following ways # |
| 14 |
# * Default Value # |
| 15 |
# * Valid & Invalid values # |
| 16 |
# # |
| 17 |
# This test also verifies : # |
| 18 |
# # |
| 19 |
# 1. The server option transaction_write_set_extraction cannot be modified # |
| 20 |
# inside a multi-statement transaction. # |
| 21 |
# # |
| 22 |
# 2. The new server option transaction_write_set_extraction can only be set # |
| 23 |
# when the binlog format is ROW and fails with other binlog formats. # |
| 24 |
# # |
| 25 |
# Note: This var cannot be set also when Group Replication is running. # |
| 26 |
# This test is done in the group replication suite # |
| 27 |
# # |
| 28 |
######################################################################################### |
| 29 |
|
| 30 |
# Having binlog format row as the test checks the default binlog format. |
| 31 |
--source include/have_binlog_format_row.inc |
| 32 |
############################################################# |
| 33 |
# Save initial value # |
| 34 |
############################################################# |
| 35 |
|
| 36 |
SET @start_global_value = @@GLOBAL.transaction_write_set_extraction; |
| 37 |
SELECT @start_global_value; |
| 38 |
SET @start_session_value = @@SESSION.transaction_write_set_extraction; |
| 39 |
SELECT @start_session_value; |
| 40 |
SET @start_global_binlog_format = @@GLOBAL.binlog_format; |
| 41 |
SELECT @start_global_binlog_format; |
| 42 |
|
| 43 |
##################################################################### |
| 44 |
# Display the DEFAULT value of transaction_write_set_extraction # |
| 45 |
##################################################################### |
| 46 |
|
| 47 |
# GLOBAL SETTINGS |
| 48 |
SET @@GLOBAL.binlog_format= 'ROW'; |
| 49 |
SET global transaction_write_set_extraction= DEFAULT; |
| 50 |
SELECT @@global.transaction_write_set_extraction; |
| 51 |
|
| 52 |
SET global transaction_write_set_extraction='OFF'; |
| 53 |
SELECT @@global.transaction_write_set_extraction; |
| 54 |
|
| 55 |
SET global transaction_write_set_extraction= 0; |
| 56 |
SELECT @@global.transaction_write_set_extraction; |
| 57 |
|
| 58 |
SET global transaction_write_set_extraction='MURMUR32'; |
| 59 |
SELECT @@global.transaction_write_set_extraction; |
| 60 |
|
| 61 |
SET global transaction_write_set_extraction= 1; |
| 62 |
SELECT @@global.transaction_write_set_extraction; |
| 63 |
|
| 64 |
SET global transaction_write_set_extraction='XXHASH64'; |
| 65 |
SELECT @@global.transaction_write_set_extraction; |
| 66 |
|
| 67 |
SET global transaction_write_set_extraction= 2; |
| 68 |
SELECT @@global.transaction_write_set_extraction; |
| 69 |
|
| 70 |
# SESSION SETTINGS |
| 71 |
SELECT @@session.transaction_write_set_extraction; |
| 72 |
|
| 73 |
SET @@SESSION.binlog_format= 'ROW'; |
| 74 |
SET session transaction_write_set_extraction=DEFAULT; |
| 75 |
SELECT @@session.transaction_write_set_extraction; |
| 76 |
|
| 77 |
SET session transaction_write_set_extraction='OFF'; |
| 78 |
SELECT @@session.transaction_write_set_extraction; |
| 79 |
|
| 80 |
SET session transaction_write_set_extraction=0; |
| 81 |
SELECT @@session.transaction_write_set_extraction; |
| 82 |
|
| 83 |
SET session transaction_write_set_extraction='MURMUR32'; |
| 84 |
SELECT @@session.transaction_write_set_extraction; |
| 85 |
|
| 86 |
SET session transaction_write_set_extraction=1; |
| 87 |
SELECT @@session.transaction_write_set_extraction; |
| 88 |
|
| 89 |
SET session transaction_write_set_extraction='XXHASH64'; |
| 90 |
SELECT @@session.transaction_write_set_extraction; |
| 91 |
|
| 92 |
SET session transaction_write_set_extraction=2; |
| 93 |
SELECT @@session.transaction_write_set_extraction; |
| 94 |
|
| 95 |
# checking that setting variable to a non existing value raises error |
| 96 |
# INVALID SESSION SETTINGS |
| 97 |
--error ER_WRONG_VALUE_FOR_VAR |
| 98 |
SET session transaction_write_set_extraction='ABC'; |
| 99 |
SELECT @@session.transaction_write_set_extraction; |
| 100 |
|
| 101 |
--error ER_WRONG_VALUE_FOR_VAR |
| 102 |
SET session transaction_write_set_extraction= 3; |
| 103 |
SELECT @@session.transaction_write_set_extraction; |
| 104 |
|
| 105 |
--error ER_WRONG_VALUE_FOR_VAR |
| 106 |
SET session transaction_write_set_extraction='1'; |
| 107 |
SELECT @@session.transaction_write_set_extraction; |
| 108 |
|
| 109 |
#################################### |
| 110 |
# Restore initial value # |
| 111 |
#################################### |
| 112 |
|
| 113 |
SET @@global.transaction_write_set_extraction = @start_global_value; |
| 114 |
SELECT @@global.transaction_write_set_extraction; |
| 115 |
SET @@session.transaction_write_set_extraction = @start_session_value; |
| 116 |
SELECT @@session.transaction_write_set_extraction; |
| 117 |
SET @@GLOBAL.binlog_format= @start_global_binlog_format; |
| 118 |
SELECT @@GLOBAL.binlog_format; |
| 119 |
|
| 120 |
##################################################################### |
| 121 |
# Checking if the value can be set inside a multi-line transaction # |
| 122 |
##################################################################### |
| 123 |
|
| 124 |
--let $assert_text= The value for transaction_write_set_extraction shoudl be OFF |
| 125 |
--let $assert_cond= "[SELECT @@SESSION.transaction_write_set_extraction]" = "OFF" |
| 126 |
--source include/assert.inc |
| 127 |
|
| 128 |
CREATE TABLE t1 (i INT PRIMARY KEY); |
| 129 |
SET @start_session_value = @@SESSION.transaction_write_set_extraction; |
| 130 |
SELECT @start_session_value; |
| 131 |
|
| 132 |
BEGIN; |
| 133 |
|
| 134 |
--error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION |
| 135 |
SET @@SESSION.transaction_write_set_extraction= MURMUR32; |
| 136 |
|
| 137 |
COMMIT; |
| 138 |
|
| 139 |
|
| 140 |
# Inside a trigger. |
| 141 |
CREATE TABLE t2(c1 INT, c2 INT); |
| 142 |
delimiter |; |
| 143 |
eval CREATE TRIGGER tr2 AFTER INSERT ON t2 FOR EACH ROW |
| 144 |
BEGIN |
| 145 |
SET @@SESSION.transaction_write_set_extraction= MURMUR32; |
| 146 |
END| |
| 147 |
delimiter ;| |
| 148 |
|
| 149 |
--error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION |
| 150 |
INSERT INTO t2 VALUES (0,0); |
| 151 |
|
| 152 |
DROP TABLE t2; |
| 153 |
|
| 154 |
|
| 155 |
SET @@SESSION.transaction_write_set_extraction=MURMUR32; |
| 156 |
SELECT @@SESSION.transaction_write_set_extraction; |
| 157 |
|
| 158 |
SET @@SESSION.transaction_write_set_extraction=OFF; |
| 159 |
--let $assert_text= The value for transaction_write_set_extraction should be OFF |
| 160 |
--let $assert_cond= "[SELECT @@SESSION.transaction_write_set_extraction]" = "OFF" |
| 161 |
--source include/assert.inc |
| 162 |
|
| 163 |
################################################################################ |
| 164 |
# Check for setting the value for this variable when binlog format is not ROW. # |
| 165 |
################################################################################ |
| 166 |
|
| 167 |
SET @@SESSION.binlog_format= 'STATEMENT'; |
| 168 |
--error ER_PREVENTS_VARIABLE_WITHOUT_RBR |
| 169 |
SET @@SESSION.transaction_write_set_extraction= MURMUR32; |
| 170 |
|
| 171 |
SET @@SESSION.binlog_format= 'MIXED'; |
| 172 |
--error ER_PREVENTS_VARIABLE_WITHOUT_RBR |
| 173 |
SET @@SESSION.transaction_write_set_extraction= MURMUR32; |
| 174 |
|
| 175 |
SET @@SESSION.binlog_format= 'ROW'; |
| 176 |
SET @@SESSION.transaction_write_set_extraction= MURMUR32; |
| 177 |
SELECT @@SESSION.transaction_write_set_extraction; |
| 178 |
|
| 179 |
SET @@SESSION.transaction_write_set_extraction = @start_session_value; |
| 180 |
SELECT @@SESSION.transaction_write_set_extraction; |
| 181 |
|
| 182 |
SET @@GLOBAL.binlog_format= 'STATEMENT'; |
| 183 |
--error ER_PREVENTS_VARIABLE_WITHOUT_RBR |
| 184 |
SET @@GLOBAL.transaction_write_set_extraction= MURMUR32; |
| 185 |
|
| 186 |
SET @@GLOBAL.binlog_format= 'MIXED'; |
| 187 |
--error ER_PREVENTS_VARIABLE_WITHOUT_RBR |
| 188 |
SET @@GLOBAL.transaction_write_set_extraction= MURMUR32; |
| 189 |
|
| 190 |
SET @@GLOBAL.binlog_format= 'ROW'; |
| 191 |
SET @@GLOBAL.transaction_write_set_extraction= MURMUR32; |
| 192 |
SELECT @@GLOBAL.transaction_write_set_extraction; |
| 193 |
|
| 194 |
SET @@GLOBAL.transaction_write_set_extraction = @start_global_value; |
| 195 |
SELECT @@GLOBAL.transaction_write_set_extraction; |
| 196 |
SET @@GLOBAL.binlog_format= @start_global_binlog_format; |
| 197 |
|
| 198 |
DROP TABLE t1; |