Fixed lp:814238 "safe_mutex issues must be assertions in debug binary"
Added --debug-assert-on-error variable which, if set, will cause safe_mutex to assert if it founds an error. include/my_sys.h: Added my_assert_on_error mysys/my_static.c: Added my_assert_on_error mysys/thr_mutex.c: Assert when found wrong mutex usage if my_assert_on_error is set sql/mysqld.cc: Added setting of my_assert_on_error
This commit is contained in:
parent
37a8497d49
commit
13e4d54795
@ -255,6 +255,7 @@ extern ulong my_file_total_opened;
|
||||
extern ulong my_sync_count;
|
||||
extern uint mysys_usage_id;
|
||||
extern my_bool my_init_done;
|
||||
extern my_bool my_assert_on_error;
|
||||
extern myf my_global_flags; /* Set to MY_WME for more error messages */
|
||||
/* Point to current my_message() */
|
||||
extern void (*my_sigtstp_cleanup)(void),
|
||||
|
@ -32,7 +32,8 @@ char NEAR curr_dir[FN_REFLEN]= {0},
|
||||
ulong my_stream_opened=0,my_file_opened=0, my_tmp_file_created=0;
|
||||
ulong my_file_total_opened= 0;
|
||||
int NEAR my_umask=0664, NEAR my_umask_dir=0777;
|
||||
myf my_global_flags;
|
||||
myf my_global_flags= 0;
|
||||
my_bool my_assert_on_error= 0;
|
||||
#ifndef THREAD
|
||||
int NEAR my_errno=0;
|
||||
#endif
|
||||
|
@ -836,6 +836,7 @@ static void print_deadlock_warning(safe_mutex_t *new_mutex,
|
||||
mutex_root->file, mutex_root->line));
|
||||
}
|
||||
fflush(stderr);
|
||||
DBUG_ASSERT(my_assert_on_error == 0);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -6068,7 +6068,9 @@ enum options_mysqld
|
||||
OPT_SECURE_FILE_PRIV,
|
||||
OPT_MIN_EXAMINED_ROW_LIMIT,
|
||||
OPT_LOG_SLOW_SLAVE_STATEMENTS,
|
||||
OPT_DEBUG_CRC, OPT_DEBUG_ON, OPT_DEBUG_ASSERT_IF_CRASHED_TABLE, OPT_OLD_MODE,
|
||||
OPT_DEBUG_CRC, OPT_DEBUG_ON, OPT_DEBUG_ASSERT_IF_CRASHED_TABLE,
|
||||
OPT_DEBUG_ASSERT_ON_ERROR,
|
||||
OPT_OLD_MODE,
|
||||
OPT_TEST_IGNORE_WRONG_OPTIONS, OPT_TEST_RESTART,
|
||||
#if defined(ENABLED_DEBUG_SYNC)
|
||||
OPT_DEBUG_SYNC_TIMEOUT,
|
||||
@ -6243,6 +6245,10 @@ struct my_option my_long_options[] =
|
||||
"Do an assert in handler::print_error() if we get a crashed table",
|
||||
&debug_assert_if_crashed_table, &debug_assert_if_crashed_table,
|
||||
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"debug-assert-on-error", OPT_DEBUG_ASSERT_ON_ERROR,
|
||||
"Do an assert in various functions if we get a fatal error",
|
||||
&my_assert_on_error, &my_assert_on_error,
|
||||
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
{"default-character-set", OPT_DEFAULT_CHARACTER_SET_OLD,
|
||||
"Set the default character set (deprecated option, use --character-set-server instead).",
|
||||
@ -9422,14 +9428,17 @@ static int get_options(int *argc,char **argv)
|
||||
my_crc_dbug_check= opt_my_crc_dbug_check;
|
||||
|
||||
/*
|
||||
Log mysys errors when we don't have a thd or thd->log_all_errors is set (recovery) to
|
||||
the log. This is mainly useful for debugging strange system errors.
|
||||
Log mysys errors when we don't have a thd or thd->log_all_errors is set
|
||||
(recovery) to the log. This is mainly useful for debugging strange system
|
||||
errors.
|
||||
*/
|
||||
if (global_system_variables.log_warnings >= 10)
|
||||
my_global_flags= MY_WME | ME_JUST_INFO;
|
||||
/* Log all errors not handled by thd->handle_error() to my_message_sql() */
|
||||
if (global_system_variables.log_warnings >= 11)
|
||||
my_global_flags|= ME_NOREFRESH;
|
||||
if (my_assert_on_error)
|
||||
debug_assert_if_crashed_table= 1;
|
||||
|
||||
/* long_query_time is in microseconds */
|
||||
global_system_variables.long_query_time= max_system_variables.long_query_time=
|
||||
|
Loading…
x
Reference in New Issue
Block a user