[MDEV-19855] Create "Sql_cmd_show_slave_status" class for "SHOW SLAVE STATUS" command. Created: 2019-06-25  Updated: 2020-08-25  Resolved: 2019-07-02

Status: Closed
Project: MariaDB Server
Component/s: Parser
Fix Version/s: 10.5.0

Type: Task Priority: Critical
Reporter: Sujatha Sivakumar (Inactive) Assignee: Sujatha Sivakumar (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-18777 Rename or alias slave-related stateme... Stalled

 Description   

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
secondary server.

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
procedures.

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:
case SQLCOM_SHOW_SLAVE_STAT:

{ ... }

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.



 Comments   
Comment by Sujatha Sivakumar (Inactive) [ 2019-06-25 ]

Hello Bar,

Can you please review the changes for MDEV-19855.
BB link: http://buildbot.askmonty.org/buildbot/grid?category=main&branch=bb-10.5-sujatha

The patch is available in commit email list.

Thank you.

Comment by Alexander Barkov [ 2019-06-26 ]

The patch looks fine. Ok to push.

Comment by Andrei Elkin [ 2019-07-01 ]

The ticket idea is reasonable and the committed patch follows it well. Approved.

Generated at Thu Feb 08 08:54:53 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.