1
0
mirror of https://github.com/MariaDB/server.git synced 2025-06-15 00:02:46 +03:00

Refs: MW-245 - changed logic so that in non primary node it is possible to do SET + SHOW + SELECT from information and pfs schema, when dirty reads are not enabled - however, non table selects are not allowed (e.g. SELECT 1)

This commit is contained in:
sjaakola
2016-03-03 09:35:52 +02:00
committed by Jan Lindström
parent c5dd2abf4c
commit 9a89614857

View File

@ -893,6 +893,7 @@ void cleanup_items(Item *item)
#ifdef WITH_WSREP #ifdef WITH_WSREP
static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables) static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables)
{ {
bool has_tables = false;
for (const TABLE_LIST *table= tables; table; table= table->next_global) for (const TABLE_LIST *table= tables; table; table= table->next_global)
{ {
TABLE_CATEGORY c; TABLE_CATEGORY c;
@ -905,8 +906,9 @@ static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables)
{ {
return false; return false;
} }
has_tables = true;
} }
return true; return has_tables;
} }
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
@ -2686,8 +2688,7 @@ mysql_execute_command(THD *thd)
!(wsrep_ready && wsrep_reject_queries == WSREP_REJECT_NONE) && !(wsrep_ready && wsrep_reject_queries == WSREP_REJECT_NONE) &&
!(thd->variables.wsrep_dirty_reads && !(thd->variables.wsrep_dirty_reads &&
(sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) == 0) && (sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) == 0) &&
!(thd->variables.wsrep_dirty_reads && !wsrep_tables_accessible_when_detached(all_tables) &&
wsrep_tables_accessible_when_detached(all_tables)) &&
lex->sql_command != SQLCOM_SET_OPTION && lex->sql_command != SQLCOM_SET_OPTION &&
!wsrep_is_show_query(lex->sql_command)) !wsrep_is_show_query(lex->sql_command))
{ {