WL#10963: Deprecate IGNORE_SERVER_IDS when GTID_MODE=ON

Affects: Server-8.0   —   Status: Complete

EXECUTIVE SUMMARY
=================

This worklog adds a deprecation warning when users try to use
CHANGE MASTER TO IGNORE_SERVER_IDS together with GTID_MODE=ON.

Background
==========

IGNORE_SERVER_IDS is meant to be used during a fail-over in a circular topology.
Normally, events are prevented from infinitely circulating because they reach
the originating server, which filters out its own server_id. However, after a
fail-over where the circle is short-cut, nothing prevents events that originate
from the removed server from circulating infinitely. Therefore,
IGNORE_SERVER_IDS was introduced so that the removed server's events can be
manually filtered out.

Rationale
=========

When GTID_MODE=ON, any transaction that has been applied already is
automatically filtered out, so there is no need for IGNORE_SERVER_IDS.
Disabling IGNORE_SERVER_IDS with GTIDs is similar to other legacy
features disabled when GTIDs are enabled, e.g., sql_skip_slave_counter.

Proposal
========

- In next GA, generate deprecation warning when user executes
  CHANGE MASTER TO IGNORE_SERVER_IDS if GTID_MODE=ON

- In next GA, generate deprecation warning when user executes
  SET GTID_MODE=ON and some channel has previously set 
  CHANGE MASTER TO IGNORE_SERVER_IDS.

- In next next GA, disallow executing CHANGE MASTER TO IGNORE_SERVER_IDS
  if GTID_MODE=ON.

- In next next GA, disallow SET GTID_MODE=ON if some channel has
  previously set CHANGE MASTER TO IGNORE_SERVER_IDS.
REQUIREMENTS
============

FR1. Server shall emit a warning when the user configures
     IGNORE_SERVER_IDS and GTID_MODE=ON.

FR2. Server shall emit a warning when the user configures GTID_MODE=ON
     and some channel has IGNORE_SERVER_IDS configured.

FR3. Server shall not emit a warning when disabling IGNORE_SERVER_IDS,
     i.e., setting it to an empty list, and GTID_MODE=ON

FR4. Server shall not emit a warning when setting GTID_MODE != ON and
     IGNORE_SERVER_IDS is configured.
User Visible Changes
====================

- Server emits a deprecation warning when IGNORE_SERVER_IDS is set
  while GTID_MODE=ON. For example:

  mysql> CHANGE MASTER TO IGNORE_SERVER_IDS=(1,2,3);
  Query OK, 0 rows affected, 1 warning (0,00 sec)

  mysql> SHOW WARNINGS\G
  *************************** 1. row ***************************
    Level: Warning
     Code: 1287
  Message: 'CHANGE MASTER TO ... IGNORE_SERVER_IDS='...' (when GTID_MODE=ON)' is
deprecated and will be removed in a future release.
  1 row in set (0,00 sec)

- Server emits a warning when GTID_MODE=ON is set and
  IGNORE_SERVER_IDS is also set in some channel. For example:

  mysql> SET @@global.gtid_mode=ON;
  Query OK, 0 rows affected, 1 warning (0,00 sec)

  mysql> SHOW WARNINGS\G
  *************************** 1. row ***************************
    Level: Warning
     Code: 1287
  Message: 'CHANGE MASTER TO ... IGNORE_SERVER_IDS='...' (when GTID_MODE=ON)' is
deprecated and will be removed in a future release.
  1 row in set (0,00 sec)

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 emited.
LOW LEVEL CHANGES
=================

1. Add a member function to Master_info that states whether there are
   IGNORE_SERVER_IDS configured or not.

2. Create a static function issue_deprecation_warnings_for_channel
   that issues a deprecation warning when setting IGNORE_SERVER_IDS
   for a channel and GTID_MODE is ON.

   Deploy a call to this function in the change_master_cmd function
   after it runs successfully, so we get the deprecation warning only
   if there are no errors.

3. Create a function to emit a deprecation warning when changing the
   GTID_MODE value. It shall iterate over all channels and check if
   any of the channels has IGNORE_SERVER_IDS configured.

   Deploy a call to this function when updating GTID_MODE.

4. Write tests that validate the requirements.