~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/suite/innodb/t/innodb-zip.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

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