1
SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION';
2
PREPARE stmt_start FROM "SELECT UNIX_TIMESTAMP() INTO @start";
3
SET @runtime = <intended_runtime>;
4
PREPARE stmt_break FROM "SELECT UNIX_TIMESTAMP() - @start > @runtime - 1";
5
DROP TABLE IF EXISTS t1;
6
# Subtest 1A (one connection, no PREPARE/EXECUTE)
8
# default: CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2))
10
# default: INSERT INTO t1 VALUES (1,1), (2,2), (3,3)
11
# default: DROP TABLE t1
12
# Subtest 1B (one connection, use PREPARE/EXECUTE)
14
# default: CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2))
16
# default: INSERT INTO t1 VALUES (1,1), (2,2), (3,3)
17
# default: DROP TABLE t1
18
# Subtest 1C (two connections, no PREPARE/EXECUTE)
20
# default: CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2))
22
# con2: INSERT INTO t1 VALUES (1,1), (2,2), (3,3)
24
# Subtest 1D (two connections, use PREPARE/EXECUTE)
26
# default: CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2))
28
# con2: INSERT INTO t1 VALUES (1,1), (2,2), (3,3)
30
# Subtest 2A (one connection, no PREPARE/EXECUTE)
32
# default: CREATE TABLE t1 ENGINE = NDB AS SELECT 1 AS f1
33
# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1
34
# default: DROP TABLE t1
35
# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE)
36
# Subtest 2B (one connection, use PREPARE/EXECUTE)
38
# default: CREATE TABLE t1 ENGINE = NDB AS SELECT 1 AS f1
39
# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1
40
# default: DROP TABLE t1
41
# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE)
42
# Subtest 2C (two connections, no PREPARE/EXECUTE)
44
# default: CREATE TABLE t1 ENGINE = NDB AS SELECT 1 AS f1
45
# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1
46
# default: DROP TABLE t1
47
# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE)
48
# Subtest 2D (two connections, use PREPARE/EXECUTE)
50
# default: CREATE TABLE t1 ENGINE = NDB AS SELECT 1 AS f1
51
# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1
52
# default: DROP TABLE t1
53
# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE)
54
# Subtest 3A (one connection, no PREPARE/EXECUTE)
56
# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=NDB
57
# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=NDB (expect to get ER_TABLE_EXISTS_ERROR)
58
# default: DROP TABLE t1
59
# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
60
# Subtest 3B (one connection, use PREPARE/EXECUTE)
62
# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=NDB
63
# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=NDB (expect to get ER_TABLE_EXISTS_ERROR)
64
# default: DROP TABLE t1
65
# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
66
# Subtest 3C (two connections, no PREPARE/EXECUTE)
68
# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=NDB
69
# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=NDB (expect to get ER_TABLE_EXISTS_ERROR)
70
# default: DROP TABLE t1
71
# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
72
# Subtest 3D (two connections, use PREPARE/EXECUTE)
74
# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=NDB
75
# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=NDB (expect to get ER_TABLE_EXISTS_ERROR)
76
# default: DROP TABLE t1
77
# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
78
CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=NDB;
80
CREATE TABLE t1 (f1 BIGINT) ENGINE=NDB;
82
# Subtest 4A (one connection, no PREPARE/EXECUTE)
84
# default: CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=NDB
85
# default: SHOW CREATE TABLE t1
86
# default: DROP TABLE t1
87
# default: SHOW CREATE TABLE t1 (expect to get ER_NO_SUCH_TABLE)
88
# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=NDB
89
# default: SHOW CREATE TABLE t1
90
# default: DROP TABLE t1
91
# Subtest 4B (one connection, use PREPARE/EXECUTE)
93
# default: CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=NDB
94
# default: SHOW CREATE TABLE t1
95
# default: DROP TABLE t1
96
# default: SHOW CREATE TABLE t1 (expect to get ER_NO_SUCH_TABLE)
97
# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=NDB
98
# default: SHOW CREATE TABLE t1
99
# default: DROP TABLE t1
100
# Subtest 4C (two connections, no PREPARE/EXECUTE)
102
# default: CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=NDB
103
# con2: SHOW CREATE TABLE t1
104
# default: DROP TABLE t1
105
# con2: SHOW CREATE TABLE t1 (expect to get ER_NO_SUCH_TABLE)
106
# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=NDB
107
# con2: SHOW CREATE TABLE t1
108
# default: DROP TABLE t1
109
# Subtest 4D (two connections, use PREPARE/EXECUTE)
111
# default: CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=NDB
112
# con2: SHOW CREATE TABLE t1
113
# default: DROP TABLE t1
114
# con2: SHOW CREATE TABLE t1 (expect to get ER_NO_SUCH_TABLE)
115
# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=NDB
116
# con2: SHOW CREATE TABLE t1
117
# default: DROP TABLE t1
118
# Subtest 5A (one connection, no PREPARE/EXECUTE)
120
# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = NDB
121
# default: INSERT INTO t1 SET f2 = 9
122
# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9
123
# default: DROP TABLE t1
124
# Subtest 5B (one connection, use PREPARE/EXECUTE)
126
# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = NDB
127
# default: INSERT INTO t1 SET f2 = 9
128
# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9
129
# default: DROP TABLE t1
130
# Subtest 5C (two connections, no PREPARE/EXECUTE)
132
# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = NDB
133
# con2: INSERT INTO t1 SET f2 = 9
134
# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9
135
# con2: DROP TABLE t1
136
# Subtest 5D (two connections, use PREPARE/EXECUTE)
138
# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = NDB
139
# con2: INSERT INTO t1 SET f2 = 9
140
# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9
141
# con2: DROP TABLE t1
142
CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1)) ENGINE=NDB;
143
# Subtest 6A (one connection, no PREPARE/EXECUTE)
145
# default: CREATE INDEX IDX1 ON t1 (f2)
146
# default: CREATE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_KEYNAME)
147
# default: DROP INDEX IDX1 ON t1
148
# default: DROP INDEX IDX1 ON t1 (expect to get ER_CANT_DROP_FIELD_OR_KEY)
149
# default: CREATE INDEX IDX1 ON t1 (f2)
150
# default: DROP INDEX IDX1 ON t1
151
# Subtest 6B (one connection, use PREPARE/EXECUTE)
153
# default: CREATE INDEX IDX1 ON t1 (f2)
154
# default: CREATE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_KEYNAME)
155
# default: DROP INDEX IDX1 ON t1
156
# default: DROP INDEX IDX1 ON t1 (expect to get ER_CANT_DROP_FIELD_OR_KEY)
157
# default: CREATE INDEX IDX1 ON t1 (f2)
158
# default: DROP INDEX IDX1 ON t1
159
# Subtest 6C (two connections, no PREPARE/EXECUTE)
161
# default: CREATE INDEX IDX1 ON t1 (f2)
162
# con2: CREATE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_KEYNAME)
163
# default: DROP INDEX IDX1 ON t1
164
# con2: DROP INDEX IDX1 ON t1 (expect to get ER_CANT_DROP_FIELD_OR_KEY)
165
# default: CREATE INDEX IDX1 ON t1 (f2)
166
# con2: DROP INDEX IDX1 ON t1
167
# Subtest 6D (two connections, use PREPARE/EXECUTE)
169
# default: CREATE INDEX IDX1 ON t1 (f2)
170
# con2: CREATE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_KEYNAME)
171
# default: DROP INDEX IDX1 ON t1
172
# con2: DROP INDEX IDX1 ON t1 (expect to get ER_CANT_DROP_FIELD_OR_KEY)
173
# default: CREATE INDEX IDX1 ON t1 (f2)
174
# con2: DROP INDEX IDX1 ON t1
176
CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1)) ENGINE=NDB;
177
INSERT INTO t1 VALUES(1,1);
178
CREATE INDEX IDX ON t1 (f2);
179
DROP INDEX IDX ON t1;
180
CREATE UNIQUE INDEX IDX ON t1 (f2);
181
DROP INDEX IDX ON t1;
182
# Subtest 8A (one connection, no PREPARE/EXECUTE)
184
# default: CREATE INDEX IDX ON t1 (f2)
185
# default: SHOW CREATE TABLE t1
186
# default: DROP INDEX IDX ON t1
187
# default: CREATE UNIQUE INDEX IDX ON t1 (f2)
188
# default: SHOW CREATE TABLE t1
189
# default: DROP INDEX IDX ON t1
190
# Subtest 8B (one connection, use PREPARE/EXECUTE)
192
# default: CREATE INDEX IDX ON t1 (f2)
193
# default: SHOW CREATE TABLE t1
194
# default: DROP INDEX IDX ON t1
195
# default: CREATE UNIQUE INDEX IDX ON t1 (f2)
196
# default: SHOW CREATE TABLE t1
197
# default: DROP INDEX IDX ON t1
198
# Subtest 8C (two connections, no PREPARE/EXECUTE)
200
# default: CREATE INDEX IDX ON t1 (f2)
201
# con2: SHOW CREATE TABLE t1
202
# default: DROP INDEX IDX ON t1
203
# default: CREATE UNIQUE INDEX IDX ON t1 (f2)
204
# con2: SHOW CREATE TABLE t1
205
# default: DROP INDEX IDX ON t1
206
# Subtest 8D (two connections, use PREPARE/EXECUTE)
208
# default: CREATE INDEX IDX ON t1 (f2)
209
# con2: SHOW CREATE TABLE t1
210
# default: DROP INDEX IDX ON t1
211
# default: CREATE UNIQUE INDEX IDX ON t1 (f2)
212
# con2: SHOW CREATE TABLE t1
213
# default: DROP INDEX IDX ON t1
215
DEALLOCATE PREPARE stmt_start;
216
DEALLOCATE PREPARE stmt_break;