mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-11177 mysqlbinlog exits silently without error when another
instance connects to server. New thread kill status added KILL_SLAVE_SAME_ID, and the related error message.
This commit is contained in:
@ -7448,3 +7448,5 @@ ER_GEOJSON_NOT_CLOSED
|
||||
eng "Incorrect GeoJSON format - polygon not closed."
|
||||
ER_JSON_PATH_EMPTY
|
||||
eng "Path expression '$' is not allowed in argument %d to function '%s'."
|
||||
ER_SLAVE_SAME_ID
|
||||
eng "A slave with the same server_uuid/server_id as this slave has connected to the master"
|
||||
|
@ -201,6 +201,9 @@ extern "C" sig_handler handle_fatal_signal(int sig)
|
||||
case ABORT_QUERY_HARD:
|
||||
kreason= "ABORT_QUERY";
|
||||
break;
|
||||
case KILL_SLAVE_SAME_ID:
|
||||
kreason= "KILL_SLAVE_SAME_ID";
|
||||
break;
|
||||
}
|
||||
my_safe_printf_stderr("%s", "\n"
|
||||
"Trying to get some variables.\n"
|
||||
|
@ -1987,6 +1987,8 @@ int killed_errno(killed_state killed)
|
||||
case KILL_SERVER:
|
||||
case KILL_SERVER_HARD:
|
||||
DBUG_RETURN(ER_SERVER_SHUTDOWN);
|
||||
case KILL_SLAVE_SAME_ID:
|
||||
DBUG_RETURN(ER_SLAVE_SAME_ID);
|
||||
}
|
||||
DBUG_RETURN(0); // Keep compiler happy
|
||||
}
|
||||
|
@ -477,17 +477,23 @@ enum killed_state
|
||||
ABORT_QUERY_HARD= 7,
|
||||
KILL_TIMEOUT= 8,
|
||||
KILL_TIMEOUT_HARD= 9,
|
||||
/*
|
||||
When binlog reading thread connects to the server it kills
|
||||
all the binlog threads with the same ID.
|
||||
*/
|
||||
KILL_SLAVE_SAME_ID= 10,
|
||||
/*
|
||||
All of the following killed states will kill the connection
|
||||
KILL_CONNECTION must be the first of these and it must start with
|
||||
an even number (becasue of HARD bit)!
|
||||
*/
|
||||
KILL_CONNECTION= 10,
|
||||
KILL_CONNECTION_HARD= 11,
|
||||
KILL_SYSTEM_THREAD= 12,
|
||||
KILL_SYSTEM_THREAD_HARD= 13,
|
||||
KILL_SERVER= 14,
|
||||
KILL_SERVER_HARD= 15
|
||||
KILL_CONNECTION= 12,
|
||||
KILL_CONNECTION_HARD= 13,
|
||||
KILL_SYSTEM_THREAD= 14,
|
||||
KILL_SYSTEM_THREAD_HARD= 15,
|
||||
KILL_SERVER= 16,
|
||||
KILL_SERVER_HARD= 17,
|
||||
|
||||
};
|
||||
|
||||
extern int killed_errno(killed_state killed);
|
||||
|
@ -2910,6 +2910,13 @@ err:
|
||||
THD_STAGE_INFO(thd, stage_waiting_to_finalize_termination);
|
||||
RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags));
|
||||
|
||||
if (info->thd->killed == KILL_SLAVE_SAME_ID)
|
||||
{
|
||||
info->errmsg= "A slave with the same server_uuid/server_id as this slave "
|
||||
"has connected to the master";
|
||||
info->error= ER_SLAVE_SAME_ID;
|
||||
}
|
||||
|
||||
const bool binlog_open = my_b_inited(&log);
|
||||
if (file >= 0)
|
||||
{
|
||||
@ -2921,7 +2928,8 @@ err:
|
||||
thd->variables.max_allowed_packet= old_max_allowed_packet;
|
||||
delete info->fdev;
|
||||
|
||||
if (info->error == ER_MASTER_FATAL_ERROR_READING_BINLOG && binlog_open)
|
||||
if ((info->error == ER_MASTER_FATAL_ERROR_READING_BINLOG ||
|
||||
info->error == ER_SLAVE_SAME_ID) && binlog_open)
|
||||
{
|
||||
/*
|
||||
detailing the fatal error message with coordinates
|
||||
@ -3392,7 +3400,7 @@ void kill_zombie_dump_threads(uint32 slave_server_id)
|
||||
it will be slow because it will iterate through the list
|
||||
again. We just to do kill the thread ourselves.
|
||||
*/
|
||||
tmp->awake(KILL_QUERY);
|
||||
tmp->awake(KILL_SLAVE_SAME_ID);
|
||||
mysql_mutex_unlock(&tmp->LOCK_thd_data);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user