Re: [Maria-developers] [Commits] 8b545d3d414: MDEV-7409 On RBR, extend the PROCESSLIST info to include at least the name of the recently used table

2019-06-19 Thread Sachin Setiya
Hi Andrei!

On Fri, Jun 14, 2019 at 2:04 AM  wrote:
>
> Sachin, salve.
>
> > revision-id: 8b545d3d41416772203cb98f06243873a4f0d8f7 
> > (mariadb-10.4.5-24-g8b545d3d414)
> > parent(s): e35676f5557d68c7b51ba47aa73dcdf72eafa436
> > author: Sachin
> > committer: Sachin
> > timestamp: 2019-05-31 12:02:37 +0530
> > message:
> >
> > MDEV-7409 On RBR, extend the PROCESSLIST info to include at least the name 
> > of the recently used table
> >
> > When RBR is used, add the db name to db Field and table name to Status
> > Field  of the "SHOW FULL PROCESSLIST" command for SQL thread.
>
> So the patch deals with the State column of the Show-Processlist command.
> I would endorse an output like the following:
>
> MariaDB [test]> show processlist;
> ++-+-+--+---+--+--+---+--+
> | Id | User| Host| db   | Command   | Time | State
> | Info
>   | Progress |
> ++-+-+--+---+--+--+---+--+
> ...
> | 13 | system user | | test | Slave_SQL |  101 | 
> Write_rows_log_event::write_row(-1) on table `t` | GTID 0-1-17: insert into 
> `t` values (46),(47) |0.000 |
> ++-+-+--+---+--+--+---+--+
>
> notice the ANSI quotes which could be more than for pretty printing
> considering legal names like `[:space:]+t`.
> Alas the text from Annotate event does not quote the table name so the
> actual Info is not that perfect *also* because the actual one does not
> display GTID..
Annotated for Status
Remaining can be done in  10.5
>
> Could we make that - the Annotate event quoted names and GTID into
> Progress-list Info in a separate patch for 10.5?
> And also to turn Progress column meaningful. It's always zero, but could
> print for the user the executed fraction of the whole event (sure we
> need to know in the Rows_log_event metadata how much rows the statement
> changed on the master; on slave we would just count the executed ones).
>
> >
> > ---
> >  mysql-test/suite/rpl/r/rpl_rbr_monitor.result | 57 +
> >  mysql-test/suite/rpl/t/rpl_rbr_monitor.test   | 86 
> > +
> >  sql/debug_sync.cc |  3 +-
> >  sql/log_event.cc  | 90 
> > +--
> >  4 files changed, 215 insertions(+), 21 deletions(-)
> >
>
> To the test, you could really do it simpler without
>
> > --- /dev/null
> > +++ b/mysql-test/suite/rpl/t/rpl_rbr_monitor.test
> > @@ -0,0 +1,86 @@
> > +--source include/have_innodb.inc
>
> > +--source include/have_debug.inc
>
> any debug.
>
> Just start a slave local trx to block Rows_log_event applying at some
> (see $param) point:
>
> --connection slave
> begin;
> --eval select a from t where a > $param for update;
>
>
>
> > +--source include/have_binlog_format_row.inc
> > +--source include/master-slave.inc
> > +--enable_connect_log
> > +
> > +--connection master
> > +create table t1(a int primary key);
> > +--save_master_pos
> > +
> > +--connection slave
> > +--sync_with_master
> > +SET GLOBAL debug_dbug="+d,should_wait_for_mdev7409";
> > +select * from t1;
> > +
> > +--connection master
> > +insert into t1(a) values(1);
> > +--save_master_pos
> > +
> > +--echo #monitoring write rows
> > +--connection slave
> > +
> > +let $wait_condition= SELECT COUNT(*) = 1 FROM  
> > INFORMATION_SCHEMA.PROCESSLIST
> > +  WHERE DB = 'test' AND STATE LIKE  
> > "Write_rows_log_event::write_row(%) on table t1";
> > +--source include/wait_condition.inc
> > +SELECT db , state  FROM  INFORMATION_SCHEMA.PROCESSLIST
> > +  WHERE DB = 'test' AND STATE LIKE  
> > "Write_rows_log_event::write_row(%) on table t1";
> > +set debug_sync="now signal cont";
> > +--sync_with_master
> > +
> > +--echo #monitoring update rows
> > +--connection master
> > +update t1 set a = a + 4194304 ;
> > +
> > +--connection slave
> > +let $wait_condition= SELECT COUNT(*) = 1 FROM  
> > INFORMATION_SCHEMA.PROCESSLIST
> > +  WHERE DB = 'test' AND STATE LIKE  "Update_rows_log_event::find_row(%) on 
> > table t1";
> > +--source include/wait_condition.inc
> > +SELECT db, state  FROM  INFORMATION_SCHEMA.PROCESSLIST
> > +  WHERE DB = 'test' AND STATE LIKE  "Update_rows_log_event::find_row(%) on 
> > table t1";
> > +set debug_sync="now signal cont1";
> > +
> > +let $wait_condition= SELECT COUNT(*) = 1 FROM  
> > INFORMATION_SCHEMA.PROCESSLIST
> > +  WHERE DB = 'test' AND STATE LIKE  
> > "Update_rows_log_event::unpack_current_row(%) on table t1";
> > +--source include/wait_condition.inc
> > +SELECT db, state  FROM  INFORMA

Re: [Maria-developers] [Commits] 8b545d3d414: MDEV-7409 On RBR, extend the PROCESSLIST info to include at least the name of the recently used table

2019-06-13 Thread andrei . elkin
Sachin, salve.

> revision-id: 8b545d3d41416772203cb98f06243873a4f0d8f7 
> (mariadb-10.4.5-24-g8b545d3d414)
> parent(s): e35676f5557d68c7b51ba47aa73dcdf72eafa436
> author: Sachin
> committer: Sachin
> timestamp: 2019-05-31 12:02:37 +0530
> message:
>
> MDEV-7409 On RBR, extend the PROCESSLIST info to include at least the name of 
> the recently used table
>
> When RBR is used, add the db name to db Field and table name to Status
> Field  of the "SHOW FULL PROCESSLIST" command for SQL thread.

So the patch deals with the State column of the Show-Processlist command.
I would endorse an output like the following:

MariaDB [test]> show processlist;
++-+-+--+---+--+--+---+--+
| Id | User| Host| db   | Command   | Time | State  
  | Info
  | Progress |
++-+-+--+---+--+--+---+--+
...
| 13 | system user | | test | Slave_SQL |  101 | 
Write_rows_log_event::write_row(-1) on table `t` | GTID 0-1-17: insert into `t` 
values (46),(47) |0.000 |
++-+-+--+---+--+--+---+--+

notice the ANSI quotes which could be more than for pretty printing
considering legal names like `[:space:]+t`.
Alas the text from Annotate event does not quote the table name so the
actual Info is not that perfect *also* because the actual one does not
display GTID..

Could we make that - the Annotate event quoted names and GTID into
Progress-list Info in a separate patch for 10.5?
And also to turn Progress column meaningful. It's always zero, but could
print for the user the executed fraction of the whole event (sure we
need to know in the Rows_log_event metadata how much rows the statement
changed on the master; on slave we would just count the executed ones).

>
> ---
>  mysql-test/suite/rpl/r/rpl_rbr_monitor.result | 57 +
>  mysql-test/suite/rpl/t/rpl_rbr_monitor.test   | 86 +
>  sql/debug_sync.cc |  3 +-
>  sql/log_event.cc  | 90 
> +--
>  4 files changed, 215 insertions(+), 21 deletions(-)
>

To the test, you could really do it simpler without 

> --- /dev/null
> +++ b/mysql-test/suite/rpl/t/rpl_rbr_monitor.test
> @@ -0,0 +1,86 @@
> +--source include/have_innodb.inc

> +--source include/have_debug.inc

any debug.

Just start a slave local trx to block Rows_log_event applying at some
(see $param) point:

--connection slave
begin;
--eval select a from t where a > $param for update;



> +--source include/have_binlog_format_row.inc
> +--source include/master-slave.inc
> +--enable_connect_log
> +
> +--connection master
> +create table t1(a int primary key);
> +--save_master_pos
> +
> +--connection slave
> +--sync_with_master
> +SET GLOBAL debug_dbug="+d,should_wait_for_mdev7409";
> +select * from t1;
> +
> +--connection master
> +insert into t1(a) values(1);
> +--save_master_pos
> +
> +--echo #monitoring write rows
> +--connection slave
> +
> +let $wait_condition= SELECT COUNT(*) = 1 FROM  INFORMATION_SCHEMA.PROCESSLIST
> +  WHERE DB = 'test' AND STATE LIKE  "Write_rows_log_event::write_row(%) 
> on table t1";
> +--source include/wait_condition.inc
> +SELECT db , state  FROM  INFORMATION_SCHEMA.PROCESSLIST
> +  WHERE DB = 'test' AND STATE LIKE  "Write_rows_log_event::write_row(%) 
> on table t1";
> +set debug_sync="now signal cont";
> +--sync_with_master
> +
> +--echo #monitoring update rows
> +--connection master
> +update t1 set a = a + 4194304 ;
> +
> +--connection slave
> +let $wait_condition= SELECT COUNT(*) = 1 FROM  INFORMATION_SCHEMA.PROCESSLIST
> +  WHERE DB = 'test' AND STATE LIKE  "Update_rows_log_event::find_row(%) on 
> table t1";
> +--source include/wait_condition.inc
> +SELECT db, state  FROM  INFORMATION_SCHEMA.PROCESSLIST
> +  WHERE DB = 'test' AND STATE LIKE  "Update_rows_log_event::find_row(%) on 
> table t1";
> +set debug_sync="now signal cont1";
> +
> +let $wait_condition= SELECT COUNT(*) = 1 FROM  INFORMATION_SCHEMA.PROCESSLIST
> +  WHERE DB = 'test' AND STATE LIKE  
> "Update_rows_log_event::unpack_current_row(%) on table t1";
> +--source include/wait_condition.inc
> +SELECT db, state  FROM  INFORMATION_SCHEMA.PROCESSLIST
> +  WHERE DB = 'test' AND STATE LIKE  
> "Update_rows_log_event::unpack_current_row(%) on table t1";
> +set debug_sync="now signal cont2";
> +
> +let $wait_condition= SELECT COUNT(*) = 1 FROM  INFORMATION_SCHEMA.PROCESSLIST
> +  WHERE DB = 'test' AND STATE LIKE  "Update_rows_log_event::ha_update_row(%) 
> on table t1";
> +--sourc