-
Notifications
You must be signed in to change notification settings - Fork 4k
/
Copy pathenforce_gtid_consistency_trx_nontrx_consistent.test
149 lines (122 loc) · 6.16 KB
/
enforce_gtid_consistency_trx_nontrx_consistent.test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
--let $gtid_violation= 0
--let $error_code= 0
--let $statement_ends_transaction= 1
--let $sync_point= end_decide_logging_format
CREATE TABLE myisam1 (a INT) ENGINE = MyISAM;
CREATE TABLE myisam2 (a INT) ENGINE = MyISAM;
CREATE TABLE innodb (a INT) ENGINE = InnoDB;
# Mixing two MyISAM updates in the same statement or transaction is
# GTID-consistent (it is only when *both* transactional and
# non-transactional updates are mixed that it violates
# GTID-consistency).
# if gtid_next=GTID, it generates ER_GTID_NEXT_TYPE_UNDEFINED_GTID.
if ($gtid_next != 'GTID')
{
--echo ---- MyISAM followed by MyISAM, in one 'trx' ----
--let $pre_statement= BEGIN; INSERT INTO myisam1 VALUES (1)
--let $statement= INSERT INTO myisam2 VALUES (1)
#Mixing of same engine so no warning
--let $extra_warning_count= 0
--source common/binlog/enforce_gtid_consistency_statement.inc
}
--echo ---- MyISAM and MyISAM in one statement ----
CREATE TRIGGER trig BEFORE INSERT ON myisam1 FOR EACH ROW INSERT INTO myisam2 VALUES (1);
--let $statement= INSERT INTO myisam2 VALUES (1)
#Mixing of same engine so no warning
--let $extra_warning_count= 0
--source common/binlog/enforce_gtid_consistency_statement.inc
DROP TRIGGER trig;
# if gtid_next=GTID, it generates ER_GTID_NEXT_TYPE_UNDEFINED_GTID.
if ($gtid_next != 'GTID')
{
# As a special case, when MyISAM precedes InnoDB in a transaction, the
# MyISAM is executed as if it was outside the transaction, so that is
# GTID-consistent too.
--echo ---- MyISAM followed by InnoDB, in one 'trx' ----
--let $pre_statement= BEGIN; INSERT INTO myisam1 VALUES (1)
--let $statement= INSERT INTO innodb VALUES (1)
#Mixing of non-composable engine so 1 warning
--let $extra_warning_count = 1
--source common/binlog/enforce_gtid_consistency_statement.inc
}
# When InnoDB is mixed with *temporary* MyISAM and binlog_format='row',
# or binlog_format=mixed and it logs in row format, it is
# GTID-consistent since DML on temporary tables is not logged at all
# in row format.
# Use binlog_format=mixed and force it to switch to row format.
SET SESSION BINLOG_FORMAT = MIXED;
--echo ---- InnoDB followed by temp MyISAM in one trx, binlog_format=mix ----
# For this case, server should switch to row format specifically
# because the transaction mixes InnoDB with temporary MyISAM. Thus, it
# becomes GTID consistent since it doesn't need to write a mix of
# InnoDB and MyISAM to the binlog.
CREATE TEMPORARY TABLE tmp_myisam1 (a INT) ENGINE = MyISAM;
--let $pre_statement= BEGIN; INSERT INTO innodb VALUES (1)
--let $statement= INSERT INTO tmp_myisam1 VALUES (1)
#Mixing of non-composable engine so 1 warning
--let $extra_warning_count = 1
--source common/binlog/enforce_gtid_consistency_statement.inc
DROP TEMPORARY TABLE tmp_myisam1;
--echo ---- InnoDB and temp MyISAM in one autocommit statement, binlog_format=mix ----
# For this case, server should switch to row format specifically
# because the transaction mixes InnoDB with temporary MyISAM. Thus, it
# becomes GTID consistent since it doesn't need to write a mix of
# InnoDB and MyISAM to the binlog.
CREATE TEMPORARY TABLE tmp_myisam1 (a INT) ENGINE = MyISAM;
CREATE TEMPORARY TABLE tmp_myisam2 (a INT) ENGINE = MyISAM;
--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
--let $statement= INSERT INTO innodb VALUES (1)
#Mixing of non-composable engine so 1 warning
--let $extra_warning_count = 1
--source common/binlog/enforce_gtid_consistency_statement.inc
DROP TRIGGER trig;
DROP TEMPORARY TABLE tmp_myisam1, tmp_myisam2;
SET BINLOG_FORMAT = 'ROW';
CREATE TEMPORARY TABLE tmp_myisam1 (a INT) ENGINE = MyISAM;
CREATE TEMPORARY TABLE tmp_myisam2 (a INT) ENGINE = MyISAM;
--echo ---- InnoDB followed by temp MyISAM in one trx, binlog_format='row' ----
--let $pre_statement= BEGIN; INSERT INTO innodb VALUES (1)
--let $statement= INSERT INTO tmp_myisam1 VALUES (1)
#Mixing of non-composable engine so 1 warning
--let $extra_warning_count = 1
--source common/binlog/enforce_gtid_consistency_statement.inc
--echo ---- InnoDB and temp MyISAM in one statement, binlog_format='row' ----
--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
--let $statement= INSERT INTO innodb VALUES (1)
#Mixing of non-composable engine so 1 warning
--let $extra_warning_count = 1
--source common/binlog/enforce_gtid_consistency_statement.inc
DROP TRIGGER trig;
# Drop temp tables and recreate them after SET BINLOG_FORMAT, since
# it's not allowed to have temp tables open when switching from
# binlog_format='row' to statement.
DROP TEMPORARY TABLE tmp_myisam1, tmp_myisam2;
--replace_regex /'[A-Z]*'/#/
eval SET BINLOG_FORMAT = '$binlog_format';
CREATE TEMPORARY TABLE tmp_myisam1 (a INT) ENGINE = MyISAM;
CREATE TEMPORARY TABLE tmp_myisam2 (a INT) ENGINE = MyISAM;
# When SQL_LOG_BIN=0, it is GTID-consistent since nothing is logged.
SET SQL_LOG_BIN = 0;
--echo ---- InnoDB and MyISAM in one statement, SQL_LOG_BIN=0 ----
--eval CREATE TRIGGER trig BEFORE INSERT ON innodb FOR EACH ROW BEGIN INSERT INTO myisam1 VALUES (1); INSERT INTO myisam2 VALUES (1); END
--let $statement= INSERT INTO innodb VALUES (1)
#Mixing of non-composable engine so 1 warning
--let $extra_warning_count = 1
--source common/binlog/enforce_gtid_consistency_statement.inc
DROP TRIGGER trig;
--echo ---- InnoDB followed by MyISAM, in one trx, SQL_LOG_BIN=0 ----
--let $pre_statement= BEGIN; INSERT INTO innodb VALUES (1)
--let $statement= INSERT INTO myisam1 VALUES (1)
#Mixing of non-composable engine so 1 warning
--let $extra_warning_count = 1
--source common/binlog/enforce_gtid_consistency_statement.inc
--echo ---- InnoDB and MyISAM in one statement inside trx, SQL_LOG_BIN=0 ----
--eval CREATE TRIGGER trig BEFORE INSERT ON innodb FOR EACH ROW BEGIN INSERT INTO myisam1 VALUES (1); INSERT INTO myisam2 VALUES (1); END
--let $pre_statement= BEGIN
--let $statement= INSERT INTO innodb VALUES (1)
#Mixing of non-composable engine so 1 warning
--let $extra_warning_count = 1
--source common/binlog/enforce_gtid_consistency_statement.inc
DROP TRIGGER trig;
SET SQL_LOG_BIN = 1;
DROP TABLE myisam1, myisam2, tmp_myisam1, tmp_myisam2, innodb;