mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
0c79de2419
Tasks:- Changes in wsrep_dirty_reads variable 1.) Global + Session scope (Current: session-only) 2.) Can be set using command line. 3.) Allow all commands that do not change data (besides SELECT) 4.) Allow prepared Statements that do not change data 5.) Works with wsrep_sync_wait enabled
122 lines
3.1 KiB
Text
122 lines
3.1 KiB
Text
#
|
|
# Check the handling of @@wsrep_dirty_reads
|
|
#
|
|
|
|
--source include/galera_cluster.inc
|
|
--source include/have_innodb.inc
|
|
|
|
# Save original auto_increment_offset values.
|
|
--let $node_1=node_1
|
|
--let $node_2=node_2
|
|
--source include/auto_increment_offset_save.inc
|
|
|
|
--connection node_2
|
|
--let $wsrep_cluster_address_saved = `SELECT @@global.wsrep_cluster_address`
|
|
|
|
CREATE TABLE t1(i INT) ENGINE=INNODB;
|
|
INSERT INTO t1 VALUES(1);
|
|
SELECT * FROM t1;
|
|
|
|
create user user1;
|
|
grant all privileges on *.* to user1;
|
|
create user user2;
|
|
grant all privileges on *.* to user2;
|
|
|
|
SET @@global.wsrep_cluster_address = '';
|
|
SET @@session.wsrep_dirty_reads=OFF;
|
|
|
|
# Set wsrep_sync_wait to avoid ER_LOCK_WAIT_TIMEOUT (MDEV-6832).
|
|
SET SESSION wsrep_sync_wait=0;
|
|
|
|
# Must return 'OFF'
|
|
SHOW STATUS LIKE 'wsrep_ready';
|
|
|
|
# Must return 'Non-primary'
|
|
SHOW STATUS LIKE 'wsrep_cluster_status';
|
|
|
|
--error ER_UNKNOWN_COM_ERROR
|
|
SELECT * FROM t1;
|
|
|
|
SET @@session.wsrep_dirty_reads=ON;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
--enable_connect_log
|
|
--connect (con1, localhost, user1,,test,$NODE_MYPORT_2,$NODE_MYSOCK_2)
|
|
#Just test the session behavior
|
|
SET SESSION wsrep_sync_wait=0;
|
|
|
|
set session wsrep_dirty_reads=1;
|
|
#Prepared statement creation should be allowed MDEV-11479
|
|
prepare stmt_show from 'select 1';
|
|
prepare stmt_select from 'select * from t1';
|
|
prepare stmt_insert from 'insert into t1 values(1)';
|
|
set session wsrep_dirty_reads=0;
|
|
|
|
#No Preapare stmt/proceure will be allowed
|
|
--error ER_UNKNOWN_COM_ERROR
|
|
execute stmt_show;
|
|
--error ER_UNKNOWN_COM_ERROR
|
|
execute stmt_select;
|
|
--error ER_UNKNOWN_COM_ERROR
|
|
execute stmt_insert;
|
|
|
|
SET wsrep_dirty_reads=ON;
|
|
select @@session.wsrep_dirty_reads;
|
|
#Only prepare statement which does not change data should be allowed
|
|
execute stmt_show;
|
|
execute stmt_select;
|
|
--error ER_UNKNOWN_COM_ERROR
|
|
execute stmt_insert;
|
|
SET @@global.wsrep_dirty_reads=ON;
|
|
|
|
--connect (con2, localhost, user2,,test,$NODE_MYPORT_2,$NODE_MYSOCK_2)
|
|
#Just test the session behavior
|
|
select @@session.wsrep_dirty_reads;
|
|
|
|
prepare stmt_show from 'select 1';
|
|
prepare stmt_select from 'select * from t1';
|
|
prepare stmt_insert from 'insert into t1 values(1)';
|
|
|
|
#Only prepare statement which does not change data should be allowed
|
|
execute stmt_show;
|
|
execute stmt_select;
|
|
--error ER_UNKNOWN_COM_ERROR
|
|
execute stmt_insert;
|
|
|
|
#wsrep_dirty_read should work when wsrep_sync_wait is 1 or non zero
|
|
#because we already are disconnected , So It does not make any sense
|
|
#to wait for other nodes
|
|
SET SESSION wsrep_sync_wait=1;
|
|
execute stmt_show;
|
|
execute stmt_select;
|
|
--error ER_UNKNOWN_COM_ERROR
|
|
execute stmt_insert;
|
|
|
|
SET SESSION wsrep_sync_wait=7;
|
|
execute stmt_show;
|
|
execute stmt_select;
|
|
--error ER_UNKNOWN_COM_ERROR
|
|
execute stmt_insert;
|
|
|
|
--connection node_2
|
|
SET @@global.wsrep_dirty_reads=OFF;
|
|
|
|
--disable_query_log
|
|
--eval SET @@global.wsrep_cluster_address = '$wsrep_cluster_address_saved'
|
|
--enable_query_log
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
--connection node_1
|
|
SELECT * FROM t1;
|
|
# Cleanup
|
|
DROP TABLE t1;
|
|
drop user user1;
|
|
drop user user2;
|
|
|
|
# Restore original auto_increment_offset values.
|
|
--source include/auto_increment_offset_restore.inc
|
|
|
|
--source include/galera_end.inc
|
|
--echo # End of test
|
|
|