Bug #59837 mysqlhotcopy fails with wrong error (11) on specific platforms
Submitted: 31 Jan 2011 10:37 Modified: 9 Feb 2011 19:24
Reporter: John Embretsen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:5.1.56,5.5.10,5.6.2-m5 OS:Linux
Assigned to: John Embretsen CPU Architecture:Any
Tags: pushbuild

[31 Jan 2011 10:37] John Embretsen
Description:
The mysqlhotcopy_myisam and mysqlhotcopy_archive tests fail on the platform "linux2.6-x86-64bit community tar-gz" in the daily-trunk branch in Pushbuild:

main.mysqlhotcopy_archive w1 [ fail ]
        Test ended at 2011-01-31 03:02:14

CURRENT_TEST: main.mysqlhotcopy_archive
Can't hotcopy to '/export/home2/pb2/test/sb_2-2916011-1296433663.75/mysql-5.6.2-m5-linux2.6-x86_64/mysql-test/var-n_mix/1/mysqld.1/data/hotcopy_save' because directory
already exist and the --allowold or --addtodest options were not given.
mysqltest: In included file "./include/mysqlhotcopy.inc": 
included from ./include/mysqlhotcopy.inc at line 112:
At line 111: command "$MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save" failed with wrong error: 11

The result from queries just before the failure was:
< snip >
t2.ARZ
t2.frm
t3.ARZ
t3.frm
DROP DATABASE hotcopy_save;
db.opt
t1.ARZ
t1.frm
t2.ARZ
t2.frm
t3.ARZ
t3.frm
DROP DATABASE hotcopy_save;
db.opt
t1.ARZ
t1.frm
t2.ARZ
t2.frm
t3.ARZ
t3.frm

More results from queries before failure can be found in /export/home2/pb2/test/sb_2-2916011-1296433663.75/mysql-5.6.2-m5-linux2.6-x86_64/mysql-test/var-n_mix/1/log/mysqlhotcopy_archive.log

Relevant section in mysql-test/include/mysqlhotcopy.inc is:

# test of option "allowold"
DROP DATABASE hotcopy_save;
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--list_files $MYSQLD_DATADIR/hotcopy_save
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--error 9,2304
--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQLHOTCOPY --quiet --allowold -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--list_files $MYSQLD_DATADIR/hotcopy_save

Here, errors 9 and 2304 are allowed for the failing command. However, on this particular platform error 11 is returned instead.

Failure has been occurring consistently in daily-trunk branch since the mysqlhotopy tests were re-enabled with the fix for Bug#56817 on 2011-01-29.

How to repeat:
perl mysql-test-run.pl --do-test=mysqlhotcopy.*

(Special environment is required, possibly old version of Red Hat and/or Perl and/or Perl modules)

Suggested fix:
Allow error code 11 as well:

--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--error 9,11,2304
--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
[31 Jan 2011 13:08] John Embretsen
Part of mysqlhotcopy script which returns the error causing test failure:

 # --- create target directories if we are using 'cp' ---
 
 my @existing = ();
 
 if ($opt{method} =~ /^cp\b/)
 {
   foreach my $rdb ( @db_desc ) {
     push @existing, $rdb->{target} if ( -d  $rdb->{target} );
   }

   if ( @existing && !($opt{allowold} || $opt{addtodest}) )
   {
     $dbh->disconnect();
     die "Can't hotcopy to '", join( "','", @existing ), "' because directory\nalready exist and the --allowold or --addtodest options were not given.\n"
   }
 }

"die" is called, and an error code is not specified. This means that the value of $!, i.e. the error code from the last failing operation, is returned. It is likely that this error code is different when using older versions of the Perl modules DBI and DBD::mysql and/or Perl or the OS itself.

Versions on frigg37 (host with failing test runs):
  OS:         Red Hat EL 4 (Nahant Update 6), kernel 2.6.9-67
  Perl:       5.8.5
  DBI:        1.40
  DBD::mysql: 2.9.004

Latest stable versions as of January 31 2011 are:
  OS:         Red Hat EL 6, kernel 2.6.32
  Perl:       5.12.3
  DBI:        1.616
  DBD::mysql: 4.018

Updating the test to allow error code 11 as well as 9 and 2304 will make the test pass also with the older versions.
[31 Jan 2011 13:15] 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/130042

3568 John H. Embretsen	2011-01-31
      Fix for Bug#59837 - mysqlhotcopy fails with wrong error (11) on specific platforms:
      Test failed on a certain Linux platform in automated environment. It turns out that this platform has an old version of Perl modules DBI and DBD::mysql installed, as well as the OS itself being relatively old.
      Allowing error code 11 to be returned from mysqlhotcopy on expected error seems harmless and will make the test pass also with older libraries.
[4 Feb 2011 18:21] Omer Barnir
triage: setting tag to SR51TEST
[8 Feb 2011 8:07] Horst Hunger
The patch is alright as far as I believe the return code is alright. I have not let the patch run. Ok to push.
[8 Feb 2011 9:51] 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/130682

3582 John H. Embretsen	2011-02-08
      Fix for Bug#59837 - mysqlhotcopy fails with wrong error (11) on specific platforms:
      Test failed on a certain Linux platform in automated environment. It turns out that this platform has an old version of Perl modules DBI and DBD::mysql installed, as well as the OS itself being relatively old.
      Allowing error code 11 to be returned from mysqlhotcopy on expected error seems harmless and will make the test pass also with older libraries.
[8 Feb 2011 9:57] Bugs System
Pushed into mysql-trunk 5.6.2 (revid:john.embretsen@oracle.com-20110208095604-yv40ya1dutsvp39a) (version source revid:john.embretsen@oracle.com-20110208095604-yv40ya1dutsvp39a) (merge vers: 5.6.2) (pib:24)
[8 Feb 2011 9:57] Bugs System
Pushed into mysql-5.5 5.5.10 (revid:john.embretsen@oracle.com-20110208095302-w3tzkmt0si4hsk9c) (version source revid:john.embretsen@oracle.com-20110208095302-w3tzkmt0si4hsk9c) (merge vers: 5.5.10) (pib:24)
[8 Feb 2011 9:58] Bugs System
Pushed into mysql-5.1 5.1.56 (revid:john.embretsen@oracle.com-20110208095109-3znb3mnvq71cadwt) (version source revid:john.embretsen@oracle.com-20110208095109-3znb3mnvq71cadwt) (merge vers: 5.1.56) (pib:24)
[9 Feb 2011 19:24] Paul DuBois
Changes to test suite. No changelog entry needed.