Commit 6402ca78 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-14016 Allow instant ADD COLUMN, ADD INDEX, LOCK=NONE

Ideally, we would move some code from
ha_innobase::prepare_inplace_alter_table() to
ha_innobase::check_if_supported_inplace_alter(),
but the API does not really allow us to return errors; it can
only inform which forms of ALGORITHM and LOCK are allowed.

So, we have to duplicate some logic between the "check" and "prepare"
phases. We do the duplication by calling common functions.

instant_alter_column_possible(): Check if instant column operation
is possible. Invoked from both
ha_innobase::check_if_supported_inplace_alter() and
prepare_inplace_alter_table_dict().

ha_innobase::check_if_supported_inplace_alter(): Before refusing
certain operations if FULLTEXT INDEX exist, check if instant ALTER TABLE
is possible and return early if it is the case.

prepare_inplace_alter_table_dict(): Before checking the limitations
on FULLTEXT INDEX, check if instant ALTER TABLE is possible, and suppress
the checks if it is the case. If instant ADD COLUMN is used when the
table already contains FULLTEXT INDEX, do account for a
hidden FTS_DOC_ID_INDEX in a debug assertion.
parent 5603a584
......@@ -440,6 +440,27 @@ tt CREATE TABLE `tt` (
PRIMARY KEY (`pk`),
FULLTEXT KEY `ct` (`ct`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try LOCK=SHARED
ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try LOCK=SHARED
CREATE TABLE tu (
pk INT PRIMARY KEY, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, t TEXT,
FULLTEXT INDEX(t)
) ENGINE=InnoDB;
ALTER TABLE tu ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try LOCK=SHARED
ALTER TABLE tu ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE;
DROP TABLE tu;
CREATE TABLE tv (
pk INT PRIMARY KEY, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, t TEXT,
UNIQUE INDEX FTS_DOC_ID_INDEX(FTS_DOC_ID),
FULLTEXT INDEX(t)
) ENGINE=InnoDB;
ALTER TABLE tv ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try LOCK=SHARED
ALTER TABLE tv ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE;
DROP TABLE tv;
ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=COPY;
ERROR 42000: Incorrect column name 'dB_row_Id'
ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=INPLACE;
......
......@@ -193,6 +193,33 @@ ALGORITHM=INPLACE, LOCK=SHARED;
-- source suite/innodb/include/innodb_dict.inc
SHOW CREATE TABLE tt;
# Non-instant ADD COLUMN would require the table to be rebuilt.
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE;
# This is still non-instant ADD COLUMN, because FTS_DOC_ID is hidden.
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE;
CREATE TABLE tu (
pk INT PRIMARY KEY, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, t TEXT,
FULLTEXT INDEX(t)
) ENGINE=InnoDB;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE tu ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE;
# Instant ADD COLUMN (adding after the visible FTS_DOC_ID)
ALTER TABLE tu ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE;
DROP TABLE tu;
CREATE TABLE tv (
pk INT PRIMARY KEY, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, t TEXT,
UNIQUE INDEX FTS_DOC_ID_INDEX(FTS_DOC_ID),
FULLTEXT INDEX(t)
) ENGINE=InnoDB;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE tv ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE;
# Instant ADD COLUMN (adding after the visible FTS_DOC_ID)
ALTER TABLE tv ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE;
DROP TABLE tv;
# DB_ROW_ID, DB_TRX_ID, DB_ROLL_PTR are reserved InnoDB system column names.
--error ER_WRONG_COLUMN_NAME
......
......@@ -483,16 +483,55 @@ info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE tab MODIFY COLUMN c2 GEOMETRY NOT NULL;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE tab add COLUMN c8 POINT NOT NULL AFTER c5, ALGORITHM = INPLACE, LOCK=NONE;
ALTER TABLE tab MODIFY COLUMN c3 POLYGON NOT NULL;
affected rows: 10
info: Records: 10 Duplicates: 0 Warnings: 0
ALTER TABLE tab add COLUMN c7 POINT NOT NULL;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE tab add COLUMN c8 POINT NOT NULL, ALGORITHM = INPLACE, LOCK=NONE;
SELECT HEX(c8) FROM tab;
HEX(c8)
BEGIN;
INSERT INTO tab SELECT 0,c2,c3,c4,c5,
ST_GeomFromText('POINT(67 89)'),ST_GeomFromText('POINT(67 89)')
FROM tab LIMIT 1;
SELECT HEX(c8) FROM tab;
HEX(c8)
0000000001010000000000000000C050400000000000405640
ROLLBACK;
ALTER TABLE tab add COLUMN c9 POINT NOT NULL AFTER c5, ALGORITHM = INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
SHOW CREATE TABLE tab;
Table Create Table
tab CREATE TABLE `tab` (
`c1` int(11) NOT NULL,
`c2` geometry NOT NULL,
`c3` linestring NOT NULL,
`c3` polygon NOT NULL,
`c4` polygon NOT NULL,
`c5` geometry NOT NULL,
`c7` point NOT NULL,
`c8` point NOT NULL,
PRIMARY KEY (`c1`),
SPATIAL KEY `idx2` (`c2`),
SPATIAL KEY `idx3` (`c3`),
......@@ -525,9 +564,11 @@ Table Create Table
tab CREATE TABLE `tab` (
`c1` int(11) NOT NULL,
`c2` geometry NOT NULL,
`c3` linestring NOT NULL,
`c3` polygon NOT NULL,
`c4` geometry NOT NULL,
`c5` geometry NOT NULL,
`c7` point NOT NULL,
`c8` point NOT NULL,
PRIMARY KEY (`c1`),
SPATIAL KEY `idx2` (`c2`),
SPATIAL KEY `idx3` (`c3`),
......@@ -571,8 +612,8 @@ ALTER TABLE tab MODIFY COLUMN c2 POINT NOT NULL;
affected rows: 8
info: Records: 8 Duplicates: 0 Warnings: 0
ALTER TABLE tab MODIFY COLUMN c3 LINESTRING NOT NULL;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
affected rows: 8
info: Records: 8 Duplicates: 0 Warnings: 0
ALTER TABLE tab MODIFY COLUMN c4 POLYGON NOT NULL;
affected rows: 8
info: Records: 8 Duplicates: 0 Warnings: 0
......@@ -584,6 +625,8 @@ tab CREATE TABLE `tab` (
`c3` linestring NOT NULL,
`c4` polygon NOT NULL,
`c5` geometry NOT NULL,
`c7` point NOT NULL,
`c8` point NOT NULL,
PRIMARY KEY (`c1`),
SPATIAL KEY `idx2` (`c2`),
SPATIAL KEY `idx3` (`c3`),
......
......@@ -476,25 +476,24 @@ ALTER TABLE tab ADD INDEX idx6(c4(10)) USING BTREE;
ALTER TABLE tab MODIFY COLUMN c2 GEOMETRY NOT NULL;
# --error ER_CANT_CREATE_GEOMETRY_OBJECT
# ALTER TABLE tab MODIFY COLUMN c3 POLYGON NOT NULL;
ALTER TABLE tab MODIFY COLUMN c3 POLYGON NOT NULL;
# --error ER_INVALID_USE_OF_NULL
# ALTER TABLE tab add COLUMN c7 POINT NOT NULL;
ALTER TABLE tab add COLUMN c7 POINT NOT NULL;
--disable_info
# instant add, supported
#ALTER TABLE tab add COLUMN c8 POINT NOT NULL, ALGORITHM = INPLACE, LOCK=NONE;
#SELECT HEX(c8) FROM tab;
#BEGIN;
#INSERT INTO tab SELECT 0,c2,c3,c4,c5,ST_GeomFromText('POINT(67 89)')
#FROM tab LIMIT 1;
#SELECT HEX(c8) FROM tab;
#ROLLBACK;
ALTER TABLE tab add COLUMN c8 POINT NOT NULL, ALGORITHM = INPLACE, LOCK=NONE;
SELECT HEX(c8) FROM tab;
BEGIN;
INSERT INTO tab SELECT 0,c2,c3,c4,c5,
ST_GeomFromText('POINT(67 89)'),ST_GeomFromText('POINT(67 89)')
FROM tab LIMIT 1;
SELECT HEX(c8) FROM tab;
ROLLBACK;
# not instant, not supported
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE tab add COLUMN c8 POINT NOT NULL AFTER c5, ALGORITHM = INPLACE, LOCK=NONE;
--disable_info
ALTER TABLE tab add COLUMN c9 POINT NOT NULL AFTER c5, ALGORITHM = INPLACE, LOCK=NONE;
SHOW CREATE TABLE tab;
......
......@@ -602,6 +602,49 @@ check_v_col_in_order(
return(true);
}
/** Determine if an instant operation is possible for altering columns.
@param[in] ha_alter_info the ALTER TABLE operation
@param[in] table table definition before ALTER TABLE */
static
bool
instant_alter_column_possible(
const Alter_inplace_info* ha_alter_info,
const TABLE* table)
{
if (~ha_alter_info->handler_flags
& Alter_inplace_info::ADD_STORED_BASE_COLUMN) {
return false;
}
/* At the moment, we disallow ADD [UNIQUE] INDEX together with
instant ADD COLUMN.
The main reason is that the work of instant ADD must be done
in commit_inplace_alter_table(). For the rollback_instant()
to work, we must add the columns to dict_table_t beforehand,
and roll back those changes in case the transaction is rolled
back.
If we added the columns to the dictionary cache already in the
prepare_inplace_alter_table(), we would have to deal with
column number mismatch in ha_innobase::open(), write_row() and
other functions. */
/* FIXME: allow instant ADD COLUMN together with
INNOBASE_ONLINE_CREATE (ADD [UNIQUE] INDEX) on pre-existing
columns. */
if (ha_alter_info->handler_flags
& ((INNOBASE_ALTER_REBUILD | INNOBASE_ONLINE_CREATE)
& ~Alter_inplace_info::ADD_STORED_BASE_COLUMN
& ~Alter_inplace_info::CHANGE_CREATE_OPTION)) {
return false;
}
return !(ha_alter_info->handler_flags
& Alter_inplace_info::CHANGE_CREATE_OPTION)
|| !create_option_need_rebuild(ha_alter_info, table);
}
/** Check if InnoDB supports a particular alter table in-place
@param altered_table TABLE object for new version of table.
@param ha_alter_info Structure describing changes to be done
......@@ -654,11 +697,6 @@ ha_innobase::check_if_supported_inplace_alter(
update_thd();
// FIXME: Construct ha_innobase_inplace_ctx here and determine
// if instant ALTER TABLE is possible. If yes, we will be able to
// allow ADD COLUMN even if SPATIAL INDEX, FULLTEXT INDEX or
// virtual columns exist, also together with adding virtual columns.
if (ha_alter_info->handler_flags
& ~(INNOBASE_INPLACE_IGNORE
| INNOBASE_ALTER_NOREBUILD
......@@ -973,76 +1011,14 @@ ha_innobase::check_if_supported_inplace_alter(
m_prebuilt->trx->will_lock++;
if (!online) {
/* We already determined that only a non-locking
operation is possible. */
} else if (((ha_alter_info->handler_flags
& Alter_inplace_info::ADD_PK_INDEX)
|| innobase_need_rebuild(ha_alter_info, table))
&& (innobase_fulltext_exist(altered_table)
|| innobase_spatial_exist(altered_table))) {
/* Refuse to rebuild the table online, if
FULLTEXT OR SPATIAL indexes are to survive the rebuild. */
online = false;
/* If the table already contains fulltext indexes,
refuse to rebuild the table natively altogether. */
if (m_prebuilt->table->fts) {
ha_alter_info->unsupported_reason = innobase_get_err_msg(
ER_INNODB_FT_LIMIT);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
if (innobase_spatial_exist(altered_table)) {
ha_alter_info->unsupported_reason =
innobase_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS);
} else {
ha_alter_info->unsupported_reason =
innobase_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS);
}
} else if ((ha_alter_info->handler_flags
& Alter_inplace_info::ADD_INDEX)) {
/* ADD FULLTEXT|SPATIAL INDEX requires a lock.
We could do ADD FULLTEXT INDEX without a lock if the
table already contains an FTS_DOC_ID column, but in
that case we would have to apply the modification log
to the full-text indexes.
We could also do ADD SPATIAL INDEX by implementing
row_log_apply() for it. */
for (uint i = 0; i < ha_alter_info->index_add_count; i++) {
const KEY* key =
&ha_alter_info->key_info_buffer[
ha_alter_info->index_add_buffer[i]];
if (key->flags & HA_FULLTEXT) {
DBUG_ASSERT(!(key->flags & HA_KEYFLAG_MASK
& ~(HA_FULLTEXT
| HA_PACK_KEY
| HA_GENERATED_KEY
| HA_BINARY_PACK_KEY)));
ha_alter_info->unsupported_reason = innobase_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS);
online = false;
break;
}
if (key->flags & HA_SPATIAL) {
ha_alter_info->unsupported_reason = innobase_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS);
online = false;
break;
}
}
}
/* When changing a NULL column to NOT NULL and specifying a
DEFAULT value, ensure that the DEFAULT expression is a constant.
Also, in ADD COLUMN, for now we only support a
constant DEFAULT expression. */
cf_it.rewind();
Field **af = altered_table->field;
bool add_column_not_last = false;
uint n_stored_cols = 0, n_add_cols = 0;
while (Create_field* cf = cf_it++) {
DBUG_ASSERT(cf->field
......@@ -1104,6 +1080,11 @@ ha_innobase::check_if_supported_inplace_alter(
} else if (!(*af)->default_value
|| !((*af)->default_value->flags
& ~(VCOL_SESSION_FUNC | VCOL_TIME_FUNC))) {
n_add_cols++;
if (af < &altered_table->field[table_share->fields]) {
add_column_not_last = true;
}
/* The added NOT NULL column lacks a DEFAULT value,
or the DEFAULT is the same for all rows.
(Time functions, such as CURRENT_TIMESTAMP(),
......@@ -1128,10 +1109,87 @@ ha_innobase::check_if_supported_inplace_alter(
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
next_column:
af++;
n_stored_cols += (*af++)->stored_in_db();
}
cf_it.rewind();
if (!add_column_not_last
&& uint(m_prebuilt->table->n_cols) - DATA_N_SYS_COLS + n_add_cols
== n_stored_cols
&& m_prebuilt->table->supports_instant()
&& instant_alter_column_possible(ha_alter_info, table)) {
/* We can perform instant ADD COLUMN, because all
columns are going to be added after existing ones
(and not after hidden InnoDB columns, such as FTS_DOC_ID). */
/* MDEV-14246 FIXME: return HA_ALTER_INPLACE_NO_LOCK and
perform all work in ha_innobase::commit_inplace_alter_table(),
to avoid an unnecessary MDL upgrade/downgrade cycle. */
DBUG_RETURN(HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE);
}
if (!online) {
/* We already determined that only a non-locking
operation is possible. */
} else if (((ha_alter_info->handler_flags
& Alter_inplace_info::ADD_PK_INDEX)
|| innobase_need_rebuild(ha_alter_info, table))
&& (innobase_fulltext_exist(altered_table)
|| innobase_spatial_exist(altered_table))) {
/* Refuse to rebuild the table online, if
FULLTEXT OR SPATIAL indexes are to survive the rebuild. */
online = false;
/* If the table already contains fulltext indexes,
refuse to rebuild the table natively altogether. */
if (m_prebuilt->table->fts) {
ha_alter_info->unsupported_reason = innobase_get_err_msg(
ER_INNODB_FT_LIMIT);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
if (innobase_spatial_exist(altered_table)) {
ha_alter_info->unsupported_reason =
innobase_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS);
} else {
ha_alter_info->unsupported_reason =
innobase_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS);
}
} else if ((ha_alter_info->handler_flags
& Alter_inplace_info::ADD_INDEX)) {
/* ADD FULLTEXT|SPATIAL INDEX requires a lock.
We could do ADD FULLTEXT INDEX without a lock if the
table already contains an FTS_DOC_ID column, but in
that case we would have to apply the modification log
to the full-text indexes.
We could also do ADD SPATIAL INDEX by implementing
row_log_apply() for it. */
for (uint i = 0; i < ha_alter_info->index_add_count; i++) {
const KEY* key =
&ha_alter_info->key_info_buffer[
ha_alter_info->index_add_buffer[i]];
if (key->flags & HA_FULLTEXT) {
DBUG_ASSERT(!(key->flags & HA_KEYFLAG_MASK
& ~(HA_FULLTEXT
| HA_PACK_KEY
| HA_GENERATED_KEY
| HA_BINARY_PACK_KEY)));
ha_alter_info->unsupported_reason = innobase_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS);
online = false;
break;
}
if (key->flags & HA_SPATIAL) {
ha_alter_info->unsupported_reason = innobase_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS);
online = false;
break;
}
}
}
DBUG_RETURN(online
? HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE
......@@ -4711,29 +4769,6 @@ prepare_inplace_alter_table_dict(
new_clustered = DICT_CLUSTERED & index_defs[0].ind_type;
if (num_fts_index > 1) {
my_error(ER_INNODB_FT_LIMIT, MYF(0));
goto error_handled;
}
if (!ctx->online) {
/* This is not an online operation (LOCK=NONE). */
} else if (ctx->add_autoinc == ULINT_UNDEFINED
&& num_fts_index == 0
&& (!innobase_need_rebuild(ha_alter_info, old_table)
|| !innobase_fulltext_exist(altered_table))) {
/* InnoDB can perform an online operation (LOCK=NONE). */
} else {
size_t query_length;
/* This should have been blocked in
check_if_supported_inplace_alter(). */
ut_ad(0);
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
innobase_get_stmt_unsafe(ctx->prebuilt->trx->mysql_thd,
&query_length));
goto error_handled;
}
/* The primary index would be rebuilt if a FTS Doc ID
column is to be added, and the primary index definition
is just copied from old table and stored in indexdefs[0] */
......@@ -5077,22 +5112,8 @@ prepare_inplace_alter_table_dict(
== !!new_clustered);
}
if (ctx->need_rebuild() && ctx->new_table->supports_instant()) {
if (~ha_alter_info->handler_flags
& Alter_inplace_info::ADD_STORED_BASE_COLUMN) {
goto not_instant_add_column;
}
if (ha_alter_info->handler_flags
& (INNOBASE_ALTER_REBUILD
& ~Alter_inplace_info::ADD_STORED_BASE_COLUMN
& ~Alter_inplace_info::CHANGE_CREATE_OPTION)) {
goto not_instant_add_column;
}
if ((ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE)
== Alter_inplace_info::CHANGE_CREATE_OPTION
&& create_option_need_rebuild(ha_alter_info, old_table)) {
if (ctx->need_rebuild() && user_table->supports_instant()) {
if (!instant_alter_column_possible(ha_alter_info, old_table)) {
goto not_instant_add_column;
}
......@@ -5105,28 +5126,6 @@ prepare_inplace_alter_table_dict(
DBUG_ASSERT(ctx->new_table->n_cols > ctx->old_table->n_cols);
if (ha_alter_info->handler_flags & INNOBASE_ONLINE_CREATE) {
/* At the moment, we disallow ADD [UNIQUE] INDEX
together with instant ADD COLUMN.
The main reason is that the work of instant
ADD must be done in commit_inplace_alter_table().
For the rollback_instant() to work, we must
add the columns to dict_table_t beforehand,
and roll back those changes in case the
transaction is rolled back.
If we added the columns to the dictionary cache
already in the prepare_inplace_alter_table(),
we would have to deal with column number
mismatch in ha_innobase::open(), write_row()
and other functions. */
/* FIXME: allow instant ADD COLUMN together
with ADD INDEX on pre-existing columns. */
goto not_instant_add_column;
}
for (uint a = 0; a < ctx->num_to_add_index; a++) {
error = dict_index_add_to_cache_w_vcol(
ctx->new_table, ctx->add_index[a], add_v,
......@@ -5134,8 +5133,15 @@ prepare_inplace_alter_table_dict(
ut_a(error == DB_SUCCESS);
}
DBUG_ASSERT(ha_alter_info->key_count
/* hidden GEN_CLUST_INDEX in InnoDB */
+ dict_index_is_auto_gen_clust(
dict_table_get_first_index(ctx->new_table))
/* hidden FTS_DOC_ID_INDEX in InnoDB */
+ (ctx->old_table->fts_doc_id_index
&& innobase_fts_check_doc_id_index_in_def(
altered_table->s->keys,
altered_table->key_info)
!= FTS_EXIST_DOC_ID_INDEX)
== ctx->num_to_add_index);
ctx->num_to_add_index = 0;
ctx->add_index = NULL;
......@@ -5253,6 +5259,33 @@ prepare_inplace_alter_table_dict(
ctx->prepare_instant();
}
if (!ctx->is_instant()) {
if (num_fts_index > 1) {
my_error(ER_INNODB_FT_LIMIT, MYF(0));
goto error_handled;
}
if (!ctx->online) {
/* This is not an online operation (LOCK=NONE). */
} else if (ctx->add_autoinc == ULINT_UNDEFINED
&& num_fts_index == 0
&& (!innobase_need_rebuild(ha_alter_info, old_table)
|| !innobase_fulltext_exist(altered_table))) {
/* InnoDB can perform an online operation
(LOCK=NONE). */
} else {
size_t query_length;
/* This should have been blocked in
check_if_supported_inplace_alter(). */
ut_ad(0);
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
innobase_get_stmt_unsafe(
ctx->prebuilt->trx->mysql_thd,
&query_length));
goto error_handled;
}
}
if (ctx->need_rebuild()) {
not_instant_add_column:
uint32_t key_id = FIL_DEFAULT_ENCRYPTION_KEY;
......
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