Commit 8aa473c4 authored by Sergei Golubchik's avatar Sergei Golubchik

fix show_relaylog_events.inc to work for multisource

and fix SHOW RELAYLOG 'src_name' EVENTS to respect src_name
parent 274a47a5
......@@ -15,7 +15,19 @@
--let $statement=show BINLOG events
if ($is_relay_log)
{
--let $statement=show relaylog events
if ($master_name)
{
let _master_name='$master_name';
}
if (!$master_name)
{
let _master_name=`select @@default_master_connection`;
if ($_master_name)
{
let _master_name='$_master_name';
}
}
--let $statement=show relaylog $_master_name events
}
if ($binlog_file)
......@@ -25,7 +37,7 @@ if ($binlog_file)
{
if ($is_relay_log)
{
--let $_binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1)
--let $_binlog_file= query_get_value(SHOW SLAVE $_master_name STATUS, Relay_Log_File, 1)
}
if (!$is_relay_log)
{
......
##############################################################################
# Show relay log events
#
# Useage:
# Usage:
# let $binlog_file= slave-relay-bin.000002;
# let $binlog_start= 106;
# let $binlog_limit= 1, 3;
# let $master_name= master1;
# source include/show_relaylog_events.inc;
#
# It shows the first relay log file if $binlog_file is not given.
......
......@@ -3800,6 +3800,7 @@ bool mysql_show_binlog_events(THD* thd)
int old_max_allowed_packet= thd->variables.max_allowed_packet;
Master_info *mi= 0;
LOG_INFO linfo;
LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
DBUG_ENTER("mysql_show_binlog_events");
......@@ -3821,10 +3822,12 @@ bool mysql_show_binlog_events(THD* thd)
}
else /* showing relay log contents */
{
if (!lex_mi->connection_name.str)
lex_mi->connection_name= thd->variables.default_master_connection;
mysql_mutex_lock(&LOCK_active_mi);
if (!master_info_index ||
!(mi= master_info_index->
get_master_info(&thd->variables.default_master_connection,
get_master_info(&lex_mi->connection_name,
Sql_condition::WARN_LEVEL_ERROR)))
{
mysql_mutex_unlock(&LOCK_active_mi);
......@@ -3835,7 +3838,6 @@ bool mysql_show_binlog_events(THD* thd)
if (binary_log->is_open())
{
LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
SELECT_LEX_UNIT *unit= &thd->lex->unit;
ha_rows event_count, limit_start, limit_end;
my_off_t pos = MY_MAX(BIN_LOG_HEADER_SIZE, lex_mi->pos); // user-friendly
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment