mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03: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:
@ -44,12 +44,13 @@ extern unsigned int mysql_server_last_errno;
|
|||||||
extern char mysql_server_last_error[MYSQL_ERRMSG_SIZE];
|
extern char mysql_server_last_error[MYSQL_ERRMSG_SIZE];
|
||||||
static my_bool emb_read_query_result(MYSQL *mysql);
|
static my_bool emb_read_query_result(MYSQL *mysql);
|
||||||
static void emb_free_embedded_thd(MYSQL *mysql);
|
static void emb_free_embedded_thd(MYSQL *mysql);
|
||||||
|
static bool embedded_print_errors= 0;
|
||||||
|
|
||||||
extern "C" void unireg_clear(int exit_code)
|
extern "C" void unireg_clear(int exit_code)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("unireg_clear");
|
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();
|
clean_up_mutexes();
|
||||||
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
|
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
@ -518,6 +519,7 @@ int init_embedded_server(int argc, char **argv, char **groups)
|
|||||||
const char *fake_groups[] = { "server", "embedded", 0 };
|
const char *fake_groups[] = { "server", "embedded", 0 };
|
||||||
my_bool acl_error;
|
my_bool acl_error;
|
||||||
|
|
||||||
|
embedded_print_errors= 1;
|
||||||
if (my_thread_init())
|
if (my_thread_init())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -1336,8 +1338,17 @@ int vprint_msg_to_log(enum loglevel level __attribute__((unused)),
|
|||||||
const char *format, va_list argsi)
|
const char *format, va_list argsi)
|
||||||
{
|
{
|
||||||
vsnprintf(mysql_server_last_error, sizeof(mysql_server_last_error),
|
vsnprintf(mysql_server_last_error, sizeof(mysql_server_last_error),
|
||||||
format, argsi);
|
format, argsi);
|
||||||
mysql_server_last_errno= CR_UNKNOWN_ERROR;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user