~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/mysql-test/innodb-zip.test

  • Committer: Monty Taylor
  • Date: 2009-03-24 17:44:41 UTC
  • mto: (960.5.2 mordred)
  • mto: This revision was merged to the branch mainline in revision 964.
  • Revision ID: mordred@inaugust.com-20090324174441-nmsq0gwjlgf7f0mt
Changed handlerton to StorageEngine.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-- source include/have_innodb.inc
 
2
 
 
3
let $per_table=`select @@innodb_file_per_table`;
 
4
let $format=`select @@innodb_file_format`;
 
5
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
 
6
set global innodb_file_per_table=off;
 
7
set global innodb_file_format=`0`;
 
8
 
 
9
create table t0(a int primary key) engine=innodb row_format=compressed;
 
10
create table t00(a int primary key) engine=innodb
 
11
key_block_size=4 row_format=compressed;
 
12
create table t1(a int primary key) engine=innodb row_format=dynamic;
 
13
create table t2(a int primary key) engine=innodb row_format=redundant;
 
14
create table t3(a int primary key) engine=innodb row_format=compact;
 
15
create table t4(a int primary key) engine=innodb key_block_size=9;
 
16
create table t5(a int primary key) engine=innodb
 
17
key_block_size=1 row_format=redundant;
 
18
 
 
19
set global innodb_file_per_table=on;
 
20
create table t6(a int primary key) engine=innodb
 
21
key_block_size=1 row_format=redundant;
 
22
set global innodb_file_format=`1`;
 
23
create table t7(a int primary key) engine=innodb
 
24
key_block_size=1 row_format=redundant;
 
25
create table t8(a int primary key) engine=innodb
 
26
key_block_size=1 row_format=fixed;
 
27
create table t9(a int primary key) engine=innodb
 
28
key_block_size=1 row_format=compact;
 
29
create table t10(a int primary key) engine=innodb
 
30
key_block_size=1 row_format=dynamic;
 
31
create table t11(a int primary key) engine=innodb
 
32
key_block_size=1 row_format=compressed;
 
33
create table t12(a int primary key) engine=innodb
 
34
key_block_size=1;
 
35
create table t13(a int primary key) engine=innodb
 
36
row_format=compressed;
 
37
create table t14(a int primary key) engine=innodb key_block_size=9;
 
38
 
 
39
SELECT table_schema, table_name, row_format
 
40
FROM information_schema.tables WHERE engine='innodb';
 
41
 
 
42
drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
 
43
alter table t1 key_block_size=0;
 
44
alter table t1 row_format=dynamic;
 
45
SELECT table_schema, table_name, row_format
 
46
FROM information_schema.tables WHERE engine='innodb';
 
47
alter table t1 row_format=compact;
 
48
SELECT table_schema, table_name, row_format
 
49
FROM information_schema.tables WHERE engine='innodb';
 
50
alter table t1 row_format=redundant;
 
51
SELECT table_schema, table_name, row_format
 
52
FROM information_schema.tables WHERE engine='innodb';
 
53
drop table t1;
 
54
 
 
55
create table t1(a int not null, b text, index(b(10))) engine=innodb
 
56
key_block_size=1;
 
57
 
 
58
create table t2(b text)engine=innodb;
 
59
insert into t2 values(concat('1abcdefghijklmnopqrstuvwxyz', repeat('A',5000)));
 
60
 
 
61
insert into t1 select 1, b from t2;
 
62
commit;
 
63
 
 
64
connect (a,localhost,root,,);
 
65
connect (b,localhost,root,,);
 
66
 
 
67
connection a;
 
68
begin;
 
69
update t1 set b=repeat('B',100);
 
70
 
 
71
connection b;
 
72
select a,left(b,40) from t1 natural join t2;
 
73
 
 
74
connection a;
 
75
rollback;
 
76
 
 
77
connection b;
 
78
select a,left(b,40) from t1 natural join t2;
 
79
 
 
80
connection default;
 
81
disconnect a;
 
82
disconnect b;
 
83
 
 
84
SELECT table_schema, table_name, row_format
 
85
FROM information_schema.tables WHERE engine='innodb';
 
86
drop table t1,t2;
 
87
 
 
88
# The following should fail even in non-strict mode.
 
89
SET SESSION innodb_strict_mode = off;
 
90
--error ER_TOO_BIG_ROWSIZE
 
91
CREATE TABLE t1(
 
92
        c TEXT NOT NULL, d TEXT NOT NULL,
 
93
        PRIMARY KEY (c(767),d(767)))
 
94
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
 
95
--error ER_TOO_BIG_ROWSIZE
 
96
CREATE TABLE t1(
 
97
        c TEXT NOT NULL, d TEXT NOT NULL,
 
98
        PRIMARY KEY (c(767),d(767)))
 
99
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
 
100
CREATE TABLE t1(
 
101
        c TEXT NOT NULL, d TEXT NOT NULL,
 
102
        PRIMARY KEY (c(767),d(767)))
 
103
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
 
104
drop table t1;
 
105
--error ER_TOO_BIG_ROWSIZE
 
106
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
 
107
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
 
108
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(439)))
 
109
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
 
110
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
 
111
DROP TABLE t1;
 
112
 
 
113
#
 
114
# Test blob column inheritance (mantis issue#36)
 
115
#
 
116
 
 
117
create table t1( c1 int not null, c2 blob, c3 blob, c4 blob,
 
118
                primary key(c1, c2(22), c3(22)))
 
119
                engine = innodb row_format = dynamic;
 
120
begin;
 
121
insert into t1 values(1, repeat('A', 20000), repeat('B', 20000),
 
122
                        repeat('C', 20000));
 
123
 
 
124
update t1 set c3 = repeat('D', 20000) where c1 = 1;
 
125
commit;
 
126
 
 
127
# one blob column which is unchanged in update and part of PK
 
128
# one blob column which is changed and part of of PK
 
129
# one blob column which is not part of PK and is unchanged
 
130
select count(*) from t1 where c2 = repeat('A', 20000);
 
131
select count(*) from t1 where c3 = repeat('D', 20000);
 
132
select count(*) from t1 where c4 = repeat('C', 20000);
 
133
 
 
134
update t1 set c3 = repeat('E', 20000) where c1 = 1;
 
135
drop table t1;
 
136
 
 
137
#
 
138
#
 
139
# Test innodb_file_format
 
140
#
 
141
set global innodb_file_format=`0`;
 
142
select @@innodb_file_format;
 
143
set global innodb_file_format=`1`;
 
144
select @@innodb_file_format;
 
145
-- error ER_WRONG_ARGUMENTS
 
146
set global innodb_file_format=`2`;
 
147
-- error ER_WRONG_ARGUMENTS
 
148
set global innodb_file_format=`-1`;
 
149
set global innodb_file_format=`Antelope`;
 
150
set global innodb_file_format=`Barracuda`;
 
151
-- error ER_WRONG_ARGUMENTS
 
152
set global innodb_file_format=`Cheetah`;
 
153
-- error ER_WRONG_ARGUMENTS
 
154
set global innodb_file_format=`abc`;
 
155
-- error ER_WRONG_ARGUMENTS
 
156
set global innodb_file_format=`1a`;
 
157
-- error ER_WRONG_ARGUMENTS
 
158
set global innodb_file_format=``;
 
159
 
 
160
#test strict mode.
 
161
# this does not work anymore, has been removed from mysqltest
 
162
# -- enable_errors
 
163
set global innodb_file_per_table = on;
 
164
set global innodb_file_format = `1`;
 
165
 
 
166
set innodb_strict_mode = off;
 
167
create table t1 (id int primary key) engine = innodb key_block_size = 0;
 
168
drop table t1;
 
169
 
 
170
#set strict_mode
 
171
set innodb_strict_mode = on;
 
172
 
 
173
#Test different values of KEY_BLOCK_SIZE
 
174
 
 
175
--error ER_CANT_CREATE_TABLE
 
176
create table t1 (id int primary key) engine = innodb key_block_size = 0;
 
177
show errors;
 
178
 
 
179
--error ER_CANT_CREATE_TABLE
 
180
create table t2 (id int primary key) engine = innodb key_block_size = 9;
 
181
show errors;
 
182
 
 
183
 
 
184
create table t3 (id int primary key) engine = innodb key_block_size = 1;
 
185
create table t4 (id int primary key) engine = innodb key_block_size = 2;
 
186
create table t5 (id int primary key) engine = innodb key_block_size = 4;
 
187
create table t6 (id int primary key) engine = innodb key_block_size = 8;
 
188
create table t7 (id int primary key) engine = innodb key_block_size = 16;
 
189
 
 
190
#check various ROW_FORMAT values.
 
191
create table t8 (id int primary key) engine = innodb row_format = compressed;
 
192
create table t9 (id int primary key) engine = innodb row_format = dynamic;
 
193
create table t10(id int primary key) engine = innodb row_format = compact;
 
194
create table t11(id int primary key) engine = innodb row_format = redundant;
 
195
 
 
196
SELECT table_schema, table_name, row_format
 
197
FROM information_schema.tables WHERE engine='innodb';
 
198
drop table t3, t4, t5, t6, t7, t8, t9, t10, t11;
 
199
 
 
200
#test different values of ROW_FORMAT with KEY_BLOCK_SIZE
 
201
create table t1 (id int primary key) engine = innodb
 
202
key_block_size = 8 row_format = compressed;
 
203
 
 
204
--error ER_CANT_CREATE_TABLE
 
205
create table t2 (id int primary key) engine = innodb
 
206
key_block_size = 8 row_format = redundant;
 
207
show errors;
 
208
 
 
209
--error ER_CANT_CREATE_TABLE
 
210
create table t3 (id int primary key) engine = innodb
 
211
key_block_size = 8 row_format = compact;
 
212
show errors;
 
213
 
 
214
--error ER_CANT_CREATE_TABLE
 
215
create table t4 (id int primary key) engine = innodb
 
216
key_block_size = 8 row_format = dynamic;
 
217
show errors;
 
218
 
 
219
--error ER_CANT_CREATE_TABLE
 
220
create table t5 (id int primary key) engine = innodb
 
221
key_block_size = 8 row_format = default;
 
222
show errors;
 
223
 
 
224
SELECT table_schema, table_name, row_format
 
225
FROM information_schema.tables WHERE engine='innodb';
 
226
drop table t1;
 
227
 
 
228
#test multiple errors
 
229
--error ER_CANT_CREATE_TABLE
 
230
create table t1 (id int primary key) engine = innodb
 
231
key_block_size = 9 row_format = redundant;
 
232
show errors;
 
233
 
 
234
--error ER_CANT_CREATE_TABLE
 
235
create table t2 (id int primary key) engine = innodb
 
236
key_block_size = 9 row_format = compact;
 
237
show errors;
 
238
 
 
239
--error ER_CANT_CREATE_TABLE
 
240
create table t2 (id int primary key) engine = innodb
 
241
key_block_size = 9 row_format = dynamic;
 
242
show errors;
 
243
 
 
244
SELECT table_schema, table_name, row_format
 
245
FROM information_schema.tables WHERE engine='innodb';
 
246
 
 
247
#test valid values with innodb_file_per_table unset
 
248
set global innodb_file_per_table = off;
 
249
 
 
250
--error ER_CANT_CREATE_TABLE
 
251
create table t1 (id int primary key) engine = innodb key_block_size = 1;
 
252
show errors;
 
253
--error ER_CANT_CREATE_TABLE
 
254
create table t2 (id int primary key) engine = innodb key_block_size = 2;
 
255
show errors;
 
256
--error ER_CANT_CREATE_TABLE
 
257
create table t3 (id int primary key) engine = innodb key_block_size = 4;
 
258
show errors;
 
259
--error ER_CANT_CREATE_TABLE
 
260
create table t4 (id int primary key) engine = innodb key_block_size = 8;
 
261
show errors;
 
262
--error ER_CANT_CREATE_TABLE
 
263
create table t5 (id int primary key) engine = innodb key_block_size = 16;
 
264
show errors;
 
265
--error ER_CANT_CREATE_TABLE
 
266
create table t6 (id int primary key) engine = innodb row_format = compressed;
 
267
show errors;
 
268
--error ER_CANT_CREATE_TABLE
 
269
create table t7 (id int primary key) engine = innodb row_format = dynamic;
 
270
show errors;
 
271
create table t8 (id int primary key) engine = innodb row_format = compact;
 
272
create table t9 (id int primary key) engine = innodb row_format = redundant;
 
273
 
 
274
SELECT table_schema, table_name, row_format
 
275
FROM information_schema.tables WHERE engine='innodb';
 
276
drop table t8, t9;
 
277
 
 
278
#test valid values with innodb_file_format unset
 
279
set global innodb_file_per_table = on;
 
280
set global innodb_file_format = `0`; 
 
281
 
 
282
--error ER_CANT_CREATE_TABLE
 
283
create table t1 (id int primary key) engine = innodb key_block_size = 1;
 
284
show errors;
 
285
--error ER_CANT_CREATE_TABLE
 
286
create table t2 (id int primary key) engine = innodb key_block_size = 2;
 
287
show errors;
 
288
--error ER_CANT_CREATE_TABLE
 
289
create table t3 (id int primary key) engine = innodb key_block_size = 4;
 
290
show errors;
 
291
--error ER_CANT_CREATE_TABLE
 
292
create table t4 (id int primary key) engine = innodb key_block_size = 8;
 
293
show errors;
 
294
--error ER_CANT_CREATE_TABLE
 
295
create table t5 (id int primary key) engine = innodb key_block_size = 16;
 
296
show errors;
 
297
--error ER_CANT_CREATE_TABLE
 
298
create table t6 (id int primary key) engine = innodb row_format = compressed;
 
299
show errors;
 
300
--error ER_CANT_CREATE_TABLE
 
301
create table t7 (id int primary key) engine = innodb row_format = dynamic;
 
302
show errors;
 
303
create table t8 (id int primary key) engine = innodb row_format = compact;
 
304
create table t9 (id int primary key) engine = innodb row_format = redundant;
 
305
 
 
306
SELECT table_schema, table_name, row_format
 
307
FROM information_schema.tables WHERE engine='innodb';
 
308
drop table t8, t9;
 
309
 
 
310
eval set global innodb_file_per_table=$per_table;
 
311
eval set global innodb_file_format=$format;
 
312
#
 
313
# Testing of tablespace tagging
 
314
#
 
315
-- disable_info
 
316
set global innodb_file_per_table=on;
 
317
set global innodb_file_format=`Barracuda`;
 
318
set global innodb_file_format_check=`Antelope`;
 
319
create table normal_table (
 
320
  c1 int
 
321
) engine = innodb;
 
322
select @@innodb_file_format_check;
 
323
create table zip_table (
 
324
  c1 int
 
325
) engine = innodb key_block_size = 8;
 
326
select @@innodb_file_format_check;
 
327
set global innodb_file_format_check=`Antelope`;
 
328
select @@innodb_file_format_check;
 
329
-- disable_result_log
 
330
show table status;
 
331
-- enable_result_log
 
332
select @@innodb_file_format_check;
 
333
drop table normal_table, zip_table;
 
334
-- disable_result_log
 
335
 
 
336
#
 
337
# restore environment to the state it was before this test execution
 
338
#
 
339
 
 
340
-- disable_query_log
 
341
eval set global innodb_file_format=$format;
 
342
eval set global innodb_file_per_table=$per_table;
 
343
eval set global innodb_file_format_check=$innodb_file_format_check_orig;