diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2018-02-13 14:35:37 +0200 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2018-02-13 14:35:37 +0200 |
commit | fc8a164a53000cefe7944997a23637b076ca3d6d (patch) | |
tree | 3c322d64446fa0fcf0cd09c8b820e62a59f20815 | |
parent | 654e955b8c6a5372db0c2da31a4abedf7bb65f9e (diff) | |
download | mariadb-git-bb.10.1-MDEV-14616.tar.gz |
Refs MW-245 wsrep_dirty_reads and wsrep_reject_queries optionsbb.10.1-MDEV-14616
Merge missing changes for wsrep_reject_queries with test case.
-rw-r--r-- | mysql-test/suite/galera/r/galera_var_reject_queries.result | 21 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/galera_var_reject_queries.test | 44 | ||||
-rw-r--r-- | sql/sql_parse.cc | 19 |
3 files changed, 75 insertions, 9 deletions
diff --git a/mysql-test/suite/galera/r/galera_var_reject_queries.result b/mysql-test/suite/galera/r/galera_var_reject_queries.result new file mode 100644 index 00000000000..e4b906f1717 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_var_reject_queries.result @@ -0,0 +1,21 @@ +CREATE TABLE t1 (f1 INTEGER); +SET SESSION wsrep_reject_queries = ALL; +ERROR HY000: Variable 'wsrep_reject_queries' is a GLOBAL variable and should be set with SET GLOBAL +SET GLOBAL wsrep_reject_queries = ALL; +SELECT * FROM t1; +ERROR 08S01: WSREP has not yet prepared node for application use +SET GLOBAL wsrep_reject_queries = ALL_KILL; +ERROR HY000: Lost connection to MySQL server during query +SELECT * FROM t1; +ERROR 70100: Connection was killed +SELECT * FROM t1; +ERROR 08S01: WSREP has not yet prepared node for application use +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 2 +1 +INSERT INTO t1 VALUES (1); +SET GLOBAL wsrep_reject_queries = NONE; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_var_reject_queries.test b/mysql-test/suite/galera/t/galera_var_reject_queries.test new file mode 100644 index 00000000000..61a4227e513 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_var_reject_queries.test @@ -0,0 +1,44 @@ +# +# Test wsrep_reject_queries +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE t1 (f1 INTEGER); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 + +--connection node_1 +--error ER_GLOBAL_VARIABLE +SET SESSION wsrep_reject_queries = ALL; + +SET GLOBAL wsrep_reject_queries = ALL; + +--error ER_UNKNOWN_COM_ERROR +SELECT * FROM t1; + +# Lost connection +--error 2013 +SET GLOBAL wsrep_reject_queries = ALL_KILL; + +--connection node_1a +--error 1927 +SELECT * FROM t1; + +--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--error ER_UNKNOWN_COM_ERROR +SELECT * FROM t1; + +# Confirm that replication continues + +--connection node_2 +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +INSERT INTO t1 VALUES (1); + +--connect node_1c, 127.0.0.1, root, , test, $NODE_MYPORT_1 +SET GLOBAL wsrep_reject_queries = NONE; + +SELECT COUNT(*) = 1 FROM t1; + +DROP TABLE t1; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 8f0fa80a3fe..13ae0907f0f 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -269,26 +269,27 @@ void init_update_queries(void) server_command_flags[COM_STATISTICS]= CF_SKIP_QUERY_ID | CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK; server_command_flags[COM_PING]= CF_SKIP_QUERY_ID | CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK; - server_command_flags[COM_QUIT]= CF_SKIP_WSREP_CHECK; - server_command_flags[COM_PROCESS_INFO]= CF_SKIP_WSREP_CHECK; - server_command_flags[COM_PROCESS_KILL]= CF_SKIP_WSREP_CHECK; - server_command_flags[COM_SHUTDOWN]= CF_SKIP_WSREP_CHECK; - server_command_flags[COM_SLEEP]= CF_SKIP_WSREP_CHECK; - server_command_flags[COM_TIME]= CF_SKIP_WSREP_CHECK; - server_command_flags[COM_END]= CF_SKIP_WSREP_CHECK; - - /* + /* COM_QUERY, COM_SET_OPTION and COM_STMT_XXX are allowed to pass the early COM_xxx filter, they're checked later in mysql_execute_command(). */ server_command_flags[COM_QUERY]= CF_SKIP_WSREP_CHECK; server_command_flags[COM_SET_OPTION]= CF_SKIP_WSREP_CHECK; server_command_flags[COM_STMT_PREPARE]= CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK; + server_command_flags[COM_STMT_FETCH]= CF_SKIP_WSREP_CHECK; server_command_flags[COM_STMT_CLOSE]= CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK; server_command_flags[COM_STMT_RESET]= CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK; server_command_flags[COM_STMT_EXECUTE]= CF_SKIP_WSREP_CHECK; server_command_flags[COM_STMT_SEND_LONG_DATA]= CF_SKIP_WSREP_CHECK; server_command_flags[COM_REGISTER_SLAVE]= CF_SKIP_WSREP_CHECK; + server_command_flags[COM_QUIT]|= CF_SKIP_WSREP_CHECK; + server_command_flags[COM_PROCESS_INFO]= CF_SKIP_WSREP_CHECK; + server_command_flags[COM_PROCESS_KILL]= CF_SKIP_WSREP_CHECK; + server_command_flags[COM_SHUTDOWN]= CF_SKIP_WSREP_CHECK; + server_command_flags[COM_SLEEP]= CF_SKIP_WSREP_CHECK; + server_command_flags[COM_TIME]= CF_SKIP_WSREP_CHECK; + server_command_flags[COM_INIT_DB]= CF_SKIP_WSREP_CHECK; + server_command_flags[COM_END]= CF_SKIP_WSREP_CHECK; /* Initialize the sql command flags array. */ memset(sql_command_flags, 0, sizeof(sql_command_flags)); |