Commit 72fd15f7 authored by SachinSetiya's avatar SachinSetiya

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:
parent 1bba40f0
...@@ -18,6 +18,19 @@ SET @@session.wsrep_dirty_reads=ON; ...@@ -18,6 +18,19 @@ SET @@session.wsrep_dirty_reads=ON;
SELECT * FROM t1; SELECT * FROM t1;
i i
1 1
SET @@session.wsrep_dirty_reads=OFF;
SELECT 2;
2
2
SELECT @@max_allowed_packet;
@@max_allowed_packet
4194304
SELECT 2+2 from DUAL;
2+2
4
SELECT sysdate() from DUAL;
sysdate()
2016-10-28 23:13:06
SELECT * FROM t1; SELECT * FROM t1;
i i
1 1
......
...@@ -39,6 +39,13 @@ SET @@session.wsrep_dirty_reads=ON; ...@@ -39,6 +39,13 @@ SET @@session.wsrep_dirty_reads=ON;
SELECT * FROM t1; SELECT * FROM t1;
#Select query which does not access table should be allowed MDEV-11016
SET @@session.wsrep_dirty_reads=OFF;
SELECT 2;
SELECT @@max_allowed_packet;
SELECT 2+2 from DUAL;
SELECT sysdate() from DUAL;
--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'
--enable_query_log --enable_query_log
......
...@@ -2388,11 +2388,15 @@ mysql_execute_command(THD *thd) ...@@ -2388,11 +2388,15 @@ mysql_execute_command(THD *thd)
/* /*
Bail out if DB snapshot has not been installed. We however, Bail out if DB snapshot has not been installed. We however,
allow SET and SHOW queries. allow SET and SHOW queries.
SHOW and SELECT queries (only if wsrep_dirty_reads is set or when it
does not access any table).
*/ */
if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready && if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready &&
lex->sql_command != SQLCOM_SET_OPTION && lex->sql_command != SQLCOM_SET_OPTION &&
!(thd->variables.wsrep_dirty_reads && !(thd->variables.wsrep_dirty_reads &&
lex->sql_command == SQLCOM_SELECT) && lex->sql_command == SQLCOM_SELECT) &&
!(lex->sql_command == SQLCOM_SELECT &&
!all_tables) &&
!wsrep_is_show_query(lex->sql_command)) !wsrep_is_show_query(lex->sql_command))
{ {
#if DIRTY_HACK #if DIRTY_HACK
......
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