Commit c8408b33 authored by Jan Lindström's avatar Jan Lindström Committed by Julius Goryavsky

MDEV-27861: Creating partitioned tables should not be allowed with...

MDEV-27861: Creating partitioned tables should not be allowed with wsrep_osu_method=TOI and wsrep_strict_ddl=ON

Problem was incorrect handling of partitioned tables,
because db_type == DB_TYPE_PARTITION_DB
wsrep_should_replicate_ddl incorrectly marked
DDL as not replicatable. However, in partitioned
tables we should check implementing storage engine
from table->file->partition_ht() if available because
if partition handler is InnoDB all DDL should be allowed
even with wsrep_strict_ddl. For other storage engines
DDL should not be allowed and error should be issued.

This is 10.6 version of the fix.
Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
parent d773fab7
connection node_2;
connection node_1;
call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table.*");
# wsrep-mode= DEFAULT
SET GLOBAL wsrep_mode = "";
SELECT @@wsrep_mode;
@@wsrep_mode
CREATE OR REPLACE TABLE t1 (v1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB
PARTITION BY KEY (v1)
PARTITIONS 2;
CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM
PARTITION BY KEY (v1)
PARTITIONS 2;
ALTER TABLE t1 ADD COLUMN v2 int;
ALTER TABLE t2 ADD COLUMN v2 int;
INSERT INTO t1 VALUES (1,1),(2,2);
INSERT INTO t2 VALUES (1,1),(2,2);
ALTER TABLE t1 ADD COLUMN v3 int, ENGINE=MyISAM;
ALTER TABLE t2 ADD COLUMN v3 int, ENGINE=Aria;
UPDATE t1 SET v3 = 3;
UPDATE t2 SET v3 = 3;
CREATE INDEX xx1 ON t1(v2);
CREATE INDEX xx2 ON t2(v2);
DROP INDEX xx1 ON t1;
DROP INDEX xx2 ON t2;
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
RENAME TABLE t1 TO t1_v2;
RENAME TABLE t2 TO t2_v2;
CREATE VIEW x1 AS SELECT * FROM t1_v2;
CREATE VIEW x2 AS SELECT * FROM t2_v2;
CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t1
AFTER INSERT ON t1_v2 FOR EACH ROW
UPDATE t1_v2 SET t1_v2.v3 = t1_v2.v3+1;
CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t2
AFTER INSERT ON t2_v2 FOR EACH ROW
UPDATE t2_v2 SET t2_v2.v3 = t2_v2.v3+1;
connection node_2;
SHOW CREATE TABLE t1_v2;
Table Create Table
t1_v2 CREATE TABLE `t1_v2` (
`v1` int(11) NOT NULL,
`v2` int(11) DEFAULT NULL,
`v3` int(11) DEFAULT NULL,
PRIMARY KEY (`v1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`v1`)
PARTITIONS 2
SHOW CREATE TABLE t2_v2;
Table Create Table
t2_v2 CREATE TABLE `t2_v2` (
`v1` int(11) NOT NULL,
`v2` int(11) DEFAULT NULL,
`v3` int(11) DEFAULT NULL,
PRIMARY KEY (`v1`)
) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`v1`)
PARTITIONS 2
SHOW CREATE VIEW x1;
View Create View character_set_client collation_connection
x1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `x1` AS select `t1_v2`.`v1` AS `v1`,`t1_v2`.`v2` AS `v2`,`t1_v2`.`v3` AS `v3` from `t1_v2` latin1 latin1_swedish_ci
SHOW CREATE VIEW x2;
View Create View character_set_client collation_connection
x2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `x2` AS select `t2_v2`.`v1` AS `v1`,`t2_v2`.`v2` AS `v2`,`t2_v2`.`v3` AS `v3` from `t2_v2` latin1 latin1_swedish_ci
SELECT * FROM t1_v2;
v1 v2 v3
SELECT * FROM t2_v2;
v1 v2 v3
connection node_1;
DROP VIEW x1;
DROP VIEW x2;
DROP TRIGGER increment_before_t1;
DROP TRIGGER increment_before_t2;
DROP TABLE t1_v2;
DROP TABLE t2_v2;
SET GLOBAL wsrep_mode = "";
CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM
PARTITION BY KEY (v1)
PARTITIONS 2;
# wsrep-mode= STRICT_REPLICATION
SET GLOBAL wsrep_mode = "STRICT_REPLICATION";
SELECT @@wsrep_mode;
@@wsrep_mode
STRICT_REPLICATION
CREATE OR REPLACE TABLE t1 (v1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB
PARTITION BY KEY (v1)
PARTITIONS 2;
CREATE OR REPLACE TABLE t3 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM
PARTITION BY KEY (v1)
PARTITIONS 2;
ERROR HY000: Galera replication not supported
ALTER TABLE t1 ADD COLUMN v2 int;
ALTER TABLE t2 ADD COLUMN v2 int;
ERROR HY000: Galera replication not supported
INSERT INTO t1 VALUES (1,1),(2,2);
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table 'test'.'t1' is not supported in Galera
INSERT INTO t2 VALUES (1),(2);
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table 'test'.'t2' is not supported in Galera
ALTER TABLE t1 ADD COLUMN v3 int, ENGINE=MyISAM;
ERROR HY000: Galera replication not supported
ALTER TABLE t2 ADD COLUMN v3 int, ENGINE=Aria;
ERROR HY000: Galera replication not supported
UPDATE t1 SET v2 = v2 + 3;
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table 'test'.'t1' is not supported in Galera
UPDATE t2 SET v1 = v1 + 3;
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table 'test'.'t2' is not supported in Galera
CREATE INDEX xx1 ON t1(v2);
CREATE INDEX xx2 ON t2(v2);
ERROR HY000: Galera replication not supported
DROP INDEX xx1 ON t1;
DROP INDEX xx2 on t2;
ERROR HY000: Galera replication not supported
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
ERROR HY000: Galera replication not supported
RENAME TABLE t1 TO t1_v2;
RENAME TABLE t2 TO t2_v2;
RENAME TABLE t2_v2 TO t2;
CREATE VIEW x1 AS SELECT * FROM t1_v2;
CREATE VIEW x2 AS SELECT * FROM t2;
ERROR HY000: Galera replication not supported
CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t1
AFTER INSERT ON t1_v2 FOR EACH ROW
UPDATE t1_v2 SET t1_v2.v2 = t1_v2.v2+1;
CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t2
AFTER INSERT ON t2 FOR EACH ROW
UPDATE t2 SET t2.v1 = t2.v1+1;
ERROR HY000: Galera replication not supported
connection node_2;
SHOW CREATE TABLE t1_v2;
Table Create Table
t1_v2 CREATE TABLE `t1_v2` (
`v1` int(11) NOT NULL,
`v2` int(11) DEFAULT NULL,
PRIMARY KEY (`v1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`v1`)
PARTITIONS 2
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`v1` int(11) NOT NULL,
`v2` int(11) DEFAULT NULL,
PRIMARY KEY (`v1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`v1`)
PARTITIONS 2
SHOW CREATE VIEW x1;
View Create View character_set_client collation_connection
x1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `x1` AS select `t1_v2`.`v1` AS `v1`,`t1_v2`.`v2` AS `v2` from `t1_v2` latin1 latin1_swedish_ci
SELECT * FROM t1_v2;
v1 v2
SELECT * FROM t2;
v1 v2
connection node_1;
DROP VIEW x1;
DROP TRIGGER increment_before_t1;
DROP TABLE t1_v2;
DROP TABLE t2;
SET GLOBAL wsrep_mode = "";
CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM
PARTITION BY KEY (v1)
PARTITIONS 2;
# wsrep-mode= STRICT_REPLICATION
SET GLOBAL wsrep_mode = "STRICT_REPLICATION";
SELECT @@wsrep_mode;
@@wsrep_mode
STRICT_REPLICATION
ALTER TABLE t2 ENGINE=InnoDB;
DROP TABLE t2;
SET GLOBAL wsrep_mode = "";
......@@ -32,6 +32,8 @@ SHOW WARNINGS;
Level Code Message
Error 4165 Galera replication not supported
Warning 1031 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM not supported.
Error 4165 Galera replication not supported
Warning 1031 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM not supported.
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
......
--source include/galera_cluster.inc
--source include/have_partition.inc
--source include/have_aria.inc
call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table.*");
--echo # wsrep-mode= DEFAULT
SET GLOBAL wsrep_mode = "";
SELECT @@wsrep_mode;
CREATE OR REPLACE TABLE t1 (v1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB
PARTITION BY KEY (v1)
PARTITIONS 2;
CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM
PARTITION BY KEY (v1)
PARTITIONS 2;
ALTER TABLE t1 ADD COLUMN v2 int;
ALTER TABLE t2 ADD COLUMN v2 int;
INSERT INTO t1 VALUES (1,1),(2,2);
INSERT INTO t2 VALUES (1,1),(2,2);
ALTER TABLE t1 ADD COLUMN v3 int, ENGINE=MyISAM;
ALTER TABLE t2 ADD COLUMN v3 int, ENGINE=Aria;
UPDATE t1 SET v3 = 3;
UPDATE t2 SET v3 = 3;
CREATE INDEX xx1 ON t1(v2);
CREATE INDEX xx2 ON t2(v2);
DROP INDEX xx1 ON t1;
DROP INDEX xx2 ON t2;
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
RENAME TABLE t1 TO t1_v2;
RENAME TABLE t2 TO t2_v2;
CREATE VIEW x1 AS SELECT * FROM t1_v2;
CREATE VIEW x2 AS SELECT * FROM t2_v2;
CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t1
AFTER INSERT ON t1_v2 FOR EACH ROW
UPDATE t1_v2 SET t1_v2.v3 = t1_v2.v3+1;
CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t2
AFTER INSERT ON t2_v2 FOR EACH ROW
UPDATE t2_v2 SET t2_v2.v3 = t2_v2.v3+1;
--connection node_2
SHOW CREATE TABLE t1_v2;
SHOW CREATE TABLE t2_v2;
SHOW CREATE VIEW x1;
SHOW CREATE VIEW x2;
SELECT * FROM t1_v2;
SELECT * FROM t2_v2;
--connection node_1
DROP VIEW x1;
DROP VIEW x2;
DROP TRIGGER increment_before_t1;
DROP TRIGGER increment_before_t2;
DROP TABLE t1_v2;
DROP TABLE t2_v2;
SET GLOBAL wsrep_mode = "";
CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM
PARTITION BY KEY (v1)
PARTITIONS 2;
--echo # wsrep-mode= STRICT_REPLICATION
SET GLOBAL wsrep_mode = "STRICT_REPLICATION";
SELECT @@wsrep_mode;
CREATE OR REPLACE TABLE t1 (v1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB
PARTITION BY KEY (v1)
PARTITIONS 2;
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
CREATE OR REPLACE TABLE t3 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM
PARTITION BY KEY (v1)
PARTITIONS 2;
ALTER TABLE t1 ADD COLUMN v2 int;
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
ALTER TABLE t2 ADD COLUMN v2 int;
INSERT INTO t1 VALUES (1,1),(2,2);
INSERT INTO t2 VALUES (1),(2);
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
ALTER TABLE t1 ADD COLUMN v3 int, ENGINE=MyISAM;
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
ALTER TABLE t2 ADD COLUMN v3 int, ENGINE=Aria;
UPDATE t1 SET v2 = v2 + 3;
UPDATE t2 SET v1 = v1 + 3;
CREATE INDEX xx1 ON t1(v2);
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
CREATE INDEX xx2 ON t2(v2);
DROP INDEX xx1 ON t1;
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
DROP INDEX xx2 on t2;
TRUNCATE TABLE t1;
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
TRUNCATE TABLE t2;
# At the moment can't restrict rename
RENAME TABLE t1 TO t1_v2;
RENAME TABLE t2 TO t2_v2;
RENAME TABLE t2_v2 TO t2;
CREATE VIEW x1 AS SELECT * FROM t1_v2;
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
CREATE VIEW x2 AS SELECT * FROM t2;
CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t1
AFTER INSERT ON t1_v2 FOR EACH ROW
UPDATE t1_v2 SET t1_v2.v2 = t1_v2.v2+1;
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t2
AFTER INSERT ON t2 FOR EACH ROW
UPDATE t2 SET t2.v1 = t2.v1+1;
--connection node_2
SHOW CREATE TABLE t1_v2;
SHOW CREATE TABLE t2;
SHOW CREATE VIEW x1;
SELECT * FROM t1_v2;
SELECT * FROM t2;
--connection node_1
DROP VIEW x1;
DROP TRIGGER increment_before_t1;
DROP TABLE t1_v2;
# We allow dropping table
DROP TABLE t2;
SET GLOBAL wsrep_mode = "";
CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM
PARTITION BY KEY (v1)
PARTITIONS 2;
--echo # wsrep-mode= STRICT_REPLICATION
SET GLOBAL wsrep_mode = "STRICT_REPLICATION";
SELECT @@wsrep_mode;
ALTER TABLE t2 ENGINE=InnoDB;
DROP TABLE t2;
SET GLOBAL wsrep_mode = "";
......@@ -1445,12 +1445,19 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables,
else
{
#ifdef WITH_WSREP
if (WSREP(thd) && hton && !wsrep_should_replicate_ddl(thd, hton))
if (WSREP(thd) && hton)
{
error= 1;
goto err;
handlerton *ht= hton;
// For partitioned tables resolve underlying handlerton
if (table->table && table->table->file->partition_ht())
ht= table->table->file->partition_ht();
if (!wsrep_should_replicate_ddl(thd, ht))
{
error= 1;
goto err;
}
}
#endif
#endif /* WITH_WSREP */
if (thd->locked_tables_mode == LTM_LOCK_TABLES ||
thd->locked_tables_mode == LTM_PRELOCKED_UNDER_LOCK_TABLES)
......@@ -9778,10 +9785,21 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
if (WSREP(thd) && table &&
(thd->lex->sql_command == SQLCOM_ALTER_TABLE ||
thd->lex->sql_command == SQLCOM_CREATE_INDEX ||
thd->lex->sql_command == SQLCOM_DROP_INDEX) &&
!wsrep_should_replicate_ddl(thd, table->s->db_type()))
DBUG_RETURN(true);
#endif /* WITH_WSREP */
thd->lex->sql_command == SQLCOM_DROP_INDEX))
{
handlerton *ht= table->s->db_type();
// If alter used ENGINE= we use that
if (create_info->used_fields & HA_CREATE_USED_ENGINE)
ht= create_info->db_type;
// For partitioned tables resolve underlying handlerton
else if (table->file->partition_ht())
ht= table->file->partition_ht();
if (!wsrep_should_replicate_ddl(thd, ht))
DBUG_RETURN(true);
}
#endif
DEBUG_SYNC(thd, "alter_table_after_open_tables");
......
......@@ -622,7 +622,12 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
table= tables->table;
#ifdef WITH_WSREP
if (WSREP(thd) && !wsrep_should_replicate_ddl(thd, table->s->db_type()))
/* Resolve should we replicate creation of the trigger.
It should be replicated if storage engine(s) associated
to trigger are replicated by Galera.
*/
if (WSREP(thd) &&
!wsrep_should_replicate_ddl_iterate(thd, tables))
goto end;
#endif
......
......@@ -336,8 +336,15 @@ bool Sql_cmd_truncate_table::lock_table(THD *thd, TABLE_LIST *table_ref,
versioned= table->versioned();
hton= table->file->ht;
#ifdef WITH_WSREP
/* Resolve should we replicate truncate. It should
be replicated if storage engine(s) associated
are replicated by Galera. If this is partitioned
table we need to find out default partition
handlerton.
*/
if (WSREP(thd) &&
!wsrep_should_replicate_ddl(thd, hton))
!wsrep_should_replicate_ddl(thd, table->file->partition_ht() ?
table->file->partition_ht() : hton))
DBUG_RETURN(TRUE);
#endif
......@@ -359,12 +366,22 @@ bool Sql_cmd_truncate_table::lock_table(THD *thd, TABLE_LIST *table_ref,
sequence= share->table_type == TABLE_TYPE_SEQUENCE;
hton= share->db_type();
#ifdef WITH_WSREP
if (WSREP(thd) &&
hton != view_pseudo_hton &&
!wsrep_should_replicate_ddl(thd, hton))
if (WSREP(thd) && hton != view_pseudo_hton)
{
tdc_release_share(share);
DBUG_RETURN(TRUE);
/* Resolve should we replicate truncate. It should
be replicated if storage engine(s) associated
are replicated by Galera. If this is partitioned
table we need to find out default partition
handlerton.
*/
const handlerton *ht= share->default_part_plugin ?
plugin_hton(share->default_part_plugin) : hton;
if (ht && !wsrep_should_replicate_ddl(thd, ht))
{
tdc_release_share(share);
DBUG_RETURN(TRUE);
}
}
#endif
......
......@@ -452,8 +452,6 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
lex->link_first_table_back(view, link_to_local);
view->open_type= OT_BASE_ONLY;
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
/*
ignore lock specs for CREATE statement
*/
......@@ -471,13 +469,20 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
}
#ifdef WITH_WSREP
if(!wsrep_should_replicate_ddl_iterate(thd, static_cast<const TABLE_LIST *>(tables)))
/* Resolve should we replicate creation of the view.
It should be replicated if storage engine(s) associated
to view are replicated by Galera.
*/
if (WSREP(thd) &&
!wsrep_should_replicate_ddl_iterate(thd, tables))
{
res= TRUE;
goto err_no_relink;
}
#endif
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
view= lex->unlink_first_table(&link_to_local);
if (check_db_dir_existence(view->db.str))
......
/* Copyright (c) 2008, 2023 Codership Oy <http://www.codership.com>
Copyright (c) 2020, 2022, MariaDB
/* Copyright (c) 2008, 2024, Codership Oy <http://www.codership.com>
Copyright (c) 2020, 2024, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -2370,29 +2370,22 @@ static int wsrep_drop_table_query(THD* thd, uchar** buf, size_t* buf_len)
/* Forward declarations. */
int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len);
bool wsrep_should_replicate_ddl_iterate(THD* thd, const TABLE_LIST* table_list)
{
if (WSREP(thd))
{
for (const TABLE_LIST* it= table_list; it; it= it->next_global)
{
if (it->table &&
!wsrep_should_replicate_ddl(thd, it->table->s->db_type()))
return false;
}
}
return true;
}
/*! Should DDL be replicated by Galera
*
* @param thd thread handle
* @param hton real storage engine handlerton
*
* @retval true if we should replicate DDL, false if not */
bool wsrep_should_replicate_ddl(THD* thd, const handlerton *hton)
{
if (!wsrep_check_mode(WSREP_MODE_STRICT_REPLICATION))
return true;
if (!hton)
return true;
DBUG_ASSERT(hton != nullptr);
const enum legacy_db_type db_type= hton->db_type;
switch (hton->db_type)
switch (db_type)
{
case DB_TYPE_INNODB:
return true;
......@@ -2409,6 +2402,11 @@ bool wsrep_should_replicate_ddl(THD* thd, const handlerton *hton)
else
WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd));
break;
case DB_TYPE_PARTITION_DB:
/* In most cases this means we could not find out
table->file->partition_ht() */
return true;
break;
default:
WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd));
break;
......@@ -2423,6 +2421,27 @@ bool wsrep_should_replicate_ddl(THD* thd, const handlerton *hton)
ha_resolve_storage_engine_name(hton));
return false;
}
bool wsrep_should_replicate_ddl_iterate(THD* thd, const TABLE_LIST* table_list)
{
for (const TABLE_LIST* it= table_list; it; it= it->next_global)
{
if (it->table)
{
/* If this is partitioned table we need to find out
implementing storage engine handlerton.
*/
const handlerton *ht= it->table->file->partition_ht() ?
it->table->file->partition_ht() :
it->table->s->db_type();
if (!wsrep_should_replicate_ddl(thd, ht))
return false;
}
}
return true;
}
/*
Decide if statement should run in TOI.
......
......@@ -356,7 +356,7 @@ int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_,
const wsrep::key_array *fk_tables= nullptr,
const HA_CREATE_INFO* create_info= nullptr);
bool wsrep_should_replicate_ddl(THD* thd, const handlerton *db_type);
bool wsrep_should_replicate_ddl(THD* thd, const handlerton *hton);
bool wsrep_should_replicate_ddl_iterate(THD* thd, const TABLE_LIST* table_list);
void wsrep_to_isolation_end(THD *thd);
......@@ -608,7 +608,6 @@ void wsrep_ready_set(bool ready_value);
#define wsrep_thr_deinit() do {} while(0)
#define wsrep_init_globals() do {} while(0)
#define wsrep_create_appliers(X) do {} while(0)
#define wsrep_should_replicate_ddl(X,Y) (1)
#define wsrep_cluster_address_exists() (false)
#define WSREP_MYSQL_DB (0)
#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) do { } while(0)
......
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