From 80c662479beae3c64ab96faff379b40565fc856a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 1 Jun 2004 17:29:24 +0300 Subject: Changed --log-warnings to be integer instead of boolean. Given --skip-log-warnings will disable warnings, --log-warnings will increment warning level by one, or the level can be given as an optional argument. Default level is 1. Changed aborted connection warning to be logged only if the level is > 1. sql/sql_class.h: Changed boolean into ulong. sql/sql_parse.cc: Changed aborted connection warning to be logged only if the level is > 1. --- sql/mysqld.cc | 12 ++++++++++-- sql/set_var.cc | 2 +- sql/sql_class.h | 2 +- sql/sql_parse.cc | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 65903d7ce8a..3cd42dbeac1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3944,11 +3944,11 @@ replicating a LOAD DATA INFILE command", 0, 0, 0, 0}, {"log-warnings", 'W', "Log some not critical warnings to the log file", (gptr*) &global_system_variables.log_warnings, - (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 1, 0, 0, + (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"warnings", 'W', "Deprecated ; Use --log-warnings instead", (gptr*) &global_system_variables.log_warnings, - (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 1, 0, 0, + (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0, 0, 0, 0}, { "back_log", OPT_BACK_LOG, "The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.", @@ -4656,6 +4656,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case 'V': print_version(); exit(0); + case 'W': + if (!argument) + global_system_variables.log_warnings++; + else if (argument == disabled_my_option) + global_system_variables.log_warnings= 0L; + else + global_system_variables.log_warnings= atoi(argument); + break; case 'I': case '?': usage(); diff --git a/sql/set_var.cc b/sql/set_var.cc index 525da26a5ac..4b66a621f62 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -133,7 +133,7 @@ sys_var_ulonglong_ptr sys_key_buffer_size("key_buffer_size", fix_key_buffer_size); sys_var_bool_ptr sys_local_infile("local_infile", &opt_local_infile); -sys_var_thd_bool sys_log_warnings("log_warnings", &SV::log_warnings); +sys_var_thd_ulong sys_log_warnings("log_warnings", &SV::log_warnings); sys_var_thd_ulong sys_long_query_time("long_query_time", &SV::long_query_time); sys_var_thd_bool sys_low_priority_updates("low_priority_updates", diff --git a/sql/sql_class.h b/sql/sql_class.h index 9663957963f..484a442af20 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -333,8 +333,8 @@ struct system_variables ulong query_prealloc_size; ulong trans_alloc_block_size; ulong trans_prealloc_size; + ulong log_warnings; - my_bool log_warnings; my_bool low_priority_updates; my_bool new_mode; my_bool query_cache_wlock_invalidate; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7ddbf79c6fe..a9723108674 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -742,7 +742,7 @@ pthread_handler_decl(handle_one_connection,arg) free_root(&thd->mem_root,MYF(0)); if (net->error && net->vio != 0) { - if (!thd->killed && thd->variables.log_warnings) + if (!thd->killed && thd->variables.log_warnings > 1) sql_print_error(ER(ER_NEW_ABORTING_CONNECTION), thd->thread_id,(thd->db ? thd->db : "unconnected"), thd->user ? thd->user : "unauthenticated", -- cgit v1.2.1