Commit 7ea92dcc authored by unknown's avatar unknown

WL 2826: Seventh step, more fixes for error injects

Removed session variables for error injects
started using DBUG macros for error injects


include/my_dbug.h:
  Added new DBUG macros
sql/sql_class.cc:
  Removed session variables for error injects
sql/sql_class.h:
  Removed session variables for error injects
sql/mysql_priv.h:
  Changed ERROR INJECT macros to use DBUG macros
sql/mysqld.cc:
  Removed session variables for error injects
sql/set_var.cc:
  Removed session variables for error injects
parent e254606f
......@@ -72,6 +72,10 @@ extern void _db_unlock_file(void);
#define DBUG_ASSERT(A) assert(A)
#define DBUG_EXECUTE_IF(keyword,a1) \
{if (_db_on_) {if (_db_strict_keyword_ (keyword)) { a1 }}}
#define DBUG_EXECUTE_COND(keyword, a1) \
(_db_on_ ? ((_db_strict_keyword_ (keyword)) ? ((a1), 0) : 0) : 0)
#define DBUG_COND(keyword) \
((_db_on_ && _db_strict_keyword_ (keyword)) ? 1 : 0)
#else /* No debugger */
#define DBUG_ENTER(a1)
......@@ -79,6 +83,8 @@ extern void _db_unlock_file(void);
#define DBUG_VOID_RETURN return
#define DBUG_EXECUTE(keyword,a1) {}
#define DBUG_EXECUTE_IF(keyword,a1) {}
#define DBUG_EXECUTE_COND(keyword, a1) 0
#define DBUG_COND(keyword) 0
#define DBUG_PRINT(keyword,arglist) {}
#define DBUG_PUSH(a1) {}
#define DBUG_POP() {}
......
......@@ -608,36 +608,45 @@ struct Query_cache_query_flags
in various error cases.
*/
#ifndef ERROR_INJECT_SUPPORT
#define ERROR_INJECT(x) 0
#define ERROR_INJECT_ACTION(x) 0
#define ERROR_INJECT_ACTION(x,action) 0
#define ERROR_INJECT_CRASH(x) 0
#define SET_ERROR_INJECT_CODE(x)
#define ERROR_INJECT_VALUE(x) 0
#define ERROR_INJECT_VALUE_ACTION(x,action) 0
#define ERROR_INJECT_VALUE_CRASH(x) 0
#define SET_ERROR_INJECT_VALUE(x)
#else
#define SET_ERROR_INJECT_CODE(x) \
current_thd->variables.error_inject_code= (x)
#define SET_ERROR_INJECT_VALUE(x) \
current_thd->variables.error_inject_value= (x)
current_thd->error_inject_value= (x)
inline bool
my_error_inject(int error)
my_error_inject(int value)
{
THD *thd= current_thd;
if (thd->variables.error_inject_code == (uint)error)
if (thd->error_inject_value == (uint)value)
{
thd->variables.error_inject_code= 0;
thd->error_inject_value= 0;
return 1;
}
return 0;
}
#define ERROR_INJECT_CRASH(code) \
(my_error_inject((code)) ? ((DBUG_ASSERT(0)), 0) : 0)
DBUG_EXECUTE_COND(code, abort();)
#define ERROR_INJECT_ACTION(code, action) \
(my_error_inject((code)) ? ((action), 0) : 0)
DBUG_EXECUTE_COND(code, action)
#define ERROR_INJECT(code) \
(my_error_inject((code)) ? 1 : 0)
DBUG_COND(code)
#define ERROR_INJECT_VALUE(value) \
my_error_inject(value)
#define ERROR_INJECT_VALUE_ACTION(value,action) \
(my_error_inject(value) ? (action) : 0)
#define ERROR_INJECT_VALUE_CRASH(value) \
(my_error_inject(value) ? abort() : 0)
#endif
uint build_table_path(char *buff, size_t bufflen, const char *db,
......
......@@ -503,10 +503,6 @@ ulong aborted_threads, aborted_connects;
ulong delayed_insert_timeout, delayed_insert_limit, delayed_queue_size;
ulong delayed_insert_threads, delayed_insert_writes, delayed_rows_in_use;
ulong delayed_insert_errors,flush_time;
#ifdef ERROR_INJECT_SUPPORT
ulong error_inject_code= 0;
ulong error_inject_value= 0;
#endif
ulong specialflag=0;
ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
ulong max_connections, max_connect_errors;
......@@ -7059,12 +7055,6 @@ static void mysql_init_variables(void)
max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR;
global_system_variables.old_passwords= 0;
global_system_variables.old_alter_table= 0;
#ifdef ERROR_INJECT_SUPPORT
global_system_variables.error_inject_code= 0;
global_system_variables.error_inject_value= 0;
max_system_variables.error_inject_code= ~0;
max_system_variables.error_inject_value= ~0;
#endif
/*
Default behavior for 4.1 and 5.0 is to treat NULL values as unequal
......
......@@ -215,13 +215,6 @@ sys_var_long_ptr sys_delayed_insert_timeout("delayed_insert_timeout",
&delayed_insert_timeout);
sys_var_long_ptr sys_delayed_queue_size("delayed_queue_size",
&delayed_queue_size);
#ifdef ERROR_INJECT_SUPPORT
sys_var_long_ptr sys_error_inject_code("error_inject_code",
&error_inject_code);
sys_var_long_ptr sys_error_inject_value("error_inject_value",
&error_inject_value);
#endif
sys_var_event_executor sys_event_executor("event_scheduler",
&event_executor_running_global_var);
sys_var_long_ptr sys_expire_logs_days("expire_logs_days",
......@@ -736,10 +729,6 @@ SHOW_VAR init_vars[]= {
{sys_div_precincrement.name,(char*) &sys_div_precincrement,SHOW_SYS},
{sys_engine_condition_pushdown.name,
(char*) &sys_engine_condition_pushdown, SHOW_SYS},
#ifdef ERROR_INJECT_SUPPORT
{sys_error_inject_code.name,(char*) &sys_error_inject_code, SHOW_SYS},
{sys_error_inject_value.name,(char*)&sys_error_inject_value, SHOW_SYS},
#endif
{sys_event_executor.name, (char*) &sys_event_executor, SHOW_SYS},
{sys_expire_logs_days.name, (char*) &sys_expire_logs_days, SHOW_SYS},
{sys_flush.name, (char*) &sys_flush, SHOW_SYS},
......
......@@ -222,6 +222,9 @@ THD::THD()
cuted_fields= sent_row_count= 0L;
limit_found_rows= 0;
statement_id_counter= 0UL;
#ifdef ERROR_INJECT_SUPPORT
error_inject_value= 0UL;
#endif
// Must be reset to handle error with THD's created for init of mysqld
lex->current_select= 0;
start_time=(time_t) 0;
......
......@@ -186,10 +186,6 @@ struct system_variables
ha_rows max_join_size;
ulong auto_increment_increment, auto_increment_offset;
ulong bulk_insert_buff_size;
#ifdef ERROR_INJECT_SUPPORT
ulong error_inject_code;
ulong error_inject_value;
#endif
ulong join_buff_size;
ulong long_query_time;
ulong max_allowed_packet;
......@@ -1103,6 +1099,9 @@ public:
query_id_t query_id, warn_id;
ulong thread_id, col_access;
#ifdef ERROR_INJECT_SUPPORT
ulong error_inject_value;
#endif
/* Statement id is thread-wide. This counter is used to generate ids */
ulong statement_id_counter;
ulong rand_saved_seed1, rand_saved_seed2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment