mirror of
https://github.com/MariaDB/server.git
synced 2025-07-18 23:03:28 +03:00
WL 2826: Seventh step, more fixes for error injects
Removed session variables for error injects started using DBUG macros for error injects
This commit is contained in:

parent
da5713e486
commit
edb8811f03
@ -72,6 +72,10 @@ extern void _db_unlock_file(void);
|
|||||||
#define DBUG_ASSERT(A) assert(A)
|
#define DBUG_ASSERT(A) assert(A)
|
||||||
#define DBUG_EXECUTE_IF(keyword,a1) \
|
#define DBUG_EXECUTE_IF(keyword,a1) \
|
||||||
{if (_db_on_) {if (_db_strict_keyword_ (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 */
|
#else /* No debugger */
|
||||||
|
|
||||||
#define DBUG_ENTER(a1)
|
#define DBUG_ENTER(a1)
|
||||||
@ -79,6 +83,8 @@ extern void _db_unlock_file(void);
|
|||||||
#define DBUG_VOID_RETURN return
|
#define DBUG_VOID_RETURN return
|
||||||
#define DBUG_EXECUTE(keyword,a1) {}
|
#define DBUG_EXECUTE(keyword,a1) {}
|
||||||
#define DBUG_EXECUTE_IF(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_PRINT(keyword,arglist) {}
|
||||||
#define DBUG_PUSH(a1) {}
|
#define DBUG_PUSH(a1) {}
|
||||||
#define DBUG_POP() {}
|
#define DBUG_POP() {}
|
||||||
|
@ -608,36 +608,45 @@ struct Query_cache_query_flags
|
|||||||
in various error cases.
|
in various error cases.
|
||||||
*/
|
*/
|
||||||
#ifndef ERROR_INJECT_SUPPORT
|
#ifndef ERROR_INJECT_SUPPORT
|
||||||
|
|
||||||
#define ERROR_INJECT(x) 0
|
#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 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)
|
#define SET_ERROR_INJECT_VALUE(x)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define SET_ERROR_INJECT_CODE(x) \
|
|
||||||
current_thd->variables.error_inject_code= (x)
|
|
||||||
#define SET_ERROR_INJECT_VALUE(x) \
|
#define SET_ERROR_INJECT_VALUE(x) \
|
||||||
current_thd->variables.error_inject_value= (x)
|
current_thd->error_inject_value= (x)
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
my_error_inject(int error)
|
my_error_inject(int value)
|
||||||
{
|
{
|
||||||
THD *thd= current_thd;
|
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 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ERROR_INJECT_CRASH(code) \
|
#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) \
|
#define ERROR_INJECT_ACTION(code, action) \
|
||||||
(my_error_inject((code)) ? ((action), 0) : 0)
|
DBUG_EXECUTE_COND(code, action)
|
||||||
#define ERROR_INJECT(code) \
|
#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
|
#endif
|
||||||
|
|
||||||
uint build_table_path(char *buff, size_t bufflen, const char *db,
|
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_timeout, delayed_insert_limit, delayed_queue_size;
|
||||||
ulong delayed_insert_threads, delayed_insert_writes, delayed_rows_in_use;
|
ulong delayed_insert_threads, delayed_insert_writes, delayed_rows_in_use;
|
||||||
ulong delayed_insert_errors,flush_time;
|
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 specialflag=0;
|
||||||
ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
|
ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
|
||||||
ulong max_connections, max_connect_errors;
|
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;
|
max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR;
|
||||||
global_system_variables.old_passwords= 0;
|
global_system_variables.old_passwords= 0;
|
||||||
global_system_variables.old_alter_table= 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
|
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);
|
&delayed_insert_timeout);
|
||||||
sys_var_long_ptr sys_delayed_queue_size("delayed_queue_size",
|
sys_var_long_ptr sys_delayed_queue_size("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",
|
sys_var_event_executor sys_event_executor("event_scheduler",
|
||||||
&event_executor_running_global_var);
|
&event_executor_running_global_var);
|
||||||
sys_var_long_ptr sys_expire_logs_days("expire_logs_days",
|
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_div_precincrement.name,(char*) &sys_div_precincrement,SHOW_SYS},
|
||||||
{sys_engine_condition_pushdown.name,
|
{sys_engine_condition_pushdown.name,
|
||||||
(char*) &sys_engine_condition_pushdown, SHOW_SYS},
|
(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_event_executor.name, (char*) &sys_event_executor, SHOW_SYS},
|
||||||
{sys_expire_logs_days.name, (char*) &sys_expire_logs_days, SHOW_SYS},
|
{sys_expire_logs_days.name, (char*) &sys_expire_logs_days, SHOW_SYS},
|
||||||
{sys_flush.name, (char*) &sys_flush, SHOW_SYS},
|
{sys_flush.name, (char*) &sys_flush, SHOW_SYS},
|
||||||
|
@ -222,6 +222,9 @@ THD::THD()
|
|||||||
cuted_fields= sent_row_count= 0L;
|
cuted_fields= sent_row_count= 0L;
|
||||||
limit_found_rows= 0;
|
limit_found_rows= 0;
|
||||||
statement_id_counter= 0UL;
|
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
|
// Must be reset to handle error with THD's created for init of mysqld
|
||||||
lex->current_select= 0;
|
lex->current_select= 0;
|
||||||
start_time=(time_t) 0;
|
start_time=(time_t) 0;
|
||||||
|
@ -186,10 +186,6 @@ struct system_variables
|
|||||||
ha_rows max_join_size;
|
ha_rows max_join_size;
|
||||||
ulong auto_increment_increment, auto_increment_offset;
|
ulong auto_increment_increment, auto_increment_offset;
|
||||||
ulong bulk_insert_buff_size;
|
ulong bulk_insert_buff_size;
|
||||||
#ifdef ERROR_INJECT_SUPPORT
|
|
||||||
ulong error_inject_code;
|
|
||||||
ulong error_inject_value;
|
|
||||||
#endif
|
|
||||||
ulong join_buff_size;
|
ulong join_buff_size;
|
||||||
ulong long_query_time;
|
ulong long_query_time;
|
||||||
ulong max_allowed_packet;
|
ulong max_allowed_packet;
|
||||||
@ -1103,6 +1099,9 @@ public:
|
|||||||
query_id_t query_id, warn_id;
|
query_id_t query_id, warn_id;
|
||||||
ulong thread_id, col_access;
|
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 */
|
/* Statement id is thread-wide. This counter is used to generate ids */
|
||||||
ulong statement_id_counter;
|
ulong statement_id_counter;
|
||||||
ulong rand_saved_seed1, rand_saved_seed2;
|
ulong rand_saved_seed1, rand_saved_seed2;
|
||||||
|
Reference in New Issue
Block a user