WL#5465: System variables: paths to relay log and binary log files

Affects: Server-5.6   —   Status: Complete

It is currently possible to get the path to the relay log index file, but not to
the binlog index file.

The goal of the worklog is to revise the system variables to get access to relay
log and binary log files.


Description
===========

The ``relay_log`` and ``relay_log_index`` variables show the value supplied to
the options, but not the actual value used. So, for example, to figure out what
file that the ``relay_log_index`` is being written to, it is necessary to use
something like this function:

    CREATE FUNCTION relay_log_index_file () RETURNS VARCHAR(256)
    BEGIN
      DECLARE rli_name VARCHAR(256);
      IF @@relay_log_index IS NOT NULL THEN
        SET rli_name = @@relay_log_index;
      ELSEIF @@relay_log IS NOT NULL THEN
        SET rli_name = @@relay_log;
      ELSE
        SET rli_name =
    CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(@@pid_file, '/', -1), '.',
    1), '-relay-bin.index');
      END IF;

      IF LEFT(rli_name, 1) != '/' THEN
        SET rli_name = CONCAT(@@datadir, rli_name);
      END IF;

      RETURN rli_name;
    END

On my scale, that does not register as "useful". If the variables held the path
to the actual files used (file base in the case of the relay_log system
variable) it would significantly simplify the job of finding these files.

This worklog extends the server so that:

* The @@relay_log_index and @@log_bin_index variables would contain
  the full path to the relay log and binary log index files
  respectively.

  This would mean that @@relay_log_index would change value compared to
  previous versions, but it is only significant in the case that a relative
  value (or no value) is provided to the option and the value is used for
  other purposes than for finding the location of the relay-log index file.

* The two variables @@relay_log_file and @@log_bin_file are introduced, 
  holding the path + basename of the relay log files and binary log files
  respectively.


Open Issues
===========

- What version of the server shall the variable be added to?


Closed Issues
=============

None
Open Issues
===========

- Shall we use "_name", "_file", or "_path" as suffix for the relay_log_X and
  log_bin_X variables?

  Informal voting in the replication team suggested to use "_basename".

Variable specification
======================

This section contain the specification of the variables.

relay_log_basename
--------------

:Variable Name: relay_log_basename
:Variable Scope: Global
:Dynamic Variable: No

The variable shows the full path to the relay log files, excluding the extension
added by the server.

Default is @@datadir + '/' + basename(@@pid_file) + '-relay-bin'


log_bin_basename
------------

:Variable Name: log_bin_basename
:Variable Scope: Global
:Dynamic Variable: No

The variable shows the full path to the binary log files, excluding the
extension added by the server.

Default is @@datadir + '/' + basename(@@pid_file) + '-bin'


log_bin_index
-------------

:Variable Name: log_bin_index
:Variable Scope: Global
:Dynamic Variable: No

The variable shows the full path to the binary log index file.

Default is @@log_bin_basename + '.index'


relay_log_index
---------------

:Variable Name: relay_log_index
:Variable Scope: Global
:Dynamic Variable: No

The variable shows the full path to the relay log index file.

Default is @@relay_log_basename + '.index'