diff options
Diffstat (limited to 'sql/table.h')
-rw-r--r-- | sql/table.h | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/sql/table.h b/sql/table.h index 46015f4425a..390a26662d6 100644 --- a/sql/table.h +++ b/sql/table.h @@ -45,7 +45,6 @@ class ACL_internal_schema_access; class ACL_internal_table_access; struct TABLE_LIST; class Field; -class Deadlock_detection_visitor; /* Used to identify NESTED_JOIN structures within a join (applicable only to @@ -515,13 +514,13 @@ public: such waits in MDL deadlock detector. */ -class Flush_ticket : public Wait_for_edge +class Wait_for_flush : public MDL_wait_for_subgraph { MDL_context *m_ctx; TABLE_SHARE *m_share; uint m_deadlock_weight; public: - Flush_ticket(MDL_context *ctx_arg, TABLE_SHARE *share_arg, + Wait_for_flush(MDL_context *ctx_arg, TABLE_SHARE *share_arg, uint deadlock_weight_arg) : m_ctx(ctx_arg), m_share(share_arg), m_deadlock_weight(deadlock_weight_arg) @@ -529,26 +528,26 @@ public: MDL_context *get_ctx() const { return m_ctx; } - bool find_deadlock(Deadlock_detection_visitor *dvisitor); + virtual bool accept_visitor(MDL_wait_for_graph_visitor *dvisitor); - uint get_deadlock_weight() const; + virtual uint get_deadlock_weight() const; /** Pointers for participating in the list of waiters for table share. */ - Flush_ticket *next_in_share; - Flush_ticket **prev_in_share; + Wait_for_flush *next_in_share; + Wait_for_flush **prev_in_share; }; -typedef I_P_List <Flush_ticket, - I_P_List_adapter<Flush_ticket, - &Flush_ticket::next_in_share, - &Flush_ticket::prev_in_share> > - Flush_ticket_list; +typedef I_P_List <Wait_for_flush, + I_P_List_adapter<Wait_for_flush, + &Wait_for_flush::next_in_share, + &Wait_for_flush::prev_in_share> > + Wait_for_flush_list; -/* +/** This structure is shared between different table objects. There is one instance of table share per one table in the database. */ @@ -669,7 +668,7 @@ struct TABLE_SHARE #ifdef WITH_PARTITION_STORAGE_ENGINE /* filled in when reading from frm */ bool auto_partitioned; - const char *partition_info_str; + char *partition_info_str; uint partition_info_str_len; uint partition_info_buffer_size; handlerton *default_part_db_type; @@ -705,7 +704,7 @@ struct TABLE_SHARE /** List of tickets representing threads waiting for the share to be flushed. */ - Flush_ticket_list m_flush_tickets; + Wait_for_flush_list m_flush_tickets; /* Set share's table cache key and update its db and table name appropriately. @@ -776,10 +775,8 @@ struct TABLE_SHARE } - /* - Must all TABLEs be reopened? - */ - inline bool needs_reopen() const + /** Is this table share being expelled from the table definition cache? */ + inline bool has_old_version() const { return version != refresh_version; } @@ -882,12 +879,13 @@ struct TABLE_SHARE return (tmp_table == SYSTEM_TMP_TABLE || is_view) ? 0 : table_map_id; } - bool find_deadlock(Flush_ticket *waiting_ticket, - Deadlock_detection_visitor *dvisitor); + bool visit_subgraph(Wait_for_flush *waiting_ticket, + MDL_wait_for_graph_visitor *gvisitor); - bool wait_until_flushed(MDL_context *mdl_context, - struct timespec *abstime, - uint deadlock_weight); + bool wait_for_old_version(THD *thd, struct timespec *abstime, + uint deadlock_weight); + /** Release resources and free memory occupied by the table share. */ + void destroy(); }; @@ -1135,9 +1133,7 @@ public: read_set= &def_read_set; write_set= &def_write_set; } - /* - Is this instance of the table should be reopen? - */ + /** Should this instance of the table be reopened? */ inline bool needs_reopen() { return !db_stat || m_needs_reopen; } |