List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:December 3 2009 7:06pm
Subject:bzr commit into mysql-5.6-next-mr branch (kostja:2985) Bug#39897
View as plain text  
#At file:///opt/local/work/next-4284/ based on revid:kostja@stripped

 2985 Konstantin Osipov	2009-12-03
      Backport of:
      ------------------------------------------------------------
      revno: 3035.4.1
      committer: Davi Arnaut <Davi.Arnaut@stripped>
      branch nick: 39897-6.0
      timestamp: Thu 2009-01-15 12:17:57 -0200
      message:
      Bug#39897: lock_multi fails in pushbuild: timeout waiting for processlist
      
      The problem is that relying on the "Table lock" thread state in
      its current position to detect that a thread is waiting on a lock
      is race prone. The "Table lock" state change happens before the
      thread actually tries to grab a lock on a table.
      
      The solution is to move the "Table lock" state so that its set
      only when a thread is actually going to wait for a lock. The state
      change happens after the thread fails to grab the lock (because it
      is owned by other thread) and proceeds to wait on a condition.
      
      This is considered part of work related to WL#4284 "Transactional
      DDL locking"
     @ mysys/thr_lock.c
        Update thread state while waiting for a table lock.

    modified:
      mysys/thr_lock.c
=== modified file 'mysys/thr_lock.c'
--- a/mysys/thr_lock.c	2009-12-02 23:09:22 +0000
+++ b/mysys/thr_lock.c	2009-12-03 19:06:01 +0000
@@ -396,6 +396,7 @@ wait_for_lock(struct st_lock_list *wait,
   struct timespec wait_timeout;
   enum enum_thr_lock_result result= THR_LOCK_ABORTED;
   my_bool can_deadlock= test(data->owner->info->n_cursors);
+  const char *old_proc_info;
   DBUG_ENTER("wait_for_lock");
 
   /*
@@ -434,6 +435,9 @@ wait_for_lock(struct st_lock_list *wait,
   thread_var->current_cond=  cond;
   data->cond= cond;
 
+  old_proc_info= proc_info_hook(NULL, "Table lock",
+                                __func__, __FILE__, __LINE__);
+
   if (can_deadlock)
     set_timespec(wait_timeout, table_lock_wait_timeout);
   while (!thread_var->abort || in_wait_list)
@@ -504,6 +508,9 @@ wait_for_lock(struct st_lock_list *wait,
   thread_var->current_mutex= 0;
   thread_var->current_cond=  0;
   pthread_mutex_unlock(&thread_var->mutex);
+
+  proc_info_hook(NULL, old_proc_info, __func__, __FILE__, __LINE__);
+
   DBUG_RETURN(result);
 }
 


Attachment: [text/bzr-bundle] bzr/kostja@sun.com-20091203190601-xe9gkxbcgkzf2vds.bundle
Thread
bzr commit into mysql-5.6-next-mr branch (kostja:2985) Bug#39897Konstantin Osipov3 Dec