WL#10924: Deprecate expire_logs_days

Affects: Server-8.0   —   Status: Complete

Executive Summary
-----------------
This worklog adds a deprecation warning when users try to set expire_logs_days
either alone or along with binlog_expire_logs_seconds.

Background
----------
expire_logs_days is the number of days for automatic binary log file removal.
The default is 30, which means that the binary logs files will be purged after
30 days, if no other value is specified. Possible purge happens at start up and
when binary log is flushed.

Rationale
---------
In 8.0 a new variable binlog_expire_log_seconds was introduced. This allowed
users to set expire time which need not be integral multiple of days. This is
the better way to set the expiration time and also more flexible, it will make
the system variable expire_logs_days unneeded, so that should be deprecated in
8.0 and may be removed in later version.
REQUIREMENTS:
=============
FR1: server SHALL emit a warning, at server start time, when configuring
     expire-logs-days=NUMBER_OF_DAYS in the server configuration file
     (expire_logs_days=NUMBER_OF_DAYS)

FR2: server SHALL emit a warning, at server start time, when passing
     expire_logs_days=NUMBER_OF_DAYS as server start up option on command line.

FR3. Warning shall be emitted in the user session when setting
     GLOBAL expire_logs_days

FR4. Warning shall be emitted in the user session when the user reads the value   
     of GLOBAL expire_logs_days.

User visible changes:

- Server emits a deprecation warning when the expire_logs_days is set.

mysql> SET @@GLOBAL.expire_logs_days = 99;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> SHOW WARNINGS\G;
*************************** 1. row ***************************
  Level: Warning
   Code: 1287
Message: '@@expire_logs_days' is deprecated and will be removed in a future
release. Please use binlog_expire_logs_seconds instead.
1 row in set (0.00 sec)

- Server emits a deprecation warning when the  user selects expire_logs_days

mysql> SELECT  @@GLOBAL.expire_logs_days;
+---------------------------+
| @@GLOBAL.expire_logs_days |
+---------------------------+
|                        99 |
+---------------------------+
1 row in set, 1 warning (0.00 sec)

mysql> SHOW WARNINGS\G;
*************************** 1. row ***************************
  Level: Warning
   Code: 1287
Message: '@@expire_logs_days' is deprecated and will be removed in a future
release. Please use binlog_expire_logs_seconds instead.
1 row in set (0.00 sec)

-Server emits a deprecation warning at start-up and it is logged in the error log.

~/log/mysqld.1.err.warnings:2017-07-04T13:03:52.665533Z 0 [Warning] The syntax
'expire-logs-days' is 
deprecated and will be removed in a future release. Please use
'binlog_expire_logs_seconds' instead.

Upgrades
--------

After using MySQL 8, the user will get the deprecation warnings as
described in the previous section.  This however, shall not break
backwards compatibility.

Security
--------

There are no security considerations.

Observability
-------------

There are no observability considerations. There is no new
functionality added only a new warning is emitted.
1. Deploy conditional calls to push_deprecated_warn in get_options, so
   that the warning is pushed at server start time, if expire_logs_days is set.

2. Add deprecation test case validating server start warnings.

3. Change the system variable 'Sys_expire_logs_days' so that it adds a
   deprecation warning when it is being accessed/changed.