mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Generate a warning(note) and write to error log if master_pos_wait() fails.
This is to make it easier to understand why master_pos_wait() fails in mtr.
This commit is contained in:
@@ -69,6 +69,8 @@ set @@default_master_connection='';
|
||||
select master_pos_wait('master-bin.999999',0,2);
|
||||
master_pos_wait('master-bin.999999',0,2)
|
||||
-1
|
||||
Warnings:
|
||||
Note 1105 Timeout waiting for master-bin.999999:4. Current pos is master-bin.000001:329
|
||||
set @@default_master_connection='';
|
||||
#
|
||||
# checking variables
|
||||
|
@@ -4,6 +4,8 @@ connection slave;
|
||||
select master_pos_wait('master-bin.999999',0,2);
|
||||
master_pos_wait('master-bin.999999',0,2)
|
||||
-1
|
||||
Warnings:
|
||||
Note 1105 Timeout waiting for master-bin.999999:4. Current pos is master-bin.000001:329
|
||||
explain extended select master_pos_wait('master-bin.999999',0,2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
@@ -16,6 +18,8 @@ include/wait_for_slave_sql_to_stop.inc
|
||||
connection slave;
|
||||
master_pos_wait('master-bin.999999',0)
|
||||
NULL
|
||||
Warnings:
|
||||
Note 1105 master_pos_wait() was aborted because slave is not running
|
||||
connection master;
|
||||
"*** must be empty ***"
|
||||
show slave status;
|
||||
@@ -34,6 +38,8 @@ include/start_slave.inc
|
||||
select master_pos_wait('master-bin.000001',1000000,1);
|
||||
master_pos_wait('master-bin.000001',1000000,1)
|
||||
-1
|
||||
Warnings:
|
||||
Note 1105 Timeout waiting for master-bin.000001:1000000. Current pos is master-bin.000001:329
|
||||
set default_master_connection = '';
|
||||
# Call for non-existing anonymous connection -- works (expected NULL)
|
||||
select master_pos_wait('master-bin.000001',1000000,1);
|
||||
@@ -43,6 +49,8 @@ NULL
|
||||
select master_pos_wait('master-bin.000001',1000000,1,"my_slave");
|
||||
master_pos_wait('master-bin.000001',1000000,1,"my_slave")
|
||||
-1
|
||||
Warnings:
|
||||
Note 1105 Timeout waiting for master-bin.000001:1000000. Current pos is master-bin.000001:329
|
||||
STOP SLAVE 'my_slave';
|
||||
RESET SLAVE 'my_slave' ALL;
|
||||
change master to master_port=MASTER_MYPORT, master_host='127.0.0.1', master_user='root';
|
||||
|
@@ -3931,8 +3931,10 @@ longlong Item_master_pos_wait::val_int()
|
||||
connection_name= thd->variables.default_master_connection;
|
||||
|
||||
if (!(mi= get_master_info(&connection_name, Sql_condition::WARN_LEVEL_WARN)))
|
||||
{
|
||||
sql_print_information("Could not get master info for %s", connection_name.str);
|
||||
goto err;
|
||||
|
||||
}
|
||||
if ((event_count = mi->rli.wait_for_pos(thd, log_name, pos, timeout)) == -2)
|
||||
{
|
||||
null_value = 1;
|
||||
|
@@ -937,6 +937,11 @@ int Relay_log_info::wait_for_pos(THD* thd, String* log_name,
|
||||
DBUG_PRINT("info",("Got signal of master update or timed out"));
|
||||
if (error == ETIMEDOUT || error == ETIME)
|
||||
{
|
||||
my_printf_error(ER_UNKNOWN_ERROR,
|
||||
"Timeout waiting for %s:%llu. Current pos is %s:%llu",
|
||||
MYF(ME_ERROR_LOG | ME_NOTE),
|
||||
log_name_tmp, (ulonglong) log_pos,
|
||||
group_master_log_name, (ulonglong) group_master_log_pos);
|
||||
error= -1;
|
||||
break;
|
||||
}
|
||||
@@ -957,6 +962,17 @@ improper_arguments: %d timed_out: %d",
|
||||
if (thd->killed || init_abort_pos_wait != abort_pos_wait ||
|
||||
!slave_running)
|
||||
{
|
||||
const char *cause= 0;
|
||||
if (init_abort_pos_wait != abort_pos_wait)
|
||||
cause= "CHANGE MASTER detected";
|
||||
else if (!slave_running)
|
||||
cause="slave is not running";
|
||||
else
|
||||
cause="connection was killed";
|
||||
my_printf_error(ER_UNKNOWN_ERROR,
|
||||
"master_pos_wait() was aborted because %s",
|
||||
MYF(ME_ERROR_LOG | ME_NOTE),
|
||||
cause);
|
||||
error= -2;
|
||||
}
|
||||
DBUG_RETURN( error ? error : event_count );
|
||||
|
Reference in New Issue
Block a user