1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-31777 ER_GET_ERRNO upon online alter on CONNECT table

Forbid Online for CONNECT.
This commit is contained in:
Nikita Malyavin
2023-07-28 17:13:55 +04:00
committed by Sergei Golubchik
parent 44ca37ef17
commit 30c965f866
5 changed files with 42 additions and 17 deletions

View File

@ -9908,7 +9908,8 @@ bool online_alter_check_autoinc(const THD *thd, const Alter_info *alter_info,
static
const char *online_alter_check_supported(const THD *thd,
const Alter_info *alter_info,
const TABLE *table, bool *online)
const TABLE *table,
const TABLE *new_table, bool *online)
{
DBUG_ASSERT(*online);
@ -9916,6 +9917,10 @@ const char *online_alter_check_supported(const THD *thd,
if (!*online)
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;
if (!*online)
return "SEQUENCE";
@ -11023,20 +11028,6 @@ do_continue:;
if (fk_prepare_copy_alter_table(thd, table, alter_info, &alter_ctx))
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 EXCLUSIVE lock is requested, upgrade already.
@ -11108,6 +11099,21 @@ do_continue:;
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
copy data for MERGE tables. Only the children have data.