############## mysql-test\t\transaction_write_set_extraction_basic.test################## # # # This test checks the basics of setting the variable transaction_write_set_extraction # # # # Variable Name: transaction_write_set_extraction # # Scope: GLOBAL | SESSION # # Access Type: Dynamic # # Data Type: enum # # Default Value: XXHASH64 # # Allowed value: OFF / MURMUR32 / XXHASH64 or 0 / 1 / 2 # # # # Description: Test Cases of Dynamic System Variable transaction_write_set_extraction # # that checks the behavior of this variable in the following ways # # * Default Value # # * Valid & Invalid values # # # # This test also verifies : # # # # 1. The server option transaction_write_set_extraction cannot be modified # # inside a multi-statement transaction. # # # # 2. The new server option transaction_write_set_extraction can only be set # # when the binlog format is ROW and fails with other binlog formats. # # # # Note: This var cannot be set also when Group Replication is running. # # This test is done in the group replication suite # # # ######################################################################################### # Having binlog format row as the test checks the default binlog format. --source include/have_binlog_format_row.inc ############################################################# # Save initial value # ############################################################# SET @start_global_value = @@GLOBAL.transaction_write_set_extraction; SELECT @start_global_value; SET @start_session_value = @@SESSION.transaction_write_set_extraction; SELECT @start_session_value; SET @start_global_binlog_format = @@GLOBAL.binlog_format; SELECT @start_global_binlog_format; ##################################################################### # Display the DEFAULT value of transaction_write_set_extraction # ##################################################################### # GLOBAL SETTINGS SET @@GLOBAL.binlog_format= 'ROW'; SET global transaction_write_set_extraction= DEFAULT; SELECT @@global.transaction_write_set_extraction; SET global transaction_write_set_extraction='OFF'; SELECT @@global.transaction_write_set_extraction; SET global transaction_write_set_extraction= 0; SELECT @@global.transaction_write_set_extraction; SET global transaction_write_set_extraction='MURMUR32'; SELECT @@global.transaction_write_set_extraction; SET global transaction_write_set_extraction= 1; SELECT @@global.transaction_write_set_extraction; SET global transaction_write_set_extraction='XXHASH64'; SELECT @@global.transaction_write_set_extraction; SET global transaction_write_set_extraction= 2; SELECT @@global.transaction_write_set_extraction; # SESSION SETTINGS SELECT @@session.transaction_write_set_extraction; SET @@SESSION.binlog_format= 'ROW'; SET session transaction_write_set_extraction=DEFAULT; SELECT @@session.transaction_write_set_extraction; SET session transaction_write_set_extraction='OFF'; SELECT @@session.transaction_write_set_extraction; SET session transaction_write_set_extraction=0; SELECT @@session.transaction_write_set_extraction; SET session transaction_write_set_extraction='MURMUR32'; SELECT @@session.transaction_write_set_extraction; SET session transaction_write_set_extraction=1; SELECT @@session.transaction_write_set_extraction; SET session transaction_write_set_extraction='XXHASH64'; SELECT @@session.transaction_write_set_extraction; SET session transaction_write_set_extraction=2; SELECT @@session.transaction_write_set_extraction; # checking that setting variable to a non existing value raises error # INVALID SESSION SETTINGS --error ER_WRONG_VALUE_FOR_VAR SET session transaction_write_set_extraction='ABC'; SELECT @@session.transaction_write_set_extraction; --error ER_WRONG_VALUE_FOR_VAR SET session transaction_write_set_extraction= 3; SELECT @@session.transaction_write_set_extraction; --error ER_WRONG_VALUE_FOR_VAR SET session transaction_write_set_extraction='1'; SELECT @@session.transaction_write_set_extraction; #################################### # Restore initial value # #################################### SET @@global.transaction_write_set_extraction = @start_global_value; SELECT @@global.transaction_write_set_extraction; SET @@session.transaction_write_set_extraction = @start_session_value; SELECT @@session.transaction_write_set_extraction; SET @@GLOBAL.binlog_format= @start_global_binlog_format; SELECT @@GLOBAL.binlog_format; ##################################################################### # Checking if the value can be set inside a multi-line transaction # ##################################################################### --let $assert_text= The value for transaction_write_set_extraction shoudl be OFF --let $assert_cond= "[SELECT @@SESSION.transaction_write_set_extraction]" = "OFF" --source include/assert.inc CREATE TABLE t1 (i INT PRIMARY KEY); SET @start_session_value = @@SESSION.transaction_write_set_extraction; SELECT @start_session_value; BEGIN; --error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION SET @@SESSION.transaction_write_set_extraction= MURMUR32; COMMIT; # Inside a trigger. CREATE TABLE t2(c1 INT, c2 INT); delimiter |; eval CREATE TRIGGER tr2 AFTER INSERT ON t2 FOR EACH ROW BEGIN SET @@SESSION.transaction_write_set_extraction= MURMUR32; END| delimiter ;| --error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION INSERT INTO t2 VALUES (0,0); DROP TABLE t2; SET @@SESSION.transaction_write_set_extraction=MURMUR32; SELECT @@SESSION.transaction_write_set_extraction; SET @@SESSION.transaction_write_set_extraction=OFF; --let $assert_text= The value for transaction_write_set_extraction should be OFF --let $assert_cond= "[SELECT @@SESSION.transaction_write_set_extraction]" = "OFF" --source include/assert.inc ################################################################################ # Check for setting the value for this variable when binlog format is not ROW. # ################################################################################ SET @@SESSION.binlog_format= 'STATEMENT'; --error ER_PREVENTS_VARIABLE_WITHOUT_RBR SET @@SESSION.transaction_write_set_extraction= MURMUR32; SET @@SESSION.binlog_format= 'MIXED'; --error ER_PREVENTS_VARIABLE_WITHOUT_RBR SET @@SESSION.transaction_write_set_extraction= MURMUR32; SET @@SESSION.binlog_format= 'ROW'; SET @@SESSION.transaction_write_set_extraction= MURMUR32; SELECT @@SESSION.transaction_write_set_extraction; SET @@SESSION.transaction_write_set_extraction = @start_session_value; SELECT @@SESSION.transaction_write_set_extraction; SET @@GLOBAL.binlog_format= 'STATEMENT'; --error ER_PREVENTS_VARIABLE_WITHOUT_RBR SET @@GLOBAL.transaction_write_set_extraction= MURMUR32; SET @@GLOBAL.binlog_format= 'MIXED'; --error ER_PREVENTS_VARIABLE_WITHOUT_RBR SET @@GLOBAL.transaction_write_set_extraction= MURMUR32; SET @@GLOBAL.binlog_format= 'ROW'; SET @@GLOBAL.transaction_write_set_extraction= MURMUR32; SELECT @@GLOBAL.transaction_write_set_extraction; SET @@GLOBAL.transaction_write_set_extraction = @start_global_value; SELECT @@GLOBAL.transaction_write_set_extraction; SET @@GLOBAL.binlog_format= @start_global_binlog_format; DROP TABLE t1;