3263 Marko Mäkelä 2010-10-20
Fix two errors introduced in the Bug#57232 fix by Sunny Bains
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:
We only make a best effort to remove, there is nothing stopping the data
dictionary from going beyond the specified upper limit.
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:
/*!< List of tables that can't be evicted
from the cache. */
Fields added to dict_table_t:
/*!< TRUE if it's not an InnoDB system table
or a table that has no FK relationships */
/*!< 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. */
/*!< 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. */
/*!< 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.
=== 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(
#endif /* UNIV_DEBUG */
=== modified file 'storage/innobase/row/row0mysql.c'
--- a/storage/innobase/row/row0mysql.c revid:email@example.com
+++ b/storage/innobase/row/row0mysql.c revid:marko.makela@stripped103435-stzwo66g76u1zqfz
@@ -2590,6 +2590,7 @@ row_import_tablespace_for_mysql(
err = DB_ERROR;
+ table = NULL;
Attachment: [text/bzr-bundle] firstname.lastname@example.org
|• bzr push into mysql-trunk-innodb branch (marko.makela:3262 to 3263) Bug#57232||marko.makela||20 Oct|