• Konstantin Osipov's avatar
    Backport of: · b70c389f
    Konstantin Osipov authored
    ------------------------------------------------------------
    revno: 2630.4.32
    committer: Dmitry Lenev <dlenev@mysql.com>
    branch nick: mysql-6.0-3726-w2
    timestamp: Thu 2008-06-19 16:39:58 +0400
    message:
      WL#3726 "DDL locking for all metadata objects".
    
      After-review fixes in progress.
    
      Ensure that metadata locking subsystem properly handles
      out-of-memory conditions. Clarified MDL interface by
      separating release of locks and removal of lock requests
      from the context.
    
    sql/lock.cc:
      mdl_release_lock(), mdl_acquire_exclusive_locks() and 
      mdl_try_acquire_exclusive_lock() are no longer responsible
      for removal of metadata lock requests from the context.
      One should explicitly call mdl_remove_all_locks() and
      mdl_remove_lock() to do this.
    sql/mdl.cc:
      Ensured that metadata locking subsystem properly handles
      out-of-memory conditions.
      Introduced new MDL_INITIALIZED state for metadata lock
      request which is used in all cases when lock is not acquired 
      and we have not associated request with object respesenting 
      lock.
      
      MDL_PENDING is now only used for requests for exclusive locks
      which are added to the MDL_LOCK::waiting_exclusive queue.
      mdl_release_lock(), mdl_acquire_exclusive_locks() and 
      mdl_try_acquire_exclusive_lock() are no longer responsible
      for removal of metadata lock requests from the context.
      One should explicitly call mdl_remove_all_locks() and
      newly introduced mdl_remove_lock() to do this.
      Also renamed mdl_release_all_locks_for_name() to 
      emphasize that it also actually removes lock requests
      from the context.
      
      Finally mdl_try_acquire_exclusive_lock() is now returs
      information about encountered lock conflict in separate
      out parameter since its return value is used for distinguishing
      between error (e.g. due to OOM) and success.
    sql/mdl.h:
      Introduced new MDL_INITIALIZED state for metadata lock
      request which is used in all cases when lock is not acquired 
      and we have not associated request with object respesenting 
      lock.
      
      MDL_PENDING is now only used for requests for exclusive locks
      which are added to the MDL_LOCK::waiting_exclusive queue.
      mdl_release_lock(), mdl_acquire_exclusive_locks() and 
      mdl_try_acquire_exclusive_lock() are no longer responsible
      for removal of metadata lock requests from the context.
      One should explicitly call mdl_remove_all_locks() and
      newly introduced mdl_remove_lock() to do this.
      Also renamed mdl_release_all_locks_for_name() to 
      emphasize that it also actually removes lock requests
      from the context.
      
      Finally mdl_try_acquire_exclusive_lock() is now returs
      information about encountered lock conflict in separate
      out parameter since its return value is used for distinguishing
      between error (e.g. due to OOM) and success.
    sql/sql_base.cc:
      mdl_release_lock(), mdl_acquire_exclusive_locks() and mdl_try_acquire_exclusive_lock() are no longer responsible
      for removal of metadata lock requests from the context.
      One should explicitly call mdl_remove_all_locks() and
      mdl_remove_lock() to do this.
      Also adjusted open_table() to ensure that it 
      releases/removes metadata locks in case of error 
      after adding/acquiring them (unless keeping these
      lock requests is required for recovering action).
    sql/sql_delete.cc:
      mdl_release_lock(), mdl_acquire_exclusive_locks() and mdl_try_acquire_exclusive_lock() are no longer responsible
      for removal of metadata lock requests from the context.
      One should explicitly call mdl_remove_all_locks() and
      mdl_remove_lock() to do this.
    sql/sql_handler.cc:
      mdl_release_lock(), mdl_acquire_exclusive_locks() and mdl_try_acquire_exclusive_lock() are no longer responsible
      for removal of metadata lock requests from the context.
      One should explicitly call mdl_remove_all_locks() and
      mdl_remove_lock() to do this.
    sql/sql_show.cc:
      mdl_release_lock(), mdl_acquire_exclusive_locks() and mdl_try_acquire_exclusive_lock() are no longer responsible
      for removal of metadata lock requests from the context.
      One should explicitly call mdl_remove_all_locks() and
      mdl_remove_lock() to do this.
    sql/sql_table.cc:
      Renamed mdl_release_all_locks_for_name() to emphasize
      that it also actually removes lock requests from the context.
      mdl_release_lock(), mdl_acquire_exclusive_locks() and mdl_try_acquire_exclusive_lock() are no longer responsible
      for removal of metadata lock requests from the context.
      One should explicitly call mdl_remove_all_locks() and
      mdl_remove_lock() to do this.
      Finally mdl_try_acquire_exclusive_lock() is now returs
      information about encountered lock conflict in separate
      out parameter since its return value is used for distinguishing
      between error (e.g. due to OOM) and success.
    b70c389f
mdl.h 7.25 KB