List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:October 11 2007 4:36pm
Subject:Re: bk commit into 5.1 tree (aelkin:1.2653) BUG#20435
View as plain text  
Mats, hej.

Tnanks for your comments.  Some of them are helpful indeed.
Part of questions have been discussed on #rep. I am mentioning that.

>> 
> 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
>>
> -#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	1797	#	#	master-bin.000001	Yes	Yes				#			0		0	1797	#	None		0	No						#	No	0		0	
>>
> +#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	1798	#	#	master-bin.000001	Yes	Yes				#			0		0	1798	#	None		0	No						#	No	0		0	
>>   
>
> Could you please make this vertical instead since you're changing the
> result file anyway. It makes it easier in the future.
>

i did. However, i don't like such partial solution. Such or similar
sticky things should be better be changed either all at once, or modified test
by modified test. I did not change this test.


>>  set sql_log_bin=0;
>>  delete from t1;
>>  set sql_log_bin=1;
>> @@ -49,7 +49,7 @@ change master to master_user='test';
>>  change master to master_user='root';
>>  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
>>
> -#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	1832	#	#	master-bin.000001	No	No				#			0		0	1832	#	None		0	No						#	No	0		0	
>>
> +#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	1833	#	#	master-bin.000001	No	No				#			0		0	1833	#	None		0	No						#	No	0		0	
>>   
>
> Same here...
>
>>  set global sql_slave_skip_counter=1;
>>  start slave;
>>  set sql_log_bin=0;
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
> b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
>> --- a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result	2007-06-27 15:44:13
> +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result	2007-10-10 11:13:17
> +03:00
>> @@ -13,7 +13,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	290
>> +Read_Master_Log_Pos	291
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -28,7 +28,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	290
>> +Exec_Master_Log_Pos	291
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -53,7 +53,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	465
>> +Read_Master_Log_Pos	466
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -68,7 +68,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	1590
>>  Last_Error	Fatal error: Not enough memory
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	325
>> +Exec_Master_Log_Pos	326
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_log_pos.result
> b/mysql-test/suite/rpl/r/rpl_log_pos.result
>> --- a/mysql-test/suite/rpl/r/rpl_log_pos.result	2007-06-27 15:28:29 +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_log_pos.result	2007-10-10 11:13:17 +03:00
>> @@ -6,9 +6,9 @@ drop table if exists t1,t2,t3,t4,t5,t6,t
>>  start slave;
>>  show master status;
>>  File	Position	Binlog_Do_DB	Binlog_Ignore_DB
>> -master-bin.000001	106	<Binlog_Ignore_DB>	
>> +master-bin.000001	107	<Binlog_Ignore_DB>	
>>  stop slave;
>> -change master to master_log_pos=75;
>> +change master to master_log_pos=76;
>>  SHOW SLAVE STATUS;
>>  Slave_IO_State	#
>>  Master_Host	127.0.0.1
>> @@ -16,7 +16,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	75
>> +Read_Master_Log_Pos	76
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -31,7 +31,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	75
>> +Exec_Master_Log_Pos	76
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -57,7 +57,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	75
>> +Read_Master_Log_Pos	76
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -72,7 +72,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	75
>> +Exec_Master_Log_Pos	76
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -91,12 +91,12 @@ Last_SQL_Errno	0
>>  Last_SQL_Error	
>>  show master status;
>>  File	Position	Binlog_Do_DB	Binlog_Ignore_DB
>> -master-bin.000001	106	<Binlog_Ignore_DB>	
>> +master-bin.000001	107	<Binlog_Ignore_DB>	
>>  create table if not exists t1 (n int);
>>  drop table if exists t1;
>>  create table t1 (n int);
>>  insert into t1 values (1),(2),(3);
>> -change master to master_log_pos=106;
>> +change master to master_log_pos=107;
>>  start slave;
>>  select * from t1 ORDER BY n;
>>  n
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
> b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
>> --- a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result	2007-08-21 16:37:49 +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result	2007-10-10 11:13:18 +03:00
>> @@ -28,7 +28,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	457
>> +Read_Master_Log_Pos	458
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -43,7 +43,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	457
>> +Exec_Master_Log_Pos	458
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_rotate_logs.result
> b/mysql-test/suite/rpl/r/rpl_rotate_logs.result
>> --- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result	2007-07-07 10:04:08 +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result	2007-10-10 11:13:18 +03:00
>> @@ -21,7 +21,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	60
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	556
>> +Read_Master_Log_Pos	557
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -36,7 +36,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	556
>> +Exec_Master_Log_Pos	557
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -63,9 +63,9 @@ insert into t2 values (34),(67),(123);
>>  flush logs;
>>  show binary logs;
>>  Log_name	File_size
>> -master-bin.000001	600
>> -master-bin.000002	371
>> -master-bin.000003	106
>> +master-bin.000001	601
>> +master-bin.000002	372
>> +master-bin.000003	107
>>  create table t3 select * from temp_table;
>>  select * from t3;
>>  a
>> @@ -79,20 +79,20 @@ start slave;
>>  purge master logs to 'master-bin.000002';
>>  show master logs;
>>  Log_name	File_size
>> -master-bin.000002	371
>> -master-bin.000003	415
>> +master-bin.000002	372
>> +master-bin.000003	416
>>  purge binary logs to 'master-bin.000002';
>>  show binary logs;
>>  Log_name	File_size
>> -master-bin.000002	371
>> -master-bin.000003	415
>> +master-bin.000002	372
>> +master-bin.000003	416
>>  select @time_for_purge:=DATE_ADD(UPDATE_TIME, INTERVAL 1 SECOND)
>>  from information_schema.tables
>>  where TABLE_SCHEMA="test" and TABLE_NAME="t2";
>>  purge master logs before (@time_for_purge);
>>  show binary logs;
>>  Log_name	File_size
>> -master-bin.000003	415
>> +master-bin.000003	416
>>  insert into t2 values (65);
>>  SHOW SLAVE STATUS;
>>  Slave_IO_State	#
>> @@ -101,7 +101,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	60
>>  Master_Log_File	master-bin.000003
>> -Read_Master_Log_Pos	504
>> +Read_Master_Log_Pos	505
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000003
>> @@ -116,7 +116,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	504
>> +Exec_Master_Log_Pos	505
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -149,12 +149,12 @@ count(*)
>>  create table t4 select * from temp_table;
>>  show binary logs;
>>  Log_name	File_size
>> -master-bin.000003	4193
>> -master-bin.000004	4198
>> -master-bin.000005	2040
>> +master-bin.000003	4194
>> +master-bin.000004	4199
>> +master-bin.000005	2041
>>  show master status;
>>  File	Position	Binlog_Do_DB	Binlog_Ignore_DB
>> -master-bin.000005	2040		
>> +master-bin.000005	2041		
>>  select * from t4;
>>  a
>>  testing temporary tables part 2
>> @@ -165,7 +165,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	60
>>  Master_Log_File	master-bin.000005
>> -Read_Master_Log_Pos	2040
>> +Read_Master_Log_Pos	2041
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000005
>> @@ -180,7 +180,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	2040
>> +Exec_Master_Log_Pos	2041
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
> b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
>> --- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result	2007-08-21 16:37:49
> +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result	2007-10-10 11:13:18
> +03:00
>> @@ -54,10 +54,10 @@ DELETE FROM t1 WHERE a = 0;
>>  UPDATE t1 SET a=99 WHERE a = 0;
>>  SHOW BINLOG EVENTS;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>> -master-bin.000001	4	Format_desc	1	106	Server ver: SERVER_VERSION, Binlog ver: 4
>> -master-bin.000001	106	Query	1	192	use `test`; CREATE TABLE t1 (a INT)
>> -master-bin.000001	192	Table_map	1	233	table_id: # (test.t1)
>> -master-bin.000001	233	Write_rows	1	272	table_id: # flags: STMT_END_F
>> +master-bin.000001	4	Format_desc	1	107	Server ver: SERVER_VERSION, Binlog ver: 4
>> +master-bin.000001	107	Query	1	193	use `test`; CREATE TABLE t1 (a INT)
>> +master-bin.000001	193	Table_map	1	234	table_id: # (test.t1)
>> +master-bin.000001	234	Write_rows	1	273	table_id: # flags: STMT_END_F
>>  DROP TABLE t1;
>>  ================ Test for BUG#17620 ================
>>  drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_create_table.result
> b/mysql-test/suite/rpl/r/rpl_row_create_table.result
>> --- a/mysql-test/suite/rpl/r/rpl_row_create_table.result	2007-08-21 15:32:50
> +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result	2007-10-10 11:13:18
> +03:00
>> @@ -8,30 +8,30 @@ CREATE TABLE t1 (a INT, b INT);
>>  CREATE TABLE t2 (a INT, b INT) ENGINE=Merge;
>>  CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
>>  CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
>> -SHOW BINLOG EVENTS FROM 216;
>> +SHOW BINLOG EVENTS FROM 217;
>>  Log_name	#
>> -Pos	216
>> +Pos	217
>>  Event_type	Query
>>  Server_id	#
>> -End_log_pos	309
>> +End_log_pos	310
>>  Info	use `test`; CREATE TABLE t1 (a INT, b INT)
>>  Log_name	#
>> -Pos	309
>> +Pos	310
>>  Event_type	Query
>>  Server_id	#
>> -End_log_pos	415
>> +End_log_pos	416
>>  Info	use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=Merge
>>  Log_name	#
>> -Pos	415
>> +Pos	416
>>  Event_type	Query
>>  Server_id	#
>> -End_log_pos	521
>> +End_log_pos	522
>>  Info	use `test`; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8
>>  Log_name	#
>> -Pos	521
>> +Pos	522
>>  Event_type	Query
>>  Server_id	#
>> -End_log_pos	640
>> +End_log_pos	641
>>  Info	use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8
>>  **** On Master ****
>>  SHOW CREATE TABLE t1;
>> @@ -127,7 +127,7 @@ NULL	5	10
>>  NULL	6	12
>>  CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
>>  ERROR 23000: Duplicate entry '2' for key 'b'
>> -SHOW BINLOG EVENTS FROM 1100;
>> +SHOW BINLOG EVENTS FROM 1101;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  CREATE TABLE t7 (a INT, b INT UNIQUE);
>>  INSERT INTO t7 SELECT a,b FROM tt3;
>> @@ -137,11 +137,11 @@ a	b
>>  1	2
>>  2	4
>>  3	6
>> -SHOW BINLOG EVENTS FROM 1100;
>> +SHOW BINLOG EVENTS FROM 1101;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>> -#	1100	Query	#	1200	use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
>> -#	1200	Table_map	#	1242	table_id: # (test.t7)
>> -#	1242	Write_rows	#	1298	table_id: # flags: STMT_END_F
>> +#	1101	Query	#	1201	use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
>> +#	1201	Table_map	#	1243	table_id: # (test.t7)
>> +#	1243	Write_rows	#	1299	table_id: # flags: STMT_END_F
>>  SELECT * FROM t7 ORDER BY a,b;
>>  a	b
>>  1	2
>> @@ -154,10 +154,10 @@ INSERT INTO t7 SELECT a,b FROM tt4;
>>  ROLLBACK;
>>  Warnings:
>>  Warning	1196	Some non-transactional changed tables couldn't be rolled back
>> -SHOW BINLOG EVENTS FROM 1298;
>> +SHOW BINLOG EVENTS FROM 1299;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>> -#	1298	Table_map	#	1340	table_id: # (test.t7)
>> -#	1340	Write_rows	#	1396	table_id: # flags: STMT_END_F
>> +#	1299	Table_map	#	1341	table_id: # (test.t7)
>> +#	1341	Write_rows	#	1397	table_id: # flags: STMT_END_F
>>  SELECT * FROM t7 ORDER BY a,b;
>>  a	b
>>  1	2
>> @@ -192,10 +192,10 @@ Create Table	CREATE TABLE `t9` (
>>    `a` int(11) DEFAULT NULL,
>>    `b` int(11) DEFAULT NULL
>>  ) ENGINE=MyISAM DEFAULT CHARSET=latin1
>> -SHOW BINLOG EVENTS FROM 1396;
>> +SHOW BINLOG EVENTS FROM 1397;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>> -#	1396	Query	#	1482	use `test`; CREATE TABLE t8 LIKE t4
>> -#	1482	Query	#	1621	use `test`; CREATE TABLE `t9` (
>> +#	1397	Query	#	1483	use `test`; CREATE TABLE t8 LIKE t4
>> +#	1483	Query	#	1622	use `test`; CREATE TABLE `t9` (
>>    `a` int(11) DEFAULT NULL,
>>    `b` int(11) DEFAULT NULL
>>  )
>> @@ -274,33 +274,33 @@ a
>>  3
>>  SHOW BINLOG EVENTS;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>> -#	4	Format_desc	#	106	Server ver: #, Binlog ver: #
>> -#	106	Query	#	192	use `test`; CREATE TABLE t1 (a INT)
>> -#	192	Table_map	#	233	table_id: # (test.t1)
>> -#	233	Write_rows	#	277	table_id: # flags: STMT_END_F
>> -#	277	Query	#	345	use `test`; BEGIN
>> -#	345	Query	#	470	use `test`; CREATE TABLE `t2` (
>> +#	4	Format_desc	#	107	Server ver: #, Binlog ver: #
>> +#	107	Query	#	193	use `test`; CREATE TABLE t1 (a INT)
>> +#	193	Table_map	#	234	table_id: # (test.t1)
>> +#	234	Write_rows	#	278	table_id: # flags: STMT_END_F
>> +#	278	Query	#	346	use `test`; BEGIN
>> +#	346	Query	#	471	use `test`; CREATE TABLE `t2` (
>>    `a` int(11) DEFAULT NULL
>>  ) ENGINE=InnoDB
>> -#	470	Table_map	#	511	table_id: # (test.t2)
>> -#	511	Write_rows	#	555	table_id: # flags: STMT_END_F
>> -#	555	Xid	#	582	COMMIT /* XID */
>> -#	582	Query	#	650	use `test`; BEGIN
>> -#	650	Query	#	775	use `test`; CREATE TABLE `t3` (
>> +#	471	Table_map	#	512	table_id: # (test.t2)
>> +#	512	Write_rows	#	556	table_id: # flags: STMT_END_F
>> +#	556	Xid	#	583	COMMIT /* XID */
>> +#	583	Query	#	651	use `test`; BEGIN
>> +#	651	Query	#	776	use `test`; CREATE TABLE `t3` (
>>    `a` int(11) DEFAULT NULL
>>  ) ENGINE=InnoDB
>> -#	775	Table_map	#	816	table_id: # (test.t3)
>> -#	816	Write_rows	#	860	table_id: # flags: STMT_END_F
>> -#	860	Xid	#	887	COMMIT /* XID */
>> -#	887	Query	#	955	use `test`; BEGIN
>> -#	955	Query	#	1080	use `test`; CREATE TABLE `t4` (
>> +#	776	Table_map	#	817	table_id: # (test.t3)
>> +#	817	Write_rows	#	861	table_id: # flags: STMT_END_F
>> +#	861	Xid	#	888	COMMIT /* XID */
>> +#	888	Query	#	956	use `test`; BEGIN
>> +#	956	Query	#	1081	use `test`; CREATE TABLE `t4` (
>>    `a` int(11) DEFAULT NULL
>>  ) ENGINE=InnoDB
>> -#	1080	Table_map	#	1121	table_id: # (test.t4)
>> -#	1121	Write_rows	#	1165	table_id: # flags: STMT_END_F
>> -#	1165	Xid	#	1192	COMMIT /* XID */
>> -#	1192	Table_map	#	1233	table_id: # (test.t1)
>> -#	1233	Write_rows	#	1277	table_id: # flags: STMT_END_F
>> +#	1081	Table_map	#	1122	table_id: # (test.t4)
>> +#	1122	Write_rows	#	1166	table_id: # flags: STMT_END_F
>> +#	1166	Xid	#	1193	COMMIT /* XID */
>> +#	1193	Table_map	#	1234	table_id: # (test.t1)
>> +#	1234	Write_rows	#	1278	table_id: # flags: STMT_END_F
>>  SHOW TABLES;
>>  Tables_in_test
>>  t1
>> @@ -365,17 +365,17 @@ a
>>  9
>>  SHOW BINLOG EVENTS;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>> -#	4	Format_desc	#	106	Server ver: #, Binlog ver: #
>> -#	106	Query	#	192	use `test`; CREATE TABLE t1 (a INT)
>> -#	192	Table_map	#	233	table_id: # (test.t1)
>> -#	233	Write_rows	#	277	table_id: # flags: STMT_END_F
>> -#	277	Query	#	377	use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB
>> -#	377	Query	#	445	use `test`; BEGIN
>> -#	445	Table_map	#	486	table_id: # (test.t2)
>> -#	486	Write_rows	#	530	table_id: # flags: STMT_END_F
>> -#	530	Table_map	#	571	table_id: # (test.t2)
>> -#	571	Write_rows	#	610	table_id: # flags: STMT_END_F
>> -#	610	Xid	#	637	COMMIT /* XID */
>> +#	4	Format_desc	#	107	Server ver: #, Binlog ver: #
>> +#	107	Query	#	193	use `test`; CREATE TABLE t1 (a INT)
>> +#	193	Table_map	#	234	table_id: # (test.t1)
>> +#	234	Write_rows	#	278	table_id: # flags: STMT_END_F
>> +#	278	Query	#	378	use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB
>> +#	378	Query	#	446	use `test`; BEGIN
>> +#	446	Table_map	#	487	table_id: # (test.t2)
>> +#	487	Write_rows	#	531	table_id: # flags: STMT_END_F
>> +#	531	Table_map	#	572	table_id: # (test.t2)
>> +#	572	Write_rows	#	611	table_id: # flags: STMT_END_F
>> +#	611	Xid	#	638	COMMIT /* XID */
>>  SELECT * FROM t2 ORDER BY a;
>>  a
>>  1
>> @@ -396,16 +396,16 @@ Warnings:
>>  Warning	1196	Some non-transactional changed tables couldn't be rolled back
>>  SELECT * FROM t2 ORDER BY a;
>>  a
>> -SHOW BINLOG EVENTS FROM 637;
>> +SHOW BINLOG EVENTS FROM 638;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>> -#	637	Query	#	717	use `test`; TRUNCATE TABLE t2
>> -#	717	Xid	#	744	COMMIT /* XID */
>> -#	744	Query	#	812	use `test`; BEGIN
>> -#	812	Table_map	#	853	table_id: # (test.t2)
>> -#	853	Write_rows	#	897	table_id: # flags: STMT_END_F
>> -#	897	Table_map	#	938	table_id: # (test.t2)
>> -#	938	Write_rows	#	977	table_id: # flags: STMT_END_F
>> -#	977	Query	#	1048	use `test`; ROLLBACK
>> +#	638	Query	#	718	use `test`; TRUNCATE TABLE t2
>> +#	718	Xid	#	745	COMMIT /* XID */
>> +#	745	Query	#	813	use `test`; BEGIN
>> +#	813	Table_map	#	854	table_id: # (test.t2)
>> +#	854	Write_rows	#	898	table_id: # flags: STMT_END_F
>> +#	898	Table_map	#	939	table_id: # (test.t2)
>> +#	939	Write_rows	#	978	table_id: # flags: STMT_END_F
>> +#	978	Query	#	1049	use `test`; ROLLBACK
>>  SELECT * FROM t2 ORDER BY a;
>>  a
>>  DROP TABLE t1,t2;
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_drop.result
> b/mysql-test/suite/rpl/r/rpl_row_drop.result
>> --- a/mysql-test/suite/rpl/r/rpl_row_drop.result	2007-06-27 15:27:29 +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_row_drop.result	2007-10-10 11:13:18 +03:00
>> @@ -43,10 +43,10 @@ t2
>>  DROP TABLE t1,t2;
>>  SHOW BINLOG EVENTS;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>> -master-bin.000001	4	Format_desc	1	106	Server ver: VERSION, Binlog ver: 4
>> -master-bin.000001	106	Query	1	192	use `test`; CREATE TABLE t1 (a int)
>> -master-bin.000001	192	Query	1	278	use `test`; CREATE TABLE t2 (a int)
>> -master-bin.000001	278	Query	1	382	use `test`; DROP TABLE `t1` /* generated by
> server */
>> +master-bin.000001	4	Format_desc	1	107	Server ver: VERSION, Binlog ver: 4
>> +master-bin.000001	107	Query	1	193	use `test`; CREATE TABLE t1 (a int)
>> +master-bin.000001	193	Query	1	279	use `test`; CREATE TABLE t2 (a int)
>> +master-bin.000001	279	Query	1	383	use `test`; DROP TABLE `t1` /* generated by
> server */
>>  SHOW TABLES;
>>  Tables_in_test
>>  t2
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
> b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
>> --- a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result	2007-08-21 15:32:26 +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result	2007-10-10 11:13:18 +03:00
>> @@ -12,13 +12,13 @@ create table t4 (a int);
>>  insert into t4 select * from t3;
>>  rename table t1 to t5, t2 to t1;
>>  flush no_write_to_binlog tables;
>> -SHOW BINLOG EVENTS FROM 623 ;
>> +SHOW BINLOG EVENTS FROM 624 ;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  master-bin.000001	#	Query	1	#	use `test`; rename table t1 to t5, t2 to t1
>>  select * from t3;
>>  a
>>  flush tables;
>> -SHOW BINLOG EVENTS FROM 623 ;
>> +SHOW BINLOG EVENTS FROM 624 ;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  master-bin.000001	#	Query	1	#	use `test`; rename table t1 to t5, t2 to t1
>>  master-bin.000001	#	Query	1	#	use `test`; flush tables
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result
> b/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result
>> --- a/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result	2007-08-21 16:37:49
> +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result	2007-10-10 11:13:19
> +03:00
>> @@ -24,7 +24,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	605
>> +Read_Master_Log_Pos	606
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -39,7 +39,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	1146
>>  Last_Error	Error 'Table 'test.t1' doesn't exist' on opening table `test`.`t1`
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	530
>> +Exec_Master_Log_Pos	531
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_log.result
> b/mysql-test/suite/rpl/r/rpl_row_log.result
>> --- a/mysql-test/suite/rpl/r/rpl_row_log.result	2007-08-21 16:37:49 +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_row_log.result	2007-10-10 11:13:19 +03:00
>> @@ -26,14 +26,14 @@ master-bin.000001	#	Query	1	#	use `test`
>>  master-bin.000001	#	Query	1	#	use `test`; create table t1 (word char(20) not
> null)ENGINE=MyISAM
>>  master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
>>  master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
>> -show binlog events from 106 limit 1;
>> +show binlog events from 107 limit 1;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null
> auto_increment primary key)ENGINE=MyISAM
>> -show binlog events from 106 limit 2;
>> +show binlog events from 107 limit 2;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null
> auto_increment primary key)ENGINE=MyISAM
>>  master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
>> -show binlog events from 106 limit 2,1;
>> +show binlog events from 107 limit 2,1;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
>>  flush logs;
>> @@ -208,13 +208,13 @@ master-bin.000002	#	Table_map	1	#	table_
>>  master-bin.000002	#	Write_rows	1	#	table_id: # flags: STMT_END_F
>>  show binary logs;
>>  Log_name	File_size
>> -master-bin.000001	1266
>> -master-bin.000002	379
>> +master-bin.000001	1267
>> +master-bin.000002	380
>>  start slave;
>>  show binary logs;
>>  Log_name	File_size
>> -slave-bin.000001	1364
>> -slave-bin.000002	280
>> +slave-bin.000001	1365
>> +slave-bin.000002	281
>>  show binlog events in 'slave-bin.000001' from 4;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  slave-bin.000001	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
>> @@ -240,7 +240,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000002
>> -Read_Master_Log_Pos	379
>> +Read_Master_Log_Pos	380
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000002
>> @@ -255,7 +255,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	379
>> +Exec_Master_Log_Pos	380
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
> b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
>> --- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result	2007-08-21 16:37:49
> +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result	2007-10-10 11:13:19
> +03:00
>> @@ -28,14 +28,14 @@ master-bin.000001	#	Query	1	#	use `test`
>>  master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
>>  master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
>>  master-bin.000001	#	Xid	1	#	COMMIT /* XID */
>> -show binlog events from 106 limit 1;
>> +show binlog events from 107 limit 1;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null
> auto_increment primary key)ENGINE=InnoDB
>> -show binlog events from 106 limit 2;
>> +show binlog events from 107 limit 2;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null
> auto_increment primary key)ENGINE=InnoDB
>>  master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
>> -show binlog events from 106 limit 2,1;
>> +show binlog events from 107 limit 2,1;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
>>  flush logs;
>> @@ -213,13 +213,13 @@ master-bin.000002	#	Write_rows	1	#	table
>>  master-bin.000002	#	Xid	1	#	COMMIT /* XID */
>>  show binary logs;
>>  Log_name	File_size
>> -master-bin.000001	1320
>> -master-bin.000002	406
>> +master-bin.000001	1321
>> +master-bin.000002	407
>>  start slave;
>>  show binary logs;
>>  Log_name	File_size
>> -slave-bin.000001	1418
>> -slave-bin.000002	307
>> +slave-bin.000001	1419
>> +slave-bin.000002	308
>>  show binlog events in 'slave-bin.000001' from 4;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  slave-bin.000001	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
>> @@ -248,7 +248,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000002
>> -Read_Master_Log_Pos	406
>> +Read_Master_Log_Pos	407
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000002
>> @@ -263,7 +263,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	406
>> +Exec_Master_Log_Pos	407
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
> b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
>> --- a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result	2007-08-21 16:37:49
> +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result	2007-10-10 11:13:19
> +03:00
>> @@ -30,7 +30,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	60268
>> +Read_Master_Log_Pos	60269
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -45,7 +45,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	60268
>> +Exec_Master_Log_Pos	60269
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -78,7 +78,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	60268
>> +Read_Master_Log_Pos	60269
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -93,7 +93,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	60268
>> +Exec_Master_Log_Pos	60269
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -126,7 +126,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	60268
>> +Read_Master_Log_Pos	60269
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -141,7 +141,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	60268
>> +Exec_Master_Log_Pos	60269
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -217,7 +217,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	60354
>> +Read_Master_Log_Pos	60355
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -232,7 +232,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	60354
>> +Exec_Master_Log_Pos	60355
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -261,7 +261,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	60430
>> +Read_Master_Log_Pos	60431
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -276,7 +276,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	60430
>> +Exec_Master_Log_Pos	60431
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -296,7 +296,7 @@ Last_SQL_Error	
>>  flush logs;
>>  show master status;
>>  File	master-bin.000002
>> -Position	106
>> +Position	107
>>  Binlog_Do_DB	<Binlog_Ignore_DB>
>>  Binlog_Ignore_DB	
>>  set global max_binlog_size= @my_max_binlog_size;
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
> b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
>> --- a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result	2007-06-27 15:28:29
> +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result	2007-10-10 11:13:19
> +03:00
>> @@ -11,7 +11,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	106
>> +Read_Master_Log_Pos	107
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -26,7 +26,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	106
>> +Exec_Master_Log_Pos	107
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -52,7 +52,7 @@ Master_User	test
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	106
>> +Read_Master_Log_Pos	107
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -67,7 +67,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	106
>> +Exec_Master_Log_Pos	107
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -132,7 +132,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	106
>> +Read_Master_Log_Pos	107
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -147,7 +147,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	106
>> +Exec_Master_Log_Pos	107
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_until.result
> b/mysql-test/suite/rpl/r/rpl_row_until.result
>> --- a/mysql-test/suite/rpl/r/rpl_row_until.result	2007-08-21 16:37:49 +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_row_until.result	2007-10-10 11:13:19 +03:00
>> @@ -26,7 +26,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	750
>> +Read_Master_Log_Pos	751
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -41,7 +41,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	317
>> +Exec_Master_Log_Pos	318
>>  Relay_Log_Space	#
>>  Until_Condition	Master
>>  Until_Log_File	master-bin.000001
>> @@ -72,7 +72,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	750
>> +Read_Master_Log_Pos	751
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -87,7 +87,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	317
>> +Exec_Master_Log_Pos	318
>>  Relay_Log_Space	#
>>  Until_Condition	Master
>>  Until_Log_File	master-no-such-bin.000001
>> @@ -116,7 +116,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	750
>> +Read_Master_Log_Pos	751
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -131,7 +131,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	594
>> +Exec_Master_Log_Pos	595
>>  Relay_Log_Space	#
>>  Until_Condition	Relay
>>  Until_Log_File	slave-relay-bin.000004
>> @@ -158,7 +158,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	750
>> +Read_Master_Log_Pos	751
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -173,7 +173,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	750
>> +Exec_Master_Log_Pos	751
>>  Relay_Log_Space	#
>>  Until_Condition	Master
>>  Until_Log_File	master-bin.000001
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_server_id1.result
> b/mysql-test/suite/rpl/r/rpl_server_id1.result
>> --- a/mysql-test/suite/rpl/r/rpl_server_id1.result	2007-06-27 15:28:29 +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_server_id1.result	2007-10-10 11:13:20 +03:00
>> @@ -31,7 +31,7 @@ Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>>  Exec_Master_Log_Pos	0
>> -Relay_Log_Space	106
>> +Relay_Log_Space	107
>>  Until_Condition	None
>>  Until_Log_File	
>>  Until_Log_Pos	0
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_server_id2.result
> b/mysql-test/suite/rpl/r/rpl_server_id2.result
>> --- a/mysql-test/suite/rpl/r/rpl_server_id2.result	2007-06-27 15:28:29 +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_server_id2.result	2007-10-10 11:13:20 +03:00
>> @@ -31,7 +31,7 @@ Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>>  Exec_Master_Log_Pos	0
>> -Relay_Log_Space	106
>> +Relay_Log_Space	107
>>  Until_Condition	None
>>  Until_Log_File	
>>  Until_Log_Pos	0
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_skip_error.result
> b/mysql-test/suite/rpl/r/rpl_skip_error.result
>> --- a/mysql-test/suite/rpl/r/rpl_skip_error.result	2007-08-21 16:37:49 +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_skip_error.result	2007-10-10 11:13:20 +03:00
>> @@ -31,6 +31,6 @@ a
>>  2
>>  3
>>  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
>>
> -#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	786	#	#	master-bin.000001	Yes	Yes							0		0	786	#	None		0	No						#	No	0		0	
>>
> +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	Heartbeat_period
>>
> +#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	787	#	#	master-bin.000001	Yes	Yes							0		0	787	#	None		0	No						#	No	0		0		5.000
>>  drop table t1;
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_slave_skip.result
> b/mysql-test/suite/rpl/r/rpl_slave_skip.result
>> --- a/mysql-test/suite/rpl/r/rpl_slave_skip.result	2007-08-21 16:37:49 +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_slave_skip.result	2007-10-10 11:13:21 +03:00
>> @@ -44,7 +44,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	722
>> +Read_Master_Log_Pos	723
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -59,7 +59,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	488
>> +Exec_Master_Log_Pos	489
>>  Relay_Log_Space	#
>>  Until_Condition	Master
>>  Until_Log_File	master-bin.000001
>> @@ -108,7 +108,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	248
>> +Read_Master_Log_Pos	249
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -123,7 +123,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	248
>> +Exec_Master_Log_Pos	249
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_sp.result
> b/mysql-test/suite/rpl/r/rpl_sp.result
>> --- a/mysql-test/suite/rpl/r/rpl_sp.result	2007-07-17 22:36:40 +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_sp.result	2007-10-10 11:13:21 +03:00
>> @@ -405,116 +405,116 @@ return 0;
>>  end|
>>  use mysqltest;
>>  set @a:= mysqltest2.f1();
>> -show binlog events in 'master-bin.000001' from 106;
>> +show binlog events from <binlog_start>;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>> -master-bin.000001	#	Query	1	#	drop database if exists mysqltest1
>> -master-bin.000001	#	Query	1	#	create database mysqltest1
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; create table t1 (a
> varchar(100))
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` procedure foo()
>> +master-bin.000001	#	Query	#	#	drop database if exists mysqltest1
>> +master-bin.000001	#	Query	#	#	create database mysqltest1
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; create table t1 (a
> varchar(100))
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` procedure foo()
>>  begin
>>  declare b int;
>>  set b = 8;
>>  insert into t1 values (b);
>>  insert into t1 values (unix_timestamp());
>>  end
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; insert into t1 values (
> NAME_CONST('b',8))
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; insert into t1 values
> (unix_timestamp())
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; delete from t1
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` procedure foo2()
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; insert into t1 values (
> NAME_CONST('b',8))
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; insert into t1 values
> (unix_timestamp())
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; delete from t1
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` procedure foo2()
>>  select * from mysqltest1.t1
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; alter procedure foo2 contains
> sql
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; drop table t1
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; create table t1 (a int)
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; create table t2 like t1
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` procedure foo3()
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; alter procedure foo2 contains
> sql
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; drop table t1
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; create table t1 (a int)
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; create table t2 like t1
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` procedure foo3()
>>  deterministic
>>  insert into t1 values (15)
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on
> mysqltest1.* to "zedjzlcsjhd"@127.0.0.1
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; grant SELECT on mysqltest1.t1 to
> "zedjzlcsjhd"@127.0.0.1
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; grant SELECT, INSERT on
> mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; CREATE
> DEFINER=`zedjzlcsjhd`@`127.0.0.1` procedure foo4()
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on
> mysqltest1.* to "zedjzlcsjhd"@127.0.0.1
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; grant SELECT on mysqltest1.t1 to
> "zedjzlcsjhd"@127.0.0.1
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; grant SELECT, INSERT on
> mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE
> DEFINER=`zedjzlcsjhd`@`127.0.0.1` procedure foo4()
>>  deterministic
>>  begin
>>  insert into t2 values(3);
>>  insert into t1 values (5);
>>  end
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; insert into t2 values(3)
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; insert into t1 values (15)
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; insert into t2 values(3)
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; alter procedure foo4 sql
> security invoker
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; insert into t2 values(3)
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; insert into t1 values (5)
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; delete from t2
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; alter table t2 add unique (a)
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; drop procedure foo4
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` procedure foo4()
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; insert into t2 values(3)
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; insert into t1 values (15)
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; insert into t2 values(3)
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; alter procedure foo4 sql
> security invoker
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; insert into t2 values(3)
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; insert into t1 values (5)
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; delete from t2
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; alter table t2 add unique (a)
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; drop procedure foo4
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` procedure foo4()
>>  deterministic
>>  begin
>>  insert into t2 values(20),(20);
>>  end
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; insert into t2 values(20),(20)
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; drop procedure foo4
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; drop procedure foo
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; drop procedure foo2
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; drop procedure foo3
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` function fn1(x int)
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; insert into t2 values(20),(20)
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; drop procedure foo4
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; drop procedure foo
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; drop procedure foo2
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; drop procedure foo3
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` function fn1(x int)
>>  returns int
>>  deterministic
>>  begin
>>  insert into t1 values (x);
>>  return x+2;
>>  end
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; delete t1,t2 from t1,t2
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; insert into t2 values(fn1(21))
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; drop function fn1
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` function fn1()
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; delete t1,t2 from t1,t2
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; insert into t2 values(fn1(21))
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; drop function fn1
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` function fn1()
>>  returns int
>>  no sql
>>  begin
>>  return unix_timestamp();
>>  end
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; delete from t1
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; insert into t1 values(fn1())
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; CREATE
> DEFINER=`zedjzlcsjhd`@`127.0.0.1` function fn2()
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; delete from t1
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; insert into t1 values(fn1())
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE
> DEFINER=`zedjzlcsjhd`@`127.0.0.1` function fn2()
>>  returns int
>>  no sql
>>  begin
>>  return unix_timestamp();
>>  end
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` function fn3()
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` function fn3()
>>  returns int
>>  not deterministic
>>  reads sql data
>>  begin
>>  return 0;
>>  end
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; delete from t2
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; alter table t2 add unique (a)
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; drop function fn1
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` function fn1(x int)
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; delete from t2
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; alter table t2 add unique (a)
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; drop function fn1
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` function fn1(x int)
>>  returns int
>>  begin
>>  insert into t2 values(x),(x);
>>  return 10;
>>  end
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; SELECT `mysqltest1`.`fn1`(100)
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; delete from t1
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; insert into t1 values (1)
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; delete from t1
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; drop trigger trg
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; insert into t1 values (1)
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` procedure foo()
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; SELECT `mysqltest1`.`fn1`(100)
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; delete from t1
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; insert into t1 values (1)
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; delete from t1
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; drop trigger trg
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; insert into t1 values (1)
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE
> DEFINER=`root`@`localhost` procedure foo()
>>  not deterministic
>>  reads sql data
>>  select * from t1
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; drop procedure foo
>> -master-bin.000001	#	Query	1	#	use `mysqltest1`; drop function fn1
>> -master-bin.000001	#	Query	1	#	drop database mysqltest1
>> -master-bin.000001	#	Query	1	#	drop user "zedjzlcsjhd"@127.0.0.1
>> -master-bin.000001	#	Query	1	#	use `test`; CREATE DEFINER=`root`@`localhost`
> function f1() returns int reads sql data
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; drop procedure foo
>> +master-bin.000001	#	Query	#	#	use `mysqltest1`; drop function fn1
>> +master-bin.000001	#	Query	#	#	drop database mysqltest1
>> +master-bin.000001	#	Query	#	#	drop user "zedjzlcsjhd"@127.0.0.1
>> +master-bin.000001	#	Query	#	#	use `test`; CREATE DEFINER=`root`@`localhost`
> function f1() returns int reads sql data
>>  begin
>>  declare var integer;
>>  declare c cursor for select a from v1;
>> @@ -523,35 +523,35 @@ fetch c into var;
>>  close c;
>>  return var;
>>  end
>> -master-bin.000001	#	Query	1	#	use `test`; CREATE ALGORITHM=UNDEFINED
> DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a
>> -master-bin.000001	#	Query	1	#	use `test`; create table t1 (a int)
>> -master-bin.000001	#	Query	1	#	use `test`; insert into t1 (a) values (f1())
>> -master-bin.000001	#	Query	1	#	use `test`; drop view v1
>> -master-bin.000001	#	Query	1	#	use `test`; drop function f1
>> -master-bin.000001	#	Query	1	#	use `test`; DROP TABLE IF EXISTS t1
>> -master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE t1(col VARCHAR(10))
>> -master-bin.000001	#	Query	1	#	use `test`; CREATE DEFINER=`root`@`localhost`
> PROCEDURE p1(arg VARCHAR(10))
>> +master-bin.000001	#	Query	#	#	use `test`; CREATE ALGORITHM=UNDEFINED
> DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a
>> +master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int)
>> +master-bin.000001	#	Query	#	#	use `test`; insert into t1 (a) values (f1())
>> +master-bin.000001	#	Query	#	#	use `test`; drop view v1
>> +master-bin.000001	#	Query	#	#	use `test`; drop function f1
>> +master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS t1
>> +master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1(col VARCHAR(10))
>> +master-bin.000001	#	Query	#	#	use `test`; CREATE DEFINER=`root`@`localhost`
> PROCEDURE p1(arg VARCHAR(10))
>>  INSERT INTO t1 VALUES(arg)
>> -master-bin.000001	#	Query	1	#	use `test`; INSERT INTO t1 VALUES(
> NAME_CONST('arg',_latin1'test'))
>> -master-bin.000001	#	Query	1	#	use `test`; DROP PROCEDURE p1
>> -master-bin.000001	#	Query	1	#	use `test`; CREATE DEFINER=`root`@`localhost`
> PROCEDURE p1() SET @a = 1
>> -master-bin.000001	#	Query	1	#	use `test`; CREATE DEFINER=`root`@`localhost`
> FUNCTION f1() RETURNS INT RETURN 0
>> -master-bin.000001	#	Query	1	#	use `test`; DROP PROCEDURE p1
>> -master-bin.000001	#	Query	1	#	use `test`; DROP FUNCTION f1
>> -master-bin.000001	#	Query	1	#	use `test`; drop table t1
>> -master-bin.000001	#	Query	1	#	drop database if exists mysqltest
>> -master-bin.000001	#	Query	1	#	drop database if exists mysqltest2
>> -master-bin.000001	#	Query	1	#	create database mysqltest
>> -master-bin.000001	#	Query	1	#	create database mysqltest2
>> -master-bin.000001	#	Query	1	#	use `mysqltest2`; create table t ( t integer )
>> -master-bin.000001	#	Query	1	#	use `mysqltest2`; CREATE
> DEFINER=`root`@`localhost` procedure mysqltest.test() begin end
>> -master-bin.000001	#	Query	1	#	use `mysqltest2`; insert into t values ( 1 )
>> -master-bin.000001	#	Query	1	#	use `mysqltest2`; CREATE
> DEFINER=`root`@`localhost` function f1 () returns int
>> +master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES(
> NAME_CONST('arg',_latin1'test'))
>> +master-bin.000001	#	Query	#	#	use `test`; DROP PROCEDURE p1
>> +master-bin.000001	#	Query	#	#	use `test`; CREATE DEFINER=`root`@`localhost`
> PROCEDURE p1() SET @a = 1
>> +master-bin.000001	#	Query	#	#	use `test`; CREATE DEFINER=`root`@`localhost`
> FUNCTION f1() RETURNS INT RETURN 0
>> +master-bin.000001	#	Query	#	#	use `test`; DROP PROCEDURE p1
>> +master-bin.000001	#	Query	#	#	use `test`; DROP FUNCTION f1
>> +master-bin.000001	#	Query	#	#	use `test`; drop table t1
>> +master-bin.000001	#	Query	#	#	drop database if exists mysqltest
>> +master-bin.000001	#	Query	#	#	drop database if exists mysqltest2
>> +master-bin.000001	#	Query	#	#	create database mysqltest
>> +master-bin.000001	#	Query	#	#	create database mysqltest2
>> +master-bin.000001	#	Query	#	#	use `mysqltest2`; create table t ( t integer )
>> +master-bin.000001	#	Query	#	#	use `mysqltest2`; CREATE
> DEFINER=`root`@`localhost` procedure mysqltest.test() begin end
>> +master-bin.000001	#	Query	#	#	use `mysqltest2`; insert into t values ( 1 )
>> +master-bin.000001	#	Query	#	#	use `mysqltest2`; CREATE
> DEFINER=`root`@`localhost` function f1 () returns int
>>  begin
>>  insert into t values (1);
>>  return 0;
>>  end
>> -master-bin.000001	#	Query	1	#	use `mysqltest`; SELECT `mysqltest2`.`f1`()
>> +master-bin.000001	#	Query	#	#	use `mysqltest`; SELECT `mysqltest2`.`f1`()
>>  set global log_bin_trust_function_creators=0;
>>  set global log_bin_trust_function_creators=0;
>>  drop database mysqltest;
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
> b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
>> --- a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result	2007-06-27 15:27:29 +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result	2007-10-10 11:13:21 +03:00
>> @@ -12,13 +12,13 @@ create table t4 (a int);
>>  insert into t4 select * from t3;
>>  rename table t1 to t5, t2 to t1;
>>  flush no_write_to_binlog tables;
>> -SHOW BINLOG EVENTS FROM 656 ;
>> +SHOW BINLOG EVENTS FROM 657 ;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  master-bin.000001	#	Query	1	#	use `test`; rename table t1 to t5, t2 to t1
>>  select * from t3;
>>  a
>>  flush tables;
>> -SHOW BINLOG EVENTS FROM 656 ;
>> +SHOW BINLOG EVENTS FROM 657 ;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  master-bin.000001	#	Query	1	#	use `test`; rename table t1 to t5, t2 to t1
>>  master-bin.000001	#	Query	1	#	use `test`; flush tables
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_stm_log.result
> b/mysql-test/suite/rpl/r/rpl_stm_log.result
>> --- a/mysql-test/suite/rpl/r/rpl_stm_log.result	2007-08-21 16:37:50 +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_stm_log.result	2007-10-10 11:13:21 +03:00
>> @@ -26,14 +26,14 @@ master-bin.000001	#	Query	1	#	use `test`
>>  master-bin.000001	#	Query	1	#	use `test`; create table t1 (word char(20) not
> null)ENGINE=MyISAM
>>  master-bin.000001	#	Begin_load_query	1	#	;file_id=1;block_len=581
>>  master-bin.000001	#	Execute_load_query	1	#	use `test`; load data infile
> '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1
>> -show binlog events from 106 limit 1;
>> +show binlog events from 107 limit 1;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null
> auto_increment primary key)ENGINE=MyISAM
>> -show binlog events from 106 limit 2;
>> +show binlog events from 107 limit 2;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null
> auto_increment primary key)ENGINE=MyISAM
>>  master-bin.000001	#	Intvar	1	#	INSERT_ID=1
>> -show binlog events from 106 limit 2,1;
>> +show binlog events from 107 limit 2,1;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  master-bin.000001	#	Query	1	#	use `test`; insert into t1 values (NULL)
>>  flush logs;
>> @@ -207,13 +207,13 @@ master-bin.000002	#	Query	1	#	use `test`
>>  master-bin.000002	#	Query	1	#	use `test`; insert into t2 values (1)
>>  show binary logs;
>>  Log_name	File_size
>> -master-bin.000001	1347
>> -master-bin.000002	392
>> +master-bin.000001	1348
>> +master-bin.000002	393
>>  start slave;
>>  show binary logs;
>>  Log_name	File_size
>> -slave-bin.000001	1447
>> -slave-bin.000002	293
>> +slave-bin.000001	1448
>> +slave-bin.000002	294
>>  show binlog events in 'slave-bin.000001' from 4;
>>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>  slave-bin.000001	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
>> @@ -238,7 +238,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000002
>> -Read_Master_Log_Pos	392
>> +Read_Master_Log_Pos	393
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000002
>> @@ -253,7 +253,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	392
>> +Exec_Master_Log_Pos	393
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
> b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
>> --- a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result	2007-06-27 15:28:29
> +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result	2007-10-10 11:13:21
> +03:00
>> @@ -28,7 +28,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	72960
>> +Read_Master_Log_Pos	72961
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -43,7 +43,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	72960
>> +Exec_Master_Log_Pos	72961
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -76,7 +76,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	72960
>> +Read_Master_Log_Pos	72961
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -91,7 +91,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	72960
>> +Exec_Master_Log_Pos	72961
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -124,7 +124,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	72960
>> +Read_Master_Log_Pos	72961
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -139,7 +139,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	72960
>> +Exec_Master_Log_Pos	72961
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -215,7 +215,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	73046
>> +Read_Master_Log_Pos	73047
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -230,7 +230,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	73046
>> +Exec_Master_Log_Pos	73047
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -259,7 +259,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	73122
>> +Read_Master_Log_Pos	73123
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -274,7 +274,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	73122
>> +Exec_Master_Log_Pos	73123
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -294,7 +294,7 @@ Last_SQL_Error	
>>  flush logs;
>>  show master status;
>>  File	master-bin.000002
>> -Position	106
>> +Position	107
>>  Binlog_Do_DB	<Binlog_Ignore_DB>
>>  Binlog_Ignore_DB	
>>  set global max_binlog_size= @my_max_binlog_size;
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
> b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
>> --- a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result	2007-06-27 15:28:29
> +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result	2007-10-10 11:13:21
> +03:00
>> @@ -11,7 +11,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	106
>> +Read_Master_Log_Pos	107
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -26,7 +26,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	106
>> +Exec_Master_Log_Pos	107
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -52,7 +52,7 @@ Master_User	test
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	106
>> +Read_Master_Log_Pos	107
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -67,7 +67,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	106
>> +Exec_Master_Log_Pos	107
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> @@ -132,7 +132,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	106
>> +Read_Master_Log_Pos	107
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -147,7 +147,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	106
>> +Exec_Master_Log_Pos	107
>>  Relay_Log_Space	#
>>  Until_Condition	None
>>  Until_Log_File	
>> diff -Nrup a/mysql-test/suite/rpl/r/rpl_stm_until.result
> b/mysql-test/suite/rpl/r/rpl_stm_until.result
>> --- a/mysql-test/suite/rpl/r/rpl_stm_until.result	2007-06-27 15:28:29 +03:00
>> +++ b/mysql-test/suite/rpl/r/rpl_stm_until.result	2007-10-10 11:13:22 +03:00
>> @@ -26,7 +26,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	784
>> +Read_Master_Log_Pos	785
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -41,7 +41,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	327
>> +Exec_Master_Log_Pos	328
>>  Relay_Log_Space	#
>>  Until_Condition	Master
>>  Until_Log_File	master-bin.000001
>> @@ -72,7 +72,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	784
>> +Read_Master_Log_Pos	785
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -87,7 +87,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	327
>> +Exec_Master_Log_Pos	328
>>  Relay_Log_Space	#
>>  Until_Condition	Master
>>  Until_Log_File	master-no-such-bin.000001
>> @@ -116,7 +116,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	784
>> +Read_Master_Log_Pos	785
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -131,7 +131,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	616
>> +Exec_Master_Log_Pos	617
>>  Relay_Log_Space	#
>>  Until_Condition	Relay
>>  Until_Log_File	slave-relay-bin.000004
>> @@ -158,7 +158,7 @@ Master_User	root
>>  Master_Port	MASTER_PORT
>>  Connect_Retry	1
>>  Master_Log_File	master-bin.000001
>> -Read_Master_Log_Pos	784
>> +Read_Master_Log_Pos	785
>>  Relay_Log_File	#
>>  Relay_Log_Pos	#
>>  Relay_Master_Log_File	master-bin.000001
>> @@ -173,7 +173,7 @@ Replicate_Wild_Ignore_Table	
>>  Last_Errno	0
>>  Last_Error	
>>  Skip_Counter	0
>> -Exec_Master_Log_Pos	784
>> +Exec_Master_Log_Pos	785
>>  Relay_Log_Space	#
>>  Until_Condition	Master
>>  Until_Log_File	master-bin.000001
>> diff -Nrup a/mysql-test/suite/rpl/t/rpl_heartbeat.test
> b/mysql-test/suite/rpl/t/rpl_heartbeat.test
>> --- /dev/null	Wed Dec 31 16:00:00 196900
>> +++ b/mysql-test/suite/rpl/t/rpl_heartbeat.test	2007-10-10 11:13:29 +03:00
>> @@ -0,0 +1,159 @@
>> +# Testing master to slave heartbeat protocol
>> +# +# Including:
>> +# - user interface, grammar, checking the range and warnings about
>> +#   unreasonable values for the heartbeat period;
>> +# - no rotation of relay log if heartbeat is less that slave_net_timeout
>> +# - SHOW STATUS like 'Slave_received_heartbeats' action
>> +# - SHOW STATUS like 'Slave_heartbeat_period' report
>> +
>> +-- source include/have_log_bin.inc
>> +
>> +connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
>> +connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK);
>> +
>> +connection master;
>> +reset master;
>> +
>> +connection slave;
>> +set @@global.slave_net_timeout= 10;
>> +
>> +###
>> +### Checking the range
>> +###
>> +
>> +#
>> +# default period slave_net_timeout/2
>> +#
>> +eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT,
> master_user='root';
>> +--query_vertical show status like 'Slave_heartbeat_period';
>>   

>
> Either ; last on the line or -- at the beginning. I would advice to
> use the form without -- first, since that does syntax checking.
>
>> +
>> +#
>> +# the max for the period is ULONG_MAX/1000; an attempt to exceed it is  denied
>> +#
>> +---replace_result $MASTER_MYPORT MASTER_PORT
>> +--error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE
>> +eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT,
> master_user='root',
>> +      master_heartbeat_period= 4294968;
>> +--query_vertical show status like 'Slave_heartbeat_period';
>>   

ack

> Your missing one test: setting the heartbeat period first, and then
> changing the slave_net_timeout. It is reasonable that this gives a
> warning as well, since it might otherwise lead to strange behavior
> without any warnings about it.
>
> Could you please also add the following test:
>
> change master to
>    master_host='127.0.0.1', master_port=$MASTER_PORT,
>    master_user='root', master_heartbeat_period=0.0009999;
> query_vertical show status like 'Slave_heartbeat_period';
>

Such test was not missed. I used 0.0009 instead of yours.
It's refined to your value.


> IMO, it should either give a warning and print something that is less
> than 0.001,

which can be only zero as we claim 0.001 is the minimum.

> or not give a warning and print 0.001. The case that it
> gives a warning (about being smaller than 0.001) and prints 0.001 is
> just confusing, and the value can be the result of a computation,
> which makes it even less easy to understand. 

I agree it should not work like this. and it does not do - warn plus
print 0.001 -  due to the rules in sql_yacc.yy.


> A better warning that the
> value has been rounded is also an option (if the test case above gives
> a warning but prints 0.001).
>

And you did forget to remind on what we agreed yesterday to refine
updating slave_net_timeout in the way to produce a warning if
the new value is less than the current of HB period.
That's done.



> I think it should be
>
>    @param[in] thd     A THD struct
>

done

>> +  @notes
>>   
>
> This is "@note" (singular form)

done

>
>> +    LOCK_log must be taken before calling this function.
>> +    It will be released at the end of the function.
>> +*/
>> +
>> +void MYSQL_BIN_LOG::wait_for_update_relay_log(THD* thd)
>> +{
>> +  const char *old_msg;
>> +  DBUG_ENTER("wait_for_update");
>> +  old_msg= thd->enter_cond(&update_cond, &LOCK_log,
>> +                           "Slave has read all relay log; " +
>> "waiting for the slave I/O "
>> +                           "thread to update it" );
>> +  pthread_cond_wait(&update_cond, &LOCK_log);
>> +  thd->exit_cond(old_msg);
>> +  DBUG_VOID_RETURN;
>> +}
>> +
>> +
>>  /*
>>    Wait until we get a signal that the binary log has been updated
>>   
>
> Please turn this into Doxygen as well...
>

done

>>     SYNOPSIS
>> -    wait_for_update()
>> +    int  wait_for_update()
>>      thd			Thread variable
>> -    is_slave            If 0, the caller is the Binlog_dump thread from master;
>> -                        if 1, the caller is the SQL thread from the slave. This
>> -                        influences only thd->proc_info.
>> +    timeout             to wait in pthread_cond_waittimout. +
>> Applies to master only.
>>  +  RETURNS
>> +     0                  if got signalled on update
>> +     non-zero           wait timeout elapsed
>> +        NOTES
>> -    One must have a lock on LOCK_log before calling this function.
>> -    This lock will be released before return! That's required by
>> -    THD::enter_cond() (see NOTES in sql_class.h).
>> +    LOCK_log must be taken before calling this function.
>> +    LOCK_log is being released while the thread is waiting.
>> +    LOCK_log is released by the caller.
>>  */
>>  -void MYSQL_BIN_LOG::wait_for_update(THD* thd, bool is_slave)
>> +int MYSQL_BIN_LOG::wait_for_update_bin_log(THD* thd,
>> +                                           const struct timespec *timeout)
>>  {
>> -  const char *old_msg;
>> -  DBUG_ENTER("wait_for_update");
>> -
>> +  int ret= 0;
>> +  const char* old_msg = thd->proc_info;
>> +  DBUG_ENTER("wait_for_update_bin_log");
>>    old_msg= thd->enter_cond(&update_cond, &LOCK_log,
>> -                           is_slave ?
>> -                           "Has read all relay log; waiting for the slave I/O "
>> -                           "thread to update it" :
>> -                           "Has sent all binlog to slave; waiting for binlog "
>> -                           "to be updated");
>> -  pthread_cond_wait(&update_cond, &LOCK_log);
>> -  thd->exit_cond(old_msg);
>> -  DBUG_VOID_RETURN;
>> +                           "Master has sent all binlog to slave; "
>> +                           "waiting for binlog to be updated");
>> +  if (!timeout)
>> +    pthread_cond_wait(&update_cond, &LOCK_log);
>> +  else
>> +    ret= pthread_cond_timedwait(&update_cond, &LOCK_log,
>> +                                const_cast<struct timespec *>(timeout));
>> +  DBUG_RETURN(ret);
>>  }
>>   diff -Nrup a/sql/log.h b/sql/log.h
>> --- a/sql/log.h	2007-08-02 07:50:52 +03:00
>> +++ b/sql/log.h	2007-10-10 11:13:25 +03:00
>> @@ -321,7 +321,8 @@ public:
>>    }
>>    void set_max_size(ulong max_size_arg);
>>    void signal_update();
>> -  void wait_for_update(THD* thd, bool master_or_slave);
>> +  void wait_for_update_relay_log(THD* thd);
>> +  int  wait_for_update_bin_log(THD* thd, const struct timespec * timeout);
>>    void set_need_start_event() { need_start_event = 1; }
>>    void init(bool no_auto_events_arg, ulong max_size);
>>    void init_pthread_objects();
>> diff -Nrup a/sql/log_event.cc b/sql/log_event.cc
>> --- a/sql/log_event.cc	2007-10-08 17:19:56 +03:00
>> +++ b/sql/log_event.cc	2007-10-10 11:13:25 +03:00
>> @@ -2511,6 +2511,7 @@ Format_description_log_event(uint8 binlo
>>        post_header_len[BEGIN_LOAD_QUERY_EVENT-1]=
> post_header_len[APPEND_BLOCK_EVENT-1];
>>        post_header_len[EXECUTE_LOAD_QUERY_EVENT-1]=
> EXECUTE_LOAD_QUERY_HEADER_LEN;
>>        post_header_len[INCIDENT_EVENT-1]= INCIDENT_HEADER_LEN;
>> +      post_header_len[HEARTBEAT_LOG_EVENT-1]= 0;
>>   
>
> Please introduce a HEARTBEAT_HEADER_LEN and set it to zero. Magic
> numbers are bad, even when they are zero.
>

done


>>      }
>>      break;
>>  @@ -8174,3 +8175,15 @@ Incident_log_event::write_data_body(IO_C
>>    DBUG_ENTER("Incident_log_event::write_data_body");
>>    DBUG_RETURN(write_str(file, m_message.str, m_message.length));
>>  }
>> +
>> +#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
>> +Heartbeat_log_event::Heartbeat_log_event(const char* buf, uint event_len,
>> +                    const Format_description_log_event* description_event)
>> +  :Log_event(buf, description_event)
>> +{
>> +  uint8 header_size= description_event->common_header_len;
>> +  ident_len = event_len - header_size;
>> +  set_if_smaller(ident_len,FN_REFLEN-1);
>> +  log_ident= buf + header_size;
>> +}
>> +#endif
>> diff -Nrup a/sql/log_event.h b/sql/log_event.h
>> --- a/sql/log_event.h	2007-08-28 16:49:00 +03:00
>> +++ b/sql/log_event.h	2007-10-10 11:13:26 +03:00
>> @@ -497,6 +497,12 @@ enum Log_event_type
>>    INCIDENT_EVENT= 26,
>>     /*
>> +    Heartbeat event to be send by master at its idle time +    to
>> ensure master's online status to slave +  */
>> +  HEARTBEAT_LOG_EVENT= 27,
>> +  +  /*
>>      Add new events here - right above this comment!
>>      Existing events (except ENUM_END_EVENT) should never change their numbers
>>    */
>> @@ -604,6 +610,17 @@ typedef struct st_print_event_info
>>  } PRINT_EVENT_INFO;
>>  #endif
>>  +/*
>> +  the struct aggregates two paramenters that identify an event
>> +  uniquely in scope of communication of a particular master and slave couple.
>> +  I.e there can not be 2 events from the same staying connected master which
>> +  have the same coordinates.
>> +*/
>>   
>
> Doxygen comment, please.
>

done

>> +struct event_coordinates
>> +{
>> +  char * file_name; // binlog file name (directories stripped)
>> +  ulong  pos;       // event's position in the binlog file
>> +};
>>   /*****************************************************************************
>>  @@ -2669,5 +2686,35 @@ static inline bool copy_event_cache_to_f
>>      my_b_copy_to_file(cache, file) ||
>>      reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE);
>>  }
>> +
>> +#ifndef MYSQL_CLIENT
>> +/*****************************************************************************
>> +
>> +  Heartbeat Log Event class
>> +
>> +  Replication event to ensure to slave that master is alive.
>> +  The event is originated by master's dump thread and sent straight to
>> +  slave without being logged. Slave itself does not store it in relay log
>> +  but rather uses a data for immediate checks and throws away the event.
>> +
>> +  Two members of the class log_ident and Log_event::log_pos
>> comprise +  @see the event_coordinates instance. The coordinates
>> that a heartbeat
>> +  instance carries correspond to the last event master has sent from
>> +  its binlog.
>> +
>> + ****************************************************************************/
>> +class Heartbeat_log_event: public Log_event
>> +{
>> +public:
>> +  const char* log_ident;
>> +  uint ident_len;
>>   

>
> Could you please hide these variables by making them private. Add a
> some accessors functions if you need, but please hide the variables.
>

done

>> +  Log_event_type get_type_code() {return HEARTBEAT_LOG_EVENT;}  +
>> bool is_valid() const {return (log_ident != NULL &&
>> +                                 log_pos >= BIN_LOG_HEADER_SIZE);}
>>   
>
> I know we don't have much of a coding standard for inline functions,
> but please make them more readable. At least put spaces on the inside
> of the braces and put the body of the function on a new line.
>

done

>> +  Heartbeat_log_event(const char* buf, uint event_len,
>> +                      const Format_description_log_event* description_event);
>> +};
>> +#endif
>> +
>>   #endif /* _log_event_h */
>> diff -Nrup a/sql/mysqld.cc b/sql/mysqld.cc
>> --- a/sql/mysqld.cc	2007-09-27 20:06:03 +03:00
>> +++ b/sql/mysqld.cc	2007-10-10 11:13:26 +03:00
>> @@ -6465,6 +6465,40 @@ static int show_slave_retried_trans(THD
>> pthread_mutex_unlock(&LOCK_active_mi);
>>    return 0;
>>  }
>> +
>> +static int show_slave_received_heartbeats(THD *thd, SHOW_VAR *var, char *buff)
>> +{
>> +  pthread_mutex_lock(&LOCK_active_mi);
>> +  if (active_mi)
>> +  {
>> +    var->type= SHOW_LONGLONG;
>> +    var->value= buff;
>> +    pthread_mutex_lock(&active_mi->rli.data_lock);
>> +    *((longlong *)buff)= active_mi->received_heartbeats;
>> +    pthread_mutex_unlock(&active_mi->rli.data_lock);
>> +  }
>> +  else
>> +    var->type= SHOW_UNDEF;
>> +  pthread_mutex_unlock(&LOCK_active_mi);
>> +  return 0;
>> +}
>> +
>> +static int show_heartbeat_period(THD *thd, SHOW_VAR *var, char *buff)
>> +{
>> +  pthread_mutex_lock(&LOCK_active_mi);
>> +  if (active_mi)
>> +  {
>> +    var->type= SHOW_CHAR;
>> +    var->value= buff;
>> +    my_sprintf(buff, (buff, "%.3f",active_mi->heartbeat_period));
>>   

>
> my_snprintf() please, we don't want buffer overflows, even if it is
> unlikely.
>

We discussed this on #rep. this suggestion does not make sense as we
have to store to buff which defined in the caller.
The caller does it with 1KB, btw.

I agree the framework I have to use is not the perfect. I are welcome
to report a bug we were discussing on #rep.


>> +  }
>> +  else
>> +    var->type= SHOW_UNDEF;
>> +  pthread_mutex_unlock(&LOCK_active_mi);
>> +  return 0;
>> +}
>> +
>> +
>>  #endif /* HAVE_REPLICATION */
>>   static int show_open_tables(THD *thd, SHOW_VAR *var, char *buff)
>> @@ -6935,6 +6969,8 @@ SHOW_VAR status_vars[]= {
>>    {"Slave_open_temp_tables",   (char*) &slave_open_temp_tables, SHOW_LONG},
>>  #ifdef HAVE_REPLICATION
>>    {"Slave_retried_transactions",(char*) &show_slave_retried_trans,
> SHOW_FUNC},
>> +  {"Slave_heartbeat_period",   (char*) &show_heartbeat_period, SHOW_FUNC},
>> +  {"Slave_received_heartbeats",(char*) &show_slave_received_heartbeats,
> SHOW_FUNC},
>>    {"Slave_running",            (char*) &show_slave_running,     SHOW_FUNC},
>>  #endif
>>    {"Slow_launch_threads",      (char*) &slow_launch_threads,    SHOW_LONG},
>> diff -Nrup a/sql/rpl_mi.cc b/sql/rpl_mi.cc
>> --- a/sql/rpl_mi.cc	2007-06-09 08:55:03 +03:00
>> +++ b/sql/rpl_mi.cc	2007-10-10 11:13:26 +03:00
>> @@ -26,12 +26,14 @@
>>  int init_intvar_from_file(int* var, IO_CACHE* f, int default_val);
>>  int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
>>  			  const char *default_val);
>> +int init_floatvar_from_file(float* var, IO_CACHE* f, float default_val);
>>   MASTER_INFO::MASTER_INFO()
>>    :Slave_reporting_capability("I/O"),
>>     ssl(0), fd(-1),  io_thd(0), inited(0),
>>     abort_slave(0),slave_running(0),
>> -   ssl_verify_server_cert(0), slave_run_id(0)
>> +   ssl_verify_server_cert(0), slave_run_id(0),
>> +   heartbeat_period(0), received_heartbeats(0)
>>  {
>>    host[0] = 0; user[0] = 0; password[0] = 0;
>>    ssl_ca[0]= 0; ssl_capath[0]= 0; ssl_cert[0]= 0;
>> @@ -70,6 +72,11 @@ void init_master_info_with_options(MASTE
>>      strmake(mi->password, master_password, MAX_PASSWORD_LENGTH);
>>    mi->port = master_port;
>>    mi->connect_retry = master_connect_retry;
>> +  /* +    always request heartbeat unless master_heartbeat_period
>> is set explicitly zero.
>> +    Here is the default value for heartbeat period if CHANGE MASTER did not
> specify it:
>> +  */
>> +  mi->heartbeat_period= slave_net_timeout/2.0;
>>     mi->ssl= master_ssl;
>>    if (master_ssl_ca)
>> @@ -94,8 +101,11 @@ enum {
>>    /* 5.1.16 added value of master_ssl_verify_server_cert */
>>    LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT= 15,
>>  +  /* 5.1.XX added value of master_heartbeat_period */
>> +  LINE_FOR_MASTER_HEARTBEAT_PERIOD= 16,
>> +
>>    /* Number of lines currently used when saving master info file */
>> -  LINES_IN_MASTER_INFO= LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT
>> +  LINES_IN_MASTER_INFO= LINE_FOR_MASTER_HEARTBEAT_PERIOD
>>  };
>>   int init_master_info(MASTER_INFO* mi, const char*
>> master_info_fname,
>> @@ -197,6 +207,7 @@ file '%s')", fname);
>>      mi->fd = fd;
>>      int port, connect_retry, master_log_pos, lines;
>>      int ssl= 0, ssl_verify_server_cert= 0;
>> +    float master_heartbeat_period= 0.0;
>>      char *first_non_digit;
>>       /*
>> @@ -281,7 +292,13 @@ file '%s')", fname);
>>        if (lines >= LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT &&
>>            init_intvar_from_file(&ssl_verify_server_cert, &mi->file,
> 0))
>>          goto errwithmsg;
>> -
>> +      /*
>> +        Starting from 5.1.XX master_heartbeat_period might be
>>   

>
> Set this to 5.1.23 if you manage to push before the .23 release.
>

i did although it might be inaccurate, alas.

>> +        in the file
>> +      */
>> +      if (lines >= LINE_FOR_MASTER_HEARTBEAT_PERIOD &&
>> +          init_floatvar_from_file(&master_heartbeat_period,
> &mi->file, 0.0))
>> +        goto errwithmsg;
>>      }
>>   #ifndef HAVE_OPENSSL
>> @@ -300,6 +317,7 @@ file '%s')", fname);
>>      mi->connect_retry= (uint) connect_retry;
>>      mi->ssl= (my_bool) ssl;
>>      mi->ssl_verify_server_cert= ssl_verify_server_cert;
>> +    mi->heartbeat_period= master_heartbeat_period;
>>    }
>>    DBUG_PRINT("master_info",("log_file_name: %s  position: %ld",
>>                              mi->master_log_name,
>> @@ -378,16 +396,19 @@ int flush_master_info(MASTER_INFO* mi, b
>>       contents of file). But because of number of lines in the first line
>>       of file we don't care about this garbage.
>>    */
>> +  char heartbeat_buf[16]; // buffer for fixed format float
>> +  my_sprintf(heartbeat_buf, (heartbeat_buf, "%.3f", mi->heartbeat_period));
>>   

> my_snprintf() please, we want to stay away from buffer overflows, even
> when they are unlikely.
>

The same comments as above apply here.


>>     my_b_seek(file, 0L);
>>    my_b_printf(file,
>> -              "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n",
>> +             
> "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n%s\n",
>>                LINES_IN_MASTER_INFO,
>>                mi->master_log_name, llstr(mi->master_log_pos, lbuf),
>>                mi->host, mi->user,
>>                mi->password, mi->port, mi->connect_retry,
>>                (int)(mi->ssl), mi->ssl_ca, mi->ssl_capath,
> mi->ssl_cert,
>> -              mi->ssl_cipher, mi->ssl_key,
> mi->ssl_verify_server_cert);
>> +              mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert,
>> +              heartbeat_buf);
>>    DBUG_RETURN(-flush_io_cache(file));
>>  }
>>  diff -Nrup a/sql/rpl_mi.h b/sql/rpl_mi.h
>> --- a/sql/rpl_mi.h	2007-06-11 23:15:28 +03:00
>> +++ b/sql/rpl_mi.h	2007-10-10 11:13:27 +03:00
>> @@ -83,6 +83,8 @@ class MASTER_INFO : public Slave_reporti
>>    RELAY_LOG_INFO rli;
>>    uint port;
>>    uint connect_retry;
>> +  float heartbeat_period;         // interface with CHANGE MASTER or
> master.info
>> +  ulonglong received_heartbeats;  // counter of received heartbeat events
>>  #ifndef DBUG_OFF
>>    int events_till_disconnect;
>>  #endif
>> diff -Nrup a/sql/share/errmsg.txt b/sql/share/errmsg.txt
>> --- a/sql/share/errmsg.txt	2007-07-27 21:20:28 +03:00
>> +++ b/sql/share/errmsg.txt	2007-10-10 11:13:28 +03:00
>> @@ -6105,3 +6105,7 @@ ER_EVENT_INVALID_CREATION_CTX
>>   ER_TRG_CANT_OPEN_TABLE
>>    eng "Cannot open table for trigger `%-.64s`.`%-.64s`"
>> +ER_SLAVE_HEARTBEAT_FAILURE
>> +  eng "Unexpected master's hearbeat data: %s"
>>   
>
> Typo
>

thanks! fixed.

>> +ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE
>> +  eng "The requested value for the heartbeat period %s %s"
>> diff -Nrup a/sql/slave.cc b/sql/slave.cc
>> --- a/sql/slave.cc	2007-08-30 09:24:39 +03:00
>> +++ b/sql/slave.cc	2007-10-10 11:13:27 +03:00
>> @@ -722,6 +722,25 @@ int init_intvar_from_file(int* var, IO_C
>>    DBUG_RETURN(1);
>>  }
>>  +int init_floatvar_from_file(float* var, IO_CACHE* f, float
>> default_val)
>> +{
>> +  char buf[16];
>> +  DBUG_ENTER("init_floatvar_from_file");
>> +
>> +
>> +  if (my_b_gets(f, buf, sizeof(buf)))
>> +  {
>> +    sscanf(buf, "%f", var);
>>   
>
> Check the return value of sscanf(), people do make goofs. There might
> be something that is not a float at the position, in which case
> sscanf() will return 0, and *var will be uninitialized.
>

good note. Fixed.

>> +    DBUG_RETURN(0);
>> +  }
>> +  else if (default_val != 0.0)
>> +  {
>> +    *var = default_val;
>> +    DBUG_RETURN(0);
>> +  }
>> +  DBUG_RETURN(1);
>> +}
>> +
>>  /*
>>    Note that we rely on the master's version (3.23, 4.0.14 etc) instead of
>>    relying on the binlog's version. This is not perfect: imagine an upgrade
>> @@ -916,8 +935,25 @@ be equal for replication to work";
>>  different values for the TIME_ZONE global variable. The values must \
>>  be equal for replication to work";
>>      mysql_free_result(master_res);
>> +    goto err;
>>    }
>>  +  if (mi->heartbeat_period != 0.0)
>> +  {
>> +    const char* query_format= "SET @master_heartbeat_period= %llu";
>> +    char query[strlen(query_format) + (18 - 4)]; // 18 max digits for %llu
>> +    /* +       the period is an ulonglong of nano-secs. +    */
>> +    my_sprintf(query, (query, query_format,
>> +                       (ulonglong) (mi->heartbeat_period*1000000000UL)));
>>   
>

> There is no guarantee that the %llu format works on every
> platform. Please use llstr() instead.
>
> Also, you should use 1000000000ULL, which we use the ULL macro for,
> i.e., ULL(1000000000), instead of a unsigned long. Probably not a
> problem, but I prefer to mix types as little as possible.

Fixed. Although there are lots of code that uses %ll... NDB, Innodb.

>
>> +    if (mysql_real_query(mysql, query, strlen(query)))
>> +    {
>> +      errmsg= "The slave I/O thread stops because querying the master failed";
>> +      goto err;
>> +    }
>> +  }
>> +   err:
>>    if (errmsg)
>>    {
>> @@ -2269,12 +2305,8 @@ Stopping slave I/O thread due to out-of-
>>         retry_count=0;                    // ok event, reset retry
>> counter
>>        thd->proc_info = "Queueing master event to the relay log";
>> -      if (queue_event(mi,(const char*)mysql->net.read_pos + 1,
>> -                      event_len))
>> +      if (queue_event(mi,(const char*)mysql->net.read_pos + 1, event_len))
>>        {
>> -        mi->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_WRITE_FAILURE,
>> -                   ER(ER_SLAVE_RELAY_LOG_WRITE_FAILURE),
>> -                   "could not queue event from master");
>>          goto err;
>>        }
>>        if (flush_master_info(mi, 1))
>> @@ -3038,6 +3070,7 @@ static int queue_old_event(MASTER_INFO *
>>  int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
>>  {
>>    int error= 0;
>> +  String error_msg;
>>    ulong inc_pos;
>>    RELAY_LOG_INFO *rli= &mi->rli;
>>    pthread_mutex_t *log_lock= rli->relay_log.get_log_lock();
>> @@ -3072,7 +3105,7 @@ int queue_event(MASTER_INFO* mi,const ch
>>      Rotate_log_event
> rev(buf,event_len,mi->rli.relay_log.description_event_for_queue);
>>      if (unlikely(process_io_rotate(mi,&rev)))
>>      {
>> -      error= 1;
>> +      error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE;
>>        goto err;
>>      }
>>      /*
>> @@ -3099,7 +3132,7 @@ int queue_event(MASTER_INFO* mi,const ch
>>            Log_event::read_log_event(buf, event_len, &errmsg,
>>                                     
> mi->rli.relay_log.description_event_for_queue)))
>>      {
>> -      error= 2;
>> +      error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE;
>>        goto err;
>>      }
>>      delete mi->rli.relay_log.description_event_for_queue;
>> @@ -3118,6 +3151,58 @@ int queue_event(MASTER_INFO* mi,const ch
>>     }
>>    break;
>> +
>> +  case HEARTBEAT_LOG_EVENT:
>> +  {
>> +    /*
>> +      HB (heartbeat) cannot come before RL (Relay)
>> +    */
>> +    char err_buff[10];
>> +    Heartbeat_log_event hb(buf, event_len,
> mi->rli.relay_log.description_event_for_queue);
>> +    if (!hb.is_valid())
>> +    {
>> +      error= ER_SLAVE_HEARTBEAT_FAILURE;
>> +      error_msg.append(STRING_WITH_LEN("inconsistent heartbeat event
> content;"));
>> +      error_msg.append(STRING_WITH_LEN("the event's data: log_file_name "));
>> +      error_msg.append(hb.log_ident, (uint) strlen(hb.log_ident));
>>   
>
> Why the cast? The append function accepts a uint32, and strlen()
> returns a size_t. There is no need for a cast here AFAICT.

fixed

>
>> +      error_msg.append(STRING_WITH_LEN(" log_pos "));
>> +      my_sprintf(err_buff, (err_buff, "%lu", hb.log_pos));
>> +      DBUG_ASSERT(strlen(err_buff) <= sizeof(err_buff));
>> +      error_msg.append(err_buff, (uint) strlen(err_buff));
>>   
>
> Same here. Remove the cast. Casts almost never fixes a problem and
> almost always hides a bug.
>
fixed

>> +      goto err;
>> +    }
>> +    mi->received_heartbeats++;
>> +    /* +       compare local and event's versions of log_file,
>> log_pos.
>> +       +       Heartbeat is sent only after an event corresponding
>> to the corrdinates
>> +       the heartbeat carries.
>> +       Slave can not have a difference in coordinates except in the only
>> +       special case when mi->master_log_name, master_log_pos have never
>> +       been updated by Rotate event i.e when slave does not have any history
>> +       with the master (and thereafter mi->master_log_pos is NULL).
>> +
>> +       TODO: handling `when' for SHOW SLAVE STATUS' snds behind
>> +    */
>> +    if ((memcmp(mi->master_log_name, hb.log_ident, hb.ident_len)
>> +         && mi->master_log_name != NULL)
>> +        || mi->master_log_pos != hb.log_pos)
>> +    {
>> +      /* missed events of heartbeat from the past */
>> +      error= ER_SLAVE_HEARTBEAT_FAILURE;
>> +      error_msg.append(STRING_WITH_LEN("heartbeat is not compatible with local
> info;"));
>> +      error_msg.append(STRING_WITH_LEN("the event's data: log_file_name "));
>> +      error_msg.append(hb.log_ident, (uint) strlen(hb.log_ident));
>> +      error_msg.append(STRING_WITH_LEN(" log_pos "));
>> +      my_sprintf(err_buff, (err_buff, "%lu", hb.log_pos));
>> +      DBUG_ASSERT(strlen(err_buff) <= sizeof(err_buff));
>> +      error_msg.append(err_buff, (uint) strlen(err_buff));
>> +      goto err;
>> +    }
>> +    goto skip_relay_logging;
>> +  }
>> +  break;
>> +       default:
>>      inc_pos= event_len;
>>      break;
>> @@ -3178,15 +3263,23 @@ int queue_event(MASTER_INFO* mi,const ch
>>        rli->relay_log.harvest_bytes_written(&rli->log_space_total);
>>      }
>>      else
>> -      error= 3;
>> +    {
>> +      error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE;
>> +    }
>>      rli->ign_master_log_name_end[0]= 0; // last event is not ignored
>>    }
>>    pthread_mutex_unlock(log_lock);
>>  -
>> +skip_relay_logging:
>> +   err:
>>    pthread_mutex_unlock(&mi->data_lock);
>>    DBUG_PRINT("info", ("error: %d", error));
>> +  if (error)
>> +    mi->report(ERROR_LEVEL, error, ER(error), +
>> (error == ER_SLAVE_RELAY_LOG_WRITE_FAILURE)?
>> +               "could not queue event from master" :
>> +               error_msg.ptr());
>>    DBUG_RETURN(error);
>>  }
>>  @@ -3649,8 +3742,8 @@ static Log_event* next_event(RELAY_LOG_I
>>          */
>>          pthread_mutex_unlock(&rli->log_space_lock);
>>          pthread_cond_broadcast(&rli->log_space_cond);
>> -        // Note that wait_for_update unlocks lock_log !
>> -        rli->relay_log.wait_for_update(rli->sql_thd, 1);
>> +        // Note that wait_for_update_relay_log unlocks lock_log !
>> +        rli->relay_log.wait_for_update_relay_log(rli->sql_thd);
>>          // re-acquire data lock since we released it earlier
>>          pthread_mutex_lock(&rli->data_lock);
>>          rli->last_master_timestamp= save_timestamp;
>> diff -Nrup a/sql/sql_lex.h b/sql/sql_lex.h
>> --- a/sql/sql_lex.h	2007-08-24 13:22:30 +03:00
>> +++ b/sql/sql_lex.h	2007-10-10 11:13:27 +03:00
>> @@ -187,14 +187,15 @@ typedef struct st_lex_master_info
>>  {
>>    char *host, *user, *password, *log_file_name;
>>    uint port, connect_retry;
>> +  float heartbeat_period;
>>    ulonglong pos;
>>    ulong server_id;
>>    /*
>>      Enum is used for making it possible to detect if the user
>>      changed variable or if it should be left at old value
>>     */
>> -  enum {SSL_UNCHANGED, SSL_DISABLE, SSL_ENABLE}
>> -    ssl, ssl_verify_server_cert;
>> +  enum {UNCHANGED, DISABLE, ENABLE}
>> +    ssl, ssl_verify_server_cert, heartbeat_opt;
>>   

> These enum constants are so simple that they are likely to clash with
> existing symbols, e.g., defined by an OS. Please keep something more
> unique as enumeration constants. I would prefer if you could add a
> second enumeration with constants HB_UNCHANGED, HB_DISABLE, and
> HB_ENABLE.

I changed that although I was not kin about doing it, to confess.
This enum is declared within st_lex_master_info members so that to
access its values from outside is possible only with prefixing.
If there were  a namesake constant defined in an external name
space the methods of the class would have to care.
What you are suggesting a redundant prefix imo.

Wrt to the name of this extra prefix, please notice,
there are already two categories in st_lex_master_info which need
the same logics. And we can speculate that the logics clearly
describing by single words like UNCHANGED, DISABLE, ENABLE is a common
feature of the class and It'd be wrong to multiply enums.
So i combined the old and potential new enums into one.

>
>>    char *ssl_key, *ssl_cert, *ssl_ca, *ssl_capath, *ssl_cipher;
>>    char *relay_log_name;
>>    ulong relay_log_pos;
>> diff -Nrup a/sql/sql_repl.cc b/sql/sql_repl.cc
>> --- a/sql/sql_repl.cc	2007-07-07 10:04:08 +03:00
>> +++ b/sql/sql_repl.cc	2007-10-10 11:13:28 +03:00
>> @@ -314,6 +314,76 @@ Increase max_allowed_packet on master";
>>  }
>>   +/**
>> +  An auxiliary function for calling in mysql_binlog_send
>> +  to initialize the heartbeat timeout in waiting for a binlogged event.
>> +
>> +  @param     thd  in:  THD to access a user variable
>>   
>
> @param[in] thd ....
>
done

>> +
>> +  @return
>> +              heartbeat period an ulonglong of nanoseconds
>> +              or zero if heartbeat was not demanded by slave
>> +*/ +static ulonglong get_heartbeat_period(THD * thd)
>> +{
>> +  my_bool null_value;
>> +  LEX_STRING name=  { C_STRING_WITH_LEN("master_heartbeat_period")};
>> +  user_var_entry *entry= +    (user_var_entry*)
>> hash_search(&thd->user_vars, (uchar*) name.str,
>> +                                  name.length);
>> +  return entry? entry->val_int(&null_value) : 0;
>> +}
>> +
>> +/*
>>   
>
> /**
>
>> +  Function prepares and sends repliation heartbeat event.
>> +
>> +  SYNOPSIS
>>   
>
> The SYNOPSIS should go away. Doxygen reorders the pieces, so this will
> not end up where yoy think it does.

done

>
>> +  @param net                net object of THD
>> +  @param packet             buffer to store the heartbeat instance
>> +  @param event_coordinates  binlog file name and position of the last
>> +                            real event master sent from binlog
>> +
>> +  @note +    Among three essential pieces of heartbeat data
>> Log_event::when
>> +    is computed locally.
>> +    The  error to send is serious and should force terminating
>> +    the dump thread.
>> +*/
>> +static int send_heartbeat_event(NET* net, String* packet,
>> +                                const struct event_coordinates *coord)
>> +{
>> +  DBUG_ENTER("send_heartbeat_event");
>> +  char header[LOG_EVENT_HEADER_LEN];
>> +  /*
>> +    'when' (the timestamp) is set to 0 so that slave could distinguish between
>> +    real and fake Rotate events (if necessary)
>> +  */
>> +  memset(header, (ulong) my_time(0), 4);  // when
>>   
>
> Why do you cast it to a ulong? memset() accepts a signed integer in
> the range -128 to 255 as second parameter, and my_time returns a
> long. So why do you add an arbitrary cast to an unsigned type here? It
> will give warnings on Windows, for one, and is not needed.
>

fixed

>> +
>> +  header[EVENT_TYPE_OFFSET] = HEARTBEAT_LOG_EVENT;
>> +
>> +  char* p= coord->file_name + dirname_length(coord->file_name);
>> +
>> +  uint ident_len = (uint) strlen(p);
>>   
>
> Why the cast here? Remove it if it is not needed.
>

fixed

>> +  ulong event_len = ident_len + LOG_EVENT_HEADER_LEN;
>> +  int4store(header + SERVER_ID_OFFSET, server_id);
>> +  int4store(header + EVENT_LEN_OFFSET, event_len);
>> +  int2store(header + FLAGS_OFFSET, 0);
>> +
>> +  int4store(header + LOG_POS_OFFSET, coord->pos);  // log_pos
>> +
>> +  packet->append(header, sizeof(header));
>> +  packet->append(p, ident_len);             // log_file_name
>> +
>> +  if (my_net_write(net, (uchar*) packet->ptr(), packet->length()))
>> +  {
>> +    DBUG_RETURN(-1);
>> +  }
>> +  net_flush(net);
>> +  packet->set("\0", 1, &my_charset_bin);
>> +  DBUG_RETURN(0);
>> +}
>> +
>>  /*
>>    TODO: Clean up loop to only have one call to send_file()
>>  */
>> @@ -340,6 +410,23 @@ void mysql_binlog_send(THD* thd, char* l
>>     bzero((char*) &log,sizeof(log));
>>  +  /* +     heartbeat_period from @master_heartbeat_period user
>> variable
>> +  */
>> +  ulonglong heartbeat_period= get_heartbeat_period(thd);
>> +  struct timespec heartbeat_buf;
>> +  struct event_coordinates coord_buf;
>> +  struct timespec *heartbeat_ts= NULL;
>> +  struct event_coordinates *coord= NULL;
>> +  if (heartbeat_period != 0LL)
>> +  {
>> +    heartbeat_ts= &heartbeat_buf;
>> +    heartbeat_ts->tv_sec= 0;
>> +    heartbeat_ts->tv_nsec= 0;
>> +    coord= &coord_buf;
>> +    coord->file_name= log_file_name; // initialization basing on what slave
> remembers
>> +    coord->pos= pos;
>> +  }
>>  #ifndef DBUG_OFF
>>    if (opt_sporadic_binlog_dump_fail && (binlog_dump_count++ % 2))
>>    {
>> @@ -530,6 +617,11 @@ impossible position";
>>  	goto err;
>>        }
>>  #endif
>> +      /*
>> +        log's filename does not change while it's active
>> +      */
>> +      if (coord)
>> +        coord->pos= uint4korr(packet->ptr() + 1 + LOG_POS_OFFSET);
>>         if ((*packet)[EVENT_TYPE_OFFSET+1] ==
>> FORMAT_DESCRIPTION_EVENT)
>>        {
>> @@ -625,26 +717,47 @@ impossible position";
>>  	  /* we read successfully, so we'll need to send it to the slave */
>>  	  pthread_mutex_unlock(log_lock);
>>  	  read_packet = 1;
>> +          if (coord)
>> +            coord->pos= uint4korr(packet->ptr() + 1 + LOG_POS_OFFSET);
>>  	  break;
>>   	case LOG_READ_EOF:
>> +          int ret;
>>  	  DBUG_PRINT("wait",("waiting for data in binary log"));
>>  	  if (thd->server_id==0) // for mysqlbinlog (mysqlbinlog.server_id==0)
>>  	  {
>>  	    pthread_mutex_unlock(log_lock);
>>  	    goto end;
>>  	  }
>> -	  if (!thd->killed)
>> -	  {
>> -	    /* Note that the following call unlocks lock_log */
>> -	    mysql_bin_log.wait_for_update(thd, 0);
>> -	  }
>> -	  else
>> -	    pthread_mutex_unlock(log_lock);
>> -	  DBUG_PRINT("wait",("binary log received update"));
>> -	  break;
>> -
>> -	default:
>> +          do +          {
>> +            if (coord)
>> +            {
>> +              DBUG_ASSERT(heartbeat_ts && heartbeat_period != 0LL);
>> +              set_timespec_nsec(*heartbeat_ts, heartbeat_period);
>> +            }
>> +            ret= mysql_bin_log.wait_for_update_bin_log(thd, heartbeat_ts);
>>   
>
> And what happends if coord is zero? Then is seems like *heartbeat_ts
> has an undefined value.
>

Right, undefined. However heartbeat_ts'd be NULL that's all what is needed.


>> +            DBUG_ASSERT(ret == 0 || heartbeat_period != 0LL && coord !=
> NULL);
>> +            if (ret == ETIMEDOUT || ret == ETIME)
>> +            {
>> +              sql_print_information("master sends heartbeat message");
>> +              if (send_heartbeat_event(net, packet, coord))
>> +              {
>> +                errmsg = "Failed on my_net_write()";
>> +                my_errno= ER_UNKNOWN_ERROR;
>> +                goto err;
>> +              }
>> +            }
>> +            else
>> +            {
>> +              DBUG_ASSERT(ret == 0);
>> +              DBUG_PRINT("wait",("binary log received update"));
>> +            }
>> +          } while (ret != 0 && coord != NULL &&
> !thd->killed);
>>   
>
> There is nothing in the loop that can affect the value of the coord
> variable, so why is it part of the loop condition?
>

Just to escape the loop without spinning around.  That would mean
no-heartbeat branch of execution, which should be of the same logics
as the pre-patch version of the code.


>> +          pthread_mutex_unlock(log_lock);
>> +          break;
>> +            +        default:
>>  	  pthread_mutex_unlock(log_lock);
>>  	  fatal_error = 1;
>>  	  break;
>> @@ -728,6 +841,8 @@ impossible position";
>>         packet->length(0);
>>        packet->append('\0');
>> +      if (coord)
>> +        coord->file_name= log_file_name; // reset to the next
>>      }
>>    }
>>  @@ -740,6 +855,11 @@ end:
>>    pthread_mutex_lock(&LOCK_thread_count);
>>    thd->current_linfo = 0;
>>    pthread_mutex_unlock(&LOCK_thread_count);
>> +  if (coord)
>> +  {
>> +    delete heartbeat_ts;
>>   
>
> You cannot delete a piece of memory allocated on the stack. It is
> usually benign, but calling delete with a value that has not been
> allocated with new invokes undefined behavior and therefore almost
> anything can happen.
>
>
>> +    delete coord;
>>   
>
> Same here. The memory that coord points to was not allocated with new,
> so the behavior is undefined.
>

You just found not the latest patch ...

>> +  }
>>    DBUG_VOID_RETURN;
>>   err:
>> @@ -1130,13 +1250,15 @@ bool change_master(THD* thd, MASTER_INFO
>>      mi->port = lex_mi->port;
>>    if (lex_mi->connect_retry)
>>      mi->connect_retry = lex_mi->connect_retry;
>> +  if (lex_mi->heartbeat_opt != LEX_MASTER_INFO::UNCHANGED)
>> +    mi->heartbeat_period = lex_mi->heartbeat_period;
>> +  mi->received_heartbeats= 0LL; // counter lives until master is CHANGEd
>>   
>
> The LL suffix is not guaranteed to be supported on all compilers we
> use. Stick to the LL(x) macro.
>

okay.


>> +  if (lex_mi->ssl != LEX_MASTER_INFO::UNCHANGED)
>> +    mi->ssl= (lex_mi->ssl == LEX_MASTER_INFO::ENABLE);
>>  -  if (lex_mi->ssl != LEX_MASTER_INFO::SSL_UNCHANGED)
>> -    mi->ssl= (lex_mi->ssl == LEX_MASTER_INFO::SSL_ENABLE);
>> -
>> -  if (lex_mi->ssl_verify_server_cert != LEX_MASTER_INFO::SSL_UNCHANGED)
>> +  if (lex_mi->ssl_verify_server_cert != LEX_MASTER_INFO::UNCHANGED)
>>      mi->ssl_verify_server_cert=
>> -      (lex_mi->ssl_verify_server_cert == LEX_MASTER_INFO::SSL_ENABLE);
>> +      (lex_mi->ssl_verify_server_cert == LEX_MASTER_INFO::ENABLE);
>>     if (lex_mi->ssl_ca)
>>      strmake(mi->ssl_ca, lex_mi->ssl_ca, sizeof(mi->ssl_ca)-1);
>> diff -Nrup a/sql/sql_yacc.yy b/sql/sql_yacc.yy
>> --- a/sql/sql_yacc.yy	2007-09-20 12:28:51 +03:00
>> +++ b/sql/sql_yacc.yy	2007-10-10 11:13:28 +03:00
>> @@ -787,6 +787,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
>>  %token  MASTER_SSL_VERIFY_SERVER_CERT_SYM
>>  %token  MASTER_SYM
>>  %token  MASTER_USER_SYM
>> +%token  MASTER_HEARTBEAT_PERIOD_SYM
>>  %token  MATCH                         /* SQL-2003-R */
>>  %token  MAX_CONNECTIONS_PER_HOUR
>>  %token  MAX_QUERIES_PER_HOUR
>> @@ -1502,13 +1503,13 @@ master_def:
>>         {
>>  	 Lex->mi.connect_retry = $3;
>>         }
>> -       | MASTER_SSL_SYM EQ ulong_num
>> -         {
>> -           Lex->mi.ssl= $3 ? -
>> LEX_MASTER_INFO::SSL_ENABLE : LEX_MASTER_INFO::SSL_DISABLE;
>> -         }
>> -       | MASTER_SSL_CA_SYM EQ TEXT_STRING_sys
>> -         {
>> +        | MASTER_SSL_SYM EQ ulong_num
>> +          {
>> +            Lex->mi.ssl= $3 ? +
>> LEX_MASTER_INFO::ENABLE : LEX_MASTER_INFO::DISABLE;
>> +          }
>> +        | MASTER_SSL_CA_SYM EQ TEXT_STRING_sys
>> +          {
>>   

>
> Why did you change the indentation?
>

My fault. Fixed. One origianl identation got refined still within the
single hunk with my changes.


>>             Lex->mi.ssl_ca= $3.str;
>>           }
>>         | MASTER_SSL_CAPATH_SYM EQ TEXT_STRING_sys
>> @@ -1525,16 +1526,52 @@ master_def:
>>           }
>>         | MASTER_SSL_KEY_SYM EQ TEXT_STRING_sys
>>           {
>> -           Lex->mi.ssl_key= $3.str;
>> -	 }
>> -       | MASTER_SSL_VERIFY_SERVER_CERT_SYM EQ ulong_num
>> +            Lex->mi.ssl_key= $3.str;
>> +          }
>> +        | MASTER_SSL_VERIFY_SERVER_CERT_SYM EQ ulong_num
>>   
>
> Same here, why change the indentation? It just causes merge problems.
>

done

>>           {
>>             Lex->mi.ssl_verify_server_cert= $3 ?
>> -               LEX_MASTER_INFO::SSL_ENABLE : LEX_MASTER_INFO::SSL_DISABLE;
>> +               LEX_MASTER_INFO::ENABLE : LEX_MASTER_INFO::DISABLE;
>> +         }
>> +       | MASTER_HEARTBEAT_PERIOD_SYM EQ NUM_literal
>> +         {
>> +           Lex->mi.heartbeat_period= $3->val_real();
>> +           if (Lex->mi.heartbeat_period > (ULONG_MAX / 1000))
>> +           {
>> +             my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
>> +                      MYF(0),
>> +                      " exceeds 4294967 (ULONG_MAX / 1000) seconds",
>> +                      " which is the maximum.");
>>   
>
> How do you know that ULONG_MAX / 1000 is 4294967? It depends on the
> compiler and the platform. You should print the actual value of
> ULONG_MAX / 1000 since this is what you check against.

That's a good point.
I claimed wrong.
if (Lex->mi.heartbeat_period >  4294967) that's what i mean.



>
>> +             MYSQL_YYABORT;
>> +           }
>> +           if (Lex->mi.heartbeat_period > slave_net_timeout)
>> +           {
>> +             push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN,
>> +                                 ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
>> +                                 ER(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE),
>> +                                 " exceeds the value of `slave_net_timeout'
> sec."
>> +                                 " A sensible value for the period should be"
>> +                                 " less than the timeout.");
>> +           }
>> +           if (Lex->mi.heartbeat_period < 0.001)
>> +           {
>> +             if (Lex->mi.heartbeat_period != 0.0)
>> +             {
>> +               push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN,
>> +                                   ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
>> +                                   ER(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE),
>> +                                   " is less than 1 msec."
>> +                                   " The period is reset to zero which means"
>> +                                   " no heartbeats will be sending");
>> +               Lex->mi.heartbeat_period= 0.0;
>> +             }
>> +             Lex->mi.heartbeat_opt=  LEX_MASTER_INFO::DISABLE;
>> +           }
>> +           Lex->mi.heartbeat_opt=  LEX_MASTER_INFO::ENABLE;
>>           }
>>         |
>>           master_file_def
>> -       ;
>> +        ;
>>   master_file_def:
>>         MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys
>>
>>   
>
>
> -- 
> Mats Kindahl
> Lead Software Developer
> Replication Team
> MySQL AB, www.mysql.com
>
>
>
> -- 
> MySQL Code Commits Mailing List
> For list archives: http://lists.mysql.com/commits
> To unsubscribe:    http://lists.mysql.com/commits?unsub=1

regards,


-- 
Andrei Elkin, Software Developer, PhD
MySQL Finland Oy, Helsinki, Finland, www.mysql.com

Are you MySQL certified?  www.mysql.com/certification
Thread
bk commit into 5.1 tree (aelkin:1.2653) BUG#20435Andrei Elkin10 Oct
  • Re: bk commit into 5.1 tree (aelkin:1.2653) BUG#20435Mats Kindahl10 Oct
    • Re: bk commit into 5.1 tree (aelkin:1.2653) BUG#20435Andrei Elkin11 Oct