List:Commits« Previous MessageNext Message »
From:He Zhenxing Date:February 10 2009 8:17am
Subject:Re: bzr commit into mysql-5.1-bugteam branch (zhou.li:2793) Bug#28777
View as plain text  
Hi Leonard,

Thank you for the work! Please see my comments in line.

Leonard Zhou wrote:
> #At file:///home/zhl/mysql/rep/5.1/bug28777/
> 
>  2793 Leonard Zhou	2009-02-09
>       Bug#28777 show binlog events can work with relay log

Usually the comment message of a bug comes in three parts, each
seperated with an empty line:
1) the title as you already have
2) a description of the bug, the symptom and the problem
3) what this patch does to fix that

Please add 2) and 3).

> added:
>   mysql-test/suite/rpl/r/rpl_bug28777.result
>   mysql-test/suite/rpl/t/rpl_bug28777.test
> modified:
>   sql/sql_parse.cc
>   sql/sql_repl.cc
>   sql/sql_repl.h
> 
> per-file messages:
>   mysql-test/suite/rpl/r/rpl_bug28777.result
>     Test result for bug28777
>   mysql-test/suite/rpl/t/rpl_bug28777.test
>     Test case for bug28777
>   sql/sql_parse.cc
>     Pass master_info to mysql_show_binlog_events
>   sql/sql_repl.cc
>     Check relay log when do mysql 'show binlog event'
>   sql/sql_repl.h
>     Add Master_info variable
> === added file 'mysql-test/suite/rpl/r/rpl_bug28777.result'
> --- a/mysql-test/suite/rpl/r/rpl_bug28777.result	1970-01-01 00:00:00 +0000
> +++ b/mysql-test/suite/rpl/r/rpl_bug28777.result	2009-02-09 07:40:07 +0000
> @@ -0,0 +1,47 @@
> +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;
> +==== Initialize ====
> +[on master]
> +CREATE TABLE t1 (a INT);
> +SHOW CREATE TABLE t1;
> +Table	Create Table
> +t1	CREATE TABLE `t1` (
> +  `a` int(11) DEFAULT NULL
> +) ENGINE=MyISAM DEFAULT CHARSET=latin1
> +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);
> +SELECT * FROM t1 ORDER BY a;
> +a
> +1
> +2
> +3
> +4
> +5
> +6
> +[on slave]
> +==== Verify results on slave ====
> +show binlog events in 'slave-bin.000001';
> +Log_name	Pos	Event_type	Server_id	End_log_pos	Info
> +slave-bin.000001	#	Format_desc	2	#	Server ver: 5.1.32-debug-log, Binlog ver: 4
> +slave-bin.000001	#	Query	1	#	use `test`; CREATE TABLE t1 (a INT)
> +slave-bin.000001	#	Query	1	#	use `test`; INSERT INTO t1 VALUES (1)
> +slave-bin.000001	#	Query	1	#	use `test`; INSERT INTO t1 VALUES (2)
> +slave-bin.000001	#	Query	1	#	use `test`; INSERT INTO t1 VALUES (3)
> +slave-bin.000001	#	Query	1	#	use `test`; INSERT INTO t1 VALUES (4)
> +slave-bin.000001	#	Query	1	#	use `test`; INSERT INTO t1 VALUES (5)
> +slave-bin.000001	#	Query	1	#	use `test`; INSERT INTO t1 VALUES (6)
> +show binlog events in 'slave-relay-bin.000002';
> +Log_name	Pos	Event_type	Server_id	End_log_pos	Info
> +slave-relay-bin.000002	#	Format_desc	2	#	Server ver: 5.1.32-debug-log, Binlog ver:
> 4
> +slave-relay-bin.000002	#	Rotate	2	#	slave-relay-bin.000003;pos=4
> +==== Clean up ====
> +[on master]
> +DROP TABLE t1;
> 
> === added file 'mysql-test/suite/rpl/t/rpl_bug28777.test'
> --- a/mysql-test/suite/rpl/t/rpl_bug28777.test	1970-01-01 00:00:00 +0000
> +++ b/mysql-test/suite/rpl/t/rpl_bug28777.test	2009-02-09 07:40:07 +0000
> @@ -0,0 +1,39 @@
> +source include/have_binlog_format_statement.inc;
> +source include/master-slave.inc;
> +
> +
> +--echo ==== Initialize ====
> +
> +--echo [on master]
> +--connection master
> +
> +CREATE TABLE t1 (a INT);
> +SHOW CREATE TABLE t1;
> +
> +
> +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);
> +SELECT * FROM t1 ORDER BY a;
> +
> +--echo [on slave]
> +sync_slave_with_master;
> +
> +
> +--echo ==== Verify results on slave ====
> +--replace_column 2 # 5 #
> +show binlog events in 'slave-bin.000001';
> +--replace_column 2 # 5 #
> +show binlog events in 'slave-relay-bin.000002';
> +
> +--echo ==== Clean up ====
> +
> +--echo [on master]
> +connection master;
> +DROP TABLE t1;
> +
> +#--echo [on slave]
> +sync_slave_with_master;
> 
> === modified file 'sql/sql_parse.cc'
> --- a/sql/sql_parse.cc	2009-02-05 06:16:00 +0000
> +++ b/sql/sql_parse.cc	2009-02-09 07:40:07 +0000
> @@ -2321,7 +2321,7 @@ mysql_execute_command(THD *thd)
>    {
>      if (check_global_access(thd, REPL_SLAVE_ACL))
>        goto error;
> -    res = mysql_show_binlog_events(thd);
> +    res = mysql_show_binlog_events(thd,active_mi);
>      break;
>    }
>  #endif
> 
> === modified file 'sql/sql_repl.cc'
> --- a/sql/sql_repl.cc	2009-01-23 12:22:05 +0000
> +++ b/sql/sql_repl.cc	2009-02-09 07:40:07 +0000
> @@ -1389,7 +1389,7 @@ int cmp_master_pos(const char* log_file_
>    @retval FALSE success
>    @retval TRUE failure
>  */
> -bool mysql_show_binlog_events(THD* thd)
> +bool mysql_show_binlog_events(THD* thd, Master_info* mi)
>  {
>    Protocol *protocol= thd->protocol;
>    List<Item> field_list;
> @@ -1414,7 +1414,7 @@ bool mysql_show_binlog_events(THD* thd)
>    */
>    ha_binlog_wait(thd);
>  
> -  if (mysql_bin_log.is_open())
> +  if (mysql_bin_log.is_open() || mi->rli.relay_log.is_open())
>    {
>      LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
>      SELECT_LEX_UNIT *unit= &thd->lex->unit;
> @@ -1440,8 +1440,12 @@ bool mysql_show_binlog_events(THD* thd)
>  
>      if (mysql_bin_log.find_log_pos(&linfo, name, 1))
>      {
> -      errmsg = "Could not find target log";
> -      goto err;
> +      mi->rli.relay_log.make_log_name(search_file_name, log_file_name);

You did not check if log_file_name is not set, in which case you should
set 'name' to 0, and find the first log available.

> +      if(mi->rli.relay_log.find_log_pos(&linfo, name, 1))
> +      {
> +        errmsg = "Could not find target log";
> +        goto err;
> +      }
>      }
>  
>      pthread_mutex_lock(&LOCK_thread_count);
> 
> === modified file 'sql/sql_repl.h'
> --- a/sql/sql_repl.h	2008-03-14 17:38:54 +0000
> +++ b/sql/sql_repl.h	2009-02-09 07:40:07 +0000
> @@ -39,7 +39,7 @@ extern my_bool opt_sporadic_binlog_dump_
>  int start_slave(THD* thd, Master_info* mi, bool net_report);
>  int stop_slave(THD* thd, Master_info* mi, bool net_report);
>  bool change_master(THD* thd, Master_info* mi);
> -bool mysql_show_binlog_events(THD* thd);
> +bool mysql_show_binlog_events(THD* thd, Master_info* mi);
>  int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
>  		   const char* log_file_name2, ulonglong log_pos2);
>  int reset_slave(THD *thd, Master_info* mi);
> 
> 

Thread
bzr commit into mysql-5.1-bugteam branch (zhou.li:2793) Bug#28777Leonard Zhou9 Feb
  • Re: bzr commit into mysql-5.1-bugteam branch (zhou.li:2793) Bug#28777He Zhenxing10 Feb