Commit 81fd8ff6 authored by Jan Lindström's avatar Jan Lindström

Fix test failures.

parent 5017c261
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
SET @@global.wsrep_desync = 1; SET @@global.wsrep_desync = 1;
SET SESSION wsrep_dirty_reads=1; SET SESSION wsrep_dirty_reads=1;
SET SESSION wsrep_sync_wait=0;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
......
...@@ -3,8 +3,11 @@ Suspending node_2 ... ...@@ -3,8 +3,11 @@ Suspending node_2 ...
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
Got one of the listed errors Got one of the listed errors
Resuming node_2 ... Resuming node_2 ...
SET SESSION wsrep_sync_wait = 1;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
SET SESSION wsrep_sync_wait = 1;
SELECT COUNT(*) = 1 FROM t1; SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1 COUNT(*) = 1
1 1
SET SESSION wsrep_sync_wait = 15;
DROP TABLE t1; DROP TABLE t1;
...@@ -3,10 +3,6 @@ INSERT INTO t1 VALUES(1); ...@@ -3,10 +3,6 @@ INSERT INTO t1 VALUES(1);
SELECT * FROM t1; SELECT * FROM t1;
i i
1 1
create user user1;
grant all privileges on *.* to user1;
create user user2;
grant all privileges on *.* to user2;
SET @@global.wsrep_cluster_address = ''; SET @@global.wsrep_cluster_address = '';
SET @@session.wsrep_dirty_reads=OFF; SET @@session.wsrep_dirty_reads=OFF;
SET SESSION wsrep_sync_wait=0; SET SESSION wsrep_sync_wait=0;
...@@ -18,78 +14,32 @@ Variable_name Value ...@@ -18,78 +14,32 @@ Variable_name Value
wsrep_cluster_status non-Primary wsrep_cluster_status non-Primary
SELECT * FROM t1; SELECT * FROM t1;
ERROR 08S01: WSREP has not yet prepared node for application use ERROR 08S01: WSREP has not yet prepared node for application use
SELECT 1 FROM t1;
ERROR 08S01: WSREP has not yet prepared node for application use
SET @@session.wsrep_dirty_reads=ON; SET @@session.wsrep_dirty_reads=ON;
SELECT * FROM t1; SELECT * FROM t1;
i i
1 1
connect con1, localhost, user1,,test,$NODE_MYPORT_2,$NODE_MYSOCK_2; SELECT 1 FROM t1;
SET SESSION wsrep_sync_wait=0;
set session wsrep_dirty_reads=1;
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;
execute stmt_show;
ERROR 08S01: WSREP has not yet prepared node for application use
execute stmt_select;
ERROR 08S01: WSREP has not yet prepared node for application use
execute stmt_insert;
ERROR 08S01: WSREP has not yet prepared node for application use
SET wsrep_dirty_reads=ON;
select @@session.wsrep_dirty_reads;
@@session.wsrep_dirty_reads
1
execute stmt_show;
1 1
1 1
execute stmt_select; SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1;
i i variable_name variable_value
1 1 WSREP_DIRTY_READS ON
execute stmt_insert; SET @@session.wsrep_dirty_reads=OFF;
SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1;
ERROR 08S01: WSREP has not yet prepared node for application use ERROR 08S01: WSREP has not yet prepared node for application use
SET @@global.wsrep_dirty_reads=ON; SELECT 1;
connect con2, localhost, user2,,test,$NODE_MYPORT_2,$NODE_MYSOCK_2;
select @@session.wsrep_dirty_reads;
@@session.wsrep_dirty_reads
1
prepare stmt_show from 'select 1';
prepare stmt_select from 'select * from t1';
prepare stmt_insert from 'insert into t1 values(1)';
execute stmt_show;
1
1
execute stmt_select;
i
1
execute stmt_insert;
ERROR 08S01: WSREP has not yet prepared node for application use ERROR 08S01: WSREP has not yet prepared node for application use
SET SESSION wsrep_sync_wait=1; USE information_schema;
execute stmt_show;
1
1
execute stmt_select;
i
1
execute stmt_insert;
ERROR 08S01: WSREP has not yet prepared node for application use ERROR 08S01: WSREP has not yet prepared node for application use
SET SESSION wsrep_sync_wait=7; SELECT * FROM information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads";
execute stmt_show; ERROR 08S01: WSREP has not yet prepared node for application use
1 SELECT COUNT(*) >= 10 FROM performance_schema.events_statements_history;
1
execute stmt_select;
i
1
execute stmt_insert;
ERROR 08S01: WSREP has not yet prepared node for application use ERROR 08S01: WSREP has not yet prepared node for application use
connection node_2; USE test;
SET @@global.wsrep_dirty_reads=OFF;
connection node_1;
SELECT * FROM t1; SELECT * FROM t1;
i i
1 1
DROP TABLE t1; DROP TABLE t1;
drop user user1;
drop user user2;
disconnect node_2;
disconnect node_1;
# End of test # End of test
...@@ -10,6 +10,7 @@ SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; ...@@ -10,6 +10,7 @@ SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
--connection node_2 --connection node_2
SET @@global.wsrep_desync = 1; SET @@global.wsrep_desync = 1;
SET SESSION wsrep_dirty_reads=1; SET SESSION wsrep_dirty_reads=1;
SET SESSION wsrep_sync_wait=0;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; --let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc --source include/wait_condition.inc
......
...@@ -41,6 +41,7 @@ INSERT INTO t1 VALUES (1); ...@@ -41,6 +41,7 @@ INSERT INTO t1 VALUES (1);
exit(0); exit(0);
EOF EOF
SET SESSION wsrep_sync_wait = 1;
--sleep 10 --sleep 10
--source include/wait_until_ready.inc --source include/wait_until_ready.inc
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
...@@ -50,9 +51,11 @@ INSERT INTO t1 VALUES (1); ...@@ -50,9 +51,11 @@ INSERT INTO t1 VALUES (1);
--source include/galera_connect.inc --source include/galera_connect.inc
--connection node_2a --connection node_2a
SET SESSION wsrep_sync_wait = 1;
--source include/wait_until_ready.inc --source include/wait_until_ready.inc
SELECT COUNT(*) = 1 FROM t1; SELECT COUNT(*) = 1 FROM t1;
SET SESSION wsrep_sync_wait = 15;
DROP TABLE t1; DROP TABLE t1;
# Restore original auto_increment_offset values. # Restore original auto_increment_offset values.
......
...@@ -5,11 +5,6 @@ ...@@ -5,11 +5,6 @@
--source include/galera_cluster.inc --source include/galera_cluster.inc
--source include/have_innodb.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 --connection node_2
--let $wsrep_cluster_address_saved = `SELECT @@global.wsrep_cluster_address` --let $wsrep_cluster_address_saved = `SELECT @@global.wsrep_cluster_address`
...@@ -17,15 +12,10 @@ CREATE TABLE t1(i INT) ENGINE=INNODB; ...@@ -17,15 +12,10 @@ CREATE TABLE t1(i INT) ENGINE=INNODB;
INSERT INTO t1 VALUES(1); INSERT INTO t1 VALUES(1);
SELECT * FROM t1; 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 @@global.wsrep_cluster_address = '';
SET @@session.wsrep_dirty_reads=OFF; SET @@session.wsrep_dirty_reads=OFF;
# Set wsrep_sync_wait to avoid ER_LOCK_WAIT_TIMEOUT (MDEV-6832). # Set wsrep_sync_wait to avoid ER_LOCK_WAIT_TIMEOUT.
SET SESSION wsrep_sync_wait=0; SET SESSION wsrep_sync_wait=0;
# Must return 'OFF' # Must return 'OFF'
...@@ -37,70 +27,32 @@ SHOW STATUS LIKE 'wsrep_cluster_status'; ...@@ -37,70 +27,32 @@ SHOW STATUS LIKE 'wsrep_cluster_status';
--error ER_UNKNOWN_COM_ERROR --error ER_UNKNOWN_COM_ERROR
SELECT * FROM t1; SELECT * FROM t1;
--error ER_UNKNOWN_COM_ERROR
SELECT 1 FROM t1;
SET @@session.wsrep_dirty_reads=ON; SET @@session.wsrep_dirty_reads=ON;
SELECT * FROM t1; SELECT * FROM t1;
SELECT 1 FROM t1;
--enable_connect_log SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1;
--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; SET @@session.wsrep_dirty_reads=OFF;
#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 --error ER_UNKNOWN_COM_ERROR
execute stmt_select; SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1;
--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 --error ER_UNKNOWN_COM_ERROR
execute stmt_insert; SELECT 1;
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 --error ER_UNKNOWN_COM_ERROR
execute stmt_insert; USE information_schema;
SET SESSION wsrep_sync_wait=7;
execute stmt_show;
execute stmt_select;
--error ER_UNKNOWN_COM_ERROR --error ER_UNKNOWN_COM_ERROR
execute stmt_insert; SELECT * FROM information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads";
--connection node_2 --error ER_UNKNOWN_COM_ERROR
SET @@global.wsrep_dirty_reads=OFF; SELECT COUNT(*) >= 10 FROM performance_schema.events_statements_history;
--disable_query_log --disable_query_log
--eval SET @@global.wsrep_cluster_address = '$wsrep_cluster_address_saved' --eval SET @@global.wsrep_cluster_address = '$wsrep_cluster_address_saved'
...@@ -108,14 +60,10 @@ SET @@global.wsrep_dirty_reads=OFF; ...@@ -108,14 +60,10 @@ SET @@global.wsrep_dirty_reads=OFF;
--source include/wait_until_connected_again.inc --source include/wait_until_connected_again.inc
--connection node_1 --connection node_1
USE test;
SELECT * FROM t1; SELECT * FROM t1;
# Cleanup # Cleanup
DROP TABLE t1; 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 --source include/galera_end.inc
--echo # End of test --echo # End of test
......
...@@ -34,11 +34,9 @@ SELECT @@session.wsrep_sync_wait; ...@@ -34,11 +34,9 @@ SELECT @@session.wsrep_sync_wait;
@@session.wsrep_sync_wait @@session.wsrep_sync_wait
7 7
SET @@session.wsrep_sync_wait=8; SET @@session.wsrep_sync_wait=8;
Warnings:
Warning 1292 Truncated incorrect wsrep_sync_wait value: '8'
SELECT @@session.wsrep_sync_wait; SELECT @@session.wsrep_sync_wait;
@@session.wsrep_sync_wait @@session.wsrep_sync_wait
7 8
# invalid values # invalid values
SET @@global.wsrep_sync_wait=NULL; SET @@global.wsrep_sync_wait=NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment