← Back to team overview

maria-developers team mailing list archive

Re: Mdev-10664 Add statuses about optimistic parallel replication stalls.

 

Sachin, howdy.

While the latest patch is pretty I still see potential to improve it,
please find A[0-9]+ prefixed annotations below.
Thank you for addressing earlier comments!

> Hi Andrei, Kristian !
>
> Sorry for late reply (I was on vacation , and there was
> very less 10.3 sprint)
>
> On Sat, Feb 10, 2018 at 5:42 PM, <andrei.elkin@xxxxxxxxxx>
> wrote:
>
>     Sachin, hello.
>
>     I've read through your latest patch as well as did so
>     to the current
>     mail thread.
>     On previous rounds there were few notes raised by
>     Kristian. I see that
>     they got addressed.
>    
>     I got few requests of myself as we spoke yesterday
>    
>      1. Let's count the transactional groups as well for
>     consistency so that
>         the total count of all *taken* to execution groups
>     would be gained
>         as simple as summing of the three kinds.
>
> Done. 
>
>      2. Suggest to name them all with '_groups' suffix:
>    
>         DDL_groups, Non_transactiona_groups,
>     Transactional_groups
>
> Done, But I have added Slave as prefix. 
>
>         'Event' is still defined as a sort of a statement,
>     or the minimum
>          indivisible piece of work by a slave applier. 
>     But the patch counts
>          Gtids that head any of the tree group of events,
>     so it should be
>          the '_groups' suffix imo.  Sure, check with Ian
>     (cc:d).
>          I see Kristian was somewhat sceptical about using
>     'group' as an offical
>          term, but that's the most natural way to name the
>     object at hand.
>          For instace the transactional group is the same
>     as just the
>          transaction (provided that `mysql.gtid_slave_pos`
>     table is of the
>          same transactional type).
>    
>       3. Make sure we document the counters are optimistic
>     in sense they are
>          incremented in the beginning of a group execution
>     before knowing
>          its outcome.
>
> I am counting events in Gtid_log_event::do_apply_event ,
> So counter is optimistic. 
>
>       4. Always head new [test] files with comments
>     explaining top-level of the test content.
>          Specifcially to mention what is tested, and what
>     are results of that.
>
> Done. 
>
>     While the patch is certainly good,
>     I would like to have another look at the final patch
>     to approve
>     formally.
>    
>     Cheers,
>    
>     Andrei
>
> Patch link 
> http://lists.askmonty.org/pipermail/commits/2018-March/012136.html

revision-id: 6b2b2a56f91b93ab2ac5e30fc32465631e0d0c47 (mariadb-10.3.5-25-g6b2b2a5)
parent(s): ad647cc84ebf331d59b24e81bffe89be2f5b1ed7
author: Sachin Setiya
committer: Sachin Setiya
timestamp: 2018-03-26 12:23:18 +0530
message:

Mdev-10664 Add statuses about optimistic parallel replication stalls

In this commit we are adding three more status variable to SHOW SLAVE
STATUS.  Slave_DDL_Events and Slave_Non_Transactional_Events.

Slave_DDL_Groups:- This status variable counts the occurrence of DDL
statements

Slave_Non_Transactional_Groups:- This variable count the occurrence
of non-transnational event group.

Slave_Transactional_Groups:- This variable count the occurrence
of transnational event group.

Patch Credit:- Kristian Nielsen

---
 mysql-test/include/check-testcase.test             |   5 +-
 mysql-test/suite/multi_source/info_logs.result     |  12 +-
 .../suite/multi_source/multi_parallel.result       | 230 +++++++++++++++++++++
 mysql-test/suite/multi_source/multi_parallel.test  | 155 ++++++++++++++
 mysql-test/suite/multi_source/reset_slave.result   |   8 +-
 mysql-test/suite/multi_source/simple.result        |  23 ++-
 mysql-test/suite/multi_source/syntax.result        |   6 +-
 sql/log_event.cc                                   |  10 +
 sql/rpl_mi.cc                                      |   3 +-
 sql/rpl_mi.h                                       |  10 +
 sql/slave.cc                                       |  24 +++
 11 files changed, 461 insertions(+), 25 deletions(-)

diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test
index 4ca5398..3c164ee 100644
--- a/mysql-test/include/check-testcase.test
+++ b/mysql-test/include/check-testcase.test
@@ -70,10 +70,13 @@ if ($tmp)
   --echo SQL_Delay     0
   --echo SQL_Remaining_Delay   NULL
   --echo Slave_SQL_Running_State       
+  --echo Slave_DDL_Groups      #
+  --echo Slave_Non_Transactional_Groups        #
+  --echo Slave_Transactional_Groups    #
 }
 if (!$tmp) {
   # Note: after WL#5177, fields 13-18 shall not be filtered-out.
-  --replace_column 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 22 # 23 # 24 # 25 # 26 # 40 # 41 # 42 # 44 #
+  --replace_column 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 22 # 23 # 24 # 25 # 26 # 40 # 41 # 42 # 44 # 51 # 52 # 53 #
   query_vertical
   SHOW SLAVE STATUS;
 }
diff --git a/mysql-test/suite/multi_source/info_logs.result b/mysql-test/suite/multi_source/info_logs.result
index e177c98..531a617 100644
--- a/mysql-test/suite/multi_source/info_logs.result
+++ b/mysql-test/suite/multi_source/info_logs.result
@@ -89,17 +89,17 @@ MASTER 2.2
 # EOF
 #
 show all slaves status;
-Connection_name        Slave_SQL_State Slave_IO_State  Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Retried_transactions    Max_relay_log_size      Executed_log_entries    Slave_received_heartbeats
        Slave_h
 eartbeat_period        Gtid_Slave_Pos
-       Slave has read all relay log; waiting for the slave I/O thread to update it     Waiting for master to send event        127.0.0.1       root    MYPORT_1        60      master-bin.000001       <read_master_log_pos>   relay.000002    <relay_log_pos> master-bin.000001       Yes     Yes                                                     0               0       <read_master_log_pos>   <relay_log_space1>      None            0       No                                              0       No      0               0                       1                       No                              conservative    0       NULL    Slave has read all relay log; waiting for the slave I/O thread to update it     0       1073741824      7       0       60.000  
-MASTER 2.2     Slave has read all relay log; waiting for the slave I/O thread to update it     Waiting for master to send event        127.0.0.1       root    MYPORT_2        60      master-bin.000001       <read_master_log_pos>   relay-master at 00202@002e2.000002      <relay_log_pos> master-bin.000001       Yes     Yes                                                     0               0       <read_master_log_pos>   <relay_log_space2>      None            0       No                                              0       No      0               0                       2                       No                              conservative    0       NULL    Slave has read all relay log; waiting for the slave I/O thread to update it     0       1073741824      7       0       60.000  
+Connection_name        Slave_SQL_State Slave_IO_State  Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Slave_DDL_Groups        Slave_Non_Transactional_Groups  Slave_Transactional_Groups      Retried_tra
 nsaction
 s      Max_relay_log_size      Executed_log_entries    Slave_received_heartbeats       Slave_heartbeat_period  Gtid_Slave_Pos
+       Slave has read all relay log; waiting for the slave I/O thread to update it     Waiting for master to send event        127.0.0.1       root    MYPORT_1        60      master-bin.000001       <read_master_log_pos>   relay.000002    <relay_log_pos> master-bin.000001       Yes     Yes                                                     0               0       <read_master_log_pos>   <relay_log_space1>      None            0       No                                              0       No      0               0                       1                       No                              conservative    0       NULL    Slave has read all relay log; waiting for the slave I/O thread to update it     0       0       0       0       1073741824      7       0       60.000  
+MASTER 2.2     Slave has read all relay log; waiting for the slave I/O thread to update it     Waiting for master to send event        127.0.0.1       root    MYPORT_2        60      master-bin.000001       <read_master_log_pos>   relay-master at 00202@002e2.000002      <relay_log_pos> master-bin.000001       Yes     Yes                                                     0               0       <read_master_log_pos>   <relay_log_space2>      None            0       No                                              0       No      0               0                       2                       No                              conservative    0       NULL    Slave has read all relay log; waiting for the slave I/O thread to update it     0       0       0       0       1073741824      7       0       60.000  
 include/wait_for_slave_to_start.inc
 set default_master_connection = 'MASTER 2.2';
 include/wait_for_slave_to_start.inc
 set default_master_connection = '';
 show all slaves status;
-Connection_name        Slave_SQL_State Slave_IO_State  Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Retried_transactions    Max_relay_log_size      Executed_log_entries    Slave_received_heartbeats
        Slave_h
 eartbeat_period        Gtid_Slave_Pos
-       Slave has read all relay log; waiting for the slave I/O thread to update it     Waiting for master to send event        127.0.0.1       root    MYPORT_1        60      master-bin.000001       <read_master_log_pos>   relay.000004    <relay_log_pos> master-bin.000001       Yes     Yes                                                     0               0       <read_master_log_pos>   <relay_log_space1>      None            0       No                                              0       No      0               0                       1                       No                              conservative    0       NULL    Slave has read all relay log; waiting for the slave I/O thread to update it     0       1073741824      6       0       60.000  
-MASTER 2.2     Slave has read all relay log; waiting for the slave I/O thread to update it     Waiting for master to send event        127.0.0.1       root    MYPORT_2        60      master-bin.000001       <read_master_log_pos>   relay-master at 00202@002e2.000004      <relay_log_pos> master-bin.000001       Yes     Yes                                                     0               0       <read_master_log_pos>   <relay_log_space2>      None            0       No                                              0       No      0               0                       2                       No                              conservative    0       NULL    Slave has read all relay log; waiting for the slave I/O thread to update it     0       1073741824      6       0       60.000  
+Connection_name        Slave_SQL_State Slave_IO_State  Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Slave_DDL_Groups        Slave_Non_Transactional_Groups  Slave_Transactional_Groups      Retried_tra
 nsaction
 s      Max_relay_log_size      Executed_log_entries    Slave_received_heartbeats       Slave_heartbeat_period  Gtid_Slave_Pos
+       Slave has read all relay log; waiting for the slave I/O thread to update it     Waiting for master to send event        127.0.0.1       root    MYPORT_1        60      master-bin.000001       <read_master_log_pos>   relay.000004    <relay_log_pos> master-bin.000001       Yes     Yes                                                     0               0       <read_master_log_pos>   <relay_log_space1>      None            0       No                                              0       No      0               0                       1                       No                              conservative    0       NULL    Slave has read all relay log; waiting for the slave I/O thread to update it     0       0       0       0       1073741824      6       0       60.000  
+MASTER 2.2     Slave has read all relay log; waiting for the slave I/O thread to update it     Waiting for master to send event        127.0.0.1       root    MYPORT_2        60      master-bin.000001       <read_master_log_pos>   relay-master at 00202@002e2.000004      <relay_log_pos> master-bin.000001       Yes     Yes                                                     0               0       <read_master_log_pos>   <relay_log_space2>      None            0       No                                              0       No      0               0                       2                       No                              conservative    0       NULL    Slave has read all relay log; waiting for the slave I/O thread to update it     0       0       0       0       1073741824      6       0       60.000  
 #
 # List of files matching '*info*' pattern
 #   after slave server restart
diff --git a/mysql-test/suite/multi_source/multi_parallel.result b/mysql-test/suite/multi_source/multi_parallel.result
new file mode 100644
index 0000000..c2f1131
--- /dev/null
+++ b/mysql-test/suite/multi_source/multi_parallel.result
@@ -0,0 +1,230 @@
+connect  master1,127.0.0.1,root,,,$SERVER_MYPORT_1;
+connect  master2,127.0.0.1,root,,,$SERVER_MYPORT_2;
+connect  slave,127.0.0.1,root,,,$SERVER_MYPORT_3;
+set global slave_parallel_threads=10;
+change master 'master1' to
+master_port=MYPORT_1,
+master_host='127.0.0.1',
+master_user='root';
+change master 'master2' to
+master_port=MYPORT_2,
+master_host='127.0.0.1',
+master_user='root';
+start all slaves;
+Warnings:
+Note   1937    SLAVE 'master2' started
+Note   1937    SLAVE 'master1' started
+set default_master_connection = 'master1';
+include/wait_for_slave_to_start.inc
+set default_master_connection = 'master2';
+include/wait_for_slave_to_start.inc
+## Slave status variable
+set default_master_connection = 'master1';
+show status like 'slave_running';
+Variable_name  Value
+Slave_running  ON
+set default_master_connection = 'master2';
+show status like 'slave_running';
+Variable_name  Value
+Slave_running  ON
+#master 1

A1. I would turn off query logging inside two loops
to avoid useless print-outs like below:

+connection master1;
+create table t1(a int primary key) engine=myisam;
+insert into t1 values(1);
+insert into t1 values(2);
+drop table t1;
+create table t1(a int primary key) engine=myisam;
+insert into t1 values(1);
+insert into t1 values(2);
+drop table t1;
+create table t1(a int primary key) engine=myisam;
+insert into t1 values(1);
+insert into t1 values(2);
+drop table t1;
+create table t1(a int primary key) engine=myisam;
+insert into t1 values(1);
+insert into t1 values(2);
+drop table t1;
+create table t1(a int primary key) engine=myisam;
+insert into t1 values(1);
+insert into t1 values(2);
+drop table t1;
+create table t1(a int primary key) engine=myisam;
+insert into t1 values(1);
+insert into t1 values(2);
+drop table t1;
+create table t1(a int primary key) engine=myisam;
+insert into t1 values(1);
+insert into t1 values(2);
+drop table t1;
+create table t1(a int primary key) engine=myisam;
+insert into t1 values(1);
+insert into t1 values(2);
+drop table t1;
+create table t1(a int primary key) engine=myisam;
+insert into t1 values(1);
+insert into t1 values(2);
+drop table t1;
+create table t1(a int primary key) engine=myisam;
+insert into t1 values(1);
+insert into t1 values(2);
+drop table t1;
+connection slave;
+Slave_DDL_Groups= 20;
+Slave_Non_Transactional_Groups= 40;
+Slave__Transactional_Groups= 0;
+#master 2
+connection master2;
+create table t2(a int primary key) engine=myisam;
+insert into t2 values(1);
+insert into t2 values(2);
+drop table t2;
+create table t2(a int primary key) engine=myisam;
+insert into t2 values(1);
+insert into t2 values(2);
+drop table t2;
+create table t2(a int primary key) engine=myisam;
+insert into t2 values(1);
+insert into t2 values(2);
+drop table t2;
+create table t2(a int primary key) engine=myisam;
+insert into t2 values(1);
+insert into t2 values(2);
+drop table t2;
+create table t2(a int primary key) engine=myisam;
+insert into t2 values(1);
+insert into t2 values(2);
+drop table t2;
+create table t2(a int primary key) engine=myisam;
+insert into t2 values(1);
+insert into t2 values(2);
+drop table t2;
+create table t2(a int primary key) engine=myisam;
+insert into t2 values(1);
+insert into t2 values(2);
+drop table t2;
+create table t2(a int primary key) engine=myisam;
+insert into t2 values(1);
+insert into t2 values(2);
+drop table t2;
+create table t2(a int primary key) engine=myisam;
+insert into t2 values(1);
+insert into t2 values(2);
+drop table t2;
+connection slave;
+Slave_DDL_Groups= 18;
+Slave_Non_Transactional_Groups= 36;
+Slave_Transactional_Groups= 0;
+#master 1
+connection master1;
+create table t1(a int primary key) engine=innodb;
+insert into t1 values(1);
+insert into t1 values(2);
+show create table t1;
+Table  Create Table
+t1     CREATE TABLE `t1` (
+  `a` int(11) NOT NULL,
+  PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+create table t1(a int primary key) engine=innodb;
+insert into t1 values(1);
+insert into t1 values(2);
+show create table t1;
+Table  Create Table
+t1     CREATE TABLE `t1` (
+  `a` int(11) NOT NULL,
+  PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+create table t1(a int primary key) engine=innodb;
+insert into t1 values(1);
+insert into t1 values(2);
+show create table t1;
+Table  Create Table
+t1     CREATE TABLE `t1` (
+  `a` int(11) NOT NULL,
+  PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+create table t1(a int primary key) engine=innodb;
+insert into t1 values(1);
+insert into t1 values(2);
+show create table t1;
+Table  Create Table
+t1     CREATE TABLE `t1` (
+  `a` int(11) NOT NULL,
+  PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+create table t1(a int primary key) engine=innodb;
+insert into t1 values(1);
+insert into t1 values(2);
+show create table t1;
+Table  Create Table
+t1     CREATE TABLE `t1` (
+  `a` int(11) NOT NULL,
+  PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+create table t1(a int primary key) engine=innodb;
+insert into t1 values(1);
+insert into t1 values(2);
+show create table t1;
+Table  Create Table
+t1     CREATE TABLE `t1` (
+  `a` int(11) NOT NULL,
+  PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+create table t1(a int primary key) engine=innodb;
+insert into t1 values(1);
+insert into t1 values(2);
+show create table t1;
+Table  Create Table
+t1     CREATE TABLE `t1` (
+  `a` int(11) NOT NULL,
+  PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+create table t1(a int primary key) engine=innodb;
+insert into t1 values(1);
+insert into t1 values(2);
+show create table t1;
+Table  Create Table
+t1     CREATE TABLE `t1` (
+  `a` int(11) NOT NULL,
+  PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+create table t1(a int primary key) engine=innodb;
+insert into t1 values(1);
+insert into t1 values(2);
+show create table t1;
+Table  Create Table
+t1     CREATE TABLE `t1` (
+  `a` int(11) NOT NULL,
+  PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+connection slave;
+Slave_DDL_Groups= 38;
+Slave_Non_Transactional_Groups= 58;
+Slave_Transactional_Groups= 18;
+stop all slaves;
+Warnings:
+Note   1938    SLAVE 'master2' stopped
+Note   1938    SLAVE 'master1' stopped
+set default_master_connection = 'master1';
+include/wait_for_slave_to_stop.inc
+set default_master_connection = 'master2';
+include/wait_for_slave_to_stop.inc
+set global slave_parallel_threads=0;
+include/reset_master_slave.inc
+disconnect slave;
+connection master1;
+include/reset_master_slave.inc
+disconnect master1;
+connection master2;
+include/reset_master_slave.inc
+disconnect master2;
diff --git a/mysql-test/suite/multi_source/multi_parallel.test b/mysql-test/suite/multi_source/multi_parallel.test
new file mode 100644
index 0000000..9b13635

A2. The test contains two loops which are supposed to be identical
requiring only different table names. But you also make the loop limit different
which is a triffle thing *but* there is a bigger issue in that we are
better off to reuse any piece of code. Why won't we turn the explicit
loops
into a macro to it twice with any number of parameters to twist (I've
counted one)?
(You many --{dis,en}able_query_log in the macro)

--- /dev/null
+++ b/mysql-test/suite/multi_source/multi_parallel.test
@@ -0,0 +1,155 @@
+# This test file tests events counter like Slave_ddl_groups,
+# Slave_non_transactional_groups, Slave_transactional_groups
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+--let $rpl_server_count= 0
+
+--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1)
+--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2)
+--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
+
+#save state
+--let $par_thd= `select @@slave_parallel_threads;`
+
+set global slave_parallel_threads=10;
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+eval change master 'master1' to
+master_port=$SERVER_MYPORT_1,
+master_host='127.0.0.1',
+master_user='root';
+
+--replace_result $SERVER_MYPORT_2 MYPORT_2
+eval change master 'master2' to
+master_port=$SERVER_MYPORT_2,
+master_host='127.0.0.1',
+master_user='root';
+
+
+#start all slaves
+
+start all slaves;
+
+set default_master_connection = 'master1';
+--source include/wait_for_slave_to_start.inc
+
+set default_master_connection = 'master2';
+--source include/wait_for_slave_to_start.inc
+
+--echo ## Slave status variable
+
+set default_master_connection = 'master1';
+show status like 'slave_running';
+
+set default_master_connection = 'master2';
+show status like 'slave_running';
+
+
+--echo #master 1
+--connection master1
+
+--let $counter=10
+while ($counter)
+{
+  #DDL statement
+  create table t1(a int primary key) engine=myisam;
+
+  #non trans update statement
+  insert into t1 values(1);
+  insert into t1 values(2);
+
+  drop table t1;
+  --dec $counter
+}
+--save_master_pos
+
+--connection slave
+
+--sync_with_master 0,'master1'
+--let $status= query_get_value(show slave 'master1' status, Slave_DDL_Groups, 1)
+--echo Slave_DDL_Groups= $status;
+
+--let $status= query_get_value(show slave 'master1' status, Slave_Non_Transactional_Groups, 1)
+--echo Slave_Non_Transactional_Groups= $status;
+
+--let $status= query_get_value(show slave 'master1' status, Slave_Transactional_Groups, 1)
+--echo Slave__Transactional_Groups= $status;
+
+--echo #master 2
+--connection master2
+
+--let $counter=9
+while ($counter)
+{
+  #DDL statement
+  create table t2(a int primary key) engine=myisam;
+
+  #non trans update statement
+  insert into t2 values(1);
+  insert into t2 values(2);
+
+  drop table t2;
+  --dec $counter
+}
+--save_master_pos
+
+--connection slave
+--sync_with_master 0,'master2'
+--let $status= query_get_value(show slave 'master2' status, Slave_DDL_Groups, 1)
+--echo Slave_DDL_Groups= $status;
+
+--let $status= query_get_value(show slave 'master2' status, Slave_Non_Transactional_Groups, 1)
+--echo Slave_Non_Transactional_Groups= $status;
+
+--let $status= query_get_value(show slave 'master2' status, Slave_Transactional_Groups, 1)
+--echo Slave_Transactional_Groups= $status;
+
+--echo #master 1
+--connection master1
+
+--let $counter=9
+while ($counter)
+{
+  #DDL statement
+  create table t1(a int primary key) engine=innodb;
+
+  #non trans update statement
+  insert into t1 values(1);
+  insert into t1 values(2);
+  show create table t1;
+  drop table t1;
+  --dec $counter
+}
+--save_master_pos
+
+--connection slave
+
+--sync_with_master 0,'master1'
+--let $status= query_get_value(show slave 'master1' status, Slave_DDL_Groups, 1)
+--echo Slave_DDL_Groups= $status;
+
+--let $status= query_get_value(show slave 'master1' status, Slave_Non_Transactional_Groups, 1)
+--echo Slave_Non_Transactional_Groups= $status;
+
+--let $status= query_get_value(show slave 'master1' status, Slave_Transactional_Groups, 1)
+--echo Slave_Transactional_Groups= $status;
+
+
+# Cleanup
+stop all slaves;
+set default_master_connection = 'master1';
+--source include/wait_for_slave_to_stop.inc
+
+set default_master_connection = 'master2';
+--source include/wait_for_slave_to_stop.inc
+
+--eval set global slave_parallel_threads=$par_thd
+
+--source include/reset_master_slave.inc
+--disconnect slave
+--connection master1
+--source include/reset_master_slave.inc
+--disconnect master1
+--connection master2
+--source include/reset_master_slave.inc
+--disconnect master2
diff --git a/mysql-test/suite/multi_source/reset_slave.result b/mysql-test/suite/multi_source/reset_slave.result
index 353970a..4f66c8f 100644
--- a/mysql-test/suite/multi_source/reset_slave.result
+++ b/mysql-test/suite/multi_source/reset_slave.result
@@ -13,15 +13,15 @@ insert into t1 values (1),(2);
 connection slave;
 stop slave 'master1';
 show slave 'master1' status;
-Slave_IO_State Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State
-       127.0.0.1       root    MYPORT_1        60      master-bin.000001       <read_master_log_pos>   mysqld-relay-bin-master1.000002 <relay_log_pos> master-bin.000001       No      No                                                      0               0       <read_master_log_pos>   <relay_log_space>       None            0       No                                              NULL    No      0               0                       1                       No                              conservative    0       NULL    
+Slave_IO_State Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Slave_DDL_Groups        Slave_Non_Transactional_Groups  Slave_Transactional_Groups
+       127.0.0.1       root    MYPORT_1        60      master-bin.000001       <read_master_log_pos>   mysqld-relay-bin-master1.000002 <relay_log_pos> master-bin.000001       No      No                                                      0               0       <read_master_log_pos>   <relay_log_space>       None            0       No                                              NULL    No      0               0                       1                       No                              conservative    0       NULL            2       3       0
 mysqld-relay-bin-master1.000001
 mysqld-relay-bin-master1.000002
 mysqld-relay-bin-master1.index
 reset slave 'master1';
 show slave 'master1' status;
-Slave_IO_State Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State
-       127.0.0.1       root    MYPORT_1        60              4               <relay_log_pos>         No      No                                                      0               0       0       <relay_log_space>       None            0       No                                              NULL    No      0               0                       1                       No                              conservative    0       NULL    
+Slave_IO_State Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Slave_DDL_Groups        Slave_Non_Transactional_Groups  Slave_Transactional_Groups
+       127.0.0.1       root    MYPORT_1        60              4               <relay_log_pos>         No      No                                                      0               0       0       <relay_log_space>       None            0       No                                              NULL    No      0               0                       1                       No                              conservative    0       NULL            2       3       0
 reset slave 'master1' all;
 show slave 'master1' status;
 ERROR HY000: There is no master connection 'master1'
diff --git a/mysql-test/suite/multi_source/simple.result b/mysql-test/suite/multi_source/simple.result
index 419b995..93ea1c0 100644
--- a/mysql-test/suite/multi_source/simple.result
+++ b/mysql-test/suite/multi_source/simple.result
@@ -18,9 +18,9 @@ connection slave;
 connection master2;
 connection slave;
 show all slaves status;
-Connection_name        Slave_SQL_State Slave_IO_State  Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Retried_transactions    Max_relay_log_size      Executed_log_entries    Slave_received_heartbeats
        Slave_h
 eartbeat_period        Gtid_Slave_Pos
-slave1 Slave has read all relay log; waiting for the slave I/O thread to update it     Waiting for master to send event        127.0.0.1       root    MYPORT_1        60      master-bin.000001       <read_master_log_pos>   mysqld-relay-bin-slave1.000002  <relay_log_pos> master-bin.000001       Yes     Yes                                                     0               0       <read_master_log_pos>   <relay_log_space1>      None            0       No                                              0       No      0               0                       1                       No                              conservative    0       NULL    Slave has read all relay log; waiting for the slave I/O thread to update it     0       1073741824      7       0       60.000  
-slave2 Slave has read all relay log; waiting for the slave I/O thread to update it     Waiting for master to send event        127.0.0.1       root    MYPORT_2        60      master-bin.000001       <read_master_log_pos>   mysqld-relay-bin-slave2.000002  <relay_log_pos> master-bin.000001       Yes     Yes                                                     0               0       <read_master_log_pos>   <relay_log_space1>      None            0       No                                              0       No      0               0                       2                       No                              conservative    0       NULL    Slave has read all relay log; waiting for the slave I/O thread to update it     0       1073741824      7       0       60.000  
+Connection_name        Slave_SQL_State Slave_IO_State  Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Slave_DDL_Groups        Slave_Non_Transactional_Groups  Slave_Transactional_Groups      Retried_tra
 nsaction
 s      Max_relay_log_size      Executed_log_entries    Slave_received_heartbeats       Slave_heartbeat_period  Gtid_Slave_Pos
+slave1 Slave has read all relay log; waiting for the slave I/O thread to update it     Waiting for master to send event        127.0.0.1       root    MYPORT_1        60      master-bin.000001       <read_master_log_pos>   mysqld-relay-bin-slave1.000002  <relay_log_pos> master-bin.000001       Yes     Yes                                                     0               0       <read_master_log_pos>   <relay_log_space1>      None            0       No                                              0       No      0               0                       1                       No                              conservative    0       NULL    Slave has read all relay log; waiting for the slave I/O thread to update it     0       0       0       0       1073741824      7       0       60.000  
+slave2 Slave has read all relay log; waiting for the slave I/O thread to update it     Waiting for master to send event        127.0.0.1       root    MYPORT_2        60      master-bin.000001       <read_master_log_pos>   mysqld-relay-bin-slave2.000002  <relay_log_pos> master-bin.000001       Yes     Yes                                                     0               0       <read_master_log_pos>   <relay_log_space1>      None            0       No                                              0       No      0               0                       2                       No                              conservative    0       NULL    Slave has read all relay log; waiting for the slave I/O thread to update it     0       0       0       0       1073741824      7       0       60.000  
 start all slaves;
 stop slave 'slave1';
 show slave 'slave1' status;
@@ -74,21 +74,24 @@ Parallel_Mode       conservative
 SQL_Delay      0
 SQL_Remaining_Delay    NULL
 Slave_SQL_Running_State        
+Slave_DDL_Groups       0
+Slave_Non_Transactional_Groups 0
+Slave_Transactional_Groups     0
 reset slave 'slave1';
 show all slaves status;
-Connection_name        Slave_SQL_State Slave_IO_State  Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Retried_transactions    Max_relay_log_size      Executed_log_entries    Slave_received_heartbeats
        Slave_h
 eartbeat_period        Gtid_Slave_Pos
-slave1                 127.0.0.1       root    MYPORT_1        60              4               <relay_log_pos>         No      No                                                      0               0       0       <relay_log_space1>      None            0       No                                              NULL    No      0               0                       1                       No                              conservative    0       NULL            0       1073741824      7       0       60.000  
-slave2 Slave has read all relay log; waiting for the slave I/O thread to update it     Waiting for master to send event        127.0.0.1       root    MYPORT_2        60      master-bin.000001       <read_master_log_pos>   mysqld-relay-bin-slave2.000002  <relay_log_pos> master-bin.000001       Yes     Yes                                                     0               0       <read_master_log_pos>   <relay_log_space1>      None            0       No                                              0       No      0               0                       2                       No                              conservative    0       NULL    Slave has read all relay log; waiting for the slave I/O thread to update it     0       1073741824      7       0       60.000  
+Connection_name        Slave_SQL_State Slave_IO_State  Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Slave_DDL_Groups        Slave_Non_Transactional_Groups  Slave_Transactional_Groups      Retried_tra
 nsaction
 s      Max_relay_log_size      Executed_log_entries    Slave_received_heartbeats       Slave_heartbeat_period  Gtid_Slave_Pos
+slave1                 127.0.0.1       root    MYPORT_1        60              4               <relay_log_pos>         No      No                                                      0               0       0       <relay_log_space1>      None            0       No                                              NULL    No      0               0                       1                       No                              conservative    0       NULL            0       0       0       0       1073741824      7       0       60.000  
+slave2 Slave has read all relay log; waiting for the slave I/O thread to update it     Waiting for master to send event        127.0.0.1       root    MYPORT_2        60      master-bin.000001       <read_master_log_pos>   mysqld-relay-bin-slave2.000002  <relay_log_pos> master-bin.000001       Yes     Yes                                                     0               0       <read_master_log_pos>   <relay_log_space1>      None            0       No                                              0       No      0               0                       2                       No                              conservative    0       NULL    Slave has read all relay log; waiting for the slave I/O thread to update it     0       0       0       0       1073741824      7       0       60.000  
 reset slave 'slave1' all;
 show all slaves status;
-Connection_name        Slave_SQL_State Slave_IO_State  Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Retried_transactions    Max_relay_log_size      Executed_log_entries    Slave_received_heartbeats
        Slave_h
 eartbeat_period        Gtid_Slave_Pos
-slave2 Slave has read all relay log; waiting for the slave I/O thread to update it     Waiting for master to send event        127.0.0.1       root    MYPORT_2        60      master-bin.000001       <read_master_log_pos>   mysqld-relay-bin-slave2.000002  <relay_log_pos> master-bin.000001       Yes     Yes                                                     0               0       <read_master_log_pos>   <relay_log_space1>      None            0       No                                              0       No      0               0                       2                       No                              conservative    0       NULL    Slave has read all relay log; waiting for the slave I/O thread to update it     0       1073741824      7       0       60.000  
+Connection_name        Slave_SQL_State Slave_IO_State  Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Slave_DDL_Groups        Slave_Non_Transactional_Groups  Slave_Transactional_Groups      Retried_tra
 nsaction
 s      Max_relay_log_size      Executed_log_entries    Slave_received_heartbeats       Slave_heartbeat_period  Gtid_Slave_Pos
+slave2 Slave has read all relay log; waiting for the slave I/O thread to update it     Waiting for master to send event        127.0.0.1       root    MYPORT_2        60      master-bin.000001       <read_master_log_pos>   mysqld-relay-bin-slave2.000002  <relay_log_pos> master-bin.000001       Yes     Yes                                                     0               0       <read_master_log_pos>   <relay_log_space1>      None            0       No                                              0       No      0               0                       2                       No                              conservative    0       NULL    Slave has read all relay log; waiting for the slave I/O thread to update it     0       0       0       0       1073741824      7       0       60.000  
 stop all slaves;
 Warnings:
 Note   1938    SLAVE 'slave2' stopped
 show all slaves status;
-Connection_name        Slave_SQL_State Slave_IO_State  Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Retried_transactions    Max_relay_log_size      Executed_log_entries    Slave_received_heartbeats
        Slave_h
 eartbeat_period        Gtid_Slave_Pos
-slave2                 127.0.0.1       root    MYPORT_2        60      master-bin.000001       <read_master_log_pos>   mysqld-relay-bin-slave2.000002  <relay_log_pos> master-bin.000001       No      No                                                      0               0       <read_master_log_pos>   <relay_log_space1>      None            0       No                                              NULL    No      0               0                       2                       No                              conservative    0       NULL            0       1073741824      7       0       60.000  
+Connection_name        Slave_SQL_State Slave_IO_State  Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Slave_DDL_Groups        Slave_Non_Transactional_Groups  Slave_Transactional_Groups      Retried_tra
 nsaction
 s      Max_relay_log_size      Executed_log_entries    Slave_received_heartbeats       Slave_heartbeat_period  Gtid_Slave_Pos
+slave2                 127.0.0.1       root    MYPORT_2        60      master-bin.000001       <read_master_log_pos>   mysqld-relay-bin-slave2.000002  <relay_log_pos> master-bin.000001       No      No                                                      0               0       <read_master_log_pos>   <relay_log_space1>      None            0       No                                              NULL    No      0               0                       2                       No                              conservative    0       NULL            0       0       0       0       1073741824      7       0       60.000  
 stop all slaves;
 include/reset_master_slave.inc
 disconnect slave;
diff --git a/mysql-test/suite/multi_source/syntax.result b/mysql-test/suite/multi_source/syntax.result
index a17a61d..35f4b30 100644
--- a/mysql-test/suite/multi_source/syntax.result
+++ b/mysql-test/suite/multi_source/syntax.result
@@ -1,11 +1,11 @@
 include/master-slave.inc
 [connection master]
 show slave status;
-Slave_IO_State Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State
+Slave_IO_State Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Slave_DDL_Groups        Slave_Non_Transactional_Groups  Slave_Transactional_Groups
 show slave '' status;
-Slave_IO_State Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State
+Slave_IO_State Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Slave_DDL_Groups        Slave_Non_Transactional_Groups  Slave_Transactional_Groups
 show all slaves status;
-Connection_name        Slave_SQL_State Slave_IO_State  Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Retried_transactions    Max_relay_log_size      Executed_log_entries    Slave_received_heartbeats
        Slave_h
 eartbeat_period        Gtid_Slave_Pos
+Connection_name        Slave_SQL_State Slave_IO_State  Master_Host     Master_User     Master_Port     Connect_Retry   Master_Log_File Read_Master_Log_Pos     Relay_Log_File  Relay_Log_Pos   Relay_Master_Log_File   Slave_IO_Running        Slave_SQL_Running       Replicate_Do_DB Replicate_Ignore_DB     Replicate_Do_Table      Replicate_Ignore_Table  Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table     Last_Errno      Last_Error      Skip_Counter    Exec_Master_Log_Pos     Relay_Log_Space Until_Condition Until_Log_File  Until_Log_Pos   Master_SSL_Allowed      Master_SSL_CA_File      Master_SSL_CA_Path      Master_SSL_Cert Master_SSL_Cipher       Master_SSL_Key  Seconds_Behind_Master   Master_SSL_Verify_Server_Cert   Last_IO_Errno   Last_IO_Error   Last_SQL_Errno  Last_SQL_Error  Replicate_Ignore_Server_Ids     Master_Server_Id        Master_SSL_Crl  Master_SSL_Crlpath      Using_Gtid      Gtid_IO_Pos     Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids     Parallel_Mode   SQL_Delay       SQL_Remaining_Delay     Slave_SQL_Running_State Slave_DDL_Groups        Slave_Non_Transactional_Groups  Slave_Transactional_Groups      Retried_tra
 nsaction
 s      Max_relay_log_size      Executed_log_entries    Slave_received_heartbeats       Slave_heartbeat_period  Gtid_Slave_Pos
 #
 # Check error handling
 #
diff --git a/sql/log_event.cc b/sql/log_event.cc
index cd47cbb..e552000 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -53,6 +53,7 @@
 #include "rpl_constants.h"
 #include "sql_digest.h"
 #include "zlib.h"
+#include "my_atomic.h"
 
 #define my_b_write_string(A, B) my_b_write((A), (uchar*)(B), (uint) (sizeof(B) - 1))
 

A3.
Now having three options the if:s asks to converting them into a switch
which is claimed to be better performing:

'The compiler doesn`t know if the order of evaluating the if-statements
is important ... with the switch-statement it knows that all clauses can
be evaluated at the same time'.

@@ -7973,6 +7974,15 @@ Gtid_log_event::do_apply_event(rpl_group_info *rgi)
   }
 
   DBUG_ASSERT((bits & OPTION_GTID_BEGIN) == 0);
+
+  Master_info *mi=rgi->rli->mi;
+  if (flags2 & FL_DDL)
+    my_atomic_add64_explicit(&mi->total_ddl_groups, 1, MY_MEMORY_ORDER_RELAXED);
+  if (!(flags2 & FL_TRANSACTIONAL))
+    my_atomic_add64_explicit(&mi->total_non_trans_groups, 1, MY_MEMORY_ORDER_RELAXED);
+  if (flags2 & FL_TRANSACTIONAL)
+    my_atomic_add64_explicit(&mi->total_trans_groups, 1, MY_MEMORY_ORDER_RELAXED);
+
   if (flags2 & FL_STANDALONE)
     return 0;
 
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index 55a6671..1fc996b 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -42,7 +42,8 @@ Master_info::Master_info(LEX_CSTRING *connection_name_arg,
    using_gtid(USE_GTID_NO), events_queued_since_last_gtid(0),
    gtid_reconnect_event_skip_count(0), gtid_event_seen(false),
    in_start_all_slaves(0), in_stop_all_slaves(0), in_flush_all_relay_logs(0),
-   users(0), killed(0)
+   users(0), killed(0),
+   total_ddl_groups(0), total_non_trans_groups(0), total_trans_groups(0)
 {
   char *tmp;
   host[0] = 0; user[0] = 0; password[0] = 0;
diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h
index 260c35e..54d6b5b 100644
--- a/sql/rpl_mi.h
+++ b/sql/rpl_mi.h
@@ -327,6 +327,16 @@ class Master_info : public Slave_reporting_capability
   uint users;                                   /* Active user for object */
   uint killed;
 
+
+  /* No of DDL event group */
+  volatile uint64 total_ddl_groups;
+
+  /* No of non-transactional event group*/
+  volatile uint64 total_non_trans_groups;
+
+  /* No of transactional event group*/
+  volatile uint64 total_trans_groups;
+
   /* domain-id based filter */
   Domain_id_filter domain_id_filter;
 
diff --git a/sql/slave.cc b/sql/slave.cc
index bf70db6..a2cea8a 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -3121,6 +3121,19 @@ void show_master_info_get_fields(THD *thd, List<Item> *field_list,
   field_list->push_back(new (mem_root)
                         Item_empty_string(thd, "Slave_SQL_Running_State",
                                           20));
+  field_list->push_back(new (mem_root)
+                       Item_return_int(thd, "Slave_DDL_Groups", 20,
+                                       MYSQL_TYPE_LONGLONG),
+                       mem_root);
+  field_list->push_back(new (mem_root)
+                       Item_return_int(thd, "Slave_Non_Transactional_Groups", 20,
+                                       MYSQL_TYPE_LONGLONG),
+                        mem_root);
+  field_list->push_back(new (mem_root)
+                       Item_return_int(thd, "Slave_Transactional_Groups", 20,
+                                       MYSQL_TYPE_LONGLONG),
+                        mem_root);
+
   if (full)
   {
     field_list->push_back(new (mem_root)
@@ -3351,6 +3364,17 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
     // Slave_SQL_Running_State
     protocol->store(slave_sql_running_state, &my_charset_bin);
 
+    uint64 events;
+    events= (uint64)my_atomic_load64_explicit((volatile int64 *)
+              &mi->total_ddl_groups, MY_MEMORY_ORDER_RELAXED);
+    protocol->store(events);
+    events= (uint64)my_atomic_load64_explicit((volatile int64 *)
+              &mi->total_non_trans_groups, MY_MEMORY_ORDER_RELAXED);
+    protocol->store(events);
+    events= (uint64)my_atomic_load64_explicit((volatile int64 *)
+              &mi->total_trans_groups, MY_MEMORY_ORDER_RELAXED);
+    protocol->store(events);
+
     if (full)
     {
       protocol->store((uint32)    mi->rli.retried_trans);

Cheers,

Andrei


Follow ups

References