Skip to content
Permalink
Browse files

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()
  • Loading branch information...
kevgs committed Jul 4, 2019
1 parent e8392e5 commit 23c12ed5cb2a86516f4d4502779d2be312fa6e17
@@ -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

0 comments on commit 23c12ed

Please sign in to comment.
You can’t perform that action at this time.