WL#14171: Replication: replace SLAVE in SQL commands

Affects: Server-8.0   —   Status: Complete

# EXECUTIVE SUMMARY

This worklog implements aliases for START SLAVE, STOP SLAVE, SHOW
SLAVE STATUS, SHOW SLAVE HOSTS and RESET SLAVE. The aliases are START
REPLICA, STOP REPLICA, SHOW REPLICA STATUS, SHOW REPLICAS and RESET
REPLICA respectively.

# USER/DEV STORIES

As a MySQL admin user I want to issue replication commands that do not
contain offensive terms so that I do not get offended by them and/or
expose them to other people (e.g., customers of my application built
on top of MySQL).

# SCOPE

This worklog is part of a broader effort to change old terminology
across the entire MySQL product line. However, this worklog focuses
only on changing the terminology for the following commands/SQL
statements:

- START/STOP SLAVE
- SHOW SLAVE STATUS
- SHOW SLAVE HOSTS
- RESET SLAVE

Further changes are to be done on follow up work.

# LIMITS

N/A
FR1. SHOW REPLICA STATUS shall produce the same output as SHOW SLAVE
     STATUS, except that the field names shall show Replica instead of
     Slave and Source instead of Master.

FR2. SHOW SLAVE STATUS shall not be modified other than emitting a
     standard deprecation warning stating that the new syntax must be
     used.

FR3. SHOW REPLICAS shall produce the same output as SHOW SLAVE STATUS,
     except that the field names shall show Replica instead of Slave
     and Source instead of Master.

FR4. SHOW SLAVE HOSTS shall not be modified other than emitting a
     standard deprecation warning stating that the new syntax must be
     used.

FR5. RESET REPLICA shall be an alias for RESET SLAVE.

FR6. RESET SLAVE shall emit a standard deprecation warning stating
     that the new syntax (RESET REPLICA) must be used.

FR7. START REPLICA shall be an alias for START SLAVE.

FR8. START SLAVE shall emit a standard deprecation warning stating
     that the new syntax (START REPLICA) must be used.

FR9. STOP REPLICA shall be an alias for STOP SLAVE.

FR10. STOP SLAVE shall emit a standard deprecation warning stating
      that the new syntax (STOP REPLICA) must be used.

FR11. The data in the Until_Condition field in SHOW REPLICA STATUS
      shall replace the value "Master" with "Source".
# SUMMARY OF THE APPROACH

- We replace Slave with Replica in the commands changed.

- We replace Master with Source in the field names that are output by
  the commands when using the new syntax.

- We replace Slave with Replica in the field names that are output by
  the commands when using the new syntax.

- We rename a couple of status variables.

# SECURITY CONTEXT

No security implications.

# UPGRADE/DOWNGRADE and CROSS-VERSION REPLICATION

## New Statements

New statements will be introduced to replace old statements.

There are no upgrade/downgrade or cross-version replication
implications, except for the fact that statements being replaced will
now emit deprecation warnings.

## Status variables renamed

The following status variables have the following aliases:

- Com_slave_start => Com_replica_start
- Com_slave_stop => Com_replica_stop
- Com_show_slave_status => Com_show_replica_status
- Com_show_slave_hosts => Com_show_replicas

# USER INTERFACE

## Alias for old statements

- An alias is introduced for SHOW SLAVE STATUS: SHOW REPLICA STATUS
- An alias is introduced for SHOW SLAVE HOSTS: SHOW REPLICAS
- An alias is introduced for RESET SLAVE: RESET REPLICA
- An alias is introduced for START SLAVE: START REPLICA
- An alias is introduced for STOP SLAVE: STOP REPLICA

## Deprecation warnings

- Deprecation warnings will be emitted for the old statements.

# OBSERVABILITY

## Status Variables Change

The following status variables have correspondent aliases:

- Com_slave_start => Com_replica_start
- Com_slave_stop => Com_replica_stop
- Com_show_slave_status => Com_show_replica_status
- Com_show_slave_hosts => Com_show_replicas

Note that this is a breaking change, as it introduces 4 new status
vars. It is still a breaking change, but the chances of breaking
existing apps (monitoring tools) are smaller than simply renaming
the variables.

## New Syntax

When using the new syntax, the name of the fields in the output of
SHOW REPLICA STATUS and SHOW REPLICAS also changes in such a way that
every "Master" is replace by "Source" and every "Slave" is replaced by
"Replica".

## BUILD, DEPLOY and INSTALL

Nothing worth noting, except for the new aliases.

## PROTOCOL

No protocol implications.

## FAILURE MODEL SPECIFICATION

No changes to the failure model.

## PERFORMANCE AND EFFICIENCY

No performance implication.
Low Level Design

# DESIGN IMPLEMENTATION STEPS

1. Change the parser to add alias for the SLAVE symbol.

2. Change the parser to add (SHOW) REPLICAS as an alias to (SHOW)
   SLAVE HOSTS.

2. Deploy deprecation warnings to the parser, when using the SLAVE
   symbol or SLAVE HOSTS.

3. Change the SHOW SLAVE STATUS and SHOW SLAVE HOSTS implementation to
   rename the fields in the output (Slave -> Replica, Master ->
   Source).

4. Deploy a filter that rename the fields back into the old names when
   using the old syntax.

5. Change the test suite to use the new syntax and thus avoid the
   deprecation warnings.