diff options
author | Monty <monty@mariadb.org> | 2018-11-13 01:02:53 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-12-08 17:26:26 +0200 |
commit | 826c61dc5a0035bcaf3f6e1d633d7629a1319613 (patch) | |
tree | 484eedbba70ed5edd0fde48eafdf87542750752c | |
parent | e87453088f1fbd6e31512d15782ff0394b2479a5 (diff) | |
download | mariadb-git-826c61dc5a0035bcaf3f6e1d633d7629a1319613.tar.gz |
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
-rw-r--r-- | sql/sql_base.cc | 4 | ||||
-rw-r--r-- | sql/sql_parse.cc | 4 | ||||
-rw-r--r-- | sql/table.h | 51 |
3 files changed, 31 insertions, 28 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 17d6320be95..5c0b9f6a5a5 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2037,8 +2037,8 @@ retry_share: 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/ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 310fbf7a8a7..5c612e36d8a 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -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; diff --git a/sql/table.h b/sql/table.h index 2b3fe1c20d4..38129ef98f8 100644 --- a/sql/table.h +++ b/sql/table.h @@ -395,28 +395,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 to inspect the system logs. @@ -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, |