Bug #38178 rpl_loaddata_map fails sporadically in pushbuild
Submitted: 16 Jul 2008 16:33 Modified: 1 Oct 2008 14:24
Reporter: Sven Sandberg Email Updates:
Status: Closed Impact on me:
None 
Category:Tests: Replication Severity:S7 (Test Cases)
Version:5.1+ OS:Any
Assigned to: Sven Sandberg CPU Architecture:Any
Tags: pushbuild, rpl_loaddata_map, sporadic, test failure

[16 Jul 2008 16:33] Sven Sandberg
Description:
rpl_loaddata_map fails sporadically in pushbuild with the following error:

rpl.rpl_loaddata_map                     [ fail ]

CURRENT_TEST: rpl.rpl_loaddata_map
=== SHOW MASTER STATUS ===
---- 1. ----
File	slave-bin.000001
Position	24409
Binlog_Do_DB	
Binlog_Ignore_DB	
==========================

=== SHOW SLAVE STATUS ===
---- 1. ----
Slave_IO_State	Waiting for master to send event
Master_Host	127.0.0.1
Master_User	root
Master_Port	12040
Connect_Retry	1
Master_Log_File	master-bin.000002
Read_Master_Log_Pos	24424
Relay_Log_File	slave-relay-bin.000004
Relay_Log_Pos	24490
Relay_Master_Log_File	master-bin.000002
Slave_IO_Running	Yes
Slave_SQL_Running	No
Replicate_Do_DB	
Replicate_Ignore_DB	
Replicate_Do_Table	
Replicate_Ignore_Table	
Replicate_Wild_Do_Table	
Replicate_Wild_Ignore_Table	
Last_Errno	1051
Last_Error	Error 'Unknown table 't1'' on query. Default database: 'test'. Query: 'drop table t1, t2'
Skip_Counter	0
Exec_Master_Log_Pos	24344
Relay_Log_Space	24871
Until_Condition	None
Until_Log_File	
Until_Log_Pos	0
Master_SSL_Allowed	No
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	No
Last_IO_Errno	0
Last_IO_Error	
Last_SQL_Errno	1051
Last_SQL_Error	Error 'Unknown table 't1'' on query. Default database: 'test'. Query: 'drop table t1, t2'
=========================

mysqltest: At line 51: could not sync with master ('select master_pos_wait('master-bin.000002', 24424)' returned NULL)

The result from queries just before the failure was:
< snip >
start slave;
create table t2 (id int not null primary key auto_increment);
select @@session.read_buffer_size - @@session.max_allowed_packet > 0 ;
@@session.read_buffer_size - @@session.max_allowed_packet > 0
1
load data infile 'MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' into table t2;
select count(*) from t2 /* 5 000 */;
count(*)
5000
show binlog events in 'master-bin.000002' from <binlog_start>;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000002	#	Query	#	#	use `test`; create table t2 (id int not null primary key auto_increment)
master-bin.000002	#	Begin_load_query	#	#	;file_id=#;block_len=#
master-bin.000002	#	Append_block	#	#	;file_id=#;block_len=#
master-bin.000002	#	Append_block	#	#	;file_id=#;block_len=#
master-bin.000002	#	Execute_load_query	#	#	use `test`; load data infile 'MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' into table t2 ;file_id=#
select count(*) from t2 /* 5 000 */;
count(*)
5000
drop table t1, t2;

More results from queries before failure can be found in /dev/shm/var-n_mix-130/3/log/rpl_loaddata_map.log 

 - saving '/dev/shm/var-n_mix-130/3/log/rpl.rpl_loaddata_map/' to '/dev/shm/var-n_mix-130/log/rpl.rpl_loaddata_map/'

Retrying test, attempt(2/3)...

How to repeat:
https://intranet.mysql.com/secure/pushbuild/showpush.pl?dir=bzr_mysql-5.1-rpl&order=23 'sapsrv1' Autopush/n_mix
And four other failures in the same push

Suggested fix:
The test creates t1 as an auxiliary table, then drops t1, then runs flush logs.
That removes the binlog containing 'create table t1'. The slave is not synchronized, so it may not have connected at this point. Hence, the slave may never see the 'create table t1' statement.

When the test cleanup code does 'drop table t1' on master and tries to synchronize the slave, the slave SQL thread stops with an error because t1 does not exist.

The fix is to not binlog 'create table t1', not binlog 'insert into t1', and not binlog 'drop table t1'.
[16 Jul 2008 16:44] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/49872

2703 Sven Sandberg	2008-07-16
      BUG#38178: rpl_loaddata_map fails sporadically in pushbuild
      Problem: master binlog has 'create table t1'. Master binlog
      was removed before slave could replicate it. In test's cleanup
      code, master did 'drop table t1', which caused slave sql
      thread to stop with an error since slave sql thread did not
      know about t1.
      Fix: t1 is just an auxiliary construction, only needed on
      master. Hence, we turn off binlogging before t1 is created,
      drop t1 as soon as we don't need it anymore, and then turn
      on binlogging again.
[16 Jul 2008 16:54] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/49873

2703 Sven Sandberg	2008-07-16
      BUG#38178: rpl_loaddata_map fails sporadically in pushbuild
      Problem: master binlog has 'create table t1'. Master binlog
      was removed before slave could replicate it. In test's cleanup
      code, master did 'drop table t1', which caused slave sql
      thread to stop with an error since slave sql thread did not
      know about t1.
      Fix: t1 is just an auxiliary construction, only needed on
      master. Hence, we turn off binlogging before t1 is created,
      drop t1 as soon as we don't need it anymore, and then turn
      on binlogging again.
[17 Jul 2008 11:32] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/49916

2703 Sven Sandberg	2008-07-17
      BUG#38178: rpl_loaddata_map fails sporadically in pushbuild
      Problem: master binlog has 'create table t1'. Master binlog
      was removed before slave could replicate it. In test's cleanup
      code, master did 'drop table t1', which caused slave sql
      thread to stop with an error since slave sql thread did not
      know about t1.
      Fix: t1 is just an auxiliary construction, only needed on
      master. Hence, we turn off binlogging before t1 is created,
      drop t1 as soon as we don't need it anymore, and then turn
      on binlogging again.
[18 Jul 2008 11:29] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/50022

2704 Sven Sandberg	2008-07-18
      BUG#38178: rpl_loaddata_map fails sporadically in pushbuild
      Problem: master binlog has 'create table t1'. Master binlog
      was removed before slave could replicate it. In test's cleanup
      code, master did 'drop table t1', which caused slave sql
      thread to stop with an error since slave sql thread did not
      know about t1.
      Fix: t1 is just an auxiliary construction, only needed on
      master. Hence, we turn off binlogging before t1 is created,
      drop t1 as soon as we don't need it anymore, and then turn
      on binlogging again.
[14 Aug 2008 7:17] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/51600

2677 He Zhenxing	2008-08-14 [merge]
      Merge with mysql-5.1-rpl-testfixes
[15 Aug 2008 2:02] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/51688

2769 He Zhenxing	2008-08-15 [merge]
      Merge 6.0-rpl-testfixes -> 6.0
[19 Aug 2008 19:56] Bugs System
Pushed into 6.0.7-alpha  (revid:sven@mysql.com-20080718113419-fw3fotg7o79vnj1z) (version source revid:sven@mysql.com-20080818175803-c1nutd5773r6b4gd) (pib:3)
[19 Aug 2008 20:31] Paul DuBois
Test case changes. No changelog entry needed.

Setting report to Patch Queued pending push of fix into 5.1.x.
[25 Aug 2008 21:04] Chuck Bell
Released in 6.0.7
[27 Aug 2008 1:18] Paul DuBois
Setting report to NDI pending push into 5.1.x.
[28 Aug 2008 20:17] Bugs System
Pushed into 6.0.7-alpha  (revid:cbell@mysql.com-20080822132131-uveo6wiuecy6m2b8) (version source revid:cbell@mysql.com-20080822132131-uveo6wiuecy6m2b8) (pib:3)
[29 Aug 2008 0:43] Paul DuBois
Setting report to NDI pending push into 5.1.x.
[1 Sep 2008 7:45] Zhenxing He
Test case changes only
[2 Sep 2008 18:17] Paul DuBois
Setting report to NDI pending push into 5.1.x.
[14 Sep 2008 2:50] Bugs System
Pushed into 6.0.7-alpha  (revid:sven@mysql.com-20080718113419-fw3fotg7o79vnj1z) (version source revid:sven@mysql.com-20080818175803-c1nutd5773r6b4gd) (pib:3)
[16 Sep 2008 4:25] Paul DuBois
Setting report to NDI pending push into 5.1.x.