Skip to content

Commit db3b68a

Browse files
jensevenbdahlerlend
authored andcommitted
Bug #27557952 IMPROVE LOGGING DURING --INITIALIZE
There are several problems here: a) There is indication that this is a normal startup and not --initialize mode b) Message about self signed ca.pem is spam in this context. c) There is no shutdown message present, user don't know when initialize progress is done. Solution: a) Changed the startup message to indicate that this is --initialize mode b) Supressed message about self signed ca.pem when in --initialize mode. c) Added a shutdown message so that users know when the initialize progress is done.
1 parent c05dc75 commit db3b68a

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

mysql-test/r/basedir.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# Try using -D with relative path
2626
# Look for [ERROR] in error log (there should be none):
2727
# Look for output (there should be none):
28+
# Supressing output for initialize:
2829
#
2930
# Cleanup
3031
#

mysql-test/t/basedir.test

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,12 @@ EOF
194194

195195
open(MYSQLD_OUT, $mysqld_out) || die "Failed to open '$mysqld_out': $!";
196196
print "# Look for output (there should be none):\n";
197+
print "# Supressing output for initialize:\n";
197198
while(<MYSQLD_OUT>)
198199
{
199-
print;
200+
if (!(/initializing of server has completed/)) {
201+
print;
202+
}
200203
}
201204
close(MYSQLD_OUT);
202205
EOF

share/errmsg-utf8.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18032,6 +18032,12 @@ ER_AUDIT_LOG_JSON_FILTER_DOES_NOT_EXIST
1803218032
ER_IB_MSG_1271
1803318033
eng "Cannot upgrade server earlier than 5.7 to 8.0"
1803418034

18035+
ER_STARTING_INIT
18036+
eng "%s (mysqld %s) initializing of server in progress as process %lu"
18037+
18038+
ER_ENDING_INIT
18039+
eng "%s (mysqld %s) initializing of server has completed"
18040+
1803518041
#
1803618042
# End of 8.0 Server error messages.
1803718043
# (Please read comments from the header of this section before adding error

sql/mysqld.cc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3814,9 +3814,13 @@ int init_common_variables() {
38143814
LogErr(INFORMATION_LEVEL, ER_BASEDIR_SET_TO, mysql_home);
38153815
}
38163816

3817-
LogErr(SYSTEM_LEVEL, ER_STARTING_AS, my_progname, server_version,
3818-
(ulong)getpid());
3819-
3817+
if (opt_initialize || opt_initialize_insecure) {
3818+
LogErr(SYSTEM_LEVEL, ER_STARTING_INIT, my_progname, server_version,
3819+
(ulong)getpid());
3820+
} else {
3821+
LogErr(SYSTEM_LEVEL, ER_STARTING_AS, my_progname, server_version,
3822+
(ulong)getpid());
3823+
}
38203824
if (opt_help && !opt_verbose) unireg_abort(MYSQLD_SUCCESS_EXIT);
38213825

38223826
DBUG_PRINT("info", ("%s Ver %s for %s on %s\n", my_progname, server_version,
@@ -4248,7 +4252,9 @@ static int warn_one(const char *file_name) {
42484252
issuer = X509_NAME_oneline(X509_get_issuer_name(ca_cert), 0, 0);
42494253
subject = X509_NAME_oneline(X509_get_subject_name(ca_cert), 0, 0);
42504254

4251-
if (!strcmp(issuer, subject)) {
4255+
/* Suppressing warning which is not relevant during initialization */
4256+
if (!strcmp(issuer, subject) &&
4257+
!(opt_initialize || opt_initialize_insecure)) {
42524258
LogErr(WARNING_LEVEL, ER_CA_SELF_SIGNED, file_name);
42534259
}
42544260

@@ -6264,6 +6270,9 @@ int mysqld_main(int argc, char **argv)
62646270

62656271
int error = bootstrap::run_bootstrap_thread(
62666272
mysql_stdin, NULL, SYSTEM_THREAD_SERVER_INITIALIZE);
6273+
if (error == 0) {
6274+
LogErr(SYSTEM_LEVEL, ER_ENDING_INIT, my_progname, server_version);
6275+
}
62676276
unireg_abort(error ? MYSQLD_ABORT_EXIT : MYSQLD_SUCCESS_EXIT);
62686277
}
62696278

0 commit comments

Comments
 (0)