From 47908d3f7762d334803045c2d66501daefd3bd9e Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 29 Jan 2025 00:43:40 +0400 Subject: [PATCH 1/9] MDEV-32619 Fix setting SRID with ST_*FromWKB(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit second argument is handled in Item_func_geometry_from_wkb::val_str. contributed by Maximilian Krög --- mysql-test/main/gis.result | 27 +++++++++++++++++++++++++++ mysql-test/main/gis.test | 26 ++++++++++++++++++++++++++ sql/item_geofunc.cc | 9 +++++++++ 3 files changed, 62 insertions(+) diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result index 196758b1e94..5fa310e93ed 100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@ -5474,4 +5474,31 @@ INSERT INTO t VALUES (1,POINT(0,0)),(2,POINT(0,0)); SELECT NTH_VALUE(a,b) OVER () FROM t; ERROR HY000: Illegal parameter data types point and bigint for operation '-' DROP TABLE t; +# +# MDEV-32619 Settng SRID on geometry with ST_*FromWKKB(g, srid) +# +SELECT +ST_SRID(g1), +ST_SRID(ST_GeomFromWKB(g1, 4326)), +ST_SRID(ST_GeomFromWKB(g1)), +ST_AsText(g1), +ST_SRID(ST_PointFromWKB(g2, 4326)), +ST_SRID(g2), +ST_SRID(ST_LineStringFromWKB(g3, 3)), +ST_SRID(ST_PolygonFromWKB(g4, 4)), +ST_SRID(ST_MultiPointFromWKB(g5, 5)), +ST_SRID(ST_MultiLineStringFromWKB(g6, 6)), +ST_SRID(ST_MultiPolygonFromWKB(g7, 7)) +FROM ( +SELECT +POINT(1, 2) AS g1, +POINT(4, 3) AS g2, +LINESTRING(POINT(4, 3), POINT(4, 4)) AS g3, +POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4, 3))) AS g4, +MULTIPOINT(POINT(4, 3)) AS g5, +MULTILINESTRING(LINESTRING(POINT(4, 3), POINT(4, 4))) AS g6, +MULTIPOLYGON(POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4, 3)))) AS g7 +) AS t; +ST_SRID(g1) ST_SRID(ST_GeomFromWKB(g1, 4326)) ST_SRID(ST_GeomFromWKB(g1)) ST_AsText(g1) ST_SRID(ST_PointFromWKB(g2, 4326)) ST_SRID(g2) ST_SRID(ST_LineStringFromWKB(g3, 3)) ST_SRID(ST_PolygonFromWKB(g4, 4)) ST_SRID(ST_MultiPointFromWKB(g5, 5)) ST_SRID(ST_MultiLineStringFromWKB(g6, 6)) ST_SRID(ST_MultiPolygonFromWKB(g7, 7)) +0 4326 0 POINT(1 2) 4326 0 3 4 5 6 7 # End of 10.5 tests diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test index 6dc932b4f8d..03c1df94d1f 100644 --- a/mysql-test/main/gis.test +++ b/mysql-test/main/gis.test @@ -3482,4 +3482,30 @@ INSERT INTO t VALUES (1,POINT(0,0)),(2,POINT(0,0)); SELECT NTH_VALUE(a,b) OVER () FROM t; DROP TABLE t; +--echo # +--echo # MDEV-32619 Settng SRID on geometry with ST_*FromWKKB(g, srid) +--echo # +SELECT + ST_SRID(g1), + ST_SRID(ST_GeomFromWKB(g1, 4326)), + ST_SRID(ST_GeomFromWKB(g1)), + ST_AsText(g1), + ST_SRID(ST_PointFromWKB(g2, 4326)), + ST_SRID(g2), + ST_SRID(ST_LineStringFromWKB(g3, 3)), + ST_SRID(ST_PolygonFromWKB(g4, 4)), + ST_SRID(ST_MultiPointFromWKB(g5, 5)), + ST_SRID(ST_MultiLineStringFromWKB(g6, 6)), + ST_SRID(ST_MultiPolygonFromWKB(g7, 7)) +FROM ( + SELECT + POINT(1, 2) AS g1, + POINT(4, 3) AS g2, + LINESTRING(POINT(4, 3), POINT(4, 4)) AS g3, + POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4, 3))) AS g4, + MULTIPOINT(POINT(4, 3)) AS g5, + MULTILINESTRING(LINESTRING(POINT(4, 3), POINT(4, 4))) AS g6, + MULTIPOLYGON(POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4, 3)))) AS g7 +) AS t; + --echo # End of 10.5 tests diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 1c364f7b31d..81cd1268f64 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -91,6 +91,15 @@ String *Item_func_geometry_from_wkb::val_str(String *str) { String *str_ret= args[0]->val_str(str); null_value= args[0]->null_value; + if (!null_value && arg_count == 2 && !args[1]->null_value) { + srid= (uint32)args[1]->val_int(); + + if (str->copy(*str_ret)) + return 0; + + int4store(str->ptr(), srid); + return str; + } return str_ret; } From f1276aa1bc8ede06ffea973d186d3b0630ffe36a Mon Sep 17 00:00:00 2001 From: Brandon Nesterenko Date: Tue, 9 Jul 2024 08:59:59 -0600 Subject: [PATCH 2/9] MDEV-26652: xa transactions binlogged in wrong order Disclaimer: This report was fixed in a previous commit with MDEV-21117, this patch only adds a test to show the presence of the fix. Prior to MDEV-21117, the ordering of the handlers in a transaction's ha_info list solely determined the order in which the handlertons commit. The binlog is supposed to commit first, and is normally placed first in the ha_list to do so; however, in multi-engine 2-phase XA transactions, the binlog can be placed second. This allowed a race-condition for other concurrent transactions to commit and binlog before the prior XA COMMIT would be written to binlog. MDEV-21117 fixed this so the binlog is specially considered to commit first, before traversing the ha_list (see commit_one_phase_2() in sql/hander.cc for this specific change in 6c39eaeb126). --- .../rpl/r/rpl_xa_2pc_multi_engine.result | 26 ++++++++ .../suite/rpl/t/rpl_xa_2pc_multi_engine.test | 63 +++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 mysql-test/suite/rpl/r/rpl_xa_2pc_multi_engine.result create mode 100644 mysql-test/suite/rpl/t/rpl_xa_2pc_multi_engine.test diff --git a/mysql-test/suite/rpl/r/rpl_xa_2pc_multi_engine.result b/mysql-test/suite/rpl/r/rpl_xa_2pc_multi_engine.result new file mode 100644 index 00000000000..9541107e62b --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_xa_2pc_multi_engine.result @@ -0,0 +1,26 @@ +include/master-slave.inc +[connection master] +connection master; +create table t1 (a int primary key, b int) engine=innodb; +insert t1 values (1,1),(3,3),(5,5),(7,7); +create table t2 (m int) engine=aria; +# Create multi-engine, two-phase XA transaction (T1) +xa start '1'; +insert t2 values (1); +update t1 set b=50 where b=5; +xa end '1'; +xa prepare '1'; +# Create T2 +connection server_1; +update t1 set b=10 where a=5; +connection master; +xa commit '1'; +connection server_1; +include/save_master_gtid.inc +# This would hang prior to MDEV-21117 +connection slave; +include/sync_with_master_gtid.inc +connection master; +drop table t1, t2; +include/rpl_end.inc +# End of rpl_xa_2pc_multi_engine.test diff --git a/mysql-test/suite/rpl/t/rpl_xa_2pc_multi_engine.test b/mysql-test/suite/rpl/t/rpl_xa_2pc_multi_engine.test new file mode 100644 index 00000000000..854935ae6a5 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_xa_2pc_multi_engine.test @@ -0,0 +1,63 @@ +# +# This test ensures binlog order is correct for multi-engine, two-phase XA +# transactions. MDEV-26652 exposed a race condition which would allow +# concurrent transactions which modify the same table record to binlog in +# the "opposite" order, i.e. what _should_ be: +# T1 XA PREPARE +# T1 XA COMMIT +# T2 +# +# was binlogged as +# T1 XA PREPARE +# T2 +# T1 XA COMMIT +# +# which would break replication. +# +# Note that the actual fix for this issue was done with MDEV-21117. +# +# References: +# MDEV-26652: xa transactions binlogged in wrong order +# MDEV-21117: refine the server binlog-based recovery for semisync +# +source include/have_binlog_format_row.inc; +source include/have_innodb.inc; +source include/master-slave.inc; + +--connection master +create table t1 (a int primary key, b int) engine=innodb; +insert t1 values (1,1),(3,3),(5,5),(7,7); +create table t2 (m int) engine=aria; + + +--echo # Create multi-engine, two-phase XA transaction (T1) +xa start '1'; +insert t2 values (1); +update t1 set b=50 where b=5; +xa end '1'; + +# Aria doesn't support XA PREPARE, so disable warnings +--disable_warnings +xa prepare '1'; +--enable_warnings + +--echo # Create T2 +--connection server_1 +--send update t1 set b=10 where a=5 + +--connection master +xa commit '1'; + +--connection server_1 +--reap +--source include/save_master_gtid.inc + +--echo # This would hang prior to MDEV-21117 +--connection slave +--source include/sync_with_master_gtid.inc + +--connection master +drop table t1, t2; + +--source include/rpl_end.inc +--echo # End of rpl_xa_2pc_multi_engine.test From 3f5b6a9837413d4a6a8526a076be5eba88a56286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 14 Jan 2025 14:29:29 +0200 Subject: [PATCH 3/9] 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 --- mysql-test/include/have_rocksdb.inc | 4 +++ mysql-test/suite/galera/r/MDEV-35748.result | 31 +++++++++++++++++++++ mysql-test/suite/galera/t/MDEV-35748.opt | 1 + mysql-test/suite/galera/t/MDEV-35748.test | 22 +++++++++++++++ sql/sql_cmd.h | 1 + sql/sql_table.cc | 23 +++++++++++++-- 6 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 mysql-test/include/have_rocksdb.inc create mode 100644 mysql-test/suite/galera/r/MDEV-35748.result create mode 100644 mysql-test/suite/galera/t/MDEV-35748.opt create mode 100644 mysql-test/suite/galera/t/MDEV-35748.test diff --git a/mysql-test/include/have_rocksdb.inc b/mysql-test/include/have_rocksdb.inc new file mode 100644 index 00000000000..bc6ec648605 --- /dev/null +++ b/mysql-test/include/have_rocksdb.inc @@ -0,0 +1,4 @@ +if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'ROCKSDB' AND support IN ('YES', 'DEFAULT', 'ENABLED')`) +{ + --skip Test requires MyRocks engine +} diff --git a/mysql-test/suite/galera/r/MDEV-35748.result b/mysql-test/suite/galera/r/MDEV-35748.result new file mode 100644 index 00000000000..fca2ab3ad40 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-35748.result @@ -0,0 +1,31 @@ +connection node_2; +connection node_1; +connection node_1; +INSTALL PLUGIN IF NOT EXISTS connect SONAME 'ha_connect'; +CREATE TABLE t1 (f INT) ENGINE=CONNECT; +Warnings: +Warning 1105 No table_type. Will be set to DOS +Warning 1105 No file name. Table will use t1.dos +CREATE TABLE t2 (f INT) ENGINE=ROCKSDB; +CREATE TABLE t3 (f INT) ENGINE=SEQUENCE; +ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster' +show warnings; +Level Code Message +Error 1235 This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster' +Note 1235 ENGINE=SEQUENCE not supported by Galera +connection node_2; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f` int(11) DEFAULT NULL +) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f` int(11) DEFAULT NULL +) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +show create table t3; +ERROR 42S02: Table 'test.t3' doesn't exist +connection node_1; +DROP TABLE t1, t2; +UNINSTALL PLUGIN IF EXISTS connect; diff --git a/mysql-test/suite/galera/t/MDEV-35748.opt b/mysql-test/suite/galera/t/MDEV-35748.opt new file mode 100644 index 00000000000..df675545bf9 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-35748.opt @@ -0,0 +1 @@ +--plugin-load=$HA_ROCKSDB_SO diff --git a/mysql-test/suite/galera/t/MDEV-35748.test b/mysql-test/suite/galera/t/MDEV-35748.test new file mode 100644 index 00000000000..0c0e83dcff7 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-35748.test @@ -0,0 +1,22 @@ +--source include/galera_cluster.inc +--source include/have_sequence.inc +--source include/have_rocksdb.inc + +--connection node_1 +INSTALL PLUGIN IF NOT EXISTS connect SONAME 'ha_connect'; + +CREATE TABLE t1 (f INT) ENGINE=CONNECT; +CREATE TABLE t2 (f INT) ENGINE=ROCKSDB; +--error ER_NOT_SUPPORTED_YET +CREATE TABLE t3 (f INT) ENGINE=SEQUENCE; +show warnings; + +--connection node_2 +show create table t1; +show create table t2; +--error ER_NO_SUCH_TABLE +show create table t3; + +--connection node_1 +DROP TABLE t1, t2; +UNINSTALL PLUGIN IF EXISTS connect; diff --git a/sql/sql_cmd.h b/sql/sql_cmd.h index ea518375226..e1ce96efb29 100644 --- a/sql/sql_cmd.h +++ b/sql/sql_cmd.h @@ -141,6 +141,7 @@ public: handlerton **ha, bool tmp_table); bool is_set() { return m_storage_engine_name.str != NULL; } + const LEX_CSTRING *name() const { return &m_storage_engine_name; } }; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 428b406c58c..6f5c1839e1f 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -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 From 7d69902d834a1c9c96df6305bcfd53336d471c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 13 Apr 2023 13:45:00 +0300 Subject: [PATCH 4/9] MDEV-29775 : Assertion `0' failed in void Protocol::end_statement() when adding data to the MyISAM table after setting wsrep_mode=replicate_myisam If wsrep_replicate_myisam=ON we allow wsrep_forced_binlog_format to be [DEFAULT|ROW]. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/r/mdev-29775.result | 44 ++++++++++++++++++ mysql-test/suite/galera/t/mdev-29775.test | 45 ++++++++++++++++++ .../r/wsrep_forced_binlog_format.result} | 0 .../wsrep/t/wsrep_forced_binlog_format.cnf | 7 +++ .../t/wsrep_forced_binlog_format.test} | 5 +- sql/sys_vars.cc | 8 +++- sql/wsrep_var.cc | 46 ++++++++++++++++++- sql/wsrep_var.h | 5 +- 8 files changed, 155 insertions(+), 5 deletions(-) create mode 100644 mysql-test/suite/galera/r/mdev-29775.result create mode 100644 mysql-test/suite/galera/t/mdev-29775.test rename mysql-test/suite/{sys_vars/r/wsrep_forced_binlog_format_basic.result => wsrep/r/wsrep_forced_binlog_format.result} (100%) create mode 100644 mysql-test/suite/wsrep/t/wsrep_forced_binlog_format.cnf rename mysql-test/suite/{sys_vars/t/wsrep_forced_binlog_format_basic.test => wsrep/t/wsrep_forced_binlog_format.test} (91%) diff --git a/mysql-test/suite/galera/r/mdev-29775.result b/mysql-test/suite/galera/r/mdev-29775.result new file mode 100644 index 00000000000..dc38f18b433 --- /dev/null +++ b/mysql-test/suite/galera/r/mdev-29775.result @@ -0,0 +1,44 @@ +connection node_2; +connection node_1; +SET GLOBAL wsrep_replicate_myisam=ON; +CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM; +INSERT INTO t VALUES(); +SELECT * FROM t; +f0 +NULL +connection node_2; +SELECT * FROM t; +f0 +NULL +DROP TABLE t; +connection node_1; +SET GLOBAL wsrep_replicate_myisam=ON; +SET GLOBAL wsrep_forced_binlog_format=ROW; +CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM; +INSERT INTO t VALUES(); +SELECT * FROM t; +f0 +NULL +connection node_2; +SELECT * FROM t; +f0 +NULL +DROP TABLE t; +connection node_1; +SET GLOBAL wsrep_forced_binlog_format=DEFAULT; +SET GLOBAL wsrep_replicate_myisam=OFF; +SET GLOBAL wsrep_forced_binlog_format=MIXED; +SET GLOBAL wsrep_replicate_myisam=ON; +ERROR HY000: wsrep_replicate_myisam=ON can't be enabled if wsrep_forced_binlog != [NONE|ROW] +SET GLOBAL wsrep_forced_binlog_format=STATEMENT; +SET GLOBAL wsrep_replicate_myisam=ON; +ERROR HY000: wsrep_replicate_myisam=ON can't be enabled if wsrep_forced_binlog != [NONE|ROW] +SET GLOBAL wsrep_forced_binlog_format=NONE; +SET GLOBAL wsrep_replicate_myisam=OFF; +SET GLOBAL wsrep_replicate_myisam=ON; +SET GLOBAL wsrep_forced_binlog_format=MIXED; +ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_replicate_myisam=ON +SET GLOBAL wsrep_forced_binlog_format=STATEMENT; +ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_replicate_myisam=ON +SET GLOBAL wsrep_forced_binlog_format=NONE; +SET GLOBAL wsrep_replicate_myisam=OFF; diff --git a/mysql-test/suite/galera/t/mdev-29775.test b/mysql-test/suite/galera/t/mdev-29775.test new file mode 100644 index 00000000000..5c6725d780d --- /dev/null +++ b/mysql-test/suite/galera/t/mdev-29775.test @@ -0,0 +1,45 @@ +--source include/galera_cluster.inc + +# +# MDEV-29775 : Assertion `0' failed in void Protocol::end_statement() when adding data to the MyISAM table after setting wsrep_mode=replicate_myisam +# +SET GLOBAL wsrep_replicate_myisam=ON; +CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM; +INSERT INTO t VALUES(); +SELECT * FROM t; +--connection node_2 +SELECT * FROM t; +DROP TABLE t; + +--connection node_1 +SET GLOBAL wsrep_replicate_myisam=ON; +SET GLOBAL wsrep_forced_binlog_format=ROW; +CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM; +INSERT INTO t VALUES(); +SELECT * FROM t; +--connection node_2 +SELECT * FROM t; +DROP TABLE t; + +--connection node_1 +SET GLOBAL wsrep_forced_binlog_format=DEFAULT; +SET GLOBAL wsrep_replicate_myisam=OFF; + +SET GLOBAL wsrep_forced_binlog_format=MIXED; +--error ER_WRONG_ARGUMENTS +SET GLOBAL wsrep_replicate_myisam=ON; +SET GLOBAL wsrep_forced_binlog_format=STATEMENT; +--error ER_WRONG_ARGUMENTS +SET GLOBAL wsrep_replicate_myisam=ON; + +SET GLOBAL wsrep_forced_binlog_format=NONE; +SET GLOBAL wsrep_replicate_myisam=OFF; + +SET GLOBAL wsrep_replicate_myisam=ON; +--error ER_WRONG_ARGUMENTS +SET GLOBAL wsrep_forced_binlog_format=MIXED; +--error ER_WRONG_ARGUMENTS +SET GLOBAL wsrep_forced_binlog_format=STATEMENT; + +SET GLOBAL wsrep_forced_binlog_format=NONE; +SET GLOBAL wsrep_replicate_myisam=OFF; diff --git a/mysql-test/suite/sys_vars/r/wsrep_forced_binlog_format_basic.result b/mysql-test/suite/wsrep/r/wsrep_forced_binlog_format.result similarity index 100% rename from mysql-test/suite/sys_vars/r/wsrep_forced_binlog_format_basic.result rename to mysql-test/suite/wsrep/r/wsrep_forced_binlog_format.result diff --git a/mysql-test/suite/wsrep/t/wsrep_forced_binlog_format.cnf b/mysql-test/suite/wsrep/t/wsrep_forced_binlog_format.cnf new file mode 100644 index 00000000000..b1c96d2614d --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep_forced_binlog_format.cnf @@ -0,0 +1,7 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=ON +wsrep-cluster-address=gcomm:// +wsrep-provider=@ENV.WSREP_PROVIDER +binlog-format=ROW diff --git a/mysql-test/suite/sys_vars/t/wsrep_forced_binlog_format_basic.test b/mysql-test/suite/wsrep/t/wsrep_forced_binlog_format.test similarity index 91% rename from mysql-test/suite/sys_vars/t/wsrep_forced_binlog_format_basic.test rename to mysql-test/suite/wsrep/t/wsrep_forced_binlog_format.test index 455034bb623..37e9c6c718e 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_forced_binlog_format_basic.test +++ b/mysql-test/suite/wsrep/t/wsrep_forced_binlog_format.test @@ -1,4 +1,7 @@ ---source include/have_wsrep.inc +--source include/have_innodb.inc +--source include/have_wsrep_provider.inc +--source include/have_binlog_format_row.inc + --echo # --echo # wsrep_forced_binlog_format diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index a2058dee224..fa258ef5de2 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -6035,7 +6035,9 @@ static const char *wsrep_binlog_format_names[]= static Sys_var_enum Sys_wsrep_forced_binlog_format( "wsrep_forced_binlog_format", "binlog format to take effect over user's choice", GLOBAL_VAR(wsrep_forced_binlog_format), CMD_LINE(REQUIRED_ARG), - wsrep_binlog_format_names, DEFAULT(BINLOG_FORMAT_UNSPEC)); + wsrep_binlog_format_names, DEFAULT(BINLOG_FORMAT_UNSPEC), + NO_MUTEX_GUARD, NOT_IN_BINLOG, + ON_CHECK(wsrep_forced_binlog_format_check)); static Sys_var_mybool Sys_wsrep_recover_datadir( "wsrep_recover", "Recover database state after crash and exit", @@ -6044,7 +6046,9 @@ static Sys_var_mybool Sys_wsrep_recover_datadir( static Sys_var_mybool Sys_wsrep_replicate_myisam( "wsrep_replicate_myisam", "To enable myisam replication", - GLOBAL_VAR(wsrep_replicate_myisam), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); + GLOBAL_VAR(wsrep_replicate_myisam), CMD_LINE(OPT_ARG), DEFAULT(FALSE), + NO_MUTEX_GUARD, NOT_IN_BINLOG, + ON_CHECK(wsrep_replicate_myisam_check)); static Sys_var_mybool Sys_wsrep_log_conflicts( "wsrep_log_conflicts", "To log multi-master conflicts", diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 0db2e15d071..61241702ef8 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -1,4 +1,4 @@ -/* Copyright 2008-2022 Codership Oy +/* Copyright 2008-2023 Codership Oy 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 @@ -1124,3 +1124,47 @@ bool wsrep_gtid_domain_id_update(sys_var* self, THD *thd, enum_var_type) wsrep_gtid_server.domain_id= wsrep_gtid_domain_id; return false; } + +bool wsrep_replicate_myisam_check(sys_var *self, THD* thd, set_var* var) +{ + bool new_replicate_myisam= (bool)var->save_result.ulonglong_value; + + if (new_replicate_myisam && !WSREP_ON_) + { + my_message(ER_WRONG_ARGUMENTS, "wsrep_replicate_myisam=ON can't be enabled " + "if wsrep_on=OFF", MYF(0)); + return true; + } + if (new_replicate_myisam && + !(wsrep_forced_binlog_format == BINLOG_FORMAT_UNSPEC || + wsrep_forced_binlog_format == BINLOG_FORMAT_ROW)) + { + my_message(ER_WRONG_ARGUMENTS, "wsrep_replicate_myisam=ON can't be enabled " + "if wsrep_forced_binlog != [NONE|ROW]", MYF(0)); + return true; + } + return false; +} + +bool wsrep_forced_binlog_format_check(sys_var *self, THD* thd, set_var* var) +{ + ulonglong new_forced_binlog_format= var->save_result.ulonglong_value; + if (new_forced_binlog_format != BINLOG_FORMAT_UNSPEC && !WSREP_ON) + { + my_message(ER_WRONG_ARGUMENTS, "wsrep_forced_binlog_format can't be set " + "if wsrep_on=OFF", MYF(0)); + return true; + } + if (!(new_forced_binlog_format == BINLOG_FORMAT_UNSPEC || + new_forced_binlog_format == BINLOG_FORMAT_ROW)) + { + if (wsrep_replicate_myisam) + { + my_message(ER_WRONG_ARGUMENTS, "wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set " + "if wsrep_replicate_myisam=ON", MYF(0)); + return true; + } + } + + return false; +} diff --git a/sql/wsrep_var.h b/sql/wsrep_var.h index 997784674dd..89053991cb9 100644 --- a/sql/wsrep_var.h +++ b/sql/wsrep_var.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2013 Codership Oy +/* Copyright (C) 2013-2023 Codership Oy 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 @@ -107,6 +107,9 @@ extern bool wsrep_debug_update UPDATE_ARGS; extern bool wsrep_gtid_seq_no_check CHECK_ARGS; extern bool wsrep_gtid_domain_id_update UPDATE_ARGS; + +extern bool wsrep_replicate_myisam_check CHECK_ARGS; +extern bool wsrep_forced_binlog_format_check CHECK_ARGS; #else /* WITH_WSREP */ #define wsrep_provider_init(X) From de216618e2cec3fe7f36166de472397fe3e19c85 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Thu, 26 Sep 2024 05:06:40 +0200 Subject: [PATCH 5/9] MDEV-29775 addendum: Relaxation of unnecessary restrictions + cosmetic corrections taken from the 10.6+ branch of the fix (to simplify merge). --- .../t/galera_var_replicate_myisam_off.test | 1 - .../t/galera_var_replicate_myisam_on.test | 1 - sql/wsrep_var.cc | 24 ++++--------------- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/mysql-test/suite/galera/t/galera_var_replicate_myisam_off.test b/mysql-test/suite/galera/t/galera_var_replicate_myisam_off.test index a9811283918..1261963520c 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_myisam_off.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_myisam_off.test @@ -3,7 +3,6 @@ # --source include/galera_cluster.inc ---source include/have_innodb.inc --let $wsrep_replicate_myisam_orig = `SELECT @@wsrep_replicate_myisam` diff --git a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test index acebe4cccdc..0a364452576 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test @@ -236,4 +236,3 @@ DROP TABLE t1; --disable_query_log --eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig --enable_query_log - diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 61241702ef8..1949c15f75c 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -365,14 +365,12 @@ bool wsrep_start_position_check (sys_var *self, THD* thd, set_var* var) var->save_result.string_value.length); start_pos_buf[var->save_result.string_value.length]= 0; - WSREP_DEBUG("SST wsrep_start_position check for new position %s old %s", - start_pos_buf, wsrep_start_position); + start_pos_buf, wsrep_start_position); // Verify the format. if (wsrep_start_position_verify(start_pos_buf)) return true; - // Give error if position is updated when wsrep is not enabled or // provider is not loaded. if ((!WSREP_ON || !Wsrep_server_state::instance().is_provider_loaded()) @@ -679,7 +677,7 @@ bool wsrep_cluster_address_update (sys_var *self, THD* thd, enum_var_type type) { wsrep_create_rollbacker(); WSREP_DEBUG("Cluster address update creating %ld applier threads running %lu", - wsrep_slave_threads, wsrep_running_applier_threads); + wsrep_slave_threads, wsrep_running_applier_threads); wsrep_create_appliers(wsrep_slave_threads); } mysql_mutex_unlock(&LOCK_wsrep_cluster_config); @@ -783,7 +781,7 @@ static void wsrep_slave_count_change_update () { wsrep_slave_count_change = (wsrep_slave_threads - wsrep_running_applier_threads); WSREP_DEBUG("Change on slave threads: New %ld old %lu difference %d", - wsrep_slave_threads, wsrep_running_applier_threads, wsrep_slave_count_change); + wsrep_slave_threads, wsrep_running_applier_threads, wsrep_slave_count_change); } bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type) @@ -808,9 +806,9 @@ bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type) // Thread creation and execution is asyncronous, therefore we need // wait them to be started or error produced while (wsrep_running_applier_threads != (ulong)wsrep_slave_threads && - !wsrep_thread_create_failed.load(std::memory_order_relaxed)) + !wsrep_thread_create_failed.load(std::memory_order_relaxed)) { - my_sleep(1000); + my_sleep(1000); } mysql_mutex_lock(&LOCK_global_system_variables); @@ -1129,12 +1127,6 @@ bool wsrep_replicate_myisam_check(sys_var *self, THD* thd, set_var* var) { bool new_replicate_myisam= (bool)var->save_result.ulonglong_value; - if (new_replicate_myisam && !WSREP_ON_) - { - my_message(ER_WRONG_ARGUMENTS, "wsrep_replicate_myisam=ON can't be enabled " - "if wsrep_on=OFF", MYF(0)); - return true; - } if (new_replicate_myisam && !(wsrep_forced_binlog_format == BINLOG_FORMAT_UNSPEC || wsrep_forced_binlog_format == BINLOG_FORMAT_ROW)) @@ -1149,12 +1141,6 @@ bool wsrep_replicate_myisam_check(sys_var *self, THD* thd, set_var* var) bool wsrep_forced_binlog_format_check(sys_var *self, THD* thd, set_var* var) { ulonglong new_forced_binlog_format= var->save_result.ulonglong_value; - if (new_forced_binlog_format != BINLOG_FORMAT_UNSPEC && !WSREP_ON) - { - my_message(ER_WRONG_ARGUMENTS, "wsrep_forced_binlog_format can't be set " - "if wsrep_on=OFF", MYF(0)); - return true; - } if (!(new_forced_binlog_format == BINLOG_FORMAT_UNSPEC || new_forced_binlog_format == BINLOG_FORMAT_ROW)) { From 22414d2ed0f1f8be26fb5e82e0129b629e5dbd20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 17 Jul 2023 17:29:20 +0300 Subject: [PATCH 6/9] 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.5 version of the fix. Signed-off-by: Julius Goryavsky --- .../galera/r/galera_partitioned_tables.result | 167 ++++++++++++++++++ .../suite/galera/r/wsrep_strict_ddl.result | 6 +- .../galera/t/galera_partitioned_tables.test | 131 ++++++++++++++ sql/sql_rename.cc | 2 +- sql/sql_table.cc | 34 +++- sql/sql_trigger.cc | 6 +- sql/sql_truncate.cc | 29 ++- sql/sql_view.cc | 11 +- sql/wsrep_mysqld.cc | 80 +++++---- sql/wsrep_mysqld.h | 2 +- 10 files changed, 416 insertions(+), 52 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_partitioned_tables.result create mode 100644 mysql-test/suite/galera/t/galera_partitioned_tables.test diff --git a/mysql-test/suite/galera/r/galera_partitioned_tables.result b/mysql-test/suite/galera/r/galera_partitioned_tables.result new file mode 100644 index 00000000000..4b5c9e74c54 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_partitioned_tables.result @@ -0,0 +1,167 @@ +connection node_2; +connection node_1; +# wsrep-strict_ddl = OFF +SET GLOBAL wsrep_strict_ddl = OFF; +SELECT @@wsrep_strict_ddl; +@@wsrep_strict_ddl +0 +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_strict_ddl = OFF; +CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM +PARTITION BY KEY (v1) +PARTITIONS 2; +# wsrep-strict_ddl = ON +SET GLOBAL wsrep_strict_ddl = ON; +SELECT @@wsrep_strict_ddl; +@@wsrep_strict_ddl +1 +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: DDL-statement is forbidden as table storage engine does not support Galera replication +ALTER TABLE t1 ADD COLUMN v2 int; +ALTER TABLE t2 ADD COLUMN v2 int; +ERROR HY000: DDL-statement is forbidden as table storage engine does not support Galera replication +INSERT INTO t1 VALUES (1,1),(2,2); +INSERT INTO t2 VALUES (1),(2); +ALTER TABLE t1 ADD COLUMN v3 int, ENGINE=MyISAM; +ERROR HY000: DDL-statement is forbidden as table storage engine does not support Galera replication +ALTER TABLE t2 ADD COLUMN v3 int, ENGINE=Aria; +ERROR HY000: DDL-statement is forbidden as table storage engine does not support Galera replication +UPDATE t1 SET v2 = v2 + 3; +UPDATE t2 SET v1 = v1 + 3; +CREATE INDEX xx1 ON t1(v2); +CREATE INDEX xx2 ON t2(v2); +ERROR HY000: DDL-statement is forbidden as table storage engine does not support Galera replication +DROP INDEX xx1 ON t1; +DROP INDEX xx2 on t2; +ERROR HY000: DDL-statement is forbidden as table storage engine does not support Galera replication +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +ERROR HY000: DDL-statement is forbidden as table storage engine does not support Galera replication +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: DDL-statement is forbidden as table storage engine does not support Galera replication +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: DDL-statement is forbidden as table storage engine does not support Galera replication +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_strict_ddl=OFF; +CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM +PARTITION BY KEY (v1) +PARTITIONS 2; +# wsrep-strict_ddl = ON +SET GLOBAL wsrep_strict_ddl = ON; +SELECT @@wsrep_strict_ddl; +@@wsrep_strict_ddl +1 +ALTER TABLE t2 ENGINE=InnoDB; +DROP TABLE t2; +SET GLOBAL wsrep_strict_ddl = DEFAULT; diff --git a/mysql-test/suite/galera/r/wsrep_strict_ddl.result b/mysql-test/suite/galera/r/wsrep_strict_ddl.result index 450c11be22d..7b166f00bc3 100644 --- a/mysql-test/suite/galera/r/wsrep_strict_ddl.result +++ b/mysql-test/suite/galera/r/wsrep_strict_ddl.result @@ -20,7 +20,7 @@ ERROR HY000: DDL-statement is forbidden as table storage engine does not support SHOW WARNINGS; Level Code Message Error 4165 DDL-statement is forbidden as table storage engine does not support Galera replication -Warning 1031 WSREP: wsrep_strict_ddl=true and storage engine does not support Galera replication. +Warning 1031 WSREP: wsrep_strict_dll enabled. Storage engine Aria not supported. connection node_2; SHOW CREATE TABLE t1; ERROR 42S02: Table 'test.t1' doesn't exist @@ -31,7 +31,9 @@ ERROR HY000: DDL-statement is forbidden as table storage engine does not support SHOW WARNINGS; Level Code Message Error 4165 DDL-statement is forbidden as table storage engine does not support Galera replication -Warning 1031 WSREP: wsrep_strict_ddl=true and storage engine does not support Galera replication. +Warning 1031 WSREP: wsrep_strict_dll enabled. Storage engine MyISAM not supported. +Error 4165 DDL-statement is forbidden as table storage engine does not support Galera replication +Warning 1031 WSREP: wsrep_strict_dll enabled. Storage engine MyISAM not supported. SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( diff --git a/mysql-test/suite/galera/t/galera_partitioned_tables.test b/mysql-test/suite/galera/t/galera_partitioned_tables.test new file mode 100644 index 00000000000..d65ee6c1a49 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_partitioned_tables.test @@ -0,0 +1,131 @@ +--source include/galera_cluster.inc +--source include/have_partition.inc +--source include/have_innodb.inc +--source include/have_aria.inc + +--echo # wsrep-strict_ddl = OFF +SET GLOBAL wsrep_strict_ddl = OFF; +SELECT @@wsrep_strict_ddl; +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_strict_ddl = OFF; +CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM + PARTITION BY KEY (v1) + PARTITIONS 2; +--echo # wsrep-strict_ddl = ON +SET GLOBAL wsrep_strict_ddl = ON; +SELECT @@wsrep_strict_ddl; +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_strict_ddl=OFF; + +CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM + PARTITION BY KEY (v1) + PARTITIONS 2; +--echo # wsrep-strict_ddl = ON +SET GLOBAL wsrep_strict_ddl = ON; +SELECT @@wsrep_strict_ddl; +ALTER TABLE t2 ENGINE=InnoDB; +DROP TABLE t2; + +SET GLOBAL wsrep_strict_ddl = DEFAULT; diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index 063645a4dce..5b4b572dba2 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -326,7 +326,7 @@ do_rename(THD *thd, TABLE_LIST *ren_table, const LEX_CSTRING *new_db, #ifdef WITH_WSREP if (WSREP(thd) && hton && hton != view_pseudo_hton && - !wsrep_should_replicate_ddl(thd, hton->db_type)) + !wsrep_should_replicate_ddl(thd, hton)) DBUG_RETURN(1); #endif diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 6f5c1839e1f..2b46fae9781 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2495,12 +2495,19 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, else { #ifdef WITH_WSREP - if (WSREP(thd) && hton && !wsrep_should_replicate_ddl(thd, hton->db_type)) + 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) @@ -10564,10 +10571,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()->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"); diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index f85faff37ac..b8e4b741599 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -588,8 +588,12 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) table= tables->table; #ifdef WITH_WSREP + /* 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(thd, table->s->db_type()->db_type)) + !wsrep_should_replicate_ddl_iterate(thd, tables)) goto end; #endif diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index cb0849400ee..e86325d31a5 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -304,8 +304,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->db_type)) + !wsrep_should_replicate_ddl(thd, table->file->partition_ht() ? + table->file->partition_ht() : hton)) DBUG_RETURN(TRUE); #endif @@ -327,12 +334,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->db_type)) + 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 diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 660e1b35cf9..89d0704f6df 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -443,8 +443,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 */ @@ -462,13 +460,20 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, } #ifdef WITH_WSREP - if(!wsrep_should_replicate_ddl_iterate(thd, static_cast(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)) diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index ae52e319e3f..c905883e2fb 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2008, 2023 Codership Oy - Copyright (c) 2020, 2022, MariaDB +/* Copyright (c) 2008, 2024, Codership Oy + 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 @@ -2073,27 +2073,24 @@ 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()->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 enum legacy_db_type db_type) +bool wsrep_should_replicate_ddl(THD* thd, const handlerton *hton) { if (!wsrep_strict_ddl) return true; + + if (!hton) + return true; - switch (db_type) + DBUG_ASSERT(hton != nullptr); + + switch (hton->db_type) { case DB_TYPE_INNODB: return true; @@ -2104,6 +2101,11 @@ bool wsrep_should_replicate_ddl(THD* thd, 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; case DB_TYPE_ARIA: /* if (wsrep_replicate_aria) */ /* fallthrough */ @@ -2115,10 +2117,33 @@ bool wsrep_should_replicate_ddl(THD* thd, /* STRICT, treat as error */ my_error(ER_GALERA_REPLICATION_NOT_SUPPORTED, MYF(0)); push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_ILLEGAL_HA, - "WSREP: wsrep_strict_ddl=true and storage engine does not support Galera replication."); + ER_ILLEGAL_HA, + "WSREP: wsrep_strict_dll enabled. " + "Storage engine %s not supported.", + 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. @@ -2147,7 +2172,7 @@ bool wsrep_can_run_in_toi(THD *thd, const char *db, const char *table, { return false; } - if (!wsrep_should_replicate_ddl(thd, create_info->db_type->db_type)) + if (!wsrep_should_replicate_ddl(thd, create_info->db_type)) { return false; } @@ -2227,16 +2252,11 @@ bool wsrep_can_run_in_toi(THD *thd, const char *db, const char *table, { if (create_info) { - enum legacy_db_type db_type; + const handlerton *hton= create_info->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)) + if (!hton) + hton= ha_default_handlerton(thd); + if (!wsrep_should_replicate_ddl(thd, hton)) return false; } } diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 02d1d7fd248..1c8220fd035 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -339,7 +339,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 enum legacy_db_type 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); From 0784dd32b1ed7348f8d6680b2f4f6e06a6e71256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 13 Apr 2023 13:45:00 +0300 Subject: [PATCH 7/9] MDEV-29775 : Assertion `0' failed in void Protocol::end_statement() when adding data to the MyISAM table after setting wsrep_mode=replicate_myisam If wsrep_mode=BINLOG_ROW_FORMAT_ONLY wsrep_forced_binlog_format can be DEFAULT (UNSPECIFIED) or ROW. Finally, if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] or wsrep_replicate_myisam=ON we allow wsrep_forced_binlog_format to be [DEFAULT|ROW]. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/r/mdev-29775.result | 68 ++++++++++++++++----- mysql-test/suite/galera/t/mdev-29775.test | 66 +++++++++++++++----- sql/wsrep_var.cc | 37 ++++++++++- 3 files changed, 139 insertions(+), 32 deletions(-) diff --git a/mysql-test/suite/galera/r/mdev-29775.result b/mysql-test/suite/galera/r/mdev-29775.result index dc38f18b433..3dba185d5b0 100644 --- a/mysql-test/suite/galera/r/mdev-29775.result +++ b/mysql-test/suite/galera/r/mdev-29775.result @@ -1,6 +1,6 @@ connection node_2; connection node_1; -SET GLOBAL wsrep_replicate_myisam=ON; +SET GLOBAL wsrep_mode=REPLICATE_MYISAM; CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM; INSERT INTO t VALUES(); SELECT * FROM t; @@ -12,7 +12,7 @@ f0 NULL DROP TABLE t; connection node_1; -SET GLOBAL wsrep_replicate_myisam=ON; +SET GLOBAL wsrep_mode=REPLICATE_MYISAM; SET GLOBAL wsrep_forced_binlog_format=ROW; CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM; INSERT INTO t VALUES(); @@ -25,20 +25,60 @@ f0 NULL DROP TABLE t; connection node_1; +SET GLOBAL wsrep_mode=REPLICATE_ARIA; +CREATE TABLE t (f0 CHAR(0)) ENGINE=Aria; +INSERT INTO t VALUES(); +SELECT * FROM t; +f0 +NULL +connection node_2; +SELECT * FROM t; +f0 +NULL +DROP TABLE t; +connection node_1; +SET GLOBAL wsrep_mode=REPLICATE_ARIA; +SET GLOBAL wsrep_forced_binlog_format=ROW; +CREATE TABLE t (f0 CHAR(0)) ENGINE=Aria; +INSERT INTO t VALUES(); +SELECT * FROM t; +f0 +NULL +connection node_2; +SELECT * FROM t; +f0 +NULL +DROP TABLE t; +connection node_1; +SET GLOBAL wsrep_mode=REPLICATE_MYISAM; +SET GLOBAL wsrep_forced_binlog_format=MIXED; +ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] +SET GLOBAL wsrep_forced_binlog_format=STATEMENT; +ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] +SET GLOBAL wsrep_mode=REPLICATE_ARIA; +SET GLOBAL wsrep_forced_binlog_format=MIXED; +ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] +SET GLOBAL wsrep_forced_binlog_format=STATEMENT; +ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] +SET GLOBAL wsrep_mode=DEFAULT; +SET GLOBAL wsrep_forced_binlog_format=MIXED; +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; +ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW] +SET GLOBAL wsrep_mode = REPLICATE_ARIA; +ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW] +SET GLOBAL wsrep_mode=DEFAULT; +SET GLOBAL wsrep_forced_binlog_format=STATEMENT; +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; +ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW] +SET GLOBAL wsrep_mode = REPLICATE_ARIA; +ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW] SET GLOBAL wsrep_forced_binlog_format=DEFAULT; -SET GLOBAL wsrep_replicate_myisam=OFF; +SET GLOBAL wsrep_mode=DEFAULT; SET GLOBAL wsrep_forced_binlog_format=MIXED; SET GLOBAL wsrep_replicate_myisam=ON; -ERROR HY000: wsrep_replicate_myisam=ON can't be enabled if wsrep_forced_binlog != [NONE|ROW] +ERROR HY000: wsrep_mode=REPLICATE_MYISAM can't be enabled if wsrep_forced_binlog != [NONE|ROW] SET GLOBAL wsrep_forced_binlog_format=STATEMENT; SET GLOBAL wsrep_replicate_myisam=ON; -ERROR HY000: wsrep_replicate_myisam=ON can't be enabled if wsrep_forced_binlog != [NONE|ROW] -SET GLOBAL wsrep_forced_binlog_format=NONE; -SET GLOBAL wsrep_replicate_myisam=OFF; -SET GLOBAL wsrep_replicate_myisam=ON; -SET GLOBAL wsrep_forced_binlog_format=MIXED; -ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_replicate_myisam=ON -SET GLOBAL wsrep_forced_binlog_format=STATEMENT; -ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_replicate_myisam=ON -SET GLOBAL wsrep_forced_binlog_format=NONE; -SET GLOBAL wsrep_replicate_myisam=OFF; +ERROR HY000: wsrep_mode=REPLICATE_MYISAM can't be enabled if wsrep_forced_binlog != [NONE|ROW] +SET GLOBAL wsrep_forced_binlog_format=DEFAULT; +SET GLOBAL wsrep_mode=DEFAULT; diff --git a/mysql-test/suite/galera/t/mdev-29775.test b/mysql-test/suite/galera/t/mdev-29775.test index 5c6725d780d..ec227a8972c 100644 --- a/mysql-test/suite/galera/t/mdev-29775.test +++ b/mysql-test/suite/galera/t/mdev-29775.test @@ -1,9 +1,10 @@ --source include/galera_cluster.inc +--source include/have_aria.inc # # MDEV-29775 : Assertion `0' failed in void Protocol::end_statement() when adding data to the MyISAM table after setting wsrep_mode=replicate_myisam # -SET GLOBAL wsrep_replicate_myisam=ON; +SET GLOBAL wsrep_mode=REPLICATE_MYISAM; CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM; INSERT INTO t VALUES(); SELECT * FROM t; @@ -12,7 +13,7 @@ SELECT * FROM t; DROP TABLE t; --connection node_1 -SET GLOBAL wsrep_replicate_myisam=ON; +SET GLOBAL wsrep_mode=REPLICATE_MYISAM; SET GLOBAL wsrep_forced_binlog_format=ROW; CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM; INSERT INTO t VALUES(); @@ -22,9 +23,53 @@ SELECT * FROM t; DROP TABLE t; --connection node_1 +SET GLOBAL wsrep_mode=REPLICATE_ARIA; +CREATE TABLE t (f0 CHAR(0)) ENGINE=Aria; +INSERT INTO t VALUES(); +SELECT * FROM t; +--connection node_2 +SELECT * FROM t; +DROP TABLE t; + +--connection node_1 +SET GLOBAL wsrep_mode=REPLICATE_ARIA; +SET GLOBAL wsrep_forced_binlog_format=ROW; +CREATE TABLE t (f0 CHAR(0)) ENGINE=Aria; +INSERT INTO t VALUES(); +SELECT * FROM t; +--connection node_2 +SELECT * FROM t; +DROP TABLE t; + +--connection node_1 +SET GLOBAL wsrep_mode=REPLICATE_MYISAM; +--error ER_WRONG_ARGUMENTS +SET GLOBAL wsrep_forced_binlog_format=MIXED; +--error ER_WRONG_ARGUMENTS +SET GLOBAL wsrep_forced_binlog_format=STATEMENT; + +SET GLOBAL wsrep_mode=REPLICATE_ARIA; +--error ER_WRONG_ARGUMENTS +SET GLOBAL wsrep_forced_binlog_format=MIXED; +--error ER_WRONG_ARGUMENTS +SET GLOBAL wsrep_forced_binlog_format=STATEMENT; + +SET GLOBAL wsrep_mode=DEFAULT; +SET GLOBAL wsrep_forced_binlog_format=MIXED; +--error ER_WRONG_ARGUMENTS +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; +--error ER_WRONG_ARGUMENTS +SET GLOBAL wsrep_mode = REPLICATE_ARIA; + +SET GLOBAL wsrep_mode=DEFAULT; +SET GLOBAL wsrep_forced_binlog_format=STATEMENT; +--error ER_WRONG_ARGUMENTS +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; +--error ER_WRONG_ARGUMENTS +SET GLOBAL wsrep_mode = REPLICATE_ARIA; + SET GLOBAL wsrep_forced_binlog_format=DEFAULT; -SET GLOBAL wsrep_replicate_myisam=OFF; - +SET GLOBAL wsrep_mode=DEFAULT; SET GLOBAL wsrep_forced_binlog_format=MIXED; --error ER_WRONG_ARGUMENTS SET GLOBAL wsrep_replicate_myisam=ON; @@ -32,14 +77,5 @@ SET GLOBAL wsrep_forced_binlog_format=STATEMENT; --error ER_WRONG_ARGUMENTS SET GLOBAL wsrep_replicate_myisam=ON; -SET GLOBAL wsrep_forced_binlog_format=NONE; -SET GLOBAL wsrep_replicate_myisam=OFF; - -SET GLOBAL wsrep_replicate_myisam=ON; ---error ER_WRONG_ARGUMENTS -SET GLOBAL wsrep_forced_binlog_format=MIXED; ---error ER_WRONG_ARGUMENTS -SET GLOBAL wsrep_forced_binlog_format=STATEMENT; - -SET GLOBAL wsrep_forced_binlog_format=NONE; -SET GLOBAL wsrep_replicate_myisam=OFF; +SET GLOBAL wsrep_forced_binlog_format=DEFAULT; +SET GLOBAL wsrep_mode=DEFAULT; diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 1c5e2311221..ce679d245ba 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -984,6 +984,28 @@ bool wsrep_max_ws_size_update(sys_var *self, THD *thd, enum_var_type) bool wsrep_mode_check(sys_var *self, THD* thd, set_var* var) { + ulonglong new_wsrep_mode= var->save_result.ulonglong_value; + if (new_wsrep_mode && !WSREP_ON) + { + my_message(ER_WRONG_ARGUMENTS, "wsrep_mode can't be set " + "if wsrep_on=OFF", MYF(0)); + return true; + } + ulonglong old_wsrep_mode= wsrep_mode; + wsrep_mode= new_wsrep_mode; + if (wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM) || + wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA)) + { + if (!(wsrep_forced_binlog_format == BINLOG_FORMAT_UNSPEC || + wsrep_forced_binlog_format == BINLOG_FORMAT_ROW)) + { + my_message(ER_WRONG_ARGUMENTS, "wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] " + "can't be enabled if wsrep_forced_binlog != [NONE|ROW]", MYF(0)); + wsrep_mode= old_wsrep_mode; + return true; + } + } + wsrep_mode= old_wsrep_mode; return false; } @@ -1157,7 +1179,7 @@ bool wsrep_replicate_myisam_check(sys_var *self, THD* thd, set_var* var) !(wsrep_forced_binlog_format == BINLOG_FORMAT_UNSPEC || wsrep_forced_binlog_format == BINLOG_FORMAT_ROW)) { - my_message(ER_WRONG_ARGUMENTS, "wsrep_replicate_myisam=ON can't be enabled " + my_message(ER_WRONG_ARGUMENTS, "wsrep_mode=REPLICATE_MYISAM can't be enabled " "if wsrep_forced_binlog != [NONE|ROW]", MYF(0)); return true; } @@ -1167,13 +1189,22 @@ bool wsrep_replicate_myisam_check(sys_var *self, THD* thd, set_var* var) bool wsrep_forced_binlog_format_check(sys_var *self, THD* thd, set_var* var) { ulonglong new_forced_binlog_format= var->save_result.ulonglong_value; + if (!(new_forced_binlog_format == BINLOG_FORMAT_UNSPEC || new_forced_binlog_format == BINLOG_FORMAT_ROW)) { - if (wsrep_replicate_myisam) + if (wsrep_check_mode(WSREP_MODE_BINLOG_ROW_FORMAT_ONLY)) { my_message(ER_WRONG_ARGUMENTS, "wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set " - "if wsrep_replicate_myisam=ON", MYF(0)); + "if wsrep_mode=BINLOG_ROW_FORMAT_ONLY", MYF(0)); + return true; + } + + if (wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM) || + wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA)) + { + my_message(ER_WRONG_ARGUMENTS, "wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set " + "if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA]", MYF(0)); return true; } } From b3925982a064d79d6f2cf57f532f143d36cfc004 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 2 May 2023 04:57:30 +0200 Subject: [PATCH 8/9] MDEV-29755 post-merge for 10.6+ 1) remove unnecessary restriction on changing mode; 2) adding lost wsrep_replicate_myisam_basic test. --- .../r/wsrep_replicate_myisam_basic.result | 15 +++++++++++++++ .../t/wsrep_replicate_myisam_basic.test | 19 +++++++++++++++++++ sql/wsrep_var.cc | 6 ------ 3 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 mysql-test/suite/sys_vars/r/wsrep_replicate_myisam_basic.result create mode 100644 mysql-test/suite/sys_vars/t/wsrep_replicate_myisam_basic.test diff --git a/mysql-test/suite/sys_vars/r/wsrep_replicate_myisam_basic.result b/mysql-test/suite/sys_vars/r/wsrep_replicate_myisam_basic.result new file mode 100644 index 00000000000..c8effa8c0f3 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/wsrep_replicate_myisam_basic.result @@ -0,0 +1,15 @@ +# +# wsrep_replicate_myisam +# +# save the initial value +SET @wsrep_mode_saved = @@global.wsrep_mode; + +# scope and valid values +SET @@global.wsrep_mode=REPLICATE_MYISAM; +SELECT @@global.wsrep_mode; +@@global.wsrep_mode +REPLICATE_MYISAM + +# restore the initial value +SET @@global.wsrep_mode = @wsrep_mode_saved; +# End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_replicate_myisam_basic.test b/mysql-test/suite/sys_vars/t/wsrep_replicate_myisam_basic.test new file mode 100644 index 00000000000..49ccdec047a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/wsrep_replicate_myisam_basic.test @@ -0,0 +1,19 @@ +--source include/have_wsrep.inc + +--echo # +--echo # wsrep_replicate_myisam +--echo # + +--echo # save the initial value +SET @wsrep_mode_saved = @@global.wsrep_mode; + +--echo +--echo # scope and valid values +SET @@global.wsrep_mode=REPLICATE_MYISAM; +SELECT @@global.wsrep_mode; + +--echo +--echo # restore the initial value +SET @@global.wsrep_mode = @wsrep_mode_saved; + +--echo # End of test diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index ce679d245ba..3d381afa704 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -985,12 +985,6 @@ bool wsrep_max_ws_size_update(sys_var *self, THD *thd, enum_var_type) bool wsrep_mode_check(sys_var *self, THD* thd, set_var* var) { ulonglong new_wsrep_mode= var->save_result.ulonglong_value; - if (new_wsrep_mode && !WSREP_ON) - { - my_message(ER_WRONG_ARGUMENTS, "wsrep_mode can't be set " - "if wsrep_on=OFF", MYF(0)); - return true; - } ulonglong old_wsrep_mode= wsrep_mode; wsrep_mode= new_wsrep_mode; if (wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM) || From 9389428380afcef4f0a148e4e2e3327c1584d265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 17 Jul 2023 17:29:20 +0300 Subject: [PATCH 9/9] 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: Julius Goryavsky --- .../galera/r/galera_partitioned_tables.result | 63 +++++++++++-------- .../r/wsrep_mode_strict_replication.result | 12 ++-- .../galera/t/galera_partitioned_tables.test | 26 ++++---- sql/wsrep_mysqld.h | 1 - 4 files changed, 56 insertions(+), 46 deletions(-) diff --git a/mysql-test/suite/galera/r/galera_partitioned_tables.result b/mysql-test/suite/galera/r/galera_partitioned_tables.result index 4b5c9e74c54..3f24cae1495 100644 --- a/mysql-test/suite/galera/r/galera_partitioned_tables.result +++ b/mysql-test/suite/galera/r/galera_partitioned_tables.result @@ -1,10 +1,11 @@ connection node_2; connection node_1; -# wsrep-strict_ddl = OFF -SET GLOBAL wsrep_strict_ddl = OFF; -SELECT @@wsrep_strict_ddl; -@@wsrep_strict_ddl -0 +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; @@ -73,55 +74,63 @@ DROP TRIGGER increment_before_t1; DROP TRIGGER increment_before_t2; DROP TABLE t1_v2; DROP TABLE t2_v2; -SET GLOBAL wsrep_strict_ddl = OFF; +SET GLOBAL wsrep_mode = ""; CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM PARTITION BY KEY (v1) PARTITIONS 2; -# wsrep-strict_ddl = ON -SET GLOBAL wsrep_strict_ddl = ON; -SELECT @@wsrep_strict_ddl; -@@wsrep_strict_ddl -1 +# 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: DDL-statement is forbidden as table storage engine does not support Galera replication +ERROR HY000: Galera replication not supported ALTER TABLE t1 ADD COLUMN v2 int; ALTER TABLE t2 ADD COLUMN v2 int; -ERROR HY000: DDL-statement is forbidden as table storage engine does not support Galera replication +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: DDL-statement is forbidden as table storage engine does not support Galera replication +ERROR HY000: Galera replication not supported ALTER TABLE t2 ADD COLUMN v3 int, ENGINE=Aria; -ERROR HY000: DDL-statement is forbidden as table storage engine does not support Galera replication +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: DDL-statement is forbidden as table storage engine does not support Galera replication +ERROR HY000: Galera replication not supported DROP INDEX xx1 ON t1; DROP INDEX xx2 on t2; -ERROR HY000: DDL-statement is forbidden as table storage engine does not support Galera replication +ERROR HY000: Galera replication not supported TRUNCATE TABLE t1; TRUNCATE TABLE t2; -ERROR HY000: DDL-statement is forbidden as table storage engine does not support Galera replication +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: DDL-statement is forbidden as table storage engine does not support Galera replication +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: DDL-statement is forbidden as table storage engine does not support Galera replication +ERROR HY000: Galera replication not supported connection node_2; SHOW CREATE TABLE t1_v2; Table Create Table @@ -153,15 +162,15 @@ DROP VIEW x1; DROP TRIGGER increment_before_t1; DROP TABLE t1_v2; DROP TABLE t2; -SET GLOBAL wsrep_strict_ddl=OFF; +SET GLOBAL wsrep_mode = ""; CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM PARTITION BY KEY (v1) PARTITIONS 2; -# wsrep-strict_ddl = ON -SET GLOBAL wsrep_strict_ddl = ON; -SELECT @@wsrep_strict_ddl; -@@wsrep_strict_ddl -1 +# 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_strict_ddl = DEFAULT; +SET GLOBAL wsrep_mode = DEFAULT; diff --git a/mysql-test/suite/galera/r/wsrep_mode_strict_replication.result b/mysql-test/suite/galera/r/wsrep_mode_strict_replication.result index 66962be3391..678f337d79e 100644 --- a/mysql-test/suite/galera/r/wsrep_mode_strict_replication.result +++ b/mysql-test/suite/galera/r/wsrep_mode_strict_replication.result @@ -19,8 +19,8 @@ CREATE TABLE t1(a int) engine=Aria; ERROR HY000: Galera replication not supported SHOW WARNINGS; Level Code Message -Error 4165 DDL-statement is forbidden as table storage engine does not support Galera replication -Warning 1031 WSREP: wsrep_strict_dll enabled. Storage engine Aria not supported. +Error 4165 Galera replication not supported +Warning 1031 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria not supported. connection node_2; SHOW CREATE TABLE t1; ERROR 42S02: Table 'test.t1' doesn't exist @@ -30,10 +30,10 @@ ALTER TABLE t2 engine=MyISAM; ERROR HY000: Galera replication not supported SHOW WARNINGS; Level Code Message -Error 4165 DDL-statement is forbidden as table storage engine does not support Galera replication -Warning 1031 WSREP: wsrep_strict_dll enabled. Storage engine MyISAM not supported. -Error 4165 DDL-statement is forbidden as table storage engine does not support Galera replication -Warning 1031 WSREP: wsrep_strict_dll 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. +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` ( diff --git a/mysql-test/suite/galera/t/galera_partitioned_tables.test b/mysql-test/suite/galera/t/galera_partitioned_tables.test index d65ee6c1a49..f29adcf1501 100644 --- a/mysql-test/suite/galera/t/galera_partitioned_tables.test +++ b/mysql-test/suite/galera/t/galera_partitioned_tables.test @@ -3,9 +3,11 @@ --source include/have_innodb.inc --source include/have_aria.inc ---echo # wsrep-strict_ddl = OFF -SET GLOBAL wsrep_strict_ddl = OFF; -SELECT @@wsrep_strict_ddl; +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; @@ -54,13 +56,13 @@ DROP TRIGGER increment_before_t2; DROP TABLE t1_v2; DROP TABLE t2_v2; -SET GLOBAL wsrep_strict_ddl = OFF; +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-strict_ddl = ON -SET GLOBAL wsrep_strict_ddl = ON; -SELECT @@wsrep_strict_ddl; +--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; @@ -117,15 +119,15 @@ DROP TRIGGER increment_before_t1; DROP TABLE t1_v2; # We allow dropping table DROP TABLE t2; -SET GLOBAL wsrep_strict_ddl=OFF; +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-strict_ddl = ON -SET GLOBAL wsrep_strict_ddl = ON; -SELECT @@wsrep_strict_ddl; +--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_strict_ddl = DEFAULT; +SET GLOBAL wsrep_mode = DEFAULT; diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 1c3ac610cf2..02df7bf5ed5 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -614,7 +614,6 @@ bool wsrep_table_list_has_non_temp_tables(THD *thd, TABLE_LIST *tables); #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)