mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
embedded client now writes errors to stderr during init_embedded_server
This was done to be able to get any information why the embedded server doesn't start.
This commit is contained in:
parent
d558981e2c
commit
b0916141c7
1 changed files with 14 additions and 3 deletions
|
@ -44,12 +44,13 @@ extern unsigned int mysql_server_last_errno;
|
|||
extern char mysql_server_last_error[MYSQL_ERRMSG_SIZE];
|
||||
static my_bool emb_read_query_result(MYSQL *mysql);
|
||||
static void emb_free_embedded_thd(MYSQL *mysql);
|
||||
|
||||
static bool embedded_print_errors= 0;
|
||||
|
||||
extern "C" void unireg_clear(int exit_code)
|
||||
{
|
||||
DBUG_ENTER("unireg_clear");
|
||||
clean_up(!opt_help && (exit_code || !opt_bootstrap)); /* purecov: inspected */
|
||||
embedded_print_errors= 0;
|
||||
clean_up(!opt_help && !exit_code); /* purecov: inspected */
|
||||
clean_up_mutexes();
|
||||
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
|
||||
DBUG_VOID_RETURN;
|
||||
|
@ -518,6 +519,7 @@ int init_embedded_server(int argc, char **argv, char **groups)
|
|||
const char *fake_groups[] = { "server", "embedded", 0 };
|
||||
my_bool acl_error;
|
||||
|
||||
embedded_print_errors= 1;
|
||||
if (my_thread_init())
|
||||
return 1;
|
||||
|
||||
|
@ -1338,6 +1340,15 @@ int vprint_msg_to_log(enum loglevel level __attribute__((unused)),
|
|||
vsnprintf(mysql_server_last_error, sizeof(mysql_server_last_error),
|
||||
format, argsi);
|
||||
mysql_server_last_errno= CR_UNKNOWN_ERROR;
|
||||
if (embedded_print_errors && level == ERROR_LEVEL)
|
||||
{
|
||||
/* The following is for testing when someone removes the above test */
|
||||
const char *tag= (level == ERROR_LEVEL ? "ERROR" :
|
||||
level == WARNING_LEVEL ? "Warning" :
|
||||
"Note");
|
||||
fprintf(stderr,"Got %s: \"%s\" errno: %d\n",
|
||||
tag, mysql_server_last_error, mysql_server_last_errno);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue