A pre-requisite patch for WL#5419 "LOCK_open scalability:
make tdc_refresh_version an atomic counter". To avoid orphaned TABLE_SHARE objects left in the cache, make sure that wherever we set table->s->version we take care of removing all unused table share objects from the table cache. Always set table->s->version under LOCK_open, to make sure that no other connection sees an old value of the version and adds the table to unused_tables list. Add an assert to table_def_unuse_table() that we never 'unuse' a talbe of a share that has an old version. With this patch, only three places are left in the code that manipulate with table->s->version: - tdc_remove_table(). In most cases we have an X mdl lock in tdc_remove_table(), the two remaining cases when we don't are 'FLUSH TABLE' and mysql_admin_table(). - sql_view.cc - a crude hack that needs a separate fix - initial assignment from refresh_version in table.cc.
Showing
Please register or sign in to comment