Skip to content

Commit

Permalink
Remove the redundant function row_table_got_default_clust_index()
Browse files Browse the repository at this point in the history
Use dict_index_is_auto_gen_clust() instead.
  • Loading branch information
dr-m committed Sep 15, 2017
1 parent 74f677f commit a449f72
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 35 deletions.
12 changes: 4 additions & 8 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6689,11 +6689,8 @@ ha_innobase::open(const char* name, int, uint)
a row in our table. Note that MySQL may also compare two row
references for equality by doing a simple memcmp on the strings
of length ref_length! */

if (!row_table_got_default_clust_index(ib_table)) {

m_prebuilt->clust_index_was_generated = FALSE;

if (!(m_prebuilt->clust_index_was_generated
= dict_index_is_auto_gen_clust(ib_table->indexes.start))) {
if (m_primary_key >= MAX_KEY) {
ib_table->dict_frm_mismatch = DICT_FRM_NO_PK;

Expand Down Expand Up @@ -6759,8 +6756,6 @@ ha_innobase::open(const char* name, int, uint)
ib_push_frm_error(thd, ib_table, table, 0, true);
}

m_prebuilt->clust_index_was_generated = TRUE;

ref_length = DATA_ROW_ID_LEN;

/* If we automatically created the clustered index, then
Expand Down Expand Up @@ -14462,7 +14457,8 @@ innobase_get_mysql_key_number_for_index(
i++;
}

if (row_table_got_default_clust_index(index->table)) {
if (dict_index_is_clust(index)
&& dict_index_is_auto_gen_clust(index)) {
ut_a(i > 0);
i--;
}
Expand Down
6 changes: 4 additions & 2 deletions storage/innobase/handler/handler0alter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,8 @@ ha_innobase::check_if_supported_inplace_alter(

/* See if MYSQL table has no pk but we do. */
if (UNIV_UNLIKELY(my_primary_key >= MAX_KEY)
&& !row_table_got_default_clust_index(m_prebuilt->table)) {
&& !dict_index_is_auto_gen_clust(
dict_table_get_first_index(m_prebuilt->table))) {
ha_alter_info->unsupported_reason = innobase_get_err_msg(
ER_PRIMARY_CANT_HAVE_NULL);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
Expand Down Expand Up @@ -4448,7 +4449,8 @@ prepare_inplace_alter_table_dict(
index_defs = innobase_create_key_defs(
ctx->heap, ha_alter_info, altered_table, ctx->num_to_add_index,
num_fts_index,
row_table_got_default_clust_index(ctx->new_table),
dict_index_is_auto_gen_clust(dict_table_get_first_index(
ctx->new_table)),
fts_doc_id_col, add_fts_doc_id, add_fts_doc_id_idx,
old_table);

Expand Down
9 changes: 0 additions & 9 deletions storage/innobase/include/row0mysql.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,6 @@ row_get_prebuilt_update_vector(
/*===========================*/
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in MySQL
handle */
/*********************************************************************//**
Checks if a table is such that we automatically created a clustered
index on it (on row id).
@return TRUE if the clustered index was generated automatically */
ibool
row_table_got_default_clust_index(
/*==============================*/
const dict_table_t* table); /*!< in: table */

/** Does an update or delete of a row for MySQL.
@param[in,out] prebuilt prebuilt struct in MySQL handle
@return error code or DB_SUCCESS */
Expand Down
16 changes: 0 additions & 16 deletions storage/innobase/row/row0mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2283,22 +2283,6 @@ row_unlock_for_mysql(
trx->op_info = "";
}

/*********************************************************************//**
Checks if a table is such that we automatically created a clustered
index on it (on row id).
@return TRUE if the clustered index was generated automatically */
ibool
row_table_got_default_clust_index(
/*==============================*/
const dict_table_t* table) /*!< in: table */
{
const dict_index_t* clust_index;

clust_index = dict_table_get_first_index(table);

return(dict_index_get_nth_col(clust_index, 0)->mtype == DATA_SYS);
}

/*********************************************************************//**
Locks the data dictionary in shared mode from modifications, for performing
foreign key check, rollback, or other operation invisible to MySQL. */
Expand Down

0 comments on commit a449f72

Please sign in to comment.