diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 5443394ffdd..ada0e8b1773 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -5251,17 +5251,6 @@ ha_innobase::index_type( } } -/****************************************************************//** -Returns the table file name extension. -@return file extension string */ - -const char** -ha_innobase::bas_ext() const -/*========================*/ -{ - return(ha_innobase_exts); -} - /****************************************************************//** Returns the operations supported for indexes. @return flags of supported operations */ @@ -15071,144 +15060,6 @@ struct tablename_compare { } }; -/** Get the table name and database name for the given table. -@param[in,out] thd user thread handle -@param[out] f_key_info pointer to table_name_info object -@param[in] foreign foreign key constraint. */ -static -void -get_table_name_info( - THD* thd, - st_handler_tablename* f_key_info, - const dict_foreign_t* foreign) -{ -#define FILENAME_CHARSET_MBMAXLEN 5 - char tmp_buff[NAME_CHAR_LEN * FILENAME_CHARSET_MBMAXLEN + 1]; - char name_buff[NAME_CHAR_LEN * FILENAME_CHARSET_MBMAXLEN + 1]; - const char* ptr; - - size_t len = dict_get_db_name_len( - foreign->referenced_table_name_lookup); - ut_memcpy(tmp_buff, foreign->referenced_table_name_lookup, len); - tmp_buff[len] = 0; - - ut_ad(len < sizeof(tmp_buff)); - - len = filename_to_tablename(tmp_buff, name_buff, sizeof(name_buff)); - f_key_info->db = thd_strmake(thd, name_buff, len); - - ptr = dict_remove_db_name(foreign->referenced_table_name_lookup); - len = filename_to_tablename(ptr, name_buff, sizeof(name_buff)); - f_key_info->tablename = thd_strmake(thd, name_buff, len); -} - -/** Get the list of tables ordered by the dependency on the other tables using -the 'CASCADE' foreign key constraint. -@param[in,out] thd user thread handle -@param[out] fk_table_list set of tables name info for the - dependent table -@retval 0 for success. */ -int -ha_innobase::get_cascade_foreign_key_table_list( - THD* thd, - List* fk_table_list) -{ - m_prebuilt->trx->op_info = "getting cascading foreign keys"; - - std::forward_list > - table_list; - - typedef std::set > cascade_fk_set; - - cascade_fk_set fk_set; - - mutex_enter(&dict_sys.mutex); - - /* Initialize the table_list with prebuilt->table name. */ - struct table_list_item item = {m_prebuilt->table, - m_prebuilt->table->name.m_name}; - - table_list.push_front(item); - - /* Get the parent table, grand parent table info from the - table list by depth-first traversal. */ - do { - const dict_table_t* parent_table; - dict_table_t* parent = NULL; - std::pair ret; - - item = table_list.front(); - table_list.pop_front(); - parent_table = item.table; - - if (parent_table == NULL) { - - ut_ad(item.name != NULL); - - parent_table = parent = dict_table_open_on_name( - item.name, TRUE, FALSE, - DICT_ERR_IGNORE_NONE); - - if (parent_table == NULL) { - /* foreign_key_checks is or was probably - disabled; ignore the constraint */ - continue; - } - } - - for (dict_foreign_set::const_iterator it = - parent_table->foreign_set.begin(); - it != parent_table->foreign_set.end(); ++it) { - - const dict_foreign_t* foreign = *it; - st_handler_tablename f1; - - /* Skip the table if there is no - cascading operation. */ - if (0 == (foreign->type - & ~(DICT_FOREIGN_ON_DELETE_NO_ACTION - | DICT_FOREIGN_ON_UPDATE_NO_ACTION))) { - continue; - } - - if (foreign->referenced_table_name_lookup != NULL) { - get_table_name_info(thd, &f1, foreign); - ret = fk_set.insert(f1); - - /* Ignore the table if it is already - in the set. */ - if (!ret.second) { - continue; - } - - struct table_list_item item1 = { - foreign->referenced_table, - foreign->referenced_table_name_lookup}; - - table_list.push_front(item1); - - st_handler_tablename* fk_table = - (st_handler_tablename*) thd_memdup( - thd, &f1, sizeof(*fk_table)); - - fk_table_list->push_front(fk_table); - } - } - - if (parent != NULL) { - dict_table_close(parent, true, false); - } - - } while(!table_list.empty()); - - mutex_exit(&dict_sys.mutex); - - m_prebuilt->trx->op_info = ""; - - return(0); -} - /*****************************************************************//** Checks if ALTER TABLE may change the storage engine of the table. Changing storage engines is not allowed for tables for which there @@ -15352,12 +15203,9 @@ ha_innobase::extra( } /** -MySQL calls this method at the end of each statement. This method -exists for readability only. ha_innobase::reset() doesn't give any -clue about the method. */ - +MySQL calls this method at the end of each statement */ int -ha_innobase::end_stmt() +ha_innobase::reset() { if (m_prebuilt->blob_heap) { row_mysql_prebuilt_free_blob_heap(m_prebuilt); @@ -15376,15 +15224,6 @@ ha_innobase::end_stmt() return(0); } -/** -MySQL calls this method at the end of each statement */ - -int -ha_innobase::reset() -{ - return(end_stmt()); -} - /******************************************************************//** MySQL calls this function at the start of each SQL statement inside LOCK TABLES. Inside LOCK TABLES the ::external_lock method does not work to diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 60c560f9bc7..cffd1683a67 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -58,35 +58,33 @@ struct st_handler_tablename const char *tablename; }; /** The class defining a handle to an Innodb table */ -class ha_innobase: public handler +class ha_innobase final: public handler { public: ha_innobase(handlerton* hton, TABLE_SHARE* table_arg); - ~ha_innobase(); + ~ha_innobase() override; /** Get the row type from the storage engine. If this method returns ROW_TYPE_NOT_USED, the information in HA_CREATE_INFO should be used. */ - enum row_type get_row_type() const; + enum row_type get_row_type() const override; - const char* table_type() const; + const char* table_type() const; - const char* index_type(uint key_number); + const char* index_type(uint key_number) override; - const char** bas_ext() const; + Table_flags table_flags() const override; - Table_flags table_flags() const; + ulong index_flags(uint idx, uint part, bool all_parts) const override; - ulong index_flags(uint idx, uint part, bool all_parts) const; + uint max_supported_keys() const override; - uint max_supported_keys() const; + uint max_supported_key_length() const override; - uint max_supported_key_length() const; + uint max_supported_key_part_length() const override; - uint max_supported_key_part_length() const; + const key_map* keys_to_use_for_scanning() override; - const key_map* keys_to_use_for_scanning(); - - void column_bitmaps_signal(); + void column_bitmaps_signal() override; /** Opens dictionary table object using table name. For partition, we need to try alternative lower/upper case names to support moving data files across @@ -102,97 +100,97 @@ public: bool is_partition, dict_err_ignore_t ignore_err); - int open(const char *name, int mode, uint test_if_locked); + int open(const char *name, int mode, uint test_if_locked) override; - handler* clone(const char *name, MEM_ROOT *mem_root); + handler* clone(const char *name, MEM_ROOT *mem_root) override; - int close(void); + int close(void) override; - double scan_time(); + double scan_time() override; - double read_time(uint index, uint ranges, ha_rows rows); + double read_time(uint index, uint ranges, ha_rows rows) override; - int delete_all_rows(); + int delete_all_rows() override; - int write_row(uchar * buf); + int write_row(uchar * buf) override; - int update_row(const uchar * old_data, const uchar * new_data); + int update_row(const uchar * old_data, const uchar * new_data) override; - int delete_row(const uchar * buf); + int delete_row(const uchar * buf) override; - bool was_semi_consistent_read(); + bool was_semi_consistent_read() override; - void try_semi_consistent_read(bool yes); + void try_semi_consistent_read(bool yes) override; - void unlock_row(); + void unlock_row() override; - int index_init(uint index, bool sorted); + int index_init(uint index, bool sorted) override; - int index_end(); + int index_end() override; int index_read( uchar* buf, const uchar* key, uint key_len, - ha_rkey_function find_flag); + ha_rkey_function find_flag) override; - int index_read_last(uchar * buf, const uchar * key, uint key_len); + int index_read_last(uchar * buf, const uchar * key, + uint key_len) override; - int index_next(uchar * buf); + int index_next(uchar * buf) override; - int index_next_same(uchar * buf, const uchar *key, uint keylen); + int index_next_same(uchar * buf, const uchar * key, + uint keylen) override; - int index_prev(uchar * buf); + int index_prev(uchar * buf) override; - int index_first(uchar * buf); + int index_first(uchar * buf) override; - int index_last(uchar * buf); + int index_last(uchar * buf) override; /* Copy a cached MySQL row. If requested, also avoids overwriting non-read columns. */ void copy_cached_row(uchar *to_rec, const uchar *from_rec, uint rec_length); - int rnd_init(bool scan); + int rnd_init(bool scan) override; - int rnd_end(); + int rnd_end() override; - int rnd_next(uchar *buf); + int rnd_next(uchar *buf) override; - int rnd_pos(uchar * buf, uchar *pos); + int rnd_pos(uchar * buf, uchar *pos) override; - int ft_init(); - void ft_end() { rnd_end(); } - FT_INFO *ft_init_ext(uint flags, uint inx, String* key); - int ft_read(uchar* buf); + int ft_init() override; + void ft_end() override { rnd_end(); } + FT_INFO *ft_init_ext(uint flags, uint inx, String* key) override; + int ft_read(uchar* buf) override; - void position(const uchar *record); + void position(const uchar *record) override; - int info(uint); + int info(uint) override; - int analyze(THD* thd,HA_CHECK_OPT* check_opt); + int analyze(THD* thd,HA_CHECK_OPT* check_opt) override; - int optimize(THD* thd,HA_CHECK_OPT* check_opt); + int optimize(THD* thd,HA_CHECK_OPT* check_opt) override; - int discard_or_import_tablespace(my_bool discard); + int discard_or_import_tablespace(my_bool discard) override; - int extra(ha_extra_function operation); + int extra(ha_extra_function operation) override; - int reset(); + int reset() override; - int external_lock(THD *thd, int lock_type); + int external_lock(THD *thd, int lock_type) override; - int start_stmt(THD *thd, thr_lock_type lock_type); - - void position(uchar *record); + int start_stmt(THD *thd, thr_lock_type lock_type) override; ha_rows records_in_range( uint inx, key_range* min_key, - key_range* max_key); + key_range* max_key) override; - ha_rows estimate_rows_upper_bound(); + ha_rows estimate_rows_upper_bound() override; - void update_create_info(HA_CREATE_INFO* create_info); + void update_create_info(HA_CREATE_INFO* create_info) override; inline int create( const char* name, @@ -204,63 +202,57 @@ public: int create( const char* name, TABLE* form, - HA_CREATE_INFO* create_info); - - const char* check_table_options(THD *thd, TABLE* table, - HA_CREATE_INFO* create_info, const bool use_tablespace, const ulint file_format); + HA_CREATE_INFO* create_info) override; inline int delete_table(const char* name, enum_sql_command sqlcom); - int truncate(); + int truncate() override; - int delete_table(const char *name); + int delete_table(const char *name) override; - int rename_table(const char* from, const char* to); + int rename_table(const char* from, const char* to) override; int defragment_table(const char* name, const char* index_name, bool async); - int check(THD* thd, HA_CHECK_OPT* check_opt); - char* update_table_comment(const char* comment); + int check(THD* thd, HA_CHECK_OPT* check_opt) override; + char* update_table_comment(const char* comment) override; - char* get_foreign_key_create_info(); + char* get_foreign_key_create_info() override; - int get_foreign_key_list(THD *thd, List *f_key_list); + int get_foreign_key_list(THD *thd, + List *f_key_list) override; int get_parent_foreign_key_list( THD* thd, - List* f_key_list); - int get_cascade_foreign_key_table_list( - THD* thd, - List* fk_table_list); + List* f_key_list) override; + bool can_switch_engines() override; - bool can_switch_engines(); + uint referenced_by_foreign_key() override; - uint referenced_by_foreign_key(); + void free_foreign_key_create_info(char* str) override; - void free_foreign_key_create_info(char* str); - - uint lock_count(void) const; + uint lock_count(void) const override; THR_LOCK_DATA** store_lock( THD* thd, THR_LOCK_DATA** to, - thr_lock_type lock_type); + thr_lock_type lock_type) override; - void init_table_handle_for_HANDLER(); + void init_table_handle_for_HANDLER() override; - virtual void get_auto_increment( + void get_auto_increment( ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong* first_value, - ulonglong* nb_reserved_values); - int reset_auto_increment(ulonglong value); + ulonglong* nb_reserved_values) override; + int reset_auto_increment(ulonglong value) override; - virtual bool get_error_message(int error, String *buf); + bool get_error_message(int error, String *buf) override; - virtual bool get_foreign_dup_key(char*, uint, char*, uint); + bool get_foreign_dup_key(char*, uint, char*, uint) override; - uint8 table_cache_type(); + uint8 table_cache_type() override; /** Ask handler about permission to cache table during query registration @@ -270,11 +262,11 @@ public: const char* table_key, uint key_length, qc_engine_callback* call_back, - ulonglong* engine_data); + ulonglong* engine_data) override; - bool primary_key_is_clustered(); + bool primary_key_is_clustered() override; - int cmp_ref(const uchar* ref1, const uchar* ref2); + int cmp_ref(const uchar* ref1, const uchar* ref2) override; /** On-line ALTER TABLE interface @see handler0alter.cc @{ */ @@ -304,7 +296,7 @@ public: enum_alter_inplace_result check_if_supported_inplace_alter( TABLE* altered_table, - Alter_inplace_info* ha_alter_info); + Alter_inplace_info* ha_alter_info) override; /** Allows InnoDB to update internal structures with concurrent writes blocked (provided that check_if_supported_inplace_alter() @@ -320,7 +312,7 @@ public: */ bool prepare_inplace_alter_table( TABLE* altered_table, - Alter_inplace_info* ha_alter_info); + Alter_inplace_info* ha_alter_info) override; /** Alter the table structure in-place with operations specified using HA_ALTER_FLAGS and Alter_inplace_information. @@ -336,7 +328,7 @@ public: */ bool inplace_alter_table( TABLE* altered_table, - Alter_inplace_info* ha_alter_info); + Alter_inplace_info* ha_alter_info) override; /** Commit or rollback the changes made during prepare_inplace_alter_table() and inplace_alter_table() inside @@ -355,12 +347,12 @@ public: bool commit_inplace_alter_table( TABLE* altered_table, Alter_inplace_info* ha_alter_info, - bool commit); + bool commit) override; /** @} */ bool check_if_incompatible_data( HA_CREATE_INFO* info, - uint table_changes); + uint table_changes) override; /** @name Multi Range Read interface @{ */ @@ -375,11 +367,11 @@ public: void* seq_init_param, uint n_ranges, uint mode, - HANDLER_BUFFER* buf); + HANDLER_BUFFER* buf) override; /** Process next multi range read @see DsMrr_impl::dsmrr_next @param range_info */ - int multi_range_read_next(range_id_t *range_info); + int multi_range_read_next(range_id_t *range_info) override; /** Initialize multi range read and get information. @see ha_myisam::multi_range_read_info_const @@ -398,7 +390,7 @@ public: uint n_ranges, uint* bufsz, uint* flags, - Cost_estimate* cost); + Cost_estimate* cost) override; /** Initialize multi range read and get information. @see DsMrr_impl::dsmrr_info @@ -411,16 +403,16 @@ public: @param cost */ ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, uint key_parts, uint* bufsz, uint* flags, - Cost_estimate* cost); + Cost_estimate* cost) override; int multi_range_read_explain_info(uint mrr_mode, - char *str, size_t size); + char *str, size_t size) override; /** Attempt to push down an index condition. @param[in] keyno MySQL key number @param[in] idx_cond Index condition to be checked @return idx_cond if pushed; NULL if not pushed */ - Item* idx_cond_push(uint keyno, Item* idx_cond); + Item* idx_cond_push(uint keyno, Item* idx_cond) override; /* @} */ /** Check if InnoDB is not storing virtual column metadata for a table. @@ -435,22 +427,19 @@ public: @param[in] pk_filter filter against which primary keys are to be checked @retval false if pushed (always) */ - bool rowid_filter_push(Rowid_filter *rowid_filter); + bool rowid_filter_push(Rowid_filter *rowid_filter) override; - bool can_convert_string(const Field_string* field, - const Column_definition& new_field) const; - bool can_convert_varstring(const Field_varstring* field, - const Column_definition& new_field) const; - bool can_convert_blob(const Field_blob* field, - const Column_definition& new_field) const; + bool + can_convert_string(const Field_string* field, + const Column_definition& new_field) const override; + bool can_convert_varstring( + const Field_varstring* field, + const Column_definition& new_field) const override; + bool + can_convert_blob(const Field_blob* field, + const Column_definition& new_field) const override; protected: - /** - MySQL calls this method at the end of each statement. This method - exists for readability only, called from reset(). The name reset() - doesn't give any clue that it is called at the end of a statement. */ - int end_stmt(); - dberr_t innobase_get_autoinc(ulonglong* value); dberr_t innobase_lock_autoinc(); ulonglong innobase_peek_autoinc(); @@ -483,7 +472,7 @@ protected: false if accessing individual fields is enough */ void build_template(bool whole_row); - virtual int info_low(uint, bool); + int info_low(uint, bool); /** The multi range read session object */ DsMrr_impl m_ds_mrr; diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index ea2348d61fd..647cc3d4274 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1897,13 +1897,13 @@ public: HazardPointer(buf_pool, mutex) {} /** Destructor */ - virtual ~FlushHp() {} + ~FlushHp() override {} /** Adjust the value of hp. This happens when some other thread working on the same list attempts to remove the hp from the list. @param bpage buffer block to be compared */ - void adjust(const buf_page_t* bpage); + void adjust(const buf_page_t* bpage) override; }; /** Class implementing buf_pool->LRU hazard pointer */ @@ -1918,13 +1918,13 @@ public: HazardPointer(buf_pool, mutex) {} /** Destructor */ - virtual ~LRUHp() {} + ~LRUHp() override {} /** Adjust the value of hp. This happens when some other thread working on the same list attempts to remove the hp from the list. @param bpage buffer block to be compared */ - void adjust(const buf_page_t* bpage); + void adjust(const buf_page_t* bpage) override; }; /** Special purpose iterators to be used when scanning the LRU list. @@ -1942,7 +1942,7 @@ public: LRUHp(buf_pool, mutex) {} /** Destructor */ - virtual ~LRUItr() {} + ~LRUItr() override {} /** Selects from where to start a scan. If we have scanned too deep into the LRU list it resets the value to the tail diff --git a/storage/innobase/include/fsp0file.h b/storage/innobase/include/fsp0file.h index 8c5b24fbadb..15485769429 100644 --- a/storage/innobase/include/fsp0file.h +++ b/storage/innobase/include/fsp0file.h @@ -504,13 +504,13 @@ public: /* No op - base constructor is called. */ } - ~RemoteDatafile() + ~RemoteDatafile() override { shutdown(); } /** Release the resources. */ - void shutdown(); + void shutdown() override; /** Get the link filepath. @return m_link_filepath */ @@ -532,7 +532,7 @@ public: in read-only mode so that it can be validated. @param[in] strict whether to issue error messages @return DB_SUCCESS or error code */ - dberr_t open_read_only(bool strict); + dberr_t open_read_only(bool strict) override; /** Opens a handle to the file linked to in an InnoDB Symbolic Link file in read-write mode so that it can be restored from doublewrite @@ -540,7 +540,7 @@ public: @param[in] read_only_mode If true, then readonly mode checks are enforced. @return DB_SUCCESS or error code */ - dberr_t open_read_write(bool read_only_mode) + dberr_t open_read_write(bool read_only_mode) override MY_ATTRIBUTE((warn_unused_result)); /****************************************************************** diff --git a/storage/innobase/include/fsp0sysspace.h b/storage/innobase/include/fsp0sysspace.h index d3a79ec23a9..bcb8dd5e5e9 100644 --- a/storage/innobase/include/fsp0sysspace.h +++ b/storage/innobase/include/fsp0sysspace.h @@ -49,7 +49,7 @@ public: /* No op */ } - ~SysTablespace() + ~SysTablespace() override { shutdown(); } diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h index 0a596e50ac7..eae636d6b7d 100644 --- a/storage/innobase/include/rem0rec.h +++ b/storage/innobase/include/rem0rec.h @@ -1293,7 +1293,7 @@ public: } /** Destructor */ - virtual ~rec_printer() {} + ~rec_printer() override {} private: /** Copy constructor */ diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h index 556c5d991d4..bf47cb8fe88 100644 --- a/storage/innobase/include/sync0rw.h +++ b/storage/innobase/include/sync0rw.h @@ -625,7 +625,7 @@ struct rw_lock_t #endif /* UNIV_PFS_RWLOCK */ #ifdef UNIV_DEBUG - virtual std::string to_string() const; + std::string to_string() const override; /** In the debug version: pointer to the debug info list of the lock */ UT_LIST_BASE_NODE_T(rw_lock_debug_t) debug_list; diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h index 142a0d72e5b..e2b5354d2de 100644 --- a/storage/innobase/include/sync0types.h +++ b/storage/innobase/include/sync0types.h @@ -1038,7 +1038,7 @@ struct sync_checker : public sync_check_functor_t /** Check the latching constraints @param[in] level The level held by the thread @return whether a latch violation was detected */ - bool operator()(const latch_level_t level) const + bool operator()(const latch_level_t level) const override { if (some_allowed) { switch (level) { @@ -1082,7 +1082,7 @@ struct sync_allowed_latches : public sync_check_functor_t { @param[in] latch The latch level to check @return true if there is a latch violation */ - bool operator()(const latch_level_t level) const + bool operator()(const latch_level_t level) const override { return(std::find(begin, end, level) == end); } diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 39dc8f4bba4..148d223a364 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -634,12 +634,12 @@ struct FetchIndexRootPages : public AbstractCallback { m_table(table) UNIV_NOTHROW { } /** Destructor */ - virtual ~FetchIndexRootPages() UNIV_NOTHROW { } + ~FetchIndexRootPages() UNIV_NOTHROW override { } /** Called for each block as it is read from the file. @param block block to convert, it is not from the buffer pool. @retval DB_SUCCESS or error code. */ - dberr_t operator()(buf_block_t* block) UNIV_NOTHROW; + dberr_t operator()(buf_block_t* block) UNIV_NOTHROW override; /** Update the import configuration that will be used to import the tablespace. */ @@ -812,7 +812,7 @@ public: rec_offs_init(m_offsets_); } - virtual ~PageConverter() UNIV_NOTHROW + ~PageConverter() UNIV_NOTHROW override { if (m_heap != 0) { mem_heap_free(m_heap); @@ -822,7 +822,7 @@ public: /** Called for each block as it is read from the file. @param block block to convert, it is not from the buffer pool. @retval DB_SUCCESS or error code. */ - dberr_t operator()(buf_block_t* block) UNIV_NOTHROW; + dberr_t operator()(buf_block_t* block) UNIV_NOTHROW override; private: /** Update the page, set the space id, max trx id and index id.