List:Commits« Previous MessageNext Message »
From:Alfranio Correia Date:May 13 2009 9:58am
Subject:Re: bzr commit into mysql-6.0-rpl branch (luis.soares:2844) Bug#28777
View as plain text  
Hi,

Find some comments in-line

Cheers.

Luís Soares wrote:
> Hi Alfranio,
>
>   Please check the comments inline.
> Regards,
> Luís
>
> On Mon, 2009-05-11 at 10:10 +0100, Alfranio Correia wrote:
>   
>> Hi Luis,
>>
>> Great that you implemented what we suggested to.
>> Please, find some comments in-line.
>>
>> Cheers.
>>
>> Luis Soares wrote:
>>     
>>> #At file:///home/lsoares/Workspace/mysql-server/bugfix/b28777/6.0-rpl/ based
> on revid:aelkin@stripped
>>>
>>>  2844 Luis Soares	2009-05-05
>>>       BUG#28777: SHOW BINLOG EVENTS does not work on relay log files
>>>       
>>>       SHOW BINLOG EVENTS does not work with relay log files. If issuing
>>>       "SHOW BINLOG EVENTS IN 'relay-log.000001'" in a non-empty relay log
>>>       file (relay-log.000001), mysql reports empty set.
>>>       
>>>       This patch addresses this issue by extending the SHOW command with
>>>       RELAYLOG. Events in relay log files can now be inspected by issuing
>>>       SHOW RELAYLOG EVENTS [IN 'file'] [FROM position].
>>>      @ mysql-test/include/show_binlog_events.inc
>>>         Added option $log_file so that show_binlog_events can take log file
>>>         name as argument.
>>>      @ mysql-test/include/show_relaylog_events.inc
>>>         Clone of show_binlog_events for relaylog events.
>>>      @ mysql-test/suite/rpl/include/rpl_show_relaylog_events.inc
>>>         Shared part of the test case.
>>>      @ mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test
>>>         Test case for row based replication.
>>>      @ mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test
>>>         Test case for statement and mixed mode replication.
>>>      @ sql/lex.h
>>>         Added RELAYLOG symbol.
>>>      @ sql/mysqld.cc
>>>         Added "show_relaylog_events" to status_vars.
>>>      @ sql/sp_head.cc
>>>         Set SQLCOM_SHOW_RELAYLOG_EVENTS to return flags=
>>>         sp_head::MULTI_RESULTS; in sp_get_flags_for_command as
>>>         SQLCOM_SHOW_BINLOG_EVENTS does.
>>>      @ sql/sql_lex.h
>>>         Added sql_command SQLCOM_SHOW_RELAYLOG_EVENTS to lex
> enum_sql_command.
>>>      @ sql/sql_parse.cc
>>>         Added handling of SQLCOM_SHOW_RELAYLOG_EVENTS.
>>>      @ sql/sql_repl.cc
>>>         mysql_show_binlog_events set to choose the log file to use based on
>>>         the command issued (SHOW BINLOG|RELAYLOG EVENTS).
>>>      @ sql/sql_yacc.yy
>>>         Added RELAYLOG to the grammar.
>>>
>>>     added:
>>>       mysql-test/include/show_relaylog_events.inc
>>>       mysql-test/suite/rpl/include/rpl_show_relaylog_events.inc
>>>       mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result
>>>       mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
>>>       mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test
>>>       mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test
>>>     modified:
>>>       mysql-test/include/show_binlog_events.inc
>>>       sql/lex.h
>>>       sql/mysqld.cc
>>>       sql/sp_head.cc
>>>       sql/sql_lex.h
>>>       sql/sql_parse.cc
>>>       sql/sql_repl.cc
>>>       sql/sql_yacc.yy
>>> === modified file 'mysql-test/include/show_binlog_events.inc'
>>> --- a/mysql-test/include/show_binlog_events.inc	2008-09-06 07:22:50 +0000
>>> +++ b/mysql-test/include/show_binlog_events.inc	2009-05-05 16:53:03 +0000
>>> @@ -1,10 +1,21 @@
>>>  # $binlog_start can be set by caller or take a default value
>>> +# $log_file the name of the log file show
>>> +
>>> +let $show_binlog_events= show binlog events;
>>>   
>>>       
>> Please, put a comment in here. Why 107?
>>     
>
> Because it was already there!!
>
> Now seriously, it seems it defaults to chop the first event in the
> binary log file (I think it is a FD event).
>
>   
>> Cheers.
>>     
>>>  
>>>  if (!$binlog_start)
>>>  {
>>>    let $binlog_start=107;
>>>  }
>>> +
>>> +if (!`SELECT CONCAT('1' $log_file, '1') = '11'`)
>>> +{
>>> +    let $show_binlog_events= $show_binlog_events in $log_file;
>>> +}
>>> +
>>> +let $show_binlog_events= $show_binlog_events from $binlog_start;
>>> +
>>>  --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start
> <binlog_start>
>>>  --replace_column 2 # 4 # 5 #
>>>  --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id:
> #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/
>>> ---eval show binlog events from $binlog_start
>>> +--eval $show_binlog_events
>>>
>>> === added file 'mysql-test/include/show_relaylog_events.inc'
>>> --- a/mysql-test/include/show_relaylog_events.inc	1970-01-01 00:00:00 +0000
>>> +++ b/mysql-test/include/show_relaylog_events.inc	2009-05-05 16:53:03 +0000
>>> @@ -0,0 +1,21 @@
>>> +# $binlog_start can be set by caller or take a default value
>>> +# $log_file the name of the log file show
>>> +
>>> +let $show_binlog_events= show relaylog events;
>>>   
>>>       
>> See above.
>>     
>
> See above.
>
>   
>>> +
>>> +if (!$binlog_start)
>>> +{
>>> +  let $binlog_start=107;
>>> +}
>>> +
>>> +if (!`SELECT CONCAT('1' $log_file, '1') = '11'`)
>>> +{
>>> +    let $show_binlog_events= $show_binlog_events in $log_file;
>>> +}
>>> +
>>> +let $show_binlog_events= $show_binlog_events from $binlog_start;
>>> +
>>> +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start
> <binlog_start>
>>> +--replace_column 2 # 4 # 5 #
>>> +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id:
> #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/
>>> +--eval $show_binlog_events
>>>
>>> === added file 'mysql-test/suite/rpl/include/rpl_show_relaylog_events.inc'
>>> --- a/mysql-test/suite/rpl/include/rpl_show_relaylog_events.inc	1970-01-01
> 00:00:00 +0000
>>> +++ b/mysql-test/suite/rpl/include/rpl_show_relaylog_events.inc	2009-05-05
> 16:53:03 +0000
>>> @@ -0,0 +1,42 @@
>>> +-- connection master
>>> +
>>> +CREATE TABLE t1 (a INT);
>>> +INSERT INTO t1 VALUES (1);
>>> +INSERT INTO t1 VALUES (2);
>>> +INSERT INTO t1 VALUES (3);
>>> +INSERT INTO t1 VALUES (4);
>>> +INSERT INTO t1 VALUES (5);
>>> +INSERT INTO t1 VALUES (6);
>>> +
>>> +-- echo [MASTER] ********* SOW BINLOG EVENTS IN ...  *********
>>> +let $log_file= 'master-bin.000001';
>>> +-- source include/show_binlog_events.inc
>>> +
>>> +-- echo [MASTER] ********* SOW BINLOG EVENTS         *********
>>> +let $log_file= ;
>>> +-- source include/show_binlog_events.inc
>>> +
>>> +-- sync_slave_with_master
>>> +
>>> +-- echo [SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
>>> +let $log_file= 'slave-bin.000001';
>>> +-- source include/show_binlog_events.inc
>>> +
>>> +-- echo [SLAVE] ********* SOW BINLOG EVENTS          *********
>>> +let $log_file= ;
>>> +-- source include/show_binlog_events.inc
>>> +
>>> +-- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
>>> +let $log_file= 'slave-relay-bin.000003';
>>> +-- source include/show_relaylog_events.inc
>>> +
>>> +-- echo [SLAVE] ********* SOW RELAYLOG EVENTS        *********
>>> +let $log_file= ;
>>> +-- source include/show_relaylog_events.inc
>>> +
>>> +-- connection master
>>> +DROP TABLE t1;
>>> +let $log_name= ;
>>> +
>>> +-- sync_slave_with_master
>>> +let $log_name= ;
>>>   
>>>       
>> I think you are missing some combinations.
>> See the command syntax below:
>>
>> SHOW BINLOG EVENTS
>>    [IN '/|log_name|/'] [FROM /|pos|/] [LIMIT [/|offset|/,] /|row_count|/]
>>
>> It would be great to force log rotation so we can have different binary
>> logs.
>>     
>
> Hmm... I think this patch does not mess around with LIMIT. In any case
> it always good to check. Will do.
>   
I disagree.
I think you should show that all the options may be used but you
don't need however to play with all possible combinations among
the options.
>   
>>> === added file 'mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result'
>>> --- a/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result	1970-01-01
> 00:00:00 +0000
>>> +++ b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result	2009-05-05
> 16:53:03 +0000
>>> @@ -0,0 +1,160 @@
>>> +stop slave;
>>> +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
>>> +reset master;
>>> +reset slave;
>>> +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
>>> +start slave;
>>> +CREATE TABLE t1 (a INT);
>>> +INSERT INTO t1 VALUES (1);
>>> +INSERT INTO t1 VALUES (2);
>>> +INSERT INTO t1 VALUES (3);
>>> +INSERT INTO t1 VALUES (4);
>>> +INSERT INTO t1 VALUES (5);
>>> +INSERT INTO t1 VALUES (6);
>>> +[MASTER] ********* SOW BINLOG EVENTS IN ...  *********
>>> +show binlog events in 'master-bin.000001' from <binlog_start>;
>>> +Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>> +master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
>>> +master-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +master-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +master-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +master-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +master-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +master-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +master-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +master-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +master-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +master-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +master-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +master-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +[MASTER] ********* SOW BINLOG EVENTS         *********
>>> +show binlog events from <binlog_start>;
>>> +Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>> +master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
>>> +master-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +master-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +master-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +master-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +master-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +master-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +master-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +master-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +master-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +master-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +master-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +master-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +[SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
>>> +show binlog events in 'slave-bin.000001' from <binlog_start>;
>>> +Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>> +slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
>>> +slave-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +slave-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +slave-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +slave-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +slave-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +slave-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +[SLAVE] ********* SOW BINLOG EVENTS          *********
>>> +show binlog events from <binlog_start>;
>>> +Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>> +slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
>>> +slave-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +slave-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +slave-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +slave-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +slave-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +slave-bin.000001	#	Query	#	#	use `test`; BEGIN
>>> +slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-bin.000001	#	Query	#	#	use `test`; COMMIT
>>> +[SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
>>> +show relaylog events in 'slave-relay-bin.000003' from <binlog_start>;
>>> +Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>> +slave-relay-bin.000003	#	Rotate	#	#	master-bin.000001;pos=4
>>> +slave-relay-bin.000003	#	Format_desc	#	#	Server ver: 6.0.12-alpha-debug-log,
> Binlog ver: 4
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; BEGIN
>>> +slave-relay-bin.000003	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-relay-bin.000003	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; COMMIT
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; BEGIN
>>> +slave-relay-bin.000003	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-relay-bin.000003	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; COMMIT
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; BEGIN
>>> +slave-relay-bin.000003	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-relay-bin.000003	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; COMMIT
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; BEGIN
>>> +slave-relay-bin.000003	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-relay-bin.000003	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; COMMIT
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; BEGIN
>>> +slave-relay-bin.000003	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-relay-bin.000003	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; COMMIT
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; BEGIN
>>> +slave-relay-bin.000003	#	Table_map	#	#	table_id: # (test.t1)
>>> +slave-relay-bin.000003	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; COMMIT
>>> +[SLAVE] ********* SOW RELAYLOG EVENTS        *********
>>> +show relaylog events from <binlog_start>;
>>> +Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>> +slave-relay-bin.000002	#	Rotate	#	#	slave-relay-bin.000003;pos=4
>>> +DROP TABLE t1;
>>>
>>> === added file
> 'mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result'
>>> ---
> a/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result	1970-01-01 00:00:00
> +0000
>>> +++
> b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result	2009-05-05 16:53:03
> +0000
>>> @@ -0,0 +1,70 @@
>>> +stop slave;
>>> +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
>>> +reset master;
>>> +reset slave;
>>> +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
>>> +start slave;
>>> +CREATE TABLE t1 (a INT);
>>> +INSERT INTO t1 VALUES (1);
>>> +INSERT INTO t1 VALUES (2);
>>> +INSERT INTO t1 VALUES (3);
>>> +INSERT INTO t1 VALUES (4);
>>> +INSERT INTO t1 VALUES (5);
>>> +INSERT INTO t1 VALUES (6);
>>> +[MASTER] ********* SOW BINLOG EVENTS IN ...  *********
>>> +show binlog events in 'master-bin.000001' from <binlog_start>;
>>> +Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>> +master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
>>> +master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
>>> +master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
>>> +master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
>>> +master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
>>> +master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
>>> +master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
>>> +[MASTER] ********* SOW BINLOG EVENTS         *********
>>> +show binlog events from <binlog_start>;
>>> +Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>> +master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
>>> +master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
>>> +master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
>>> +master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
>>> +master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
>>> +master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
>>> +master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
>>> +[SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
>>> +show binlog events in 'slave-bin.000001' from <binlog_start>;
>>> +Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>> +slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
>>> +slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
>>> +slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
>>> +slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
>>> +slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
>>> +slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
>>> +slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
>>> +[SLAVE] ********* SOW BINLOG EVENTS          *********
>>> +show binlog events from <binlog_start>;
>>> +Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>> +slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
>>> +slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
>>> +slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
>>> +slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
>>> +slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
>>> +slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
>>> +slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
>>>   
>>>       
>> ==================================================
>>     
>>> +[SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
>>> +show relaylog events in 'slave-relay-bin.000003' from <binlog_start>;
>>> +Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>> +slave-relay-bin.000003	#	Rotate	#	#	master-bin.000001;pos=4
>>> +slave-relay-bin.000003	#	Format_desc	#	#	Server ver: 6.0.12-alpha-debug-log,
> Binlog ver: 4
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
>>> +slave-relay-bin.000003	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
>>> +[SLAVE] ********* SOW RELAYLOG EVENTS        *********
>>> +show relaylog events from <binlog_start>;
>>> +Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>> +slave-relay-bin.000002	#	Rotate	#	#	slave-relay-bin.000003;pos=4
>>> +DROP TABLE t1;
>>>   
>>>       
>> ==================================================
>>
>> I can't understand the above output. Which is the current relay log?
>>     
>
>   
Ok. I understood it now. It would be great to print the list of binary
logs and relay logs
before executing the show command. This is just a suggestion. There is
no need to
implement it.
> I don't quite get what do you mean by "current"?
>
> The behavior is exactly like it is stated in the manual:
>
> "If you do not specify 'log_name', the first binary log is displayed."
>
> So, in the case the binary log name is not specified, the first one is
> displayed (thats the second printout above). The first printout is the
> most recent relay log file (maybe this is what you meant by "current").
>
>
>   
>>> === added file 'mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test'
>>> --- a/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test	1970-01-01
> 00:00:00 +0000
>>> +++ b/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test	2009-05-05
> 16:53:03 +0000
>>> @@ -0,0 +1,18 @@
>>> +# BUG#28777 SHOW BINLOG EVENTS does not work on relay log files
>>> +#
>>> +# GOAL
>>> +# ==== 
>>> +# 
>>> +#   Test that SHOW BINLOG EVENTS and the new SHOW RELAYLOG EVENTS works
> after
>>> +#   the patch, both on master and slave.
>>> +#
>>> +# HOW
>>> +# ===
>>> +#
>>> +#   This test issues SHOW [BINLOG|RELAYLOG] EVENTS both on master and slave
> after 
>>> +#   some statements have been issued.
>>> +
>>> +-- source include/master-slave.inc
>>> +-- source include/have_binlog_format_row.inc
>>> +
>>> +-- source suite/rpl/include/rpl_show_relaylog_events.inc
>>>
>>> === added file
> 'mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test'
>>> --- a/mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test	1970-01-01
> 00:00:00 +0000
>>> +++ b/mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test	2009-05-05
> 16:53:03 +0000
>>> @@ -0,0 +1,18 @@
>>> +# BUG#28777 SHOW BINLOG EVENTS does not work on relay log files
>>> +#
>>> +# GOAL
>>> +# ==== 
>>> +# 
>>> +#   Test that SHOW BINLOG EVENTS and the new SHOW RELAYLOG EVENTS works
> after
>>> +#   the patch, both on master and slave.
>>> +#
>>> +# HOW
>>> +# ===
>>> +#
>>> +#   This test issues SHOW [BINLOG|RELAYLOG] EVENTS both on master and slave
> after 
>>> +#   some statements have been issued.
>>> +
>>> +-- source include/master-slave.inc
>>> +-- source include/have_binlog_format_mixed_or_statement.inc
>>> +
>>> +-- source suite/rpl/include/rpl_show_relaylog_events.inc
>>>
>>> === modified file 'sql/lex.h'
>>> --- a/sql/lex.h	2009-03-09 14:00:03 +0000
>>> +++ b/sql/lex.h	2009-05-05 16:53:03 +0000
>>> @@ -444,6 +444,7 @@ static SYMBOL symbols[] = {
>>>    { "REDUNDANT",	SYM(REDUNDANT_SYM)},
>>>    { "REFERENCES",	SYM(REFERENCES)},
>>>    { "REGEXP",		SYM(REGEXP)},
>>> +  { "RELAYLOG",         SYM(RELAYLOG_SYM)},
>>>    { "RELAY_LOG_FILE",   SYM(RELAY_LOG_FILE_SYM)},
>>>    { "RELAY_LOG_POS",    SYM(RELAY_LOG_POS_SYM)},
>>>    { "RELAY_THREAD",     SYM(RELAY_THREAD)},
>>>
>>> === modified file 'sql/mysqld.cc'
>>> --- a/sql/mysqld.cc	2009-04-22 22:12:25 +0000
>>> +++ b/sql/mysqld.cc	2009-05-05 16:53:03 +0000
>>> @@ -3279,6 +3279,7 @@ SHOW_VAR com_status_vars[]= {
>>>    {"show_processlist",     (char*) offsetof(STATUS_VAR, com_stat[(uint)
> SQLCOM_SHOW_PROCESSLIST]), SHOW_LONG_STATUS},
>>>    {"show_profile",         (char*) offsetof(STATUS_VAR, com_stat[(uint)
> SQLCOM_SHOW_PROFILE]), SHOW_LONG_STATUS},
>>>    {"show_profiles",        (char*) offsetof(STATUS_VAR, com_stat[(uint)
> SQLCOM_SHOW_PROFILES]), SHOW_LONG_STATUS},
>>> +  {"show_relaylog_events", (char*) offsetof(STATUS_VAR, com_stat[(uint)
> SQLCOM_SHOW_RELAYLOG_EVENTS]), SHOW_LONG_STATUS},
>>>    {"show_slave_hosts",     (char*) offsetof(STATUS_VAR, com_stat[(uint)
> SQLCOM_SHOW_SLAVE_HOSTS]), SHOW_LONG_STATUS},
>>>    {"show_slave_status",    (char*) offsetof(STATUS_VAR, com_stat[(uint)
> SQLCOM_SHOW_SLAVE_STAT]), SHOW_LONG_STATUS},
>>>    {"show_status",          (char*) offsetof(STATUS_VAR, com_stat[(uint)
> SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS},
>>>
>>> === modified file 'sql/sp_head.cc'
>>> --- a/sql/sp_head.cc	2009-04-13 13:24:28 +0000
>>> +++ b/sql/sp_head.cc	2009-05-05 16:53:03 +0000
>>> @@ -175,6 +175,7 @@ sp_get_flags_for_command(LEX *lex)
>>>    case SQLCOM_SHOW_AUTHORS:
>>>    case SQLCOM_SHOW_BINLOGS:
>>>    case SQLCOM_SHOW_BINLOG_EVENTS:
>>> +  case SQLCOM_SHOW_RELAYLOG_EVENTS:
>>>    case SQLCOM_SHOW_CHARSETS:
>>>    case SQLCOM_SHOW_COLLATIONS:
>>>    case SQLCOM_SHOW_CONTRIBUTORS:
>>>
>>> === modified file 'sql/sql_lex.h'
>>> --- a/sql/sql_lex.h	2009-03-19 16:42:23 +0000
>>> +++ b/sql/sql_lex.h	2009-05-05 16:53:03 +0000
>>> @@ -123,6 +123,7 @@ enum enum_sql_command {
>>>  #endif
>>>    SQLCOM_SHOW_PROFILE, SQLCOM_SHOW_PROFILES,
>>>    SQLCOM_SIGNAL, SQLCOM_RESIGNAL,
>>> +  SQLCOM_SHOW_RELAYLOG_EVENTS, 
>>>  
>>>    /*
>>>      When a command is added here, be sure it's also added in mysqld.cc
>>>
>>> === modified file 'sql/sql_parse.cc'
>>> --- a/sql/sql_parse.cc	2009-04-22 22:12:25 +0000
>>> +++ b/sql/sql_parse.cc	2009-05-05 16:53:03 +0000
>>> @@ -2353,6 +2353,7 @@ mysql_execute_command(THD *thd)
>>>      res = show_slave_hosts(thd);
>>>      break;
>>>    }
>>> +  case SQLCOM_SHOW_RELAYLOG_EVENTS: /* fall through */
>>>    case SQLCOM_SHOW_BINLOG_EVENTS:
>>>    {
>>>      if (check_global_access(thd, REPL_SLAVE_ACL))
>>>
>>> === modified file 'sql/sql_repl.cc'
>>> --- a/sql/sql_repl.cc	2009-04-21 13:49:02 +0000
>>> +++ b/sql/sql_repl.cc	2009-05-05 16:53:03 +0000
>>> @@ -1689,6 +1689,7 @@ bool mysql_show_binlog_events(THD* thd)
>>>    bool ret = TRUE;
>>>    IO_CACHE log;
>>>    File file = -1;
>>> +  MYSQL_BIN_LOG *binary_log= NULL;
>>>    DBUG_ENTER("mysql_show_binlog_events");
>>>  
>>>    Log_event::init_show_field_list(&field_list);
>>> @@ -1699,14 +1700,30 @@ bool mysql_show_binlog_events(THD* thd)
>>>    Format_description_log_event *description_event= new
>>>      Format_description_log_event(3); /* MySQL 4.0 by default */
>>>  
>>> -  /*
>>> -    Wait for handlers to insert any pending information
>>> -    into the binlog.  For e.g. ndb which updates the binlog asynchronously
>>> -    this is needed so that the uses sees all its own commands in the binlog
>>> -  */
>>> -  ha_binlog_wait(thd);
>>> +  DBUG_ASSERT(thd->lex->sql_command == SQLCOM_SHOW_BINLOG_EVENTS ||
>>> +              thd->lex->sql_command == SQLCOM_SHOW_RELAYLOG_EVENTS);
>>>  
>>> -  if (mysql_bin_log.is_open())
>>> +  /* select wich binary log to use: binlog or relay */
>>> +  if ( thd->lex->sql_command == SQLCOM_SHOW_BINLOG_EVENTS )
>>> +  {
>>> +    /*
>>> +      Wait for handlers to insert any pending information
>>> +      into the binlog.  For e.g. ndb which updates the binlog
> asynchronously
>>> +      this is needed so that the uses sees all its own commands in the
> binlog
>>> +    */
>>> +    ha_binlog_wait(thd);
>>> +
>>> +    binary_log= &mysql_bin_log;
>>> +  }
>>> +  else  /* showing relay log contents */
>>> +  {
>>> +    if (!active_mi)
>>> +      DBUG_RETURN(TRUE);
>>> +
>>> +    binary_log= &(active_mi->rli->relay_log);
>>> +  }
>>> +
>>> +  if (binary_log->is_open())
>>>    {
>>>      LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
>>>      SELECT_LEX_UNIT *unit= &thd->lex->unit;
>>> @@ -1714,7 +1731,7 @@ bool mysql_show_binlog_events(THD* thd)
>>>      my_off_t pos = max(BIN_LOG_HEADER_SIZE, lex_mi->pos); //
> user-friendly
>>>      char search_file_name[FN_REFLEN], *name;
>>>      const char *log_file_name = lex_mi->log_file_name;
>>> -    pthread_mutex_t *log_lock = mysql_bin_log.get_log_lock();
>>> +    pthread_mutex_t *log_lock = binary_log->get_log_lock();
>>>      LOG_INFO linfo;
>>>      Log_event* ev;
>>>  
>>> @@ -1724,13 +1741,13 @@ bool mysql_show_binlog_events(THD* thd)
>>>  
>>>      name= search_file_name;
>>>      if (log_file_name)
>>> -      mysql_bin_log.make_log_name(search_file_name, log_file_name);
>>> +      binary_log->make_log_name(search_file_name, log_file_name);
>>>      else
>>>        name=0;					// Find first log
>>>  
>>>      linfo.index_file_offset = 0;
>>>  
>>> -    if (mysql_bin_log.find_log_pos(&linfo, name, 1))
>>> +    if (binary_log->find_log_pos(&linfo, name, 1))
>>>      {
>>>        errmsg = "Could not find target log";
>>>        goto err;
>>>
>>> === modified file 'sql/sql_yacc.yy'
>>> --- a/sql/sql_yacc.yy	2009-04-01 21:36:07 +0000
>>> +++ b/sql/sql_yacc.yy	2009-05-05 16:53:03 +0000
>>>   
>>>       
>> And?
>>
>> binlog_base64_event:
>>           BINLOG_SYM TEXT_STRING_sys
>>           {
>>             Lex->sql_command = SQLCOM_BINLOG_BASE64_EVENT;
>>             Lex->comment= $2;
>>           }
>>         ;
>>     
>
> What about it?
>
> To my knowledge, that is not a 'SHOW' parameter. I believe it is used by
> mysqlbinlog to print certain events in the binlog. The server is also
> able to handle those (decode and process). Check the references below:
>
>  * http://dev.mysql.com/doc/refman/5.1/en/binlog.html
>  * test case: suite/binlog/t/binlog_base64_flag.test
>   
This is not a SHOW parameter but this may be used to process strings in
a relay log. However, as you discussed in the IRC there is no need to change
anything regarding that point as there is no meaning in having a RELAYLOG
command. The BINLOG command is enough to process strings in both files:
binary and relay logs.
>   
>>> @@ -1033,6 +1033,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
>>>  %token  REDUNDANT_SYM
>>>  %token  REFERENCES                    /* SQL-2003-R */
>>>  %token  REGEXP
>>> +%token  RELAYLOG_SYM
>>>  %token  RELAY_LOG_FILE_SYM
>>>  %token  RELAY_LOG_POS_SYM
>>>  %token  RELAY_THREAD
>>> @@ -10693,6 +10694,11 @@ show_param:
>>>              LEX *lex= Lex;
>>>              lex->sql_command= SQLCOM_SHOW_BINLOG_EVENTS;
>>>            } opt_limit_clause_init
>>> +        | RELAYLOG_SYM EVENTS_SYM binlog_in binlog_from
>>> +          {
>>> +            LEX *lex= Lex;
>>> +            lex->sql_command= SQLCOM_SHOW_RELAYLOG_EVENTS;
>>> +          } opt_limit_clause_init
>>>          | keys_or_index from_or_in table_ident opt_db where_clause
>>>            {
>>>              LEX *lex= Lex;
>>> @@ -12316,6 +12322,7 @@ keyword_sp:
>>>          | REDO_BUFFER_SIZE_SYM     {}
>>>          | REDOFILE_SYM             {}
>>>          | REDUNDANT_SYM            {}
>>> +        | RELAYLOG_SYM             {}
>>>          | RELAY_LOG_FILE_SYM       {}
>>>          | RELAY_LOG_POS_SYM        {}
>>>          | RELAY_THREAD             {}
>>>   
>>> ------------------------------------------------------------------------
>>>
>>> This body part will be downloaded on demand.
>>>       
>>     

Thread
bzr commit into mysql-6.0-rpl branch (luis.soares:2844) Bug#28777Luis Soares5 May
  • Re: bzr commit into mysql-6.0-rpl branch (luis.soares:2844) Bug#28777Alfranio Correia11 May
    • Re: bzr commit into mysql-6.0-rpl branch (luis.soares:2844) Bug#28777Luís Soares13 May
      • Re: bzr commit into mysql-6.0-rpl branch (luis.soares:2844) Bug#28777Alfranio Correia13 May
        • Re: bzr commit into mysql-6.0-rpl branch (luis.soares:2844) Bug#28777Luís Soares13 May
  • Re: bzr commit into mysql-6.0-rpl branch (luis.soares:2844) Bug#28777He Zhenxing12 May
    • Re: bzr commit into mysql-6.0-rpl branch (luis.soares:2844) Bug#28777Luís Soares13 May
      • Re: bzr commit into mysql-6.0-rpl branch (luis.soares:2844) Bug#28777He Zhenxing13 May