Skip to content

Commit

Permalink
Bug #27557952 IMPROVE LOGGING DURING --INITIALIZE
Browse files Browse the repository at this point in the history
  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.
  • Loading branch information
jensevenb authored and dahlerlend committed Mar 28, 2018
1 parent c05dc75 commit db3b68a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
1 change: 1 addition & 0 deletions mysql-test/r/basedir.result
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# Try using -D with relative path
# Look for [ERROR] in error log (there should be none):
# Look for output (there should be none):
# Supressing output for initialize:
#
# Cleanup
#
Expand Down
5 changes: 4 additions & 1 deletion mysql-test/t/basedir.test
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,12 @@ EOF

open(MYSQLD_OUT, $mysqld_out) || die "Failed to open '$mysqld_out': $!";
print "# Look for output (there should be none):\n";
print "# Supressing output for initialize:\n";
while(<MYSQLD_OUT>)
{
print;
if (!(/initializing of server has completed/)) {
print;
}
}
close(MYSQLD_OUT);
EOF
Expand Down
6 changes: 6 additions & 0 deletions share/errmsg-utf8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18032,6 +18032,12 @@ ER_AUDIT_LOG_JSON_FILTER_DOES_NOT_EXIST
ER_IB_MSG_1271
eng "Cannot upgrade server earlier than 5.7 to 8.0"

ER_STARTING_INIT
eng "%s (mysqld %s) initializing of server in progress as process %lu"

ER_ENDING_INIT
eng "%s (mysqld %s) initializing of server has completed"

#
# End of 8.0 Server error messages.
# (Please read comments from the header of this section before adding error
Expand Down
17 changes: 13 additions & 4 deletions sql/mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3814,9 +3814,13 @@ int init_common_variables() {
LogErr(INFORMATION_LEVEL, ER_BASEDIR_SET_TO, mysql_home);
}

LogErr(SYSTEM_LEVEL, ER_STARTING_AS, my_progname, server_version,
(ulong)getpid());

if (opt_initialize || opt_initialize_insecure) {
LogErr(SYSTEM_LEVEL, ER_STARTING_INIT, my_progname, server_version,
(ulong)getpid());
} else {
LogErr(SYSTEM_LEVEL, ER_STARTING_AS, my_progname, server_version,
(ulong)getpid());
}
if (opt_help && !opt_verbose) unireg_abort(MYSQLD_SUCCESS_EXIT);

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

if (!strcmp(issuer, subject)) {
/* Suppressing warning which is not relevant during initialization */
if (!strcmp(issuer, subject) &&
!(opt_initialize || opt_initialize_insecure)) {
LogErr(WARNING_LEVEL, ER_CA_SELF_SIGNED, file_name);
}

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

int error = bootstrap::run_bootstrap_thread(
mysql_stdin, NULL, SYSTEM_THREAD_SERVER_INITIALIZE);
if (error == 0) {
LogErr(SYSTEM_LEVEL, ER_ENDING_INIT, my_progname, server_version);
}
unireg_abort(error ? MYSQLD_ABORT_EXIT : MYSQLD_SUCCESS_EXIT);
}

Expand Down

0 comments on commit db3b68a

Please sign in to comment.