mirror of
https://github.com/MariaDB/server.git
synced 2025-12-03 05:41:09 +03:00
MDEV-11016 wsrep_node_is_ready() check is too strict
Problem:-
The condition that checks for node readiness is too strict as it does
not allow SELECTs even if these selects do not access any tables.
For example,if we run
SELECT 1;
OR
SELECT @@max_allowed_packet;
Solution:-
We need not to report this error when all_tables(lex->query_tables)
is NULL:
This commit is contained in:
@@ -2,12 +2,14 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
|
||||
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
|
||||
SET SESSION wsrep_on = OFF;
|
||||
SET SESSION wsrep_on = ON;
|
||||
SET global wsrep_sync_wait=0;
|
||||
START SLAVE;
|
||||
include/wait_for_slave_param.inc [Slave_IO_Running]
|
||||
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
|
||||
include/wait_for_slave_to_start.inc
|
||||
INSERT INTO t1 VALUES (1);
|
||||
DROP TABLE t1;
|
||||
SET global wsrep_sync_wait=7;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE ALL;
|
||||
CALL mtr.add_suppression('failed registering on master');
|
||||
|
||||
@@ -18,6 +18,15 @@ Variable_name Value
|
||||
wsrep_cluster_status non-Primary
|
||||
SELECT * FROM t1;
|
||||
ERROR 08S01: WSREP has not yet prepared node for application use
|
||||
SELECT @@wsrep_dirty_reads;
|
||||
@@wsrep_dirty_reads
|
||||
0
|
||||
SELECT 2;
|
||||
2
|
||||
2
|
||||
SELECT 2+2 FROM DUAL;
|
||||
2+2
|
||||
4
|
||||
SET @@session.wsrep_dirty_reads=ON;
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
|
||||
@@ -11,12 +11,16 @@
|
||||
--enable_query_log
|
||||
|
||||
--connection node_1
|
||||
--let $wsrep_sync_wait_state= `SELECT @@global.wsrep_sync_wait;`
|
||||
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
|
||||
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
|
||||
SET SESSION wsrep_on = OFF;
|
||||
--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'
|
||||
--source include/wait_condition.inc
|
||||
SET SESSION wsrep_on = ON;
|
||||
#wsrep_sync_wait is set to zero because when slave tries to connect it it ask for queries like SELECT UNIX_TIMESTAMP() on node 1 which will fail, causing
|
||||
#a warning in slave error log.
|
||||
SET global wsrep_sync_wait=0;
|
||||
|
||||
--connection node_3
|
||||
START SLAVE;
|
||||
@@ -47,6 +51,7 @@ INSERT INTO t1 VALUES (1);
|
||||
--connection node_1
|
||||
DROP TABLE t1;
|
||||
|
||||
--eval SET global wsrep_sync_wait=$wsrep_sync_wait_state
|
||||
--connection node_3
|
||||
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
|
||||
--source include/wait_condition.inc
|
||||
|
||||
@@ -37,6 +37,11 @@ SHOW STATUS LIKE 'wsrep_cluster_status';
|
||||
--error ER_UNKNOWN_COM_ERROR
|
||||
SELECT * FROM t1;
|
||||
|
||||
#Select query which does not access table should be allowed MDEV-11016
|
||||
SELECT @@wsrep_dirty_reads;
|
||||
SELECT 2;
|
||||
SELECT 2+2 FROM DUAL;
|
||||
|
||||
SET @@session.wsrep_dirty_reads=ON;
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
@@ -288,6 +288,7 @@ void init_update_queries(void)
|
||||
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;
|
||||
|
||||
/* Initialize the sql command flags array. */
|
||||
memset(sql_command_flags, 0, sizeof(sql_command_flags));
|
||||
@@ -2651,7 +2652,7 @@ mysql_execute_command(THD *thd)
|
||||
/*
|
||||
Bail out if DB snapshot has not been installed. SET and SHOW commands,
|
||||
however, are always allowed.
|
||||
|
||||
Select query is also allowed if it does not access any table.
|
||||
We additionally allow all other commands that do not change data in
|
||||
case wsrep_dirty_reads is enabled.
|
||||
*/
|
||||
@@ -2659,6 +2660,8 @@ mysql_execute_command(THD *thd)
|
||||
!wsrep_is_show_query(lex->sql_command) &&
|
||||
!(thd->variables.wsrep_dirty_reads &&
|
||||
!is_update_query(lex->sql_command)) &&
|
||||
!(lex->sql_command == SQLCOM_SELECT &&
|
||||
!all_tables) &&
|
||||
!wsrep_node_is_ready(thd))
|
||||
goto error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user