As part of MDEV-18777 new alias named "REPLICA" is added for "SLAVE".
One possible option is to add a new member to Lex to capture the name specified for
Like thd->lex->secondary_name= SLAVE/REPLICA. But there are following limitations
in implementing this solution.
LEX is so huge, it uses a lot of memory.
Inside SP, many statements, for example an assignment statement,
use their own LEX per statement. As a result, stored procedures use too
much memory. Also, LEX initialization is very expensive. Currently
server spends too much CPU to initalize LEXes, especially in stored
We're doing the other way around: remove all specific members from LEX.
Please do the following way:
1. Add a new class Sql_cmd_show_slave_status
2. Move this code:
from mysql_execute_command() to Sql_cmd_show_slave_status::execute().
3. Add a new member which will distinguish between SLAVE and REPLICA
into this new class Sql_cmd_show_slave_status, instead of LEX.
4. Adjust the rest of the code to use the new class instead
of a "case" in mysql_execute_command().
For example, add "new Sql_cmd_show_slave_status" into sql_yacc.yy and sql_yacc_ora.yy
Please also add a member "verbose" in Sql_cmd_show_slave_status
and use it instead of LEX::verbose for SHOW SLAVE purposes.