Bug #56964 Replication test's state affecting subsequent rpl tests
Submitted: 23 Sep 2010 8:32 Modified: 15 Mar 2011 11:32
Reporter: Nirbhay Choubey Email Updates:
Status: Closed Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S3 (Non-critical)
Version:5.6.1-m4 OS:Any
Assigned to: Bjørn Munch CPU Architecture:Any
Tags: mysql-trunk, mysql-trunk-bugfixing

[23 Sep 2010 8:32] Nirbhay Choubey
Description:
The following statement produces single 'id' 
when run inside a single replication test, while
it produces two 'id's when two replication tests
are run in succession. 

select id from information_schema.processlist where command='Binlog Dump';

This is clean-up issue, and mtr should perform the proper cleaning of
the leftovers of the previous replication tests before starting the next
rpl test.

How to repeat:
Run the attached test suite with --repeat=2

perl mtr --suite=bug --repeat=2
[23 Sep 2010 8:34] Nirbhay Choubey
Test suite for the bug

Attachment: bug_56964.tar.gz (application/x-gzip, text), 380 bytes.

[23 Sep 2010 8:48] Sven Sandberg
I think this can be fixed after BUG#49978, by executing this:

rpl_end.inc:
For each master:
   --let $id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND = 'Binlog Dump'`
   while (`SELECT '$id' != 'No such row')
   {
     KILL $id;
     --let $id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND = 'Binlog Dump'`
   }

In rpl_end.inc:
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND='Binlog Dump';
[25 Sep 2010 12:20] Sveta Smirnova
Thank you for the report.

Verified as described.

Test is pretty easy:

source include/master-slave.inc;
select id from information_schema.processlist where command='Binlog Dump';
[22 Dec 2010 9:46] Bjørn Munch
Following the suggestion, I tried adding the following to the first while() loop in the new rpl_end.inc after 49978:

-----------------------------
  --disable_query_log
  let $id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE
            COMMAND = 'Binlog Dump'`;
   while ($id)
   {
     eval KILL $id;
     let $id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE
              COMMAND = 'Binlog Dump'`;
   }  
  --enable_query_log
----------------------

(Note I have to use let...; instead if --let syntax to be able to wrap the long lines in a good way)

The only effect is that the id reported by the 2nd execution of the test increases from 14 to 15; the first one has 5.

It seems a bit overkill to have to do this for every rpl test just to cover this special case. And if it's not possible anyway, the affected test may as well force a restart.
[6 Jan 2011 14:50] Bjørn Munch
This is not something mtr can fix. If the test is not able to clean up as suggested (and my simple test seems to indicate it can't), then a test which needs to do this may have to force a restart before running, by adding --force-restart to <test>-master.opt.
[15 Mar 2011 11:32] Bjørn Munch
Cleanup