List:Commits« Previous MessageNext Message »
From:marko.makela Date:October 20 2010 10:35am
Subject:bzr push into mysql-trunk-innodb branch (marko.makela:3262 to 3263) Bug#57232
View as plain text  
 3263 Marko Mäkelä	2010-10-20
      Fix two errors introduced in the Bug#57232 fix by Sunny Bains
      revno: 3262
      revision-id: sunny.bains@stripped444-drizi19jxee2kdkp

    modified:
      storage/innobase/lock/lock0lock.c
      storage/innobase/row/row0mysql.c
 3262 Sunny Bains	2010-10-20
      For tables that have a reference count of zero, are not referenced by any
      foreign key and don't refer to any table (FK) are removed from the dictionary
      cache if it reaches an upper bound.  The count is controlled by the parameter:
      
      	--table-cache-size
      
      We only make a best effort to remove, there is nothing stopping the data
      dictionary from going beyond the specified upper limit.
      
      Added functions:
      ================
      dict_check_sys_foreign_tables_exist(void)
      dict_index_remove_from_cache_low()
      dict_table_remove_from_cache_low()
      dict_lru_validate()
      dict_lru_find_table()
      dict_non_lru_find_table()
      dict_move_to_mru()
      dict_table_open_on_name_low()
      dict_table_open_on_name_no_stats()
      dict_table_can_be_evicted()
      dict_make_room_in_cache()
      dict_table_move_from_lru_to_non_lru()
      dict_table_move_from_non_lru_to_lru()
      dict_table_remove_from_cache_low()
      dict_index_remove_from_cache_low()
      dict_lru_validate()
      dict_lru_find_table()
      dict_non_lru_find_table()
      innobase_add_index_cleanup()
      lock_table_has_locks()
      
      Rename  dict_table_decrement_handle_count() to dict_table_close()
      Rename dict_table_get_on_id() to  dict_table_open_on_id()
      Rename dict_table_get() to dict_table_open_on_name()
      
      Fields added to dict_sys_t:
      
         UT_LIST_BASE_NODE_T(dict_table_t)     table_non_LRU
                                     /*!< List of tables that can't be evicted
      			       from the cache. */
      
      Fields added to dict_table_t:
             unsigned        can_be_evicted:1;
                                     /*!< TRUE if it's not an InnoDB system table
                                     or a table that has no FK relationships */
      
             ulint           n_rec_locks;
                                     /*!< Count of the number of record locks on
                                     this table. We use this to determine whether
                                     we can evict the table from the dictionary
                                     cache. It is protected by the lock mutex. */
      
             ulint           n_ref_count;
                                     /*!< count of how many handles are opened
                                     to this table; dropping of the table is
                                     NOT allowed until this count gets to zero;
                                     MySQL does NOT itself check the number of
                                     open handles at drop */
      
      Added following enumerations to sym_tab_entry.
      
             SYM_UNSET,       	/*!< Unset entry. */
             SYM_TABLE_REF_COUNTED,  
                                      /*!< database table name, ref counted. Must
                                     be closed explicitly. */
      
      --table-cache-size is a global parameter that can be changed at runtime. We do
      a dirty read of this parameter before trying to evict tables from the table
      cache every 60 seconds when the server is busy. We scan only 50% of the table
      LRU list when the server is active and 100% of the list when it is idle.
      
      With this change all InnoDB tables should be opened using the public interface
      of dict0dict.c and not the low-level equivalent functions, this applies to
      internal InnoDB calls too. I've made the low level variants static and private
      to the dict/ source files. The tables must be closed after use. We use this to
      reference count all opens including open requests from MySQL layer. Previously
      we only reference counted open requests from the MySQL layer. Several changes
      were made to existing code to conform to the new behavior. The changes are too
      numerous to list individually.
      
      When opening or closing a table the only important requirement is whether the
      caller has the dict_sys_t::mutex locked or not. This state is passed to the
      open/close functions using a flag. Which is set to TRUE if the caller has
      locked the dict mutex or FALSE if it is not locked.
      
      The internal SQL parser has been updated to use the new interfaces too. A new
      symbol type is introduced for reference counted tables. In fact we don't open
      the table multiple times as we did in the past.
      
      The master thread will attempt to keep the dictionary table cache within
      limits periodically. Because this check can be expensive we limit it to once
      every 60 seconds and scan only 50% of the LRU list when the server is active
      and 100% when the server is idle.
      
      Before a table is dropped we move it from the LRU list to the non-LRU list
      this is to ensure that the table is not asynchronously evicted from the cache.
      
      Added several debug assertions that check whether a table has any kind of lock
      on the table. There was a bug in existing code that resulted in a table being
      dropped while it had record locks on the table. The record locks were implicit
      locks of recovered transactions that had been converted to explicit locks.
      
      See bug http://bugs.mysql.com/bug.php?id=57232
      
      rb://379, Approved by: Jimmy Yang and Marko Makela.

    added:
      storage/innobase/include/dict0priv.h
      storage/innobase/include/dict0priv.ic
    modified:
      storage/innobase/Makefile.am
      storage/innobase/dict/dict0boot.c
      storage/innobase/dict/dict0crea.c
      storage/innobase/dict/dict0dict.c
      storage/innobase/dict/dict0load.c
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/handler0alter.cc
      storage/innobase/ibuf/ibuf0ibuf.c
      storage/innobase/include/dict0dict.h
      storage/innobase/include/dict0dict.ic
      storage/innobase/include/dict0mem.h
      storage/innobase/include/ha_prototypes.h
      storage/innobase/include/lock0lock.h
      storage/innobase/include/pars0sym.h
      storage/innobase/lock/lock0lock.c
      storage/innobase/pars/pars0pars.c
      storage/innobase/pars/pars0sym.c
      storage/innobase/row/row0ins.c
      storage/innobase/row/row0merge.c
      storage/innobase/row/row0mysql.c
      storage/innobase/row/row0purge.c
      storage/innobase/row/row0sel.c
      storage/innobase/row/row0uins.c
      storage/innobase/row/row0umod.c
      storage/innobase/row/row0upd.c
      storage/innobase/srv/srv0srv.c
      storage/innobase/trx/trx0roll.c
=== modified file 'storage/innobase/lock/lock0lock.c'
--- a/storage/innobase/lock/lock0lock.c	revid:sunny.bains@strippedee2kdkp
+++ b/storage/innobase/lock/lock0lock.c	revid:marko.makela@stripped
@@ -5822,6 +5822,6 @@ lock_table_has_locks(
 		}
 	}
 
-	return(lock);
+	return(NULL);
 }
 #endif /* UNIV_DEBUG */

=== modified file 'storage/innobase/row/row0mysql.c'
--- a/storage/innobase/row/row0mysql.c	revid:sunny.bains@oracle.com-20101020085444-drizi19jxee2kdkp
+++ b/storage/innobase/row/row0mysql.c	revid:marko.makela@stripped103435-stzwo66g76u1zqfz
@@ -2590,6 +2590,7 @@ row_import_tablespace_for_mysql(
 		err = DB_ERROR;
 
 		row_mysql_lock_data_dictionary(trx);
+		table = NULL;
 
 		goto funct_exit;
 	}

Attachment: [text/bzr-bundle] bzr/marko.makela@oracle.com-20101020103435-stzwo66g76u1zqfz.bundle
Thread
bzr push into mysql-trunk-innodb branch (marko.makela:3262 to 3263) Bug#57232marko.makela20 Oct