Skip to content

Commit ce415be

Browse files
author
Jan Lindström
committed
MDEV-25549 : Assertion `*new_engine' failed in bool check_engine(THD*, const char*, const char*, HA_CREATE_INFO*)
In Galera case we call check_engine that could set create_info->db_type to NULL e.g. if TEMPORARY is not supported by storage engine. Thus, we need to restore it after that call because it is needed later on mysql_create_table that will also call check_engine.
1 parent c430f61 commit ce415be

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

sql/sql_table.cc

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright (c) 2000, 2019, Oracle and/or its affiliates.
3-
Copyright (c) 2010, 2020, MariaDB
3+
Copyright (c) 2010, 2022, MariaDB
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -11036,14 +11036,23 @@ bool Sql_cmd_create_table::execute(THD *thd)
1103611036
tables, like mysql replication does. Also check if the requested
1103711037
engine is allowed/supported.
1103811038
*/
11039-
if (WSREP(thd) &&
11040-
!check_engine(thd, create_table->db, create_table->table_name,
11041-
&create_info) &&
11042-
(!thd->is_current_stmt_binlog_format_row() ||
11043-
!create_info.tmp_table()))
11039+
#ifdef WITH_WSREP
11040+
if (WSREP(thd))
1104411041
{
11045-
WSREP_TO_ISOLATION_BEGIN(create_table->db, create_table->table_name, NULL)
11042+
handlerton *orig_ht= create_info.db_type;
11043+
if (!check_engine(thd, create_table->db, create_table->table_name,
11044+
&create_info) &&
11045+
(!thd->is_current_stmt_binlog_format_row() ||
11046+
!create_info.tmp_table()))
11047+
{
11048+
WSREP_TO_ISOLATION_BEGIN(create_table->db, create_table->table_name, NULL)
11049+
}
11050+
// check_engine will set db_type to NULL if e.g. TEMPORARY is
11051+
// not supported by the storage engine, this case is checked
11052+
// again in mysql_create_table
11053+
create_info.db_type= orig_ht;
1104611054
}
11055+
#endif /* WITH_WSREP */
1104711056
/* Regular CREATE TABLE */
1104811057
res= mysql_create_table(thd, create_table, &create_info, &alter_info);
1104911058
}

0 commit comments

Comments
 (0)