Skip to content
Permalink
Browse files
MW-405 Remove redundant conditions
Remove clause on `thd->variables.wsrep_on` in the following code:

if (WSREP(thd))
{
...
        if (thd->variables.wsrep_on &&
            ...

In the above snippet, `WSREP(thd)` already ensures thd->variables.wsrep_on
  • Loading branch information
sciascid authored and Jan Lindström committed Apr 3, 2018
1 parent d970f80 commit fc26fd1
Showing 1 changed file with 16 additions and 14 deletions.
@@ -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) &&

0 comments on commit fc26fd1

Please sign in to comment.