Skip to content

Commit 4afd1b9

Browse files
author
Arpit Goswami
committed
WL#10495 Replication Usability: Deprecate writing multiple engines when atleast one
is non-transactional or non-composable This worklog deprecates writing transactions/statements to tables associated to multiple engines if atleast one is non-transactional or non-composable engine. Change-Id: I512abd7f7adda768a5b3e8e4b43b6245f6bf0b22
1 parent 92e102d commit 4afd1b9

File tree

83 files changed

+11676
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+11676
-8
lines changed

mysql-test/common/binlog/enforce_gtid_consistency_statement.inc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ if ($extra_warning_count == '')
8181
{
8282
--let $extra_warning_count= 0
8383
}
84+
if ($mix_engine_warning_count == '')
85+
{
86+
--let $mix_engine_warning_count= 0
87+
}
8488

8589
# $expected_status is 0 if the statement is ok, 1 if an error is expected,
8690
# 2 if a warning is expected.
@@ -159,11 +163,12 @@ if ($expected_status != 1)
159163
}
160164

161165
# Check warnings / errors.
162-
166+
--connection $auxiliary_connection
167+
--let $warning_index= `SELECT 1 + $mix_engine_warning_count`
163168
--connection $statement_connection
164169
--let $warning_count= `SHOW COUNT(*) WARNINGS`
165-
--let $warning_message= query_get_value(SHOW WARNINGS, Message, 1)
166-
--let $warning_level= query_get_value(SHOW WARNINGS, Level, 1)
170+
--let $warning_message= query_get_value(SHOW WARNINGS, Message, $warning_index)
171+
--let $warning_level= query_get_value(SHOW WARNINGS, Level, $warning_index)
167172

168173
--connection $auxiliary_connection
169174

@@ -182,7 +187,7 @@ if ($expected_status == 0)
182187
if ($expected_status == 1)
183188
{
184189
--let $assert_text= One warning/error should be generated.
185-
--let $assert_cond= $warning_count = 1
190+
--let $assert_cond= $warning_count = 1 + $mix_engine_warning_count
186191
--source include/assert.inc
187192

188193
--let $assert_text= It should be an Error, not a Warning.

mysql-test/common/binlog/enforce_gtid_consistency_trx_nontrx_consistent.test

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@ if ($gtid_next != 'GTID')
1818
--echo ---- MyISAM followed by MyISAM, in one 'trx' ----
1919
--let $pre_statement= BEGIN; INSERT INTO myisam1 VALUES (1)
2020
--let $statement= INSERT INTO myisam2 VALUES (1)
21-
21+
#Mixing of same engine so no warning
22+
--let $extra_warning_count= 0
2223
--source common/binlog/enforce_gtid_consistency_statement.inc
2324
}
2425

2526
--echo ---- MyISAM and MyISAM in one statement ----
2627
CREATE TRIGGER trig BEFORE INSERT ON myisam1 FOR EACH ROW INSERT INTO myisam2 VALUES (1);
2728
--let $statement= INSERT INTO myisam2 VALUES (1)
29+
#Mixing of same engine so no warning
30+
--let $extra_warning_count= 0
2831
--source common/binlog/enforce_gtid_consistency_statement.inc
2932
DROP TRIGGER trig;
3033

@@ -38,6 +41,8 @@ if ($gtid_next != 'GTID')
3841
--echo ---- MyISAM followed by InnoDB, in one 'trx' ----
3942
--let $pre_statement= BEGIN; INSERT INTO myisam1 VALUES (1)
4043
--let $statement= INSERT INTO innodb VALUES (1)
44+
#Mixing of non-composable engine so 1 warning
45+
--let $extra_warning_count = 1
4146
--source common/binlog/enforce_gtid_consistency_statement.inc
4247
}
4348

@@ -59,6 +64,8 @@ SET SESSION BINLOG_FORMAT = MIXED;
5964
CREATE TEMPORARY TABLE tmp_myisam1 (a INT) ENGINE = MyISAM;
6065
--let $pre_statement= BEGIN; INSERT INTO innodb VALUES (1)
6166
--let $statement= INSERT INTO tmp_myisam1 VALUES (1)
67+
#Mixing of non-composable engine so 1 warning
68+
--let $extra_warning_count = 1
6269
--source common/binlog/enforce_gtid_consistency_statement.inc
6370
DROP TEMPORARY TABLE tmp_myisam1;
6471

@@ -73,6 +80,8 @@ CREATE TEMPORARY TABLE tmp_myisam1 (a INT) ENGINE = MyISAM;
7380
CREATE TEMPORARY TABLE tmp_myisam2 (a INT) ENGINE = MyISAM;
7481
--eval CREATE TRIGGER trig BEFORE INSERT ON innodb FOR EACH ROW BEGIN INSERT INTO tmp_myisam1 VALUES (1); INSERT INTO tmp_myisam2 VALUES (1); END
7582
--let $statement= INSERT INTO innodb VALUES (1)
83+
#Mixing of non-composable engine so 1 warning
84+
--let $extra_warning_count = 1
7685
--source common/binlog/enforce_gtid_consistency_statement.inc
7786
DROP TRIGGER trig;
7887
DROP TEMPORARY TABLE tmp_myisam1, tmp_myisam2;
@@ -84,11 +93,15 @@ CREATE TEMPORARY TABLE tmp_myisam2 (a INT) ENGINE = MyISAM;
8493
--echo ---- InnoDB followed by temp MyISAM in one trx, binlog_format='row' ----
8594
--let $pre_statement= BEGIN; INSERT INTO innodb VALUES (1)
8695
--let $statement= INSERT INTO tmp_myisam1 VALUES (1)
96+
#Mixing of non-composable engine so 1 warning
97+
--let $extra_warning_count = 1
8798
--source common/binlog/enforce_gtid_consistency_statement.inc
8899

89100
--echo ---- InnoDB and temp MyISAM in one statement, binlog_format='row' ----
90101
--eval CREATE TRIGGER trig BEFORE INSERT ON innodb FOR EACH ROW BEGIN INSERT INTO tmp_myisam1 VALUES (1); INSERT INTO tmp_myisam2 VALUES (1); END
91102
--let $statement= INSERT INTO innodb VALUES (1)
103+
#Mixing of non-composable engine so 1 warning
104+
--let $extra_warning_count = 1
92105
--source common/binlog/enforce_gtid_consistency_statement.inc
93106
DROP TRIGGER trig;
94107

@@ -110,18 +123,24 @@ SET SQL_LOG_BIN = 0;
110123
--echo ---- InnoDB and MyISAM in one statement, SQL_LOG_BIN=0 ----
111124
--eval CREATE TRIGGER trig BEFORE INSERT ON innodb FOR EACH ROW BEGIN INSERT INTO myisam1 VALUES (1); INSERT INTO myisam2 VALUES (1); END
112125
--let $statement= INSERT INTO innodb VALUES (1)
126+
#Mixing of non-composable engine so 1 warning
127+
--let $extra_warning_count = 1
113128
--source common/binlog/enforce_gtid_consistency_statement.inc
114129
DROP TRIGGER trig;
115130

116131
--echo ---- InnoDB followed by MyISAM, in one trx, SQL_LOG_BIN=0 ----
117132
--let $pre_statement= BEGIN; INSERT INTO innodb VALUES (1)
118133
--let $statement= INSERT INTO myisam1 VALUES (1)
134+
#Mixing of non-composable engine so 1 warning
135+
--let $extra_warning_count = 1
119136
--source common/binlog/enforce_gtid_consistency_statement.inc
120137

121138
--echo ---- InnoDB and MyISAM in one statement inside trx, SQL_LOG_BIN=0 ----
122139
--eval CREATE TRIGGER trig BEFORE INSERT ON innodb FOR EACH ROW BEGIN INSERT INTO myisam1 VALUES (1); INSERT INTO myisam2 VALUES (1); END
123140
--let $pre_statement= BEGIN
124141
--let $statement= INSERT INTO innodb VALUES (1)
142+
#Mixing of non-composable engine so 1 warning
143+
--let $extra_warning_count = 1
125144
--source common/binlog/enforce_gtid_consistency_statement.inc
126145
DROP TRIGGER trig;
127146

mysql-test/common/binlog/enforce_gtid_consistency_trx_nontrx_violation.test

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
--let $error_message= Statement violates GTID consistency: Updates to non-transactional tables
44
--let $sync_point= end_decide_logging_format
55
--let $statement_ends_transaction= 0
6-
6+
--let $extra_warning_count = 0
7+
--let $mix_engine_warning_count = 1
78
CREATE TABLE myisam1 (a INT) ENGINE = MyISAM;
89
CREATE TABLE myisam2 (a INT) ENGINE = MyISAM;
910
CREATE TABLE innodb (a INT) ENGINE = InnoDB;
@@ -25,6 +26,7 @@ if ($binlog_direct_non_transactional_updates == 0)
2526
--disable_warnings
2627
--let $pre_statement= BEGIN; INSERT INTO innodb VALUES (1)
2728
--let $statement= INSERT INTO myisam1 VALUES (1)
29+
--expr $extra_warning_count = $extra_warning_count + $mix_engine_warning_count
2830
--source common/binlog/enforce_gtid_consistency_statement.inc
2931
--enable_warnings
3032
--let $extra_warning_count= 0
@@ -33,7 +35,10 @@ if ($binlog_direct_non_transactional_updates == 0)
3335
CREATE TRIGGER trig BEFORE INSERT ON innodb FOR EACH ROW INSERT INTO myisam1 VALUES (1);
3436
--let $statement= INSERT INTO innodb VALUES (1)
3537
--let $statement_ends_transaction= 1
38+
# Mixing of non-composable engine
39+
--let $extra_warning_count= $mix_engine_warning_count
3640
--source common/binlog/enforce_gtid_consistency_statement.inc
41+
--let $extra_warning_count= 0
3742

3843
--echo ---- InnoDB and MyISAM in one statement inside trx ----
3944
# If binlog_format==STATEMENT, there is a warning for unsafe statement.
@@ -46,6 +51,8 @@ if ($binlog_format == 'STATEMENT')
4651
--let $pre_statement= BEGIN
4752
--let $statement= INSERT INTO innodb VALUES (1)
4853
--let $statement_ends_transaction= 0
54+
# Mixing of non-composable engine
55+
--expr $extra_warning_count= $extra_warning_count + $mix_engine_warning_count
4956
--source common/binlog/enforce_gtid_consistency_statement.inc
5057
DROP TRIGGER trig;
5158
--let $extra_warning_count= 0
@@ -65,12 +72,16 @@ CREATE TEMPORARY TABLE tmp_myisam2 (a INT) ENGINE = MyISAM;
6572
--let $pre_statement= BEGIN; INSERT INTO innodb VALUES (1)
6673
--let $statement= INSERT INTO tmp_myisam1 VALUES (1)
6774
--let $statement_ends_transaction= 0
75+
# Mixing of non-composable engine
76+
--let $extra_warning_count= $mix_engine_warning_count
6877
--source common/binlog/enforce_gtid_consistency_statement.inc
6978

7079
--echo ---- InnoDB and temp MyISAM in one autocommit statement, binlog_format=stm ----
7180
CREATE TRIGGER trig BEFORE INSERT ON innodb FOR EACH ROW INSERT INTO tmp_myisam1 VALUES (1);
7281
--let $statement= INSERT INTO innodb VALUES (1)
7382
--let $statement_ends_transaction= 1
83+
# Mixing of non-composable engine
84+
--let $extra_warning_count= $mix_engine_warning_count
7485
--source common/binlog/enforce_gtid_consistency_statement.inc
7586

7687
--echo ---- InnoDB and temp MyISAM in one statement inside trx, binlog_format=stm ----

mysql-test/r/flush_read_lock.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,6 +1540,8 @@ alter table t1_temp drop column c1;
15401540
begin;
15411541
insert into t1_base values (1);
15421542
insert into t3_trans values (1);
1543+
Warnings:
1544+
Warning 6414 Combining the storage engines InnoDB and MyISAM is deprecated, but the statement or transaction updates both the InnoDB table test.t3_trans and the MyISAM table test.t1_base.
15431545
# Switching to connection 'con1'.
15441546
# The below FTWRL should not be blocked by transaction in 'default'.
15451547
flush tables with read lock;

mysql-test/r/foreign_key_myisam.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ ALTER TABLE parent ENGINE=InnoDB;
180180
ERROR HY000: Table 'child' was locked with a READ lock and can't be updated
181181
UNLOCK TABLES;
182182
LOCK TABLES child WRITE, parent WRITE;
183+
Warnings:
184+
Warning 6414 Combining the storage engines MyISAM and InnoDB is deprecated, but the statement or transaction updates both the MyISAM table test.parent and the InnoDB table test.child.
183185
ALTER TABLE parent ENGINE=InnoDB;
184186
UNLOCK TABLES;
185187
DROP TABLES child, parent;

mysql-test/r/lock_multi.result

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,8 @@ UNLOCK TABLES;
963963
# 2.c) Blocks concurrent modifications to table
964964
connection default;
965965
LOCK TABLE t1 WRITE, t2 WRITE;
966+
Warnings:
967+
Warning 6414 Combining the storage engines InnoDB and MyISAM is deprecated, but the statement or transaction updates both the InnoDB table test.t2 and the MyISAM table test.t1.
966968
connection con1;
967969
# Sending:
968970
INSERT INTO t1 VALUES (1);
@@ -2099,6 +2101,8 @@ i
20992101
1
21002102
connection default;
21012103
LOCK TABLE t8 WRITE;
2104+
Warnings:
2105+
Warning 6414 Combining the storage engines InnoDB and MyISAM is deprecated, but the statement or transaction updates both the InnoDB table test.t2 and the MyISAM table test.t8.
21022106
connection con1;
21032107
# Sending:
21042108
SELECT * FROM t2;;
@@ -2165,11 +2169,15 @@ RELEASE_LOCK('mysqltest_lock')
21652169
1
21662170
connection con2;
21672171
# Reaping LOCK TABLE WRITE
2172+
Warnings:
2173+
Warning 6414 Combining the storage engines InnoDB and MyISAM is deprecated, but the statement or transaction updates both the InnoDB table test.t2 and the MyISAM table test.t8.
21682174
UNLOCK TABLES;
21692175
#
21702176
# 7.c) Blocks concurrent modifications to table
21712177
connection default;
21722178
LOCK TABLE t7 WRITE, t8 WRITE;
2179+
Warnings:
2180+
Warning 6414 Combining the storage engines InnoDB and MyISAM is deprecated, but the statement or transaction updates both the InnoDB table test.t2 and the MyISAM table test.t7.
21732181
connection con1;
21742182
# Sending:
21752183
INSERT INTO t1 VALUES (1);
@@ -2240,6 +2248,8 @@ RELEASE_LOCK('mysqltest_lock')
22402248
1
22412249
connection con2;
22422250
# Reaping LOCK TABLES WRITE
2251+
Warnings:
2252+
Warning 6414 Combining the storage engines InnoDB and MyISAM is deprecated, but the statement or transaction updates both the InnoDB table test.t2 and the MyISAM table test.t8.
22432253
UNLOCK TABLES;
22442254
connection default;
22452255
# Revert effects from INSERTs
@@ -2276,6 +2286,8 @@ connection default;
22762286
COMMIT;
22772287
connection con1;
22782288
# Reap LOCK TABLES WRITE
2289+
Warnings:
2290+
Warning 6414 Combining the storage engines InnoDB and MyISAM is deprecated, but the statement or transaction updates both the InnoDB table test.t2 and the MyISAM table test.t8.
22792291
UNLOCK TABLES;
22802292
connection default;
22812293
#
@@ -2305,6 +2317,8 @@ connection default;
23052317
COMMIT;
23062318
connection con1;
23072319
# Reap LOCK TABLES WRITE
2320+
Warnings:
2321+
Warning 6414 Combining the storage engines InnoDB and MyISAM is deprecated, but the statement or transaction updates both the InnoDB table test.t2 and the MyISAM table test.t8.
23082322
UNLOCK TABLES;
23092323
connection default;
23102324
# Revert effects from INSERTs
@@ -2326,6 +2340,8 @@ connection con1;
23262340
UNLOCK TABLES;
23272341
connection default;
23282342
LOCK TABLES t8 WRITE;
2343+
Warnings:
2344+
Warning 6414 Combining the storage engines InnoDB and MyISAM is deprecated, but the statement or transaction updates both the InnoDB table test.t2 and the MyISAM table test.t8.
23292345
connection con1;
23302346
# Sending:
23312347
LOCK TABLES t2 WRITE;;

mysql-test/r/mix2_myisam.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,6 +1179,8 @@ CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=MyISAM;
11791179
SET AUTOCOMMIT=0;
11801180
INSERT INTO t1 ( B_ID ) VALUES ( 1 );
11811181
INSERT INTO t2 ( NEXT_T ) VALUES ( 1 );
1182+
Warnings:
1183+
Warning 6414 Combining the storage engines MEMORY and MyISAM is deprecated, but the statement or transaction updates both the MEMORY table test.t2 and the MyISAM table test.t1.
11821184
ROLLBACK;
11831185
Warnings:
11841186
Warning 1196 Some non-transactional changed tables couldn't be rolled back
@@ -1199,6 +1201,8 @@ create table t1 (a int not null auto_increment primary key, b int, c int, key(c)
11991201
create table t2 (a int not null auto_increment primary key, b int) ENGINE = MEMORY;
12001202
insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);
12011203
insert into t2 (a) select b from t1;
1204+
Warnings:
1205+
Warning 6414 Combining the storage engines MEMORY and MyISAM is deprecated, but the statement or transaction updates both the MEMORY table test.t2 and the MyISAM table test.t1.
12021206
insert into t1 (b) select b from t2;
12031207
insert into t2 (a) select b from t1;
12041208
insert into t1 (a) select b from t2;

mysql-test/r/no_binlog_gtid_next_partially_failed_stmts.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ SET SESSION GTID_NEXT='MASTER_UUID:7';
190190
OPTIMIZE TABLE t1, t_non_existent;
191191
Table Op Msg_type Msg_text
192192
test.t1 optimize status Table is already up to date
193+
test.t_non_existent optimize Warning Combining the storage engines InnoDB and MyISAM is deprecated, but the statement or transaction updates both the InnoDB table mysql.gtid_executed and the MyISAM table test.t1.
193194
test.t_non_existent optimize Error Table 'test.t_non_existent' doesn't exist
194195
test.t_non_existent optimize status Operation failed
195196
#
@@ -230,6 +231,7 @@ SET SESSION GTID_NEXT='MASTER_UUID:9';
230231
REPAIR TABLE t1, t_non_existent;
231232
Table Op Msg_type Msg_text
232233
test.t1 repair status OK
234+
test.t_non_existent repair Warning Combining the storage engines InnoDB and MyISAM is deprecated, but the statement or transaction updates both the InnoDB table mysql.gtid_executed and the MyISAM table test.t1.
233235
test.t_non_existent repair Error Table 'test.t_non_existent' doesn't exist
234236
test.t_non_existent repair status Operation failed
235237
#

mysql-test/r/partition_innodb_semi_consistent.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ SELECT * FROM t1;
103103
a b
104104
1 init+con1
105105
# Switch to connection con2
106+
Warnings:
107+
Warning 6414 Combining the storage engines MyISAM and InnoDB is deprecated, but the statement or transaction updates both the MyISAM table test.t2 and the InnoDB table test.t1.
106108
SELECT * FROM t1;
107109
a b
108110
1 init+con1+con2
@@ -130,6 +132,8 @@ SELECT * FROM t1;
130132
a b
131133
2 init+con1
132134
# Switch to connection con2
135+
Warnings:
136+
Warning 6414 Combining the storage engines MyISAM and InnoDB is deprecated, but the statement or transaction updates both the MyISAM table test.t2 and the InnoDB table test.t1.
133137
SELECT * FROM t1;
134138
a b
135139
2 init+con1

mysql-test/r/rename_debug_myisam.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ CREATE TABLE t0 (m INT) ENGINE=MyISAM;
2424
# from the set of locked tables. Metadata locks on both
2525
# old and new table names are kept.
2626
LOCK TABLES t1 WRITE, t2 WRITE, t0 WRITE;
27+
Warnings:
28+
Warning 6414 Combining the storage engines MyISAM and InnoDB is deprecated, but the statement or transaction updates both the MyISAM table test.t0 and the InnoDB table test.t1.
2729
SET @@debug='+d,injecting_fault_writing';
2830
RENAME TABLES t0 TO t00, t1 TO t01;
2931
ERROR HY000: Error writing file 'binlog' ((errno: #)
@@ -72,6 +74,8 @@ CREATE TABLE t1 (i INT) ENGINE=InnoDB;
7274
CREATE TABLE t0 (l INT) ENGINE=MyISAM;
7375
CREATE DATABASE mysqltest;
7476
LOCK TABLES t0 WRITE, t1 WRITE;
77+
Warnings:
78+
Warning 6414 Combining the storage engines InnoDB and MyISAM is deprecated, but the statement or transaction updates both the InnoDB table test.t1 and the MyISAM table test.t0.
7579
SET @@debug='+d,injecting_fault_writing';
7680
RENAME TABLES t0 TO mysqltest.t0, t1 TO t01;
7781
ERROR HY000: Error writing file 'binlog' ((errno: #)

0 commit comments

Comments
 (0)