Bug #28777 SHOW BINLOG EVENTS does not work on relay log files
Submitted: 30 May 2007 15:20 Modified: 12 Nov 2009 12:51
Reporter: Mark Leith Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.0.42 OS:Any
Assigned to: Luis Soares CPU Architecture:Any

[30 May 2007 15:20] Mark Leith
Description:
SHOW BINLOG EVENTS does not work with relay log files, although it should:

mysql> show slave status\G
*************************** 1. row ***************************
...
             Relay_Log_File: relay-bin.000020
              Relay_Log_Pos: 407
      Relay_Master_Log_File: log-bin.000003
           Slave_IO_Running: Yes
          Slave_SQL_Running: Yes
...

mysql> show binlog events in 'relay-bin.000020';
Empty set (0.00 sec)

[markleith@medusa:~/mysql/mysql-5.0.34/data] $ ../bin/mysqlbinlog  relay-bin.000020 
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
# at 4
#070530 15:18:08 server id 12  end_log_pos 98   Start: binlog v 4, server v 5.0.34-enterprise-gpl created 070530 15:18:08
# at 98
#700101  1:00:00 server id 3  end_log_pos 0     Rotate to log-bin.000003  pos: 98
# at 139
#070529 22:14:24 server id 3  end_log_pos 0     Start: binlog v 4, server v 5.0.40-enterprise-gpl-log created 070529 22:14:24
# at 233
#070530 15:18:57 server id 3  end_log_pos 184   Query   thread_id=22    exec_time=0     error_code=0
use test;
SET TIMESTAMP=1180534737;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
/*!\C latin1 */;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t2 (i int);
# at 319
#070530 15:19:07 server id 3  end_log_pos 272   Query   thread_id=22    exec_time=0     error_code=0
SET TIMESTAMP=1180534747;
insert into t2 values (1);
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;

How to repeat:
See description.
[28 Jan 2008 20:23] Omer Barnir
Workaround: Use mysqlbinlog to get the information
[9 Feb 2009 9:02] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/65570

2793 Leonard Zhou	2009-02-09
      Bug#28777 show binlog events can work with relay log
[11 Feb 2009 9:04] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/65852

2793 Leonard Zhou	2009-02-11
      Bug#28777 show binlog events can work on relay log
      
      Show binlog event can't work on relay log.
      
      Check relay log when do mysql 'show binlog event', so this command can work on both bin log and relay log.
[5 May 2009 16:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/73407

2844 Luis Soares	2009-05-05
      BUG#28777: SHOW BINLOG EVENTS does not work on relay log files
      
      SHOW BINLOG EVENTS does not work with relay log files. If issuing
      "SHOW BINLOG EVENTS IN 'relay-log.000001'" in a non-empty relay log
      file (relay-log.000001), mysql reports empty set.
      
      This patch addresses this issue by extending the SHOW command with
      RELAYLOG. Events in relay log files can now be inspected by issuing
      SHOW RELAYLOG EVENTS [IN 'file'] [FROM position].
     @ mysql-test/include/show_binlog_events.inc
        Added option $log_file so that show_binlog_events can take log file
        name as argument.
     @ mysql-test/include/show_relaylog_events.inc
        Clone of show_binlog_events for relaylog events.
     @ mysql-test/suite/rpl/include/rpl_show_relaylog_events.inc
        Shared part of the test case.
     @ mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test
        Test case for row based replication.
     @ mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test
        Test case for statement and mixed mode replication.
     @ sql/lex.h
        Added RELAYLOG symbol.
     @ sql/mysqld.cc
        Added "show_relaylog_events" to status_vars.
     @ sql/sp_head.cc
        Set SQLCOM_SHOW_RELAYLOG_EVENTS to return flags=
        sp_head::MULTI_RESULTS; in sp_get_flags_for_command as
        SQLCOM_SHOW_BINLOG_EVENTS does.
     @ sql/sql_lex.h
        Added sql_command SQLCOM_SHOW_RELAYLOG_EVENTS to lex enum_sql_command.
     @ sql/sql_parse.cc
        Added handling of SQLCOM_SHOW_RELAYLOG_EVENTS.
     @ sql/sql_repl.cc
        mysql_show_binlog_events set to choose the log file to use based on
        the command issued (SHOW BINLOG|RELAYLOG EVENTS).
     @ sql/sql_yacc.yy
        Added RELAYLOG to the grammar.
[13 May 2009 11:04] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/73931

2844 Luis Soares	2009-05-13
      BUG#28777: SHOW BINLOG EVENTS does not work on relay log files
            
      SHOW BINLOG EVENTS does not work with relay log files. If issuing
      "SHOW BINLOG EVENTS IN 'relay-log.000001'" in a non-empty relay log
      file (relay-log.000001), mysql reports empty set.
            
      This patch addresses this issue by extending the SHOW command with
      RELAYLOG. Events in relay log files can now be inspected by issuing
      SHOW RELAYLOG EVENTS [IN 'log_name'] [FROM pos] 
      [LIMIT [offset,] row_count].
     @ mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc
        Shared part of the test case.
     @ mysql-test/include/show_binlog_events.inc
        Added options $binary_log_file, $binary_log_limit_row, 
        $binary_log_limit_offset so that show_binlog_events can take 
        same parameters as SHOW BINLOG EVENTS does.
     @ mysql-test/include/show_relaylog_events.inc
        Clone of show_binlog_events for relaylog events.
     @ mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test
        Test case for row based replication.
     @ mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test
        Test case for statement and mixed mode replication.
     @ sql/lex.h
        Added RELAYLOG symbol.
     @ sql/mysqld.cc
        Added "show_relaylog_events" to status_vars.
     @ sql/sp_head.cc
        Set SQLCOM_SHOW_RELAYLOG_EVENTS to return flags=
        sp_head::MULTI_RESULTS; in sp_get_flags_for_command as
        SQLCOM_SHOW_BINLOG_EVENTS does.
     @ sql/sql_lex.h
        Added sql_command SQLCOM_SHOW_RELAYLOG_EVENTS to lex enum_sql_command.
     @ sql/sql_parse.cc
        Added handling of SQLCOM_SHOW_RELAYLOG_EVENTS.
     @ sql/sql_repl.cc
        mysql_show_binlog_events set to choose the log file to use based on
        the command issued (SHOW BINLOG|RELAYLOG EVENTS).
     @ sql/sql_yacc.yy
        Added RELAYLOG to the grammar.
[14 May 2009 12:23] Luis Soares
Pushed to 6.0-rpl.
[1 Jun 2009 9:24] Lars Thalmann
See also WL#4293
[16 Jun 2009 14:57] Bugs System
Pushed into 5.4.4-alpha (revid:zhenxing.he@sun.com-20090612081554-kmu72j3wenjn82a8) (version source revid:zhenxing.he@sun.com-20090612034751-dqd4y0bv0iln1yaj) (merge vers: 5.4.4-alpha) (pib:7)
[17 Jun 2009 19:26] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090616183122-chjzbaa30qopdra9) (version source revid:zhenxing.he@sun.com-20090612034751-dqd4y0bv0iln1yaj) (merge vers: 5.4.4-alpha) (pib:11)
[24 Jun 2009 13:38] Jon Stephens
Documented in the mysql-5.4.4 changelog as follows:

      Because SHOW BINLOG EVENTS cannot be used to read events from 
      relay log files, a new SHOW RELAYLOG EVENTS statement has been 
      added for this purpose.
      
      [http://dev.mysql.com/doc/refman/5.4/en/show-relaylog-events.html]

Also added new section covering statement, should appear shortly as URL above.
[12 Aug 2009 21:40] Paul DuBois
Noted in 5.4.2 changelog because next 5.4 version will be 5.4.2 and not 5.4.4.
[14 Aug 2009 22:39] Paul DuBois
Ignore previous comment about 5.4.2.
[28 Sep 2009 22:59] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/84913

3112 Luis Soares	2009-09-28
      BUG#28777, WL#4293: SHOW BINLOG EVENTS does not work on relay log
      files
      
      NOTE: this is the backport to next-mr.
                  
      SHOW BINLOG EVENTS does not work with relay log files. If issuing
      "SHOW BINLOG EVENTS IN 'relay-log.000001'" in a non-empty relay
      log file (relay-log.000001), mysql reports empty set.
                  
      This patch addresses this issue by extending the SHOW command
      with RELAYLOG. Events in relay log files can now be inspected by
      issuing SHOW RELAYLOG EVENTS [IN 'log_name'] [FROM pos] [LIMIT
      [offset,] row_count].
      
      NOTE: backport to next-mr.
     @ mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc
        Shared part of the test case.
     @ mysql-test/include/show_binlog_events.inc
        Added options $binary_log_file, $binary_log_limit_row, 
        $binary_log_limit_offset so that show_binlog_events can take 
        same parameters as SHOW BINLOG EVENTS does.
     @ mysql-test/include/show_relaylog_events.inc
        Clone of show_binlog_events for relaylog events.
     @ mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test
        Test case for row based replication.
     @ mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test
        Test case for statement and mixed mode replication.
     @ sql/lex.h
        Added RELAYLOG symbol.
     @ sql/mysqld.cc
        Added "show_relaylog_events" to status_vars.
     @ sql/sp_head.cc
        Set SQLCOM_SHOW_RELAYLOG_EVENTS to return flags=
        sp_head::MULTI_RESULTS; in sp_get_flags_for_command as
        SQLCOM_SHOW_BINLOG_EVENTS does.
     @ sql/sql_lex.h
        Added sql_command SQLCOM_SHOW_RELAYLOG_EVENTS to lex enum_sql_command.
     @ sql/sql_parse.cc
        Added handling of SQLCOM_SHOW_RELAYLOG_EVENTS.
     @ sql/sql_repl.cc
        mysql_show_binlog_events set to choose the log file to use based on
        the command issued (SHOW BINLOG|RELAYLOG EVENTS).
     @ sql/sql_yacc.yy
        Added RELAYLOG to the grammar.
[28 Sep 2009 23:04] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/84914

3112 Luis Soares	2009-09-29
      BUG#28777, WL#4293: SHOW BINLOG EVENTS does not work on relay log
      files
      
      NOTE: this is the backport to next-mr.
                  
      SHOW BINLOG EVENTS does not work with relay log files. If issuing
      "SHOW BINLOG EVENTS IN 'relay-log.000001'" in a non-empty relay
      log file (relay-log.000001), mysql reports empty set.
                  
      This patch addresses this issue by extending the SHOW command
      with RELAYLOG. Events in relay log files can now be inspected by
      issuing SHOW RELAYLOG EVENTS [IN 'log_name'] [FROM pos] [LIMIT
      [offset,] row_count].
     @ mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc
        Shared part of the test case.
     @ mysql-test/include/show_binlog_events.inc
        Added options $binary_log_file, $binary_log_limit_row, 
        $binary_log_limit_offset so that show_binlog_events can take 
        same parameters as SHOW BINLOG EVENTS does.
     @ mysql-test/include/show_relaylog_events.inc
        Clone of show_binlog_events for relaylog events.
     @ mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test
        Test case for row based replication.
     @ mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test
        Test case for statement and mixed mode replication.
     @ sql/lex.h
        Added RELAYLOG symbol.
     @ sql/mysqld.cc
        Added "show_relaylog_events" to status_vars.
     @ sql/sp_head.cc
        Set SQLCOM_SHOW_RELAYLOG_EVENTS to return flags=
        sp_head::MULTI_RESULTS; in sp_get_flags_for_command as
        SQLCOM_SHOW_BINLOG_EVENTS does.
     @ sql/sql_lex.h
        Added sql_command SQLCOM_SHOW_RELAYLOG_EVENTS to lex enum_sql_command.
     @ sql/sql_parse.cc
        Added handling of SQLCOM_SHOW_RELAYLOG_EVENTS.
     @ sql/sql_repl.cc
        mysql_show_binlog_events set to choose the log file to use based on
        the command issued (SHOW BINLOG|RELAYLOG EVENTS).
     @ sql/sql_yacc.yy
        Added RELAYLOG to the grammar.
[27 Oct 2009 9:48] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091027094604-9p7kplu1vd2cvcju) (version source revid:zhenxing.he@sun.com-20091026140226-uhnqejkyqx1aeilc) (merge vers: 6.0.14-alpha) (pib:13)
[27 Oct 2009 18:37] Jon Stephens
Documented bugfix and SHOW RELAYLOG EVENTS in the 6.0.14 changelog as previously noted for 5.4.4.

Closed.
[12 Nov 2009 8:16] Bugs System
Pushed into 5.5.0-beta (revid:alik@sun.com-20091110093229-0bh5hix780cyeicl) (version source revid:alik@sun.com-20091027095744-rf45u3x3q5d1f5y0) (merge vers: 5.5.0-beta) (pib:13)
[12 Nov 2009 12:51] Jon Stephens
Bugfix also documented in the 5.5.0 changelog.

SHOW RELAYLOG EVENTS already documented in 5.5 Manual.

Closed.