Commit 23c12ed5 authored by Eugene Kosov's avatar Eugene Kosov

MDEV-19951 use override keyword across the InnoDB

Use on every virtual function override.

ha_innobase: mark a final

ha_innobase::bas_ext(): remove as unused

ha_innobase::get_cascade_foreign_key_table_list: remove as unused

ha_innobase::end_stmt(): merge into ha_innobase::reset()
parent e8392e58
......@@ -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<st_handler_tablename>* fk_table_list)
{
m_prebuilt->trx->op_info = "getting cascading foreign keys";
std::forward_list<table_list_item, ut_allocator<table_list_item> >
table_list;
typedef std::set<st_handler_tablename, tablename_compare,
ut_allocator<st_handler_tablename> > 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<cascade_fk_set::iterator,bool> 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
......
This diff is collapsed.
......@@ -1897,13 +1897,13 @@ class FlushHp: public HazardPointer {
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 @@ class LRUHp: public HazardPointer {
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 @@ class LRUItr: public LRUHp {
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
......
......@@ -504,13 +504,13 @@ class RemoteDatafile : public Datafile
/* 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 @@ class RemoteDatafile : public Datafile
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 @@ class RemoteDatafile : public Datafile
@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));
/******************************************************************
......
......@@ -49,7 +49,7 @@ class SysTablespace : public Tablespace
/* No op */
}
~SysTablespace()
~SysTablespace() override
{
shutdown();
}
......
......@@ -1293,7 +1293,7 @@ class rec_printer : public std::ostringstream {
}
/** Destructor */
virtual ~rec_printer() {}
~rec_printer() override {}
private:
/** Copy constructor */
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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 @@ class PageConverter : public AbstractCallback {
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 @@ class PageConverter : public AbstractCallback {
/** 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.
......
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