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

MDEV-34647 : 'INSERT...SELECT' on MyISAM table suddenly replicated by Galera

Replication of MyISAM and Aria DML is experimental and best
effort only. Earlier change make INSERT SELECT on both
MyISAM and Aria to replicate using TOI and STATEMENT
replication. Replication should happen only if user
has set needed wsrep_mode setting.

Note: This commit contains additional changes compared
to those already made for the 10.5 branch.

+ small refactoring after main fix.
Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
parent b1f75221
......@@ -39,7 +39,7 @@ id val
7 d
9 d
11 d
set global wsrep_mode=REPLICATE_MYISAM;
set global wsrep_mode='REPLICATE_MYISAM,REPLICATE_ARIA';
create table t4(id serial, val varchar(100)) engine=myisam;
insert into t4 values(null, 'a');
insert into t4 values(null, 'b');
......@@ -95,6 +95,7 @@ id val
4 d
5 d
6 d
set global wsrep_mode=default;
connection node_1;
drop table t1,t2,t3,t4,t5;
set global wsrep_mode=default;
......@@ -17,12 +17,14 @@ SELECT * FROM s;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
connection node_2;
SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM';
SELECT * FROM t1;
a
SELECT * FROM s;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
connection node_1;
SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM';
DROP TABLE t1;
DROP SEQUENCE s;
# Case 2 REPLACE INTO ... SELECT with error
......@@ -240,3 +242,5 @@ pk
DROP TABLE t1;
DROP VIEW view_t1;
SET GLOBAL wsrep_mode=DEFAULT;
connection node_2;
SET GLOBAL wsrep_mode=DEFAULT;
......@@ -22,7 +22,7 @@ insert into t3 select null, 'c';
insert into t3 select null, 'd' from t3;
select * from t3;
set global wsrep_mode=REPLICATE_MYISAM;
set global wsrep_mode='REPLICATE_MYISAM,REPLICATE_ARIA';
create table t4(id serial, val varchar(100)) engine=myisam;
insert into t4 values(null, 'a');
......@@ -45,9 +45,8 @@ select * from t2;
select * from t3;
select * from t4;
select * from t5;
set global wsrep_mode=default;
--connection node_1
drop table t1,t2,t3,t4,t5;
set global wsrep_mode=default;
......@@ -16,6 +16,7 @@ SELECT * FROM t1;
SELECT * FROM s;
--connection node_2
SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM';
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 's'
......@@ -27,6 +28,7 @@ SELECT * FROM t1;
SELECT * FROM s;
--connection node_1
SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM';
DROP TABLE t1;
DROP SEQUENCE s;
......@@ -183,3 +185,6 @@ SELECT * FROM t1;
DROP TABLE t1;
DROP VIEW view_t1;
SET GLOBAL wsrep_mode=DEFAULT;
--connection node_2
SET GLOBAL wsrep_mode=DEFAULT;
......@@ -4728,8 +4728,11 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
if (!wsrep_toi)
{
/* Currently we support TOI for MyISAM only. */
if (db_type == DB_TYPE_MYISAM && wsrep_replicate_myisam)
if ((db_type == DB_TYPE_MYISAM && wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM)) ||
(db_type == DB_TYPE_ARIA && wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA)))
{
WSREP_TO_ISOLATION_BEGIN(first_table->db.str, first_table->table_name.str, NULL);
}
}
}
}
......
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