diff options
author | Konstantin Osipov <kostja@sun.com> | 2010-06-01 14:49:35 +0400 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2010-06-01 14:49:35 +0400 |
commit | 5fa66315e992e9c2743f43e8c583a9e97c0ae085 (patch) | |
tree | e87713fb3141efb187444338b27db64d32e29948 /sql/sql_base.h | |
parent | a96d23a57afffa1c74f79864267a889215be7fef (diff) | |
download | mariadb-git-5fa66315e992e9c2743f43e8c583a9e97c0ae085.tar.gz |
A follow up patch for the fix for Bug#51263 "Deadlock between
transactional SELECT and ALTER TABLE ... REBUILD PARTITION".
Make open flags part of Open_table_context.
This allows to simplify some code and (in future)
enforce the invariant that we don't, say, request a back
off on the table when there is MYSQL_OPEN_IGNORE_FLUSH
flag.
sql/sql_base.cc:
open_table() flags are part of Open_table_context.
Remove dead code that would check for OPEN_VIEW_NO_PARSE,
which is not an open table flag.
sql/sql_base.h:
Move flags to Open_table_context. Reorder Open_table_context
members to compact the structure footprint.
sql/sql_insert.cc:
Update with a new calling signature of open_table().
sql/sql_table.cc:
Update with a new calling signature of open_table().
Diffstat (limited to 'sql/sql_base.h')
-rw-r--r-- | sql/sql_base.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/sql/sql_base.h b/sql/sql_base.h index a0a1ef856a6..f5751094ee0 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -89,7 +89,7 @@ TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name); TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update, uint lock_flags); bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, - Open_table_context *ot_ctx, uint flags); + Open_table_context *ot_ctx); bool name_lock_locked_table(THD *thd, TABLE_LIST *tables); bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list, bool link_in); TABLE *table_cache_insert_placeholder(THD *thd, const char *key, @@ -456,7 +456,7 @@ public: OT_DISCOVER, OT_REPAIR }; - Open_table_context(THD *thd, ulong timeout); + Open_table_context(THD *thd, uint flags); bool recover_from_failed_open(THD *thd); bool request_backoff_action(enum_open_table_action action_arg, @@ -486,11 +486,10 @@ public: return m_timeout; } + uint get_flags() const { return m_flags; } private: /** List of requests for all locks taken so far. Used for waiting on locks. */ MDL_request_list m_mdl_requests; - /** Back off action. */ - enum enum_open_table_action m_action; /** For OT_WAIT_MDL_LOCK action, the request for which we should wait. */ MDL_request *m_failed_mdl_request; /** @@ -501,12 +500,6 @@ private: TABLE_LIST *m_failed_table; MDL_ticket *m_start_of_statement_svp; /** - Whether we had any locks when this context was created. - If we did, they are from the previous statement of a transaction, - and we can't safely do back-off (and release them). - */ - bool m_has_locks; - /** Request object for global intention exclusive lock which is acquired during opening tables for statements which take upgradable shared metadata locks. */ @@ -515,7 +508,17 @@ private: Lock timeout in seconds. Initialized to LONG_TIMEOUT when opening system tables or to the "lock_wait_timeout" system variable for regular tables. */ - uint m_timeout; + ulong m_timeout; + /* open_table() flags. */ + uint m_flags; + /** Back off action. */ + enum enum_open_table_action m_action; + /** + Whether we had any locks when this context was created. + If we did, they are from the previous statement of a transaction, + and we can't safely do back-off (and release them). + */ + bool m_has_locks; }; |