Commit e54643a0 authored by Monty's avatar Monty

Simplify test for updateable TABLE_CATEGORY's

- Re-numbered enum_table_category to make some tests easier
- Moved TABLE_CATEGORY_INFORMATION to be first CATEGORY of virtual tables
- Don't take MDL locks for not updateable table category's
parent f1867505
......@@ -2038,8 +2038,8 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
tc_add_table(thd, table);
}
if (!(flags & MYSQL_OPEN_HAS_MDL_LOCK))
if (!(flags & MYSQL_OPEN_HAS_MDL_LOCK) &&
table->s->table_category < TABLE_CATEGORY_INFORMATION)
{
/*
We are not under LOCK TABLES and going to acquire write-lock/
......
......@@ -1180,10 +1180,8 @@ static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables)
{
for (const TABLE_LIST *table= tables; table; table= table->next_global)
{
TABLE_CATEGORY c;
LEX_CSTRING db= table->db, tn= table->table_name;
c= get_table_category(&db, &tn);
if (c != TABLE_CATEGORY_INFORMATION && c != TABLE_CATEGORY_PERFORMANCE)
if (get_table_category(&db, &tn) < TABLE_CATEGORY_INFORMATION)
return false;
}
return true;
......
......@@ -394,28 +394,6 @@ enum enum_table_category
*/
TABLE_CATEGORY_SYSTEM=3,
/**
Information schema tables.
These tables are an interface provided by the system
to inspect the system metadata.
These tables do *not* honor:
- LOCK TABLE t FOR READ/WRITE
- FLUSH TABLES WITH READ LOCK
- SET GLOBAL READ_ONLY = ON
as there is no point in locking explicitly
an INFORMATION_SCHEMA table.
Nothing is directly written to information schema tables.
Note that this value is not used currently,
since information schema tables are not shared,
but implemented as session specific temporary tables.
*/
/*
TODO: Fixing the performance issues of I_S will lead
to I_S tables in the table cache, which should use
this table type.
*/
TABLE_CATEGORY_INFORMATION=4,
/**
Log tables.
These tables are an interface provided by the system
......@@ -436,7 +414,33 @@ enum enum_table_category
The server implementation perform writes.
Log tables are cached in the table cache.
*/
TABLE_CATEGORY_LOG=5,
TABLE_CATEGORY_LOG=4,
/*
Types below are read only tables, not affected by FLUSH TABLES or
MDL locks.
*/
/**
Information schema tables.
These tables are an interface provided by the system
to inspect the system metadata.
These tables do *not* honor:
- LOCK TABLE t FOR READ/WRITE
- FLUSH TABLES WITH READ LOCK
- SET GLOBAL READ_ONLY = ON
as there is no point in locking explicitly
an INFORMATION_SCHEMA table.
Nothing is directly written to information schema tables.
Note that this value is not used currently,
since information schema tables are not shared,
but implemented as session specific temporary tables.
*/
/*
TODO: Fixing the performance issues of I_S will lead
to I_S tables in the table cache, which should use
this table type.
*/
TABLE_CATEGORY_INFORMATION=5,
/**
Performance schema tables.
......@@ -460,6 +464,7 @@ enum enum_table_category
*/
TABLE_CATEGORY_PERFORMANCE=6
};
typedef enum enum_table_category TABLE_CATEGORY;
TABLE_CATEGORY get_table_category(const LEX_CSTRING *db,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment