List:Commits« Previous MessageNext Message »
From:Luis Soares Date:November 24 2009 3:00pm
Subject:bzr commit into mysql-5.1-rep+2 branch (luis.soares:3146) Bug#42150
View as plain text  
#At file:///home/lsoares/Workspace/bzr/work/backport/b42150/mysql-5.1-rep%2B2/ based on revid:luis.soares@stripped

 3146 Luis Soares	2009-11-24
      BUG#42150: binlog_start_comment.test failed: Error writing file 'UNOPENED'
      
      NOTE: backporting BUG#42150 into next-mr
            Includes latest Andrei's patch (see [2 Feb 18:40] Bugs System)
            and merge.test post-push fix (see [3 Feb 18:04] Bugs System)
      
      The reason of the bug appeared to be overreacting on absense of a
      binlog file although the file name had been presented in in the master
      binlog index file.
      By convention, there should have been only a warning printed and the rest of
      `reset master' logics completed.  This did not happen on windows
      due to incorrect value of my_errno returned from nt_share_delete().
            
      Fixed with correcting my_errno assignment in nt_share_delete() to be ENOENT in 
      he event of no binlog file. Some minor refactoring has been made.

    modified:
      mysys/my_delete.c
=== modified file 'mysys/my_delete.c'
--- a/mysys/my_delete.c	2007-12-07 20:27:48 +0000
+++ b/mysys/my_delete.c	2009-11-24 15:00:08 +0000
@@ -37,7 +37,7 @@ int my_delete(const char *name, myf MyFl
 } /* my_delete */
 
 #if defined(__WIN__) && defined(__NT__)
-/*
+/**
   Delete file which is possibly not closed.
 
   This function is intended to be used exclusively as a temporal solution
@@ -53,6 +53,20 @@ int my_delete(const char *name, myf MyFl
   renamed to <name>.<num>.deleted where <name> - the initial name of the
   file, <num> - a hexadecimal number chosen to make the temporal name to
   be unique.
+
+  @param the name of the being deleted file
+  @param the flags instructing how to react on an error internally in
+         the function
+
+  @note The per-thread @c my_errno holds additional info for a caller to
+        decide how critical the error can be.
+
+  @retval
+    0	ok
+  @retval
+    1   error
+
+
 */
 int nt_share_delete(const char *name, myf MyFlags)
 {
@@ -63,6 +77,7 @@ int nt_share_delete(const char *name, my
 
   for (cnt= GetTickCount(); cnt; cnt--)
   {
+    errno= 0;
     sprintf(buf, "%s.%08X.deleted", name, cnt);
     if (MoveFile(name, buf))
       break;
@@ -78,15 +93,23 @@ int nt_share_delete(const char *name, my
                            name, buf, errno));
     break;
   }
-
-  if (DeleteFile(buf))
-    DBUG_RETURN(0);
-
-  my_errno= GetLastError();
+  
+  if (errno == ERROR_FILE_NOT_FOUND)
+  {
+       my_errno= ENOENT;    // marking, that `name' doesn't exist 
+  }
+  else if (errno == 0)
+  {
+       if (DeleteFile(buf))
+            DBUG_RETURN(0);
+       else if ((my_errno= GetLastError()) == 0)
+            my_errno= ENOENT; // marking, that `buf' doesn't exist
+  } else
+       my_errno= errno;
+  
   if (MyFlags & (MY_FAE+MY_WME))
-    my_error(EE_DELETE, MYF(ME_BELL + ME_WAITTANG + (MyFlags & ME_NOINPUT)),
-	       name, my_errno);
-
+       my_error(EE_DELETE, MYF(ME_BELL + ME_WAITTANG + (MyFlags & ME_NOINPUT)),
+                name, my_errno);
   DBUG_RETURN(-1);
 }
 #endif


Attachment: [text/bzr-bundle] bzr/luis.soares@sun.com-20091124150008-fogkm9q1621uww69.bundle
Thread
bzr commit into mysql-5.1-rep+2 branch (luis.soares:3146) Bug#42150Luis Soares24 Nov