mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-29499 Improving the 'Can't execute init_slave query' error message with the actual failure
Currently, there are multiple error codes reported for the issue 'Can't execute init_slave query'. Those error codes are the underlying reason the init_slave query cannot be executed, but this makes it difficult to detect the issue in an automated way. This patch introduces a new error code, ER_INIT_SLAVE_ERROR, to unify all the errors related to the init_slave query. The ER_INIT_SLAVE_ERROR error is raised for any issue related to the init_slave query, and the underlying error code and message are included in the Last_SQL_Error field. Reviewed by: Jimmy Hu <jimmy.hu@mariadb.com> Brandon Nesterenko <brandon.nesterenko@mariadb.com>
This commit is contained in:
committed by
Brandon Nesterenko
parent
28dbfcb397
commit
247e2f8d4d
@@ -15,8 +15,8 @@ connection slave;
|
||||
reset slave;
|
||||
SET GLOBAL init_slave= "garbage";
|
||||
start slave;
|
||||
include/wait_for_slave_sql_error.inc [errno=1064]
|
||||
Last_SQL_Error = 'Slave SQL thread aborted. Can't execute init_slave query'
|
||||
include/wait_for_slave_sql_error.inc [errno=4226]
|
||||
Last_SQL_Error = 'Slave SQL thread aborted. Can't execute init_slave query due to error code 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'garbage' at line 1'
|
||||
SET GLOBAL init_slave= "";
|
||||
include/stop_slave_io.inc
|
||||
RESET SLAVE;
|
||||
|
@@ -15,8 +15,8 @@ connection slave;
|
||||
reset slave;
|
||||
SET GLOBAL init_slave= "garbage";
|
||||
start slave;
|
||||
include/wait_for_slave_sql_error.inc [errno=1064]
|
||||
Last_SQL_Error = 'Slave SQL thread aborted. Can't execute init_slave query'
|
||||
include/wait_for_slave_sql_error.inc [errno=4226]
|
||||
Last_SQL_Error = 'Slave SQL thread aborted. Can't execute init_slave query due to error code 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'garbage' at line 1'
|
||||
SET GLOBAL init_slave= "";
|
||||
include/stop_slave_io.inc
|
||||
RESET SLAVE;
|
||||
|
@@ -72,6 +72,10 @@ set @@global.debug_dbug = @saved_dbug;
|
||||
######################################################################
|
||||
# Injecting faults in the init_slave option
|
||||
######################################################################
|
||||
|
||||
# MDEV-29499 introduces a new error code for init_slave errors
|
||||
# 4226 = ER_INIT_SLAVE_ERROR
|
||||
# 1064 = ER_PARSE_ERROR
|
||||
connection slave;
|
||||
|
||||
reset slave;
|
||||
@@ -79,11 +83,14 @@ reset slave;
|
||||
SET GLOBAL init_slave= "garbage";
|
||||
|
||||
start slave;
|
||||
# 1064 = ER_PARSE_ERROR
|
||||
--let $slave_sql_errno= 1064
|
||||
# 4226 = ER_INIT_SLAVE_ERROR
|
||||
--let $slave_sql_errno= 4226
|
||||
# This test also checks that the root error code - 1064 in this case - is
|
||||
# included in the Last_SQL_Error
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
|
||||
######################################################################
|
||||
# Clean up
|
||||
######################################################################
|
||||
|
@@ -12328,3 +12328,5 @@ ER_WARN_MALFORMED_HINT
|
||||
eng "Hint %s is ignored as malformed"
|
||||
ER_WARN_HINTS_ON_INSERT_PART_OF_INSERT_SELECT
|
||||
eng "Optimizer hints at the INSERT part of a INSERT..SELECT statement are not supported"
|
||||
ER_INIT_SLAVE_ERROR
|
||||
eng "Slave SQL thread aborted. Can't execute init_slave query due to error code %u: %s"
|
||||
|
@@ -5396,8 +5396,9 @@ pthread_handler_t handle_slave_sql(void *arg)
|
||||
execute_init_command(thd, &opt_init_slave, &LOCK_sys_init_slave);
|
||||
if (unlikely(thd->is_slave_error))
|
||||
{
|
||||
rli->report(ERROR_LEVEL, thd->get_stmt_da()->sql_errno(), NULL,
|
||||
"Slave SQL thread aborted. Can't execute init_slave query");
|
||||
rli->report(ERROR_LEVEL, ER_INIT_SLAVE_ERROR, NULL,
|
||||
my_get_err_msg(ER_INIT_SLAVE_ERROR),
|
||||
thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user