Bug #57914 invalid sleep values results in different error messages in windows and linux
Submitted: 2 Nov 2010 6:57 Modified: 2 Dec 2010 0:09
Reporter: Satya B Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Enterprise Backup Severity:S3 (Non-critical)
Version:3.5.2 OS:Any
Assigned to: Satya B CPU Architecture:Any
Tags: innobackup, MEB 3.5.2, mysqlbackup

[2 Nov 2010 6:57] Satya B
Description:
When mysqlbackup is invoked with invalid sleep value, it produces
different error messages on windows and linux.

On linux machines: ibbackup process has died      
On windows machines: mysqlbackup "backup" failed    

How to repeat:
On windows machine, run meb.innobackup_logs_field.test in meb suite in mysql-5.1-meb branch. 

Suggested fix:
Should display a common error message on windows and linux.
[8 Nov 2010 10:56] Satya B
Suggested patch is:

=== modified file 'meb-innobackup-c/src/innobackup.c'
--- meb-innobackup-c/src/innobackup.c   2010-10-19 11:45:13 +0000
+++ meb-innobackup-c/src/innobackup.c   2010-11-03 10:27:48 +0000
@@ -3311,6 +3311,7 @@
     {
       /* Process state has been changed */
     case WAIT_OBJECT_0:
+      print_message(NO_TIMESTAMP, ERROR, "ibbackup process has died");
       goto err20;
      /* Wait Failed */
     case WAIT_FAILED:

After applying the suggested patch, innobackup_logs_field will now fail in windows due to a difference in error code.

 SELECT exit_state, last_error, last_error_code FROM mysql.backup_history;
 exit_state     last_error      last_error_code
-FAILURE        ibbackup process has died       2
+FAILURE        ibbackup process has died       13

The last_error_code is generated by errno. 

#define	ENOENT		 2	/* No such file or directory */
#define	EACCES		13	/* Permission denied */

The errno is 2 in linux and 13 in windows. The errno 2 value may not be correct as the mysqlbackup process dies because the child process (ibbackup) cannot execute ( due to an invalid sleep value). 

On the other hand, 13 looks appropriate as child wasn't executed properly.

I wonder how errno is mapped in windows as errno is in UNIX specification only and value of 13 in windows is surprising.

Using windows specific api, GetLastError() gives 0. This may be because of the fact the error was thrown by child and not by the parent mysqlbackup process.

Q:
==
1. This field is only for informational purpose. So it is Okay to Mask this in testcase.

2. Windows specific api GetLastError() returns 0 which is worse than what errno displays. 

3. Any other solutions to this?
[11 Nov 2010 15:39] Ingo Strüwing
Approved. No comments. Test case fix (suppression of error number) required.
[18 Nov 2010 6:21] Satya B
branch: meb-3.5.next
revno: 252
revision-id: satya.bn@sun.com-20101109073201-a1lj8j1vbu8b0593