List:Commits« Previous MessageNext Message »
From:John H. Embretsen Date:June 4 2009 8:50am
Subject:bzr push into mysql-6.0-falcon-team branch (john.embretsen:2718 to 2719)
View as plain text  
 2719 John H. Embretsen	2009-06-04 [merge]
      Merge mysql-6.0-falcon --> mysql-6.0-falcon-team.
      Includes fix for MTR/Pushbuild/Windows bug (44775).

    modified:
      libservices/thd_alloc_service.c
      mysql-test/lib/My/SafeProcess/safe_process_win.cc
 2718 Kevin Lewis	2009-06-03
      Bug#44911 - More follow-on changes.  
      This assures that there will not be a infinite loop in the case where a lock record is returned from Table::fetch and the transaction becomes CommittedVisible soon after.  This should only occur once.  The next time, it has to be a different lock record.  If the same record is read again, something is fataly wrong.  It happened once while I was making some changes for 43344 because of a mistake. So instead of looping infinitely reading the same record, this patch will issue a fatal error.

    modified:
      storage/falcon/Table.cpp
=== modified file 'libservices/thd_alloc_service.c'
--- a/libservices/thd_alloc_service.c	2009-05-06 18:17:49 +0000
+++ b/libservices/thd_alloc_service.c	2009-05-29 19:05:24 +0000
@@ -14,4 +14,4 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
 #include <service_versions.h>
-SERVICE_VERSION thd_alloc_servicee= (void*)VERSION_thd_alloc;
+SERVICE_VERSION thd_alloc_service= (void*)VERSION_thd_alloc;

=== modified file 'mysql-test/lib/My/SafeProcess/safe_process_win.cc'
--- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc	2009-02-09 18:24:48 +0000
+++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc	2009-05-14 19:56:53 +0000
@@ -259,22 +259,37 @@ int main(int argc, const char** argv )
     the JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE flag, making sure it will be
     terminated when the last handle to it is closed(which is owned by
     this process).
+
+    If breakaway from job fails on some reason, fallback is to create a
+    new process group. Process groups also allow to kill process and its 
+    descedants, subject to some restrictions (processes have to run within
+    the same console,and must not ignore CTRL_BREAK)
   */
-  if (CreateProcess(NULL, (LPSTR)child_args,
+  DWORD create_flags[]= {CREATE_BREAKAWAY_FROM_JOB, CREATE_NEW_PROCESS_GROUP, 0};
+  BOOL process_created= FALSE;
+  BOOL jobobject_assigned= FALSE;
+
+  for (int i=0; i < sizeof(create_flags)/sizeof(create_flags[0]); i++)
+  { 
+    process_created= CreateProcess(NULL, (LPSTR)child_args,
                     NULL,
                     NULL,
                     TRUE, /* inherit handles */
-                    CREATE_SUSPENDED | CREATE_BREAKAWAY_FROM_JOB,
+                    CREATE_SUSPENDED | create_flags[i],
                     NULL,
                     NULL,
                     &si,
-                    &process_info) == 0)
-    die("CreateProcess failed");
+                    &process_info);
+    if (process_created)
+    {
+     jobobject_assigned= AssignProcessToJobObject(job_handle, process_info.hProcess);
+     break;
+    }
+  }
 
-  if (AssignProcessToJobObject(job_handle, process_info.hProcess) == 0)
+  if (!process_created)
   {
-    TerminateProcess(process_info.hProcess, 200);
-    die("AssignProcessToJobObject failed");
+    die("CreateProcess failed");
   }
   ResumeThread(process_info.hThread);
   CloseHandle(process_info.hThread);
@@ -312,6 +327,13 @@ int main(int argc, const char** argv )
     message("TerminateJobObject failed");
   CloseHandle(job_handle);
   message("Job terminated and closed");
+
+  if (!jobobject_assigned)
+  {
+    GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, process_info.dwProcessId);
+    TerminateProcess(process_info.hProcess, 202);
+  }
+
   if (wait_res != WAIT_OBJECT_0 + CHILD)
   {
     /* The child has not yet returned, wait for it */


Attachment: [text/bzr-bundle] bzr/john.embretsen@sun.com-20090604081853-i2exm54f0qv5kew2.bundle
Thread
bzr push into mysql-6.0-falcon-team branch (john.embretsen:2718 to 2719) John H. Embretsen4 Jun