Skip to content

Commit affff1a

Browse files
committed
Less logging of not critial things during startup/shutdown:
- Added --start option to mysqld which don't prints notes to log on startup This helps to find errors in configure options easier - Dont write [Note] entries to log after we have abort the server This makes it easier to find what went wrong - Don't by default write out Changed limits for max_open_files as this didn't really change from anything the user gave us - Dont write warnings about not using --explicit_defaults_for_timestamp (we don't have plans do depricate the old behaviour)
1 parent 602c803 commit affff1a

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

mysql-test/r/mysqld--help.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,7 @@ The following options may be given as the first argument:
909909
--show-slave-auth-info
910910
Show user and password in SHOW SLAVE HOSTS on this
911911
master.
912+
--silent Don't print [Note] to log during startup.
912913
--skip-bdb Deprecated option; Exist only for compatibility with old
913914
my.cnf files
914915
--skip-grant-tables Start without grant tables. This gives all users FULL
@@ -1386,6 +1387,7 @@ secure-auth TRUE
13861387
secure-file-priv (No default value)
13871388
server-id 0
13881389
show-slave-auth-info FALSE
1390+
silent FALSE
13891391
skip-grant-tables TRUE
13901392
skip-name-resolve FALSE
13911393
skip-networking FALSE

sql/log.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8455,6 +8455,9 @@ void sql_print_information(const char *format, ...)
84558455
va_list args;
84568456
DBUG_ENTER("sql_print_information");
84578457

8458+
if (disable_log_notes)
8459+
DBUG_VOID_RETURN; // Skip notes during start/shutdown
8460+
84588461
va_start(args, format);
84598462
error_log_print(INFORMATION_LEVEL, format, args);
84608463
va_end(args);

sql/mysqld.cc

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,8 @@ static DYNAMIC_ARRAY all_options;
386386
/* Global variables */
387387

388388
bool opt_bin_log, opt_bin_log_used=0, opt_ignore_builtin_innodb= 0;
389-
my_bool opt_log, debug_assert_if_crashed_table= 0, opt_help= 0;
389+
my_bool opt_log, debug_assert_if_crashed_table= 0, opt_help= 0, opt_silent= 0;
390+
my_bool disable_log_notes;
390391
static my_bool opt_abort;
391392
ulonglong log_output_options;
392393
my_bool opt_userstat_running;
@@ -2012,6 +2013,8 @@ extern "C" void unireg_abort(int exit_code)
20122013
usage();
20132014
if (exit_code)
20142015
sql_print_error("Aborting\n");
2016+
/* Don't write more notes to the log to not hide error message */
2017+
disable_log_notes= 1;
20152018

20162019
#ifdef WITH_WSREP
20172020
/* Check if wsrep class is used. If yes, then cleanup wsrep */
@@ -4396,7 +4399,7 @@ static int init_common_variables()
43964399
DBUG_PRINT("warning",
43974400
("Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld",
43984401
files, max_connections, tc_size));
4399-
if (global_system_variables.log_warnings)
4402+
if (global_system_variables.log_warnings > 1)
44004403
sql_print_warning("Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld",
44014404
files, max_connections, tc_size);
44024405
}
@@ -5934,6 +5937,7 @@ int mysqld_main(int argc, char **argv)
59345937
unireg_abort(1);
59355938
}
59365939

5940+
disable_log_notes= 0; /* Startup done, now we can give notes again */
59375941
sql_print_information(ER_DEFAULT(ER_STARTUP),my_progname,server_version,
59385942
((mysql_socket_getfd(unix_sock) == INVALID_SOCKET) ?
59395943
(char*) "" : mysqld_unix_port),
@@ -7491,6 +7495,8 @@ struct my_option my_long_options[]=
74917495
"Show user and password in SHOW SLAVE HOSTS on this master.",
74927496
&opt_show_slave_auth_info, &opt_show_slave_auth_info, 0,
74937497
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
7498+
{"silent", OPT_SILENT, "Don't print [Note] to log during startup.",
7499+
&opt_silent, &opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
74947500
{"skip-bdb", OPT_DEPRECATED_OPTION,
74957501
"Deprecated option; Exist only for compatibility with old my.cnf files",
74967502
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -8659,6 +8665,7 @@ static int mysql_init_variables(void)
86598665
opt_tc_log_file= (char *)"tc.log"; // no hostname in tc_log file name !
86608666
opt_secure_auth= 0;
86618667
opt_bootstrap= opt_myisam_log= 0;
8668+
disable_log_notes= 0;
86628669
mqh_used= 0;
86638670
kill_in_progress= 0;
86648671
cleanup_done= 0;
@@ -9164,7 +9171,9 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
91649171
}
91659172
}
91669173
break;
9167-
9174+
case OPT_SILENT:
9175+
disable_log_notes= opt_silent;
9176+
break;
91689177
case OPT_PLUGIN_LOAD:
91699178
free_list(opt_plugin_load_list_ptr);
91709179
/* fall through */
@@ -9398,6 +9407,7 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
93989407
global_system_variables.max_allowed_packet);
93999408
}
94009409

9410+
#if MYSQL_VERSION_ID > 101001
94019411
/*
94029412
TIMESTAMP columns get implicit DEFAULT values when
94039413
--explicit_defaults_for_timestamp is not set.
@@ -9406,7 +9416,7 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
94069416
sql_print_warning("TIMESTAMP with implicit DEFAULT value is deprecated. "
94079417
"Please use --explicit_defaults_for_timestamp server "
94089418
"option (see documentation for more details).");
9409-
9419+
#endif
94109420

94119421
if (log_error_file_ptr != disabled_my_option)
94129422
opt_error_log= 1;

sql/mysqld.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,7 @@ enum options_mysqld
616616
OPT_REPLICATE_WILD_IGNORE_TABLE,
617617
OPT_SAFE,
618618
OPT_SERVER_ID,
619+
OPT_SILENT,
619620
OPT_SKIP_HOST_CACHE,
620621
OPT_SKIP_RESOLVE,
621622
OPT_SLAVE_PARALLEL_MODE,
@@ -783,7 +784,7 @@ extern ulong thread_created;
783784
extern scheduler_functions *thread_scheduler, *extra_thread_scheduler;
784785
extern char *opt_log_basename;
785786
extern my_bool opt_master_verify_checksum;
786-
extern my_bool opt_stack_trace;
787+
extern my_bool opt_stack_trace, disable_log_notes;
787788
extern my_bool opt_expect_abort;
788789
extern my_bool opt_slave_sql_verify_checksum;
789790
extern my_bool opt_mysql56_temporal_format, strict_password_validation;

0 commit comments

Comments
 (0)