mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
refs MW-245 - merged wsrep_dirty_reads and wsrep_reject_queries from PXC
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2017, MariaDB
|
||||
Copyright (c) 2008, 2018, MariaDB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -284,6 +284,8 @@ void init_update_queries(void)
|
||||
server_command_flags[COM_QUERY]= CF_SKIP_WSREP_CHECK;
|
||||
server_command_flags[COM_SET_OPTION]= CF_SKIP_WSREP_CHECK;
|
||||
server_command_flags[COM_STMT_PREPARE]= CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
|
||||
server_command_flags[COM_STMT_EXECUTE]= CF_SKIP_WSREP_CHECK;
|
||||
server_command_flags[COM_STMT_FETCH]= CF_SKIP_WSREP_CHECK;
|
||||
server_command_flags[COM_STMT_CLOSE]= CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
|
||||
server_command_flags[COM_STMT_RESET]= CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
|
||||
server_command_flags[COM_STMT_EXECUTE]= CF_SKIP_WSREP_CHECK;
|
||||
@ -887,6 +889,25 @@ void cleanup_items(Item *item)
|
||||
}
|
||||
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables)
|
||||
{
|
||||
for (const TABLE_LIST *table= tables; table; table= table->next_global)
|
||||
{
|
||||
TABLE_CATEGORY c;
|
||||
LEX_STRING db, tn;
|
||||
lex_string_set(&db, table->db);
|
||||
lex_string_set(&tn, table->table_name);
|
||||
c= get_table_category(&db, &tn);
|
||||
if (c != TABLE_CATEGORY_INFORMATION &&
|
||||
c != TABLE_CATEGORY_PERFORMANCE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
@ -2659,14 +2680,18 @@ mysql_execute_command(THD *thd)
|
||||
We additionally allow all other commands that do not change data in
|
||||
case wsrep_dirty_reads is enabled.
|
||||
*/
|
||||
if (lex->sql_command != SQLCOM_SET_OPTION &&
|
||||
!wsrep_is_show_query(lex->sql_command) &&
|
||||
!(thd->variables.wsrep_dirty_reads &&
|
||||
!is_update_query(lex->sql_command)) &&
|
||||
!(lex->sql_command == SQLCOM_SELECT &&
|
||||
!all_tables) &&
|
||||
!wsrep_node_is_ready(thd))
|
||||
if (thd->variables.wsrep_on && !thd->wsrep_applier &&
|
||||
!(wsrep_ready ||
|
||||
(thd->variables.wsrep_dirty_reads &&
|
||||
(sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) == 0) ||
|
||||
wsrep_tables_accessible_when_detached(all_tables)) &&
|
||||
lex->sql_command != SQLCOM_SET_OPTION &&
|
||||
!wsrep_is_show_query(lex->sql_command))
|
||||
{
|
||||
my_message(ER_UNKNOWN_COM_ERROR,
|
||||
"WSREP has not yet prepared node for application use", MYF(0));
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
status_var_increment(thd->status_var.com_stat[lex->sql_command]);
|
||||
|
Reference in New Issue
Block a user