mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-31777 ER_GET_ERRNO upon online alter on CONNECT table
Forbid Online for CONNECT.
This commit is contained in:
committed by
Sergei Golubchik
parent
44ca37ef17
commit
30c965f866
@@ -371,7 +371,10 @@ enum chf_create_flags {
|
|||||||
/* Implements SELECT ... FOR UPDATE SKIP LOCKED */
|
/* Implements SELECT ... FOR UPDATE SKIP LOCKED */
|
||||||
#define HA_CAN_SKIP_LOCKED (1ULL << 61)
|
#define HA_CAN_SKIP_LOCKED (1ULL << 61)
|
||||||
|
|
||||||
#define HA_LAST_TABLE_FLAG HA_CAN_SKIP_LOCKED
|
/* This engine is not compatible with Online ALTER TABLE */
|
||||||
|
#define HA_NO_ONLINE_ALTER (1ULL << 62)
|
||||||
|
|
||||||
|
#define HA_LAST_TABLE_FLAG HA_NO_ONLINE_ALTER
|
||||||
|
|
||||||
|
|
||||||
/* bits in index_flags(index_number) for what you can do with index */
|
/* bits in index_flags(index_number) for what you can do with index */
|
||||||
|
@@ -9908,7 +9908,8 @@ bool online_alter_check_autoinc(const THD *thd, const Alter_info *alter_info,
|
|||||||
static
|
static
|
||||||
const char *online_alter_check_supported(const THD *thd,
|
const char *online_alter_check_supported(const THD *thd,
|
||||||
const Alter_info *alter_info,
|
const Alter_info *alter_info,
|
||||||
const TABLE *table, bool *online)
|
const TABLE *table,
|
||||||
|
const TABLE *new_table, bool *online)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(*online);
|
DBUG_ASSERT(*online);
|
||||||
|
|
||||||
@@ -9916,6 +9917,10 @@ const char *online_alter_check_supported(const THD *thd,
|
|||||||
if (!*online)
|
if (!*online)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
*online= (new_table->file->ha_table_flags() & HA_NO_ONLINE_ALTER) == 0;
|
||||||
|
if (!*online)
|
||||||
|
return new_table->file->engine_name()->str;
|
||||||
|
|
||||||
*online= table->s->sequence == NULL;
|
*online= table->s->sequence == NULL;
|
||||||
if (!*online)
|
if (!*online)
|
||||||
return "SEQUENCE";
|
return "SEQUENCE";
|
||||||
@@ -11023,20 +11028,6 @@ do_continue:;
|
|||||||
if (fk_prepare_copy_alter_table(thd, table, alter_info, &alter_ctx))
|
if (fk_prepare_copy_alter_table(thd, table, alter_info, &alter_ctx))
|
||||||
goto err_new_table_cleanup;
|
goto err_new_table_cleanup;
|
||||||
|
|
||||||
if (online)
|
|
||||||
{
|
|
||||||
const char *reason= online_alter_check_supported(thd, alter_info, table,
|
|
||||||
&online);
|
|
||||||
if (reason &&
|
|
||||||
alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_NONE)
|
|
||||||
{
|
|
||||||
DBUG_ASSERT(!online);
|
|
||||||
my_error(ER_ALTER_OPERATION_NOT_SUPPORTED_REASON, MYF(0),
|
|
||||||
"LOCK=NONE", reason, "LOCK=SHARED");
|
|
||||||
goto err_new_table_cleanup;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!table->s->tmp_table)
|
if (!table->s->tmp_table)
|
||||||
{
|
{
|
||||||
// If EXCLUSIVE lock is requested, upgrade already.
|
// If EXCLUSIVE lock is requested, upgrade already.
|
||||||
@@ -11108,6 +11099,21 @@ do_continue:;
|
|||||||
thd->session_tracker.state_change.mark_as_changed(thd);
|
thd->session_tracker.state_change.mark_as_changed(thd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (online)
|
||||||
|
{
|
||||||
|
const char *reason= online_alter_check_supported(thd, alter_info, table,
|
||||||
|
new_table,
|
||||||
|
&online);
|
||||||
|
if (reason &&
|
||||||
|
alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_NONE)
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(!online);
|
||||||
|
my_error(ER_ALTER_OPERATION_NOT_SUPPORTED_REASON, MYF(0),
|
||||||
|
"LOCK=NONE", reason, "LOCK=SHARED");
|
||||||
|
goto err_new_table_cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Note: In case of MERGE table, we do not attach children. We do not
|
Note: In case of MERGE table, we do not attach children. We do not
|
||||||
copy data for MERGE tables. Only the children have data.
|
copy data for MERGE tables. Only the children have data.
|
||||||
|
@@ -1174,7 +1174,7 @@ ulonglong ha_connect::table_flags() const
|
|||||||
// HA_FAST_KEY_READ | causes error when sorting (???)
|
// HA_FAST_KEY_READ | causes error when sorting (???)
|
||||||
HA_NO_TRANSACTIONS | HA_DUPLICATE_KEY_NOT_IN_ORDER |
|
HA_NO_TRANSACTIONS | HA_DUPLICATE_KEY_NOT_IN_ORDER |
|
||||||
HA_NO_BLOBS | HA_MUST_USE_TABLE_CONDITION_PUSHDOWN |
|
HA_NO_BLOBS | HA_MUST_USE_TABLE_CONDITION_PUSHDOWN |
|
||||||
HA_REUSES_FILE_NAMES;
|
HA_REUSES_FILE_NAMES | HA_NO_ONLINE_ALTER;
|
||||||
ha_connect *hp= (ha_connect*)this;
|
ha_connect *hp= (ha_connect*)this;
|
||||||
PTOS pos= hp->GetTableOptionStruct();
|
PTOS pos= hp->GetTableOptionStruct();
|
||||||
|
|
||||||
|
@@ -272,3 +272,11 @@ line
|
|||||||
2Two
|
2Two
|
||||||
3Three
|
3Three
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
|
# MDEV-31777 ER_GET_ERRNO upon online alter with concurrent DML on
|
||||||
|
# CONNECT table
|
||||||
|
CREATE TABLE t (a INT) ENGINE=CONNECT TABLE_TYPE=DOS;
|
||||||
|
Warnings:
|
||||||
|
Warning 1105 No file name. Table will use t.dos
|
||||||
|
ALTER TABLE t FORCE, ALGORITHM=COPY, LOCK=NONE;
|
||||||
|
ERROR 0A000: LOCK=NONE is not supported. Reason: CONNECT. Try LOCK=SHARED
|
||||||
|
DROP TABLE t;
|
||||||
|
@@ -133,6 +133,14 @@ SELECT * from t2;
|
|||||||
|
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
|
|
||||||
|
|
||||||
|
--echo # MDEV-31777 ER_GET_ERRNO upon online alter with concurrent DML on
|
||||||
|
--echo # CONNECT table
|
||||||
|
CREATE TABLE t (a INT) ENGINE=CONNECT TABLE_TYPE=DOS;
|
||||||
|
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||||
|
ALTER TABLE t FORCE, ALGORITHM=COPY, LOCK=NONE;
|
||||||
|
DROP TABLE t;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Clean up
|
# Clean up
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user