List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:January 20 2010 11:19am
Subject:bzr commit into mysql-5.6-next-mr branch (kostja:3059) Bug#38924
Bug#46272
View as plain text  
#At file:///opt/local/work/next-4284-stage/ based on revid:kostja@stripped

 3059 Konstantin Osipov	2010-01-20
      Bug#46272/Bug#38924 review fixes in progress.
      Misc fixes.

    modified:
      sql/mdl.cc
      sql/mdl.h
=== modified file 'sql/mdl.cc'
--- a/sql/mdl.cc	2010-01-20 10:17:29 +0000
+++ b/sql/mdl.cc	2010-01-20 11:19:31 +0000
@@ -78,11 +78,10 @@ public:
     return has_locks;
   }
   virtual bool can_grant_lock(const MDL_context *requestor_ctx,
-                              enum_mdl_type type, bool is_upgrade) = 0;
-  virtual void wake_up_waiters() = 0;
+                              enum_mdl_type type, bool is_upgrade)= 0;
+  virtual void wake_up_waiters()= 0;
 
   inline static MDL_lock *create(const MDL_key *key);
-  inline static void destroy(MDL_lock *lock);
 
   static MDL_lock *find(const MDL_key *key);
   static MDL_lock *find_or_insert(const MDL_key *key);
@@ -130,6 +129,7 @@ private:
   bool m_is_destroyed;
 
 private:
+  inline static void destroy(MDL_lock *lock);
   static bool move_from_hash_to_lock_mutex(MDL_lock *lock);
 };
 
@@ -417,9 +417,8 @@ bool MDL_lock::move_from_hash_to_lock_mu
       other since the object is removed from the hash so no one will
       be able to find it and increment m_ref_usage anymore.
     */
-    uint ref_usage, ref_release;
-    ref_usage= lock->m_ref_usage;
-    ref_release= lock->m_ref_release;
+    uint ref_usage= lock->m_ref_usage;
+    uint ref_release= lock->m_ref_release;
     pthread_mutex_unlock(&lock->m_mutex);
     if (ref_usage == ref_release)
       MDL_lock::destroy(lock);
@@ -693,29 +692,32 @@ MDL_global_lock::can_grant_lock(const MD
 
 
 /**
-  Wake up contexts which are waiting to acquire global metadata and
-  which may succeed now, when we released global lock or removed request
-  for global shared lock from waiters list (the latter can happen when
-  context trying to acquire global shared lock is killed).
+  Wake up contexts which are waiting to acquire the global
+  metadata lock and which may succeed now, when we released it, or
+  removed a blocking request for it from the waiters list.
+  The latter can happen when the context trying to acquire the
+  global shared lock is killed.
 */
 
 void MDL_global_lock::wake_up_waiters()
 {
   /*
-    There are no active locks or they are of INTENION EXCLUSIVE type.
-    Wake up contexts waiting for INTENTION EXCLUSIVE lock if there
-    are no pending requests for global SHARED lock.
-    (Happens when we release global SHARED lock or abort wait for
-     global SHARED lock).
+    If there are no active locks or they are of INTENTION
+    EXCLUSIVE type and there are no pending requests for global
+    SHARED lock, wake up contexts waiting for an INTENTION
+    EXCLUSIVE lock.
+    This happens when we release the global SHARED lock or abort
+    or remove a pending request for it, i.e. abort the
+    context waiting for it.
   */
   if ((granted.is_empty() ||
        granted.front()->m_type == MDL_INTENTION_EXCLUSIVE) &&
       waiting_shared.is_empty() && ! waiting_exclusive.is_empty())
   {
     MDL_lock::Ticket_iterator it(waiting_exclusive);
-    MDL_ticket *wake_up_ticket;
-    while ((wake_up_ticket= it++))
-      wake_up_ticket->get_ctx()->wake_up();
+    MDL_ticket *awake_ticket;
+    while ((awake_ticket= it++))
+      awake_ticket->get_ctx()->awake();
   }
 
   /*
@@ -732,9 +734,9 @@ void MDL_global_lock::wake_up_waiters()
       ! waiting_shared.is_empty())
   {
     MDL_lock::Ticket_iterator it(waiting_shared);
-    MDL_ticket *wake_up_ticket;
-    while ((wake_up_ticket= it++))
-      wake_up_ticket->get_ctx()->wake_up();
+    MDL_ticket *awake_ticket;
+    while ((awake_ticket= it++))
+      awake_ticket->get_ctx()->awake();
   }
 }
 
@@ -864,7 +866,7 @@ void MDL_object_lock::wake_up_waiters()
     MDL_lock::Ticket_iterator it(waiting_shared);
     MDL_ticket *waiting_ticket;
     while ((waiting_ticket= it++))
-      waiting_ticket->get_ctx()->wake_up();
+      waiting_ticket->get_ctx()->awake();
   }
 
   /*
@@ -876,7 +878,7 @@ void MDL_object_lock::wake_up_waiters()
     MDL_lock::Ticket_iterator it(waiting_exclusive);
     MDL_ticket *waiting_ticket;
     while ((waiting_ticket= it++))
-      waiting_ticket->get_ctx()->wake_up();
+      waiting_ticket->get_ctx()->awake();
   }
 }
 
@@ -1276,9 +1278,9 @@ void notify_shared_lock(THD *thd, MDL_ti
 
     /*
       If the thread that holds the conflicting lock is waiting in MDL
-      subsystem it has to be woken up by calling MDL_context::wake_up().
+      subsystem it has to be woken up by calling MDL_context::awake().
     */
-    conflicting_ticket->get_ctx()->wake_up();
+    conflicting_ticket->get_ctx()->awake();
     /*
       If it is waiting on table-level lock or some other non-MDL resource
       we delegate its waking up to code outside of MDL.
@@ -2078,7 +2080,7 @@ void MDL_ticket::downgrade_exclusive_loc
     MDL_lock::Ticket_iterator it(m_lock->waiting_shared);
     MDL_ticket *ticket;
     while ((ticket= it++))
-      ticket->get_ctx()->wake_up();
+      ticket->get_ctx()->awake();
   }
 
   pthread_mutex_unlock(&m_lock->m_mutex);

=== modified file 'sql/mdl.h'
--- a/sql/mdl.h	2010-01-20 10:40:14 +0000
+++ b/sql/mdl.h	2010-01-20 11:19:31 +0000
@@ -316,7 +316,6 @@ private:
      m_lock(NULL)
   {}
 
-
   static MDL_ticket *create(MDL_context *ctx_arg, enum_mdl_type type_arg);
   static void destroy(MDL_ticket *ticket);
 private:
@@ -420,7 +419,7 @@ public:
   /**
     Wake up context which is waiting for a change of MDL_lock state.
   */
-  void wake_up()
+  void awake()
   {
     pthread_cond_signal(&m_ctx_wakeup_cond);
   }


Attachment: [text/bzr-bundle] bzr/kostja@sun.com-20100120111931-238jn783ce4b3v83.bundle
Thread
bzr commit into mysql-5.6-next-mr branch (kostja:3059) Bug#38924Bug#46272Konstantin Osipov20 Jan