1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-35748 : Attempting to create a CONNECT engine Table results in non-InnoDB sequences in Galera cluster error

Problem was incorrect condition on wsrep_check_sequence
when ENGINE!=InnoDB.

Fix is not use DB_TYPE_XXX because it is not correct
on dynamic storage engines. Instead used storage engine
name is looked from thd->lex->m_sql_cmd->option_storage_engine_name.

For CREATE TABLE allow anyting except ENGINE=SEQUENCE.
For CREATE SEQUENCE only ENGINE=InnoDB is supported.
For ALTER TABLE if original table contains sequence information
only ENGINE=InnoDB is supported.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
This commit is contained in:
Jan Lindström
2025-01-14 14:29:29 +02:00
committed by Julius Goryavsky
parent 47908d3f77
commit 3f5b6a9837
6 changed files with 79 additions and 3 deletions

View File

@@ -5708,9 +5708,26 @@ bool wsrep_check_sequence(THD* thd,
// In Galera cluster we support only InnoDB sequences
if (db_type != DB_TYPE_INNODB)
{
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
"non-InnoDB sequences in Galera cluster");
return(true);
// Currently any dynamic storage engine is not possible to identify
// using DB_TYPE_XXXX and ENGINE=SEQUENCE is one of them.
// Therefore, we get storage engine name from lex.
const LEX_CSTRING *tb_name= thd->lex->m_sql_cmd->option_storage_engine_name()->name();
// (1) CREATE TABLE ... ENGINE=SEQUENCE OR
// (2) ALTER TABLE ... ENGINE= OR
// Note in ALTER TABLE table->s->sequence != nullptr
// (3) CREATE SEQUENCE ... ENGINE=
if ((thd->lex->sql_command == SQLCOM_CREATE_TABLE &&
lex_string_eq(tb_name, STRING_WITH_LEN("SEQUENCE"))) ||
(thd->lex->sql_command == SQLCOM_ALTER_TABLE) ||
(thd->lex->sql_command == SQLCOM_CREATE_SEQUENCE))
{
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
"non-InnoDB sequences in Galera cluster");
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_NOT_SUPPORTED_YET,
"ENGINE=%s not supported by Galera", tb_name->str);
return(true);
}
}
// In Galera cluster it is best to use INCREMENT BY 0 with CACHE