Commit b3df194e authored by Jan Lindström's avatar Jan Lindström

MDEV-24833 : Signal 11 on wsrep_can_run_in_toi at wsrep_mysqld.cc:1994

Problem was that when engine substitution is allowd (e.g. sql_mode='')
we must also check db_type. Additionally, we did not resolve
default storage engine on that case and used that to check is
TOI possible or not.
parent 7fb528d7
connection node_2;
connection node_1;
SET sql_mode='';
CREATE TABLE t3 (c1 VARCHAR(10));
ALTER TABLE t3 ENGINE=NonExistentEngine;
Warnings:
Warning 1286 Unknown storage engine 'NonExistentEngine'
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`c1` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
INSERT INTO t3 values (1);
SET sql_mode=default;
ALTER TABLE t3 engine=innodbCLUSTER;
ERROR 42000: Unknown storage engine 'innodbCLUSTER'
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`c1` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t3;
SET sql_mode='';
SET SESSION default_storage_engine=MyISAM;
SELECT @@default_storage_engine;
@@default_storage_engine
MyISAM
SET GLOBAL wsrep_replicate_myisam=OFF;
SET GLOBAL wsrep_strict_ddl=ON;
CREATE TABLE t3 (c1 VARCHAR(10)) ENGINE=InnoDB;
ALTER TABLE t3 ENGINE=NonExistentEngine;
ERROR HY000: DDL-statement is forbidden as table storage engine does not support Galera replication
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`c1` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t3;
--source include/galera_cluster.inc
#
# MDEV-24833 : Signal 11 on wsrep_can_run_in_toi at wsrep_mysqld.cc:1994
#
SET sql_mode='';
CREATE TABLE t3 (c1 VARCHAR(10));
ALTER TABLE t3 ENGINE=NonExistentEngine;
SHOW CREATE TABLE t3;
INSERT INTO t3 values (1);
SET sql_mode=default;
--error ER_UNKNOWN_STORAGE_ENGINE
ALTER TABLE t3 engine=innodbCLUSTER;
SHOW CREATE TABLE t3;
DROP TABLE t3;
#
# Test default_storage_engine to engine that is not supported by Galera
#
SET sql_mode='';
SET SESSION default_storage_engine=MyISAM;
SELECT @@default_storage_engine;
SET GLOBAL wsrep_replicate_myisam=OFF;
SET GLOBAL wsrep_strict_ddl=ON;
CREATE TABLE t3 (c1 VARCHAR(10)) ENGINE=InnoDB;
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
ALTER TABLE t3 ENGINE=NonExistentEngine;
SHOW CREATE TABLE t3;
DROP TABLE t3;
--disable_query_log
SET GLOBAL sql_mode=default;
SET GLOBAL default_storage_engine=default;
SET GLOBAL wsrep_replicate_myisam=default;
SET GLOBAL wsrep_strict_ddl=default;
--enable_query_log
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "sp_head.h" #include "sp_head.h"
#include "sql_show.h" #include "sql_show.h"
#include "sp.h" #include "sp.h"
#include "handler.h"
#include "wsrep_priv.h" #include "wsrep_priv.h"
#include "wsrep_thd.h" #include "wsrep_thd.h"
#include "wsrep_sst.h" #include "wsrep_sst.h"
...@@ -1991,10 +1992,23 @@ bool wsrep_can_run_in_toi(THD *thd, const char *db, const char *table, ...@@ -1991,10 +1992,23 @@ bool wsrep_can_run_in_toi(THD *thd, const char *db, const char *table,
return true; return true;
break; break;
case SQLCOM_ALTER_TABLE: case SQLCOM_ALTER_TABLE:
if (create_info && {
!wsrep_should_replicate_ddl(thd, create_info->db_type->db_type)) if (create_info)
return false; {
/* fallthrough */ enum legacy_db_type db_type;
if (create_info->db_type)
db_type= create_info->db_type->db_type;
else
{
const handlerton *hton= ha_default_handlerton(thd);
db_type= hton->db_type;
}
if (!wsrep_should_replicate_ddl(thd, db_type))
return false;
}
}
/* fallthrough */
default: default:
if (table && !thd->find_temporary_table(db, table)) if (table && !thd->find_temporary_table(db, table))
{ {
......
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