MDEV-17093: SOURCE_REVISION in log and handle_fatal_signal
MariaDB MDEV-12583 added `SOURCE_REVISION` variable that exposes the SHA1 of source code commit that the current running engine was built from. This info is useful for troubleshooting and debugging. This commit does the following: - addes the `SOURCE_REVISION` value into engine error log. - when a crash triggers handle_fatal_signal, the `SOURCE_REVISION` will be included in crash report. - resolves MDEV-20344: startup messages belong in stderr/error-log not stdout All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
This commit is contained in:
parent
758c24dae2
commit
af0ff8b455
@ -119,6 +119,8 @@
|
|||||||
|
|
||||||
#include <my_service_manager.h>
|
#include <my_service_manager.h>
|
||||||
|
|
||||||
|
#include <source_revision.h>
|
||||||
|
|
||||||
#define mysqld_charset &my_charset_latin1
|
#define mysqld_charset &my_charset_latin1
|
||||||
|
|
||||||
/* We have HAVE_valgrind below as this speeds up the shutdown of MySQL */
|
/* We have HAVE_valgrind below as this speeds up the shutdown of MySQL */
|
||||||
@ -4445,21 +4447,6 @@ static int init_common_variables()
|
|||||||
|
|
||||||
mysql_real_data_home_len= uint(strlen(mysql_real_data_home));
|
mysql_real_data_home_len= uint(strlen(mysql_real_data_home));
|
||||||
|
|
||||||
if (!opt_abort)
|
|
||||||
{
|
|
||||||
if (IS_SYSVAR_AUTOSIZE(&server_version_ptr))
|
|
||||||
sql_print_information("%s (mysqld %s) starting as process %lu ...",
|
|
||||||
my_progname, server_version, (ulong) getpid());
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char real_server_version[SERVER_VERSION_LENGTH];
|
|
||||||
set_server_version(real_server_version, sizeof(real_server_version));
|
|
||||||
sql_print_information("%s (mysqld %s as %s) starting as process %lu ...",
|
|
||||||
my_progname, real_server_version, server_version,
|
|
||||||
(ulong) getpid());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sf_leaking_memory= 0; // no memory leaks from now on
|
sf_leaking_memory= 0; // no memory leaks from now on
|
||||||
|
|
||||||
#ifndef EMBEDDED_LIBRARY
|
#ifndef EMBEDDED_LIBRARY
|
||||||
@ -5258,6 +5245,13 @@ static int init_server_components()
|
|||||||
error_handler_hook= my_message_sql;
|
error_handler_hook= my_message_sql;
|
||||||
proc_info_hook= set_thd_stage_info;
|
proc_info_hook= set_thd_stage_info;
|
||||||
|
|
||||||
|
/*
|
||||||
|
 Print source revision hash, as one of the first lines, if not the
|
||||||
|
 first in error log, for troubleshooting and debugging purposes
|
||||||
|
 */
|
||||||
|
sql_print_information("Starting MariaDB %s source revision %s as process %lu",
|
||||||
|
server_version, SOURCE_REVISION, (ulong) getpid());
|
||||||
|
|
||||||
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
|
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
|
||||||
/*
|
/*
|
||||||
Parsing the performance schema command line option may have reported
|
Parsing the performance schema command line option may have reported
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "mysqld.h"
|
#include "mysqld.h"
|
||||||
#include "sql_class.h"
|
#include "sql_class.h"
|
||||||
#include "my_stacktrace.h"
|
#include "my_stacktrace.h"
|
||||||
|
#include <source_revision.h>
|
||||||
|
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
@ -177,7 +178,8 @@ extern "C" sig_handler handle_fatal_signal(int sig)
|
|||||||
"something is definitely wrong and this may fail.\n\n");
|
"something is definitely wrong and this may fail.\n\n");
|
||||||
|
|
||||||
set_server_version(server_version, sizeof(server_version));
|
set_server_version(server_version, sizeof(server_version));
|
||||||
my_safe_printf_stderr("Server version: %s\n", server_version);
|
my_safe_printf_stderr("Server version: %s source revision: %s\n",
|
||||||
|
server_version, SOURCE_REVISION);
|
||||||
|
|
||||||
if (dflt_key_cache)
|
if (dflt_key_cache)
|
||||||
my_safe_printf_stderr("key_buffer_size=%lu\n",
|
my_safe_printf_stderr("key_buffer_size=%lu\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user