Debian Codegraph @

mysql-test/suite/ndb/t/ndb_dd_ddl.test

raw
1 #########################################
2 # Author: JBM
3 # Date: 2006-01-03
4 # Purpose: Test the NDB engine reaction to duplicate
5 # Table spaces and log groups. Also to test
6 # Statement mixed case.
7 ############################################
8 # Change Author:JBM
9 # Change Date 2006-01-19
10 # Change: Adding to test cases feedback from OB
11 # 1) The 'duplicate' tests.
12 # a) The test is using the default (test) database and is not
13 # attempting to create databases (only logs, table spaces and
14 # tables). Is this intentional?
15 # b) What about a duplication of table name when one exists on disk and
16 # you are trying to create it again in memory?
17 #
18 #2) 'CaSE SensiTiVE' tests
19 # a) Suggest you include a test case where the case difference is in
20 # the file name. I know this is not an issue for *nix systems but
21 # will be when we expand to Windows and Mac. Better put it in now.
22 ############################################
23 #
24 # Jonas 2006-03-10
25 # Add verification that ndb currently is limited to 1 logfile group
26 #
27
28
29 -- source include/have_ndb.inc
30
31 CREATE DATABASE mysqltest;
32
33 ############## Duplcate Statement Testing #########
34
35 --echo **** Begin Duplicate Statement Testing ****
36
37 CREATE LOGFILE GROUP lg1
38 ADD UNDOFILE 'undofile.dat'
39 INITIAL_SIZE 1M
40 UNDO_BUFFER_SIZE = 1M
41 ENGINE=NDB;
42
43 # Verify that one currently can create only 1 logfile group
44 --error ER_CREATE_FILEGROUP_FAILED
45 CREATE LOGFILE GROUP lg2
46 ADD UNDOFILE 'undofile2.dat'
47 INITIAL_SIZE 1M
48 UNDO_BUFFER_SIZE 1M
49 ENGINE NDB;
50 SHOW WARNINGS;
51
52 --error ER_CREATE_FILEGROUP_FAILED
53 CREATE LOGFILE GROUP lg1
54 ADD UNDOFILE 'undofile.dat'
55 INITIAL_SIZE 1M
56 UNDO_BUFFER_SIZE = 1M
57 ENGINE=NDB;
58 SHOW WARNINGS;
59
60 ALTER LOGFILE GROUP lg1
61 ADD UNDOFILE 'undofile02.dat'
62 INITIAL_SIZE 1M ENGINE NDB;
63
64 --error ER_ALTER_FILEGROUP_FAILED
65 ALTER LOGFILE GROUP lg1
66 ADD UNDOFILE 'undofile02.dat'
67 INITIAL_SIZE 1M ENGINE=NDB;
68 SHOW WARNINGS;
69
70 CREATE TABLESPACE ts1
71 ADD DATAFILE 'datafile.dat'
72 USE LOGFILE GROUP lg1
73 INITIAL_SIZE 1M
74 ENGINE NDB;
75
76 --error ER_TABLESPACE_EXISTS
77 CREATE TABLESPACE ts1
78 ADD DATAFILE 'datafile.dat'
79 USE LOGFILE GROUP lg1
80 INITIAL_SIZE 1M
81 ENGINE NDB;
82
83 ALTER TABLESPACE ts1
84 ADD DATAFILE 'datafile2.dat'
85 INITIAL_SIZE 1M;
86
87 --error ER_ALTER_FILEGROUP_FAILED
88 ALTER TABLESPACE ts1
89 ADD DATAFILE 'datafile2.dat'
90 INITIAL_SIZE 1M;
91 SHOW WARNINGS;
92
93 CREATE TABLE mysqltest.t1
94 (pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
95 TABLESPACE ts1 STORAGE DISK
96 ENGINE=NDB;
97
98 --error ER_TABLE_EXISTS_ERROR
99 CREATE TABLE mysqltest.t1
100 (pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
101 TABLESPACE ts1 STORAGE DISK
102 ENGINE=NDB;
103
104 --error ER_TABLE_EXISTS_ERROR
105 CREATE TABLE mysqltest.t1
106 (pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
107 ENGINE=NDB;
108
109
110 DROP TABLE mysqltest.t1;
111
112 ALTER TABLESPACE ts1
113 DROP DATAFILE 'datafile2.dat';
114
115 --error ER_MISSING_TABLESPACE_FILE
116 ALTER TABLESPACE ts1
117 DROP DATAFILE 'datafile2.dat';
118
119 ALTER TABLESPACE ts1
120 DROP DATAFILE 'datafile.dat';
121
122 --error ER_MISSING_TABLESPACE_FILE
123 ALTER TABLESPACE ts1
124 DROP DATAFILE 'datafile.dat';
125
126 DROP TABLESPACE ts1;
127
128 --error ER_TABLESPACE_MISSING_WITH_NAME
129 DROP TABLESPACE ts1;
130
131 DROP LOGFILE GROUP lg1
132 ENGINE=NDB;
133
134 --error ER_DROP_FILEGROUP_FAILED
135 DROP LOGFILE GROUP lg1
136 ENGINE=NDB;
137 SHOW WARNINGS;
138
139 #
140 # Bug#13804744 INCONSISTENT REQUIREMENT OF ENGINE= CLAUSE WHEN DEFAULT STORAGE_ENGINE IS USED
141 #
142
143 SET DEFAULT_STORAGE_ENGINE=NDB;
144
145 CREATE LOGFILE GROUP lgx
146 ADD UNDOFILE 'undofile.dat'
147 INITIAL_SIZE 1M
148 UNDO_BUFFER_SIZE = 1M;
149
150 ALTER LOGFILE GROUP lgx
151 ADD UNDOFILE 'undofile02.dat'
152 INITIAL_SIZE=1M;
153
154 CREATE TABLESPACE tsx
155 ADD DATAFILE 'datafile.dat'
156 USE LOGFILE GROUP lgx
157 INITIAL_SIZE=1M;
158
159 ALTER TABLESPACE tsx
160 DROP DATAFILE 'datafile.dat'
161 INITIAL_SIZE=1M;
162
163 DROP TABLESPACE tsx;
164
165 DROP LOGFILE GROUP lgx;
166
167 DROP DATABASE IF EXISTS mysqltest;
168
169 --echo **** End Duplicate Statement Testing ****
170 ############# End Duplicate Statments ############
171 --echo
172 ############ Begin CaSe Testing ##################
173 --echo **** Begin Statment CaSe Testing ****
174
175 creaTE LOgfilE GrOuP lg1
176 adD undoFILE 'undofile.dat'
177 initiAL_siZE 1M
178 UnDo_BuFfEr_SiZe = 1M
179 ENGInE=NDb;
180
181 altER LOgFiLE GrOUp lg1
182 AdD UnDOfILe 'uNdOfiLe02.daT'
183 INItIAl_SIzE 1M ENgINE nDB;
184
185 CrEAtE TABLEspaCE ts1
186 ADD DATAfilE 'datafile.dat'
187 UsE LoGFiLE GRoUP lg1
188 INITiaL_SizE 1M
189 ENGiNe NDb;
190
191 AlTeR tAbLeSpAcE ts1
192 AdD DaTaFiLe 'dAtAfiLe2.daT'
193 InItIaL_SiZe 1M;
194
195 CREATE TABLE t1
196 (pk1 int not null primary key, b int not null, c int not null)
197 TABLEspace ts1 storAGE dISk
198 ENGine nDb;
199
200 DROP TABLE t1;
201
202 AlteR TAblespaCE ts1
203 droP DATAfile 'dAtAfiLe2.daT';
204
205 ALter tablesPACE ts1
206 dROp dAtAfIlE 'datafile.dat';
207
208 DrOp TaBleSpAcE ts1;
209
210 DrOp lOgFiLe GrOuP lg1
211 EnGiNe=nDb;
212
213 --echo **** End Statment CaSe Testing ****
214 ############ End CaSe Testing ##################
215 --echo
216 ############ Begin = and no = Testing ##########
217 --echo **** Begin = And No = Testing ****
218
219 CREATE LOGFILE GROUP lg1
220 ADD UNDOFILE 'undofile.dat'
221 INITIAL_SIZE=1M
222 UNDO_BUFFER_SIZE=1M
223 ENGINE=NDB;
224
225 ALTER LOGFILE GROUP lg1
226 ADD UNDOFILE 'undofile02.dat'
227 INITIAL_SIZE=1M
228 ENGINE=NDB;
229
230 CREATE TABLESPACE ts1
231 ADD DATAFILE 'datafile.dat'
232 USE LOGFILE GROUP lg1
233 INITIAL_SIZE=1M
234 ENGINE=NDB;
235
236 ALTER TABLESPACE ts1
237 ADD DATAFILE 'datafile2.dat'
238 INITIAL_SIZE=1M;
239
240 CREATE TABLE t1
241 (pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
242 TABLESPACE ts1 STORAGE DISK
243 ENGINE=NDB;
244
245 DROP TABLE t1;
246
247 ALTER TABLESPACE ts1
248 DROP DATAFILE 'datafile2.dat';
249
250 ALTER TABLESPACE ts1
251 DROP DATAFILE 'datafile.dat';
252
253 DROP TABLESPACE ts1;
254
255 DROP LOGFILE GROUP lg1
256 ENGINE=NDB;
257
258 --echo
259 --echo **** End of = ****
260 --echo
261
262 CREATE LOGFILE GROUP lg1
263 ADD UNDOFILE 'undofile.dat'
264 INITIAL_SIZE 1M
265 UNDO_BUFFER_SIZE 1M
266 ENGINE NDB;
267
268 ALTER LOGFILE GROUP lg1
269 ADD UNDOFILE 'undofile02.dat'
270 INITIAL_SIZE 1M
271 ENGINE NDB;
272
273 CREATE TABLESPACE ts1
274 ADD DATAFILE 'datafile.dat'
275 USE LOGFILE GROUP lg1
276 INITIAL_SIZE 1M
277 ENGINE NDB;
278
279 ALTER TABLESPACE ts1
280 ADD DATAFILE 'datafile2.dat'
281 INITIAL_SIZE 1M;
282
283 CREATE TABLE t1
284 (pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
285 TABLESPACE ts1 STORAGE MEMORY
286 ENGINE NDB;
287
288 ALTER TABLE t1 STORAGE DISK;
289
290 CREATE INDEX b_i on t1(b);
291 CREATE INDEX bc_i on t1(b, c);
292
293 DROP TABLE t1;
294
295 # bug#20053
296
297 CREATE TABLESPACE ts2
298 ADD DATAFILE 'datafile3.dat'
299 USE LOGFILE GROUP lg1
300 INITIAL_SIZE 1M
301 ENGINE NDB;
302
303 --error ER_MISSING_TABLESPACE_FILE
304 ALTER TABLESPACE ts1
305 DROP DATAFILE 'datafile3.dat';
306
307 --error ER_MISSING_TABLESPACE_FILE
308 ALTER TABLESPACE ts2
309 DROP DATAFILE 'datafile2.dat';
310 # bug#20053
311
312 ALTER TABLESPACE ts1
313 DROP DATAFILE 'datafile2.dat';
314
315 ALTER TABLESPACE ts1
316 DROP DATAFILE 'datafile.dat';
317
318 DROP TABLESPACE ts1;
319
320 ALTER TABLESPACE ts2
321 DROP DATAFILE 'datafile3.dat';
322
323 DROP TABLESPACE ts2;
324
325 DROP LOGFILE GROUP lg1
326 ENGINE NDB;
327
328 --echo **** End = And No = ****
329 ############ End = And No = ##################
330
331 ###
332 #
333 # bug#16341
334 #create table t1 (a int primary key) engine = myisam;
335 # 2007-08-22 Jeb
336 # Removed the use of create table and manually
337 # created the file to cause failure due to
338 # inconsistant results on other OS
339 # see #bug30559
340
341 # Create empty file
342 --write_file $MYSQLTEST_VARDIR/tmp/t1.dat
343 EOF
344
345 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
346 --error ER_CREATE_FILEGROUP_FAILED
347 --eval create logfile group lg1 add undofile '$MYSQLTEST_VARDIR/tmp/t1.dat' initial_size 1M undo_buffer_size = 1M engine=ndb;
348
349 create logfile group lg1
350 add undofile 'undofile.dat'
351 initial_size 1M
352 undo_buffer_size = 1M
353 engine=ndb;
354
355 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
356 --error ER_CREATE_FILEGROUP_FAILED
357 --eval create tablespace ts1 add datafile '$MYSQLTEST_VARDIR/tmp/t1.dat' use logfile group lg1 initial_size 1M engine ndb;
358
359 --error ER_TABLESPACE_MISSING_WITH_NAME
360 drop tablespace ts1
361 engine ndb;
362
363 drop logfile group lg1
364 engine ndb;
365
366 --remove_file $MYSQLTEST_VARDIR/tmp/t1.dat
367
368
369 # End 5.1 test