WL#4293: Replication: show relay log events on slave

Affects: Server-5.5   —   Status: Complete   —   Priority: Very High

State of this work
==================

This work was completed as BUG#28777.


Summary
=======

Would be useful to have command for slave that should be very similar ``SHOW
BINLOG EVENTS`` for master. That command opens relay log on slave and shows
executed events. The syntax can be like that::

    SHOW RELAYLOG EVENTS


Rationale
=========

The main role for this command is to be used for forensics when the relay log
has become corrupt or to investigate the contents of the relay log and compare
with the binary log. It can, for example, be used to compare events on master
and or slave for circular replication or for relay master/slave when using
chained replication A -> B -> C.

SYNTAX
======

The grammar of the SHOW BINLOG EVENTS is extended to::

   SHOW {BINLOG | BINARY LOG | RELAYLOG} EVENTS
     [IN '*log_name*'] [FROM *pos*] [LIMIT [*offset*,] *row_count*]


SEMANTICS
=========

The ``SHOW BINLOG EVENTS`` and ``SHOW BINARY LOG EVENTS`` both show the contents
of the binary log and is no different from before. The command ``SHOW RELAYLOG``
events will show the contents of the relay log instead, assuming that the
server is a slave.

TESTING
=======

  The testing for this work was performed by writing an MTR test case
  (see BUG#28777). For each parameter in SHOW BINLOG EVENTS it tested
  on slave SHOW BINLOG/RELAYLOG and on master SHOW BINLOG (we might
  need to check also RELAYLOG on master just to be sure).

  The following table provides a better view on the tests done.
  BINLOG/RELAYLOG relate to the log in use (eg, SHOW BINLOG/RELAYLOG)
  and IN/FROM/LIMIT relate to parameters.


               BINLOG          RELAYLOG

           IN FROM LIMIT     IN FROM LIMIT
              
   master   x    x     x      -    -     -

   slave    x    x     x      x    x     x 


  Details on the test case can be found in the commit email at:

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