mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
fix show_relaylog_events.inc to work for multisource
and fix SHOW RELAYLOG 'src_name' EVENTS to respect src_name
This commit is contained in:
@ -15,7 +15,19 @@
|
|||||||
--let $statement=show BINLOG events
|
--let $statement=show BINLOG events
|
||||||
if ($is_relay_log)
|
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)
|
if ($binlog_file)
|
||||||
@ -25,7 +37,7 @@ if ($binlog_file)
|
|||||||
{
|
{
|
||||||
if ($is_relay_log)
|
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)
|
if (!$is_relay_log)
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
# Show relay log events
|
# Show relay log events
|
||||||
#
|
#
|
||||||
# Useage:
|
# Usage:
|
||||||
# let $binlog_file= slave-relay-bin.000002;
|
# let $binlog_file= slave-relay-bin.000002;
|
||||||
# let $binlog_start= 106;
|
# let $binlog_start= 106;
|
||||||
# let $binlog_limit= 1, 3;
|
# let $binlog_limit= 1, 3;
|
||||||
|
# let $master_name= master1;
|
||||||
# source include/show_relaylog_events.inc;
|
# source include/show_relaylog_events.inc;
|
||||||
#
|
#
|
||||||
# It shows the first relay log file if $binlog_file is not given.
|
# 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;
|
int old_max_allowed_packet= thd->variables.max_allowed_packet;
|
||||||
Master_info *mi= 0;
|
Master_info *mi= 0;
|
||||||
LOG_INFO linfo;
|
LOG_INFO linfo;
|
||||||
|
LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
|
||||||
|
|
||||||
DBUG_ENTER("mysql_show_binlog_events");
|
DBUG_ENTER("mysql_show_binlog_events");
|
||||||
|
|
||||||
@ -3821,10 +3822,12 @@ bool mysql_show_binlog_events(THD* thd)
|
|||||||
}
|
}
|
||||||
else /* showing relay log contents */
|
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);
|
mysql_mutex_lock(&LOCK_active_mi);
|
||||||
if (!master_info_index ||
|
if (!master_info_index ||
|
||||||
!(mi= 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)))
|
Sql_condition::WARN_LEVEL_ERROR)))
|
||||||
{
|
{
|
||||||
mysql_mutex_unlock(&LOCK_active_mi);
|
mysql_mutex_unlock(&LOCK_active_mi);
|
||||||
@ -3835,7 +3838,6 @@ bool mysql_show_binlog_events(THD* thd)
|
|||||||
|
|
||||||
if (binary_log->is_open())
|
if (binary_log->is_open())
|
||||||
{
|
{
|
||||||
LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
|
|
||||||
SELECT_LEX_UNIT *unit= &thd->lex->unit;
|
SELECT_LEX_UNIT *unit= &thd->lex->unit;
|
||||||
ha_rows event_count, limit_start, limit_end;
|
ha_rows event_count, limit_start, limit_end;
|
||||||
my_off_t pos = MY_MAX(BIN_LOG_HEADER_SIZE, lex_mi->pos); // user-friendly
|
my_off_t pos = MY_MAX(BIN_LOG_HEADER_SIZE, lex_mi->pos); // user-friendly
|
||||||
|
Reference in New Issue
Block a user