@@ -275,6 +275,7 @@ void init_update_queries(void)
275
275
server_command_flags[COM_SHUTDOWN]= CF_SKIP_WSREP_CHECK;
276
276
server_command_flags[COM_SLEEP]= CF_SKIP_WSREP_CHECK;
277
277
server_command_flags[COM_TIME]= CF_SKIP_WSREP_CHECK;
278
+ server_command_flags[COM_INIT_DB]= CF_SKIP_WSREP_CHECK;
278
279
server_command_flags[COM_END]= CF_SKIP_WSREP_CHECK;
279
280
280
281
/*
@@ -913,7 +914,8 @@ static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables)
913
914
#ifdef WITH_WSREP
914
915
static bool wsrep_node_is_ready (THD *thd)
915
916
{
916
- if (thd->variables .wsrep_on && !thd->wsrep_applier && !wsrep_ready)
917
+ if (thd->variables .wsrep_on && !thd->wsrep_applier &&
918
+ (!wsrep_ready || wsrep_reject_queries != WSREP_REJECT_NONE))
917
919
{
918
920
my_message (ER_UNKNOWN_COM_ERROR,
919
921
" WSREP has not yet prepared node for application use" ,
@@ -1104,8 +1106,9 @@ bool do_command(THD *thd)
1104
1106
/*
1105
1107
Bail out if DB snapshot has not been installed.
1106
1108
*/
1107
- if (!(server_command_flags[command] & CF_SKIP_WSREP_CHECK) &&
1108
- !wsrep_node_is_ready (thd))
1109
+ if (thd->variables .wsrep_on && !thd->wsrep_applier &&
1110
+ (!wsrep_ready || wsrep_reject_queries != WSREP_REJECT_NONE) &&
1111
+ (server_command_flags[command] & CF_SKIP_WSREP_CHECK) == 0 )
1109
1112
{
1110
1113
thd->protocol ->end_statement ();
1111
1114
@@ -2674,19 +2677,18 @@ mysql_execute_command(THD *thd)
2674
2677
}
2675
2678
2676
2679
/*
2677
- Bail out if DB snapshot has not been installed. SET and SHOW commands,
2678
- however, are always allowed.
2679
- Select query is also allowed if it does not access any table.
2680
- We additionally allow all other commands that do not change data in
2681
- case wsrep_dirty_reads is enabled.
2682
- */
2683
- if (thd->variables .wsrep_on && !thd->wsrep_applier &&
2684
- !(wsrep_ready ||
2685
- (thd->variables .wsrep_dirty_reads &&
2686
- (sql_command_flags[lex->sql_command ] & CF_CHANGES_DATA) == 0 ) ||
2687
- wsrep_tables_accessible_when_detached (all_tables)) &&
2688
- lex->sql_command != SQLCOM_SET_OPTION &&
2689
- !wsrep_is_show_query (lex->sql_command ))
2680
+ * Bail out if DB snapshot has not been installed. We however,
2681
+ * allow SET and SHOW queries and reads from information schema
2682
+ * and dirty reads (if configured)
2683
+ */
2684
+ if (thd->variables .wsrep_on &&
2685
+ !thd->wsrep_applier &&
2686
+ !(wsrep_ready && wsrep_reject_queries == WSREP_REJECT_NONE) &&
2687
+ !(thd->variables .wsrep_dirty_reads &&
2688
+ (sql_command_flags[lex->sql_command ] & CF_CHANGES_DATA) == 0 ) &&
2689
+ !wsrep_tables_accessible_when_detached (all_tables) &&
2690
+ lex->sql_command != SQLCOM_SET_OPTION &&
2691
+ !wsrep_is_show_query (lex->sql_command ))
2690
2692
{
2691
2693
my_message (ER_UNKNOWN_COM_ERROR,
2692
2694
" WSREP has not yet prepared node for application use" , MYF (0 ));
0 commit comments