diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 9271e231197..0c40c4852f6 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1088,22 +1088,25 @@ bool do_command(THD *thd) command_name[command].str)); #ifdef WITH_WSREP - /* - Bail out if DB snapshot has not been installed. - */ - if (thd->variables.wsrep_on && !thd->wsrep_applier && + if (WSREP(thd)) + { + /* + Bail out if DB snapshot has not been installed. + */ + if (!thd->wsrep_applier && (!wsrep_ready || wsrep_reject_queries != WSREP_REJECT_NONE) && (server_command_flags[command] & CF_SKIP_WSREP_CHECK) == 0) - { - thd->protocol->end_statement(); + { + thd->protocol->end_statement(); - /* Performance Schema Interface instrumentation end. */ - MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da()); - thd->m_statement_psi= NULL; - thd->m_digest= NULL; + /* Performance Schema Interface instrumentation end. */ + MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da()); + thd->m_statement_psi= NULL; + thd->m_digest= NULL; - return_value= FALSE; - goto out; + return_value= FALSE; + goto out; + } } #endif @@ -2666,8 +2669,7 @@ mysql_execute_command(THD *thd) * allow SET and SHOW queries and reads from information schema * and dirty reads (if configured) */ - if (thd->variables.wsrep_on && - !thd->wsrep_applier && + if (!thd->wsrep_applier && !(wsrep_ready && wsrep_reject_queries == WSREP_REJECT_NONE) && !(thd->variables.wsrep_dirty_reads && (sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) == 0) &&