Bug #47639 The rpl_binlog_corruption test fails on Windows
Submitted: 25 Sep 2009 3:16 Modified: 15 Mar 2010 4:21
Reporter: Igor Babaev Email Updates:
Status: Closed Impact on me:
None 
Category:Tests: Replication Severity:S3 (Non-critical)
Version:5.1 OS:Windows
Assigned to: Luis Soares CPU Architecture:Any

[25 Sep 2009 3:16] Igor Babaev
Description:
When working on Windows with the build created from the current mysql-5.1 tree 
(http://bazaar.launchpad.net/~mysql/mysql-server/mysql-5.1/) and trying to run

mysql-5.1\mysql-test>perl mysql-test-run.pl rpl_binlog_corruption
I've got an unexpected result.

How to repeat:
Install MySQL from the build tree on Windows following the instructions that could be
found in win/README.

Run 

mysql-5.1\mysql-test>perl mysql-test-run.pl rpl_binlog_corruption

You'll get something like this:

C:\mysql-5.1\mysql-test>perl mysql-test-run.pl rpl_binlog_corruption
Logging: mysql-test-run.pl  rpl_binlog_corruption
MySQL Version 5.1.40
Checking supported features...
 - skipping ndbcluster, mysqld not compiled with ndbcluster
 - SSL connections supported
 - binaries are debug compiled
Collecting tests...
 - adding combinations for rpl
vardir: C:/mysql-5.1/mysql-test/var
Checking leftover processes...
Removing old var directory...
Creating var directory 'C:/mysql-5.1/mysql-test/var'...
Installing system database...
Using server port 2693

==============================================================================

TEST                                      RESULT   TIME (ms)
------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
rpl.rpl_binlog_corruption 'row'          [ fail ]
        Test ended at 2009-09-24 20:13:35

CURRENT_TEST: rpl.rpl_binlog_corruption
mysqltest: In included file ".\include\setup_fake_relay_log.inc": At line 75: query 'CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_f
' not found (Errcode: 22)Y_LOG_POS=4' failed: 29: File 'slave-relay-bin-fake.000001

The result from queries just before the failure was:
call mtr.add_suppression('Found invalid event in binary log');
==== Initialize ====
Setting up fake replication from MYSQL_TEST_DIR/std_data/bug40482-bin.000001

Warnings from just before the error:
' not found (Errcode: 22)y-bin-fake.000001

 - saving 'C:/mysql-5.1/mysql-test/var/log/rpl.rpl_binlog_corruption-row/' to 'C:/mysql-5.1/mysql-test/var/log/rpl.rpl_binlog_corruption-row/'

Only  1  of 3 completed.
mysql-test-run: *** ERROR: Not all tests completed
[25 Sep 2009 5:13] Sveta Smirnova
Thank you for the report.

Verified as described.
[1 Feb 2010 1:08] Luis Soares
List of failures:
  http://tinyurl.com/y9k4hr3
[2 Feb 2010 11:58] Luis Soares
The test case fails when trying to setup the a fake relay log on
mysqld.1 instance. The setup is done using the include file:
setup_fake_relay_log.inc.

Inside it, a fake relay log index file is created so that it
holds a reference to the fake relay log. This is done resorting
to the instruction:

  --exec echo $_fake_filename-fake.000001 > $_fake_relay_index

Running the test case and inspecting the index file after a
failure on windows host we get:

> cat slave-relay-bin.index 
slave-relay-bin-fake.000001
.\slave-relay-bin.000001

This seems fine, but when further inspection is conducted on the
contents of the index file:

> od -c slave-relay-bin.index
0000000   s   l   a   v   e   -   r   e   l   a   y   -   b   i   n   -
0000020   f   a   k   e   .   0   0   0   0   0   1  \r  \n   .   \   s
0000040   l   a   v   e   -   r   e   l   a   y   -   b   i   n   .   0
0000060   0   0   0   0   1  \n
0000066

We can find that the first line is terminated with a CR+LF, and
this is causing troubles for mysqld.

The fix for this would be not to rely on a OS primitive to
generate the index file (echo + redirection - >), but instead
maybe create it using mysql facilities (which should make the
procedure platform independent). For instance, replacing the line
above with:

-- eval select '$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index'
[2 Feb 2010 15:18] 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/98960

3346 Luis Soares	2010-02-02
      BUG#47639: The rpl_binlog_corruption test fails on Windows
      
      The test case rpl_binlog_corruption fails on windows because when
      adding a line to the binary log index file it gets terminated
      with a CR+LF (which btw, is the normal case in windows, but not on
      Unixes - LF). This causes mismatch between the relay log names,
      causing mysqld to report that it cannot find the log file.
      
      We fix this by creating the instrumented index file through
      mysql, ie, using SELECT ... INTO DUMPFILE ..., as opposed on
      relying on ultimatly OS commands like: -- echo "..." >
      index. These changes go into the file and make the procedure
      platform independent:
      
        include/setup_fake_relay_log.inc
      
      Side note: when using SELECT ... INTO DUMPFILE ..., one needs to
      check if mysqld is running with secure_file_priv. If it is, we do
      it in two steps: 1. create the file on the allowed location;
      2. move it to the datadir. If it is not, then we just create the
      file directly on the datadir (so previous step 2. is not needed).
[4 Feb 2010 10:20] Bugs System
Pushed into 5.1.44 (revid:joro@sun.com-20100204101444-2j32mhqroo0iiio6) (version source revid:luis.soares@sun.com-20100203121251-83sucdrllmoq826k) (merge vers: 5.1.43) (pib:16)
[4 Feb 2010 13:33] Jon Stephens
Change in test code only, no end-user changes to document. Closed without further action.
[5 Feb 2010 11:51] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100204063540-9czpdmpixi3iw2yb) (version source revid:alik@sun.com-20100203215248-sz18zyqu7e3sg9p7) (pib:16)
[5 Feb 2010 11:57] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100205113942-oqovjy0eoqbarn7i) (version source revid:alik@sun.com-20100204064210-ljwanqvrjs83s1gq) (merge vers: 6.0.14-alpha) (pib:16)
[5 Feb 2010 12:02] Bugs System
Pushed into 5.5.2-m2 (revid:alik@sun.com-20100203172258-1n5dsotny40yufxw) (version source revid:alik@sun.com-20100203172258-1n5dsotny40yufxw) (merge vers: 5.5.2-m2) (pib:16)
[5 Feb 2010 13:26] Jon Stephens
Change in tests only, no user visible changes to document.

Closed.
[12 Mar 2010 14:10] Bugs System
Pushed into 5.1.44-ndb-7.0.14 (revid:jonas@mysql.com-20100312135944-t0z8s1da2orvl66x) (version source revid:jonas@mysql.com-20100312115609-woou0te4a6s4ae9y) (merge vers: 5.1.44-ndb-7.0.14) (pib:16)
[12 Mar 2010 14:26] Bugs System
Pushed into 5.1.44-ndb-6.2.19 (revid:jonas@mysql.com-20100312134846-tuqhd9w3tv4xgl3d) (version source revid:jonas@mysql.com-20100312060623-mx6407w2vx76h3by) (merge vers: 5.1.44-ndb-6.2.19) (pib:16)
[12 Mar 2010 14:40] Bugs System
Pushed into 5.1.44-ndb-6.3.33 (revid:jonas@mysql.com-20100312135724-xcw8vw2lu3mijrhn) (version source revid:jonas@mysql.com-20100312103652-snkltsd197l7q2yg) (merge vers: 5.1.44-ndb-6.3.33) (pib:16)
[15 Mar 2010 4:21] Jon Stephens
Closing; see my previous comment.