Skip to content

Commit

Permalink
MDEV-13359 Enable ALTER TABLE...ALGORITHM=INPLACE for compressed columns
Browse files Browse the repository at this point in the history
innobase_rec_reset(): Remove. This function was introduced in the
InnoDB Plugin for MySQL 5.1, which later evolved into MySQL 5.5.
There used to be a bug that ADD UNIQUE INDEX would not always correctly
report the duplicate key value of the secondary index. This function
ensured that instead of reporting total garbage values, InnoDB
would report NULL.

It looks like the function was made unnecessary in MySQL 5.6.6 by
mysql/mysql-server@d143097

The corresponding test was subsequently adjusted in
mysql/mysql-server@fde80cf

The ALTER TABLE tests were imported to MariaDB as part of MDEV-13625,
and these tests do pass with this change.

The unnecessary function did not do any harm before MDEV-11371 introduced
compressed columns.

One question remains: What if we needed to report a duplicate key value
for a compressed column? The simple answer is that the test
main.column_compression demonstrates that no indexes can be defined
on compressed columns.
  • Loading branch information
dr-m committed Sep 1, 2017
1 parent 8a8cca2 commit a8ec55e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 42 deletions.
28 changes: 0 additions & 28 deletions storage/innobase/handler/handler0alter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -727,13 +727,6 @@ ha_innobase::check_if_supported_inplace_alter(

DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}

/* Disable online ALTER TABLE for compressed columns until
MDEV-13359 - "Online ALTER TABLE will be disabled for compressed columns"
is fixed. */
if (field->compression_method()) {
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
}

ulint n_indexes = UT_LIST_GET_LEN((m_prebuilt->table)->indexes);
Expand Down Expand Up @@ -1032,12 +1025,6 @@ ha_innobase::check_if_supported_inplace_alter(
|| (ha_alter_info->handler_flags
& Alter_inplace_info::ADD_COLUMN));

/* Disable online ALTER TABLE for compressed columns until
MDEV-13359 - "Online ALTER TABLE will be disabled for compressed columns"
is fixed. */
if (cf->compression_method()) {
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
if (const Field* f = cf->field) {
/* This could be changing an existing column
from NULL to NOT NULL. */
Expand Down Expand Up @@ -1982,21 +1969,6 @@ innobase_row_to_mysql(
}
}

/*************************************************************//**
Resets table->record[0]. */
void
innobase_rec_reset(
/*===============*/
TABLE* table) /*!< in/out: MySQL table */
{
uint n_fields = table->s->fields;
uint i;

for (i = 0; i < n_fields; i++) {
table->field[i]->set_default();
}
}

/*******************************************************************//**
This function checks that index keys are sensible.
@return 0 or error number */
Expand Down
8 changes: 0 additions & 8 deletions storage/innobase/include/handler0alter.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ innobase_row_to_mysql(
const dtuple_t* row) /*!< in: InnoDB row */
MY_ATTRIBUTE((nonnull));

/*************************************************************//**
Resets table->record[0]. */
void
innobase_rec_reset(
/*===============*/
struct TABLE* table) /*!< in/out: MySQL table */
MY_ATTRIBUTE((nonnull));

/** Generate the next autoinc based on a snapshot of the session
auto_increment_increment and auto_increment_offset variables. */
struct ib_sequence_t {
Expand Down
6 changes: 0 additions & 6 deletions storage/innobase/row/row0merge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4867,12 +4867,6 @@ row_merge_build_indexes(
}
}

/* Reset the MySQL row buffer that is used when reporting
duplicate keys.
This is likely reason for a problem described in MDEV-13359. */
innobase_rec_reset(table);

if (global_system_variables.log_warnings > 2) {
sql_print_information("InnoDB: Online DDL : Start reading"
" clustered index of the table"
Expand Down

0 comments on commit a8ec55e

Please sign in to comment.