diff options
-rw-r--r-- | include/my_sys.h | 1 | ||||
-rw-r--r-- | mysys/my_static.c | 3 | ||||
-rw-r--r-- | mysys/thr_mutex.c | 1 | ||||
-rw-r--r-- | sql/mysqld.cc | 15 |
4 files changed, 16 insertions, 4 deletions
diff --git a/include/my_sys.h b/include/my_sys.h index aa17fe365eb..30b7e0262da 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -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), diff --git a/mysys/my_static.c b/mysys/my_static.c index 07e106cb1ea..c519542c6f6 100644 --- a/mysys/my_static.c +++ b/mysys/my_static.c @@ -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 diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c index 9421a3b2d98..d284badfef4 100644 --- a/mysys/thr_mutex.c +++ b/mysys/thr_mutex.c @@ -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; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7e656bbd3bd..7131188b306 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -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= |