~vadim-tk/percona-server/percona-galera-5.1.57

« back to all changes in this revision

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

  • Committer: root
  • Date: 2011-07-10 16:09:24 UTC
  • Revision ID: root@r815.office.percona.com-20110710160924-fyffqsbaclgu6vui
Initial port

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-- source include/have_innodb_plugin.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 in non-strict mode too.
 
89
# (The fix of Bug #50945 only affects REDUNDANT and COMPACT tables.)
 
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
create table t1 (id int primary key) engine = innodb key_block_size = 0;
 
177
 
 
178
--error ER_CANT_CREATE_TABLE
 
179
create table t2 (id int primary key) engine = innodb key_block_size = 9;
 
180
show warnings;
 
181
 
 
182
 
 
183
create table t3 (id int primary key) engine = innodb key_block_size = 1;
 
184
create table t4 (id int primary key) engine = innodb key_block_size = 2;
 
185
create table t5 (id int primary key) engine = innodb key_block_size = 4;
 
186
create table t6 (id int primary key) engine = innodb key_block_size = 8;
 
187
create table t7 (id int primary key) engine = innodb key_block_size = 16;
 
188
 
 
189
#check various ROW_FORMAT values.
 
190
create table t8 (id int primary key) engine = innodb row_format = compressed;
 
191
create table t9 (id int primary key) engine = innodb row_format = dynamic;
 
192
create table t10(id int primary key) engine = innodb row_format = compact;
 
193
create table t11(id int primary key) engine = innodb row_format = redundant;
 
194
 
 
195
SELECT table_schema, table_name, row_format
 
196
FROM information_schema.tables WHERE engine='innodb';
 
197
drop table t1, t3, t4, t5, t6, t7, t8, t9, t10, t11;
 
198
 
 
199
#test different values of ROW_FORMAT with KEY_BLOCK_SIZE
 
200
create table t1 (id int primary key) engine = innodb
 
201
key_block_size = 8 row_format = compressed;
 
202
 
 
203
--error ER_CANT_CREATE_TABLE
 
204
create table t2 (id int primary key) engine = innodb
 
205
key_block_size = 8 row_format = redundant;
 
206
show warnings;
 
207
 
 
208
--error ER_CANT_CREATE_TABLE
 
209
create table t3 (id int primary key) engine = innodb
 
210
key_block_size = 8 row_format = compact;
 
211
show warnings;
 
212
 
 
213
--error ER_CANT_CREATE_TABLE
 
214
create table t4 (id int primary key) engine = innodb
 
215
key_block_size = 8 row_format = dynamic;
 
216
show warnings;
 
217
 
 
218
create table t5 (id int primary key) engine = innodb
 
219
key_block_size = 8 row_format = default;
 
220
 
 
221
SELECT table_schema, table_name, row_format
 
222
FROM information_schema.tables WHERE engine='innodb';
 
223
drop table t1, t5;
 
224
 
 
225
#test multiple errors
 
226
--error ER_CANT_CREATE_TABLE
 
227
create table t1 (id int primary key) engine = innodb
 
228
key_block_size = 9 row_format = redundant;
 
229
show warnings;
 
230
 
 
231
--error ER_CANT_CREATE_TABLE
 
232
create table t2 (id int primary key) engine = innodb
 
233
key_block_size = 9 row_format = compact;
 
234
show warnings;
 
235
 
 
236
--error ER_CANT_CREATE_TABLE
 
237
create table t2 (id int primary key) engine = innodb
 
238
key_block_size = 9 row_format = dynamic;
 
239
show warnings;
 
240
 
 
241
SELECT table_schema, table_name, row_format
 
242
FROM information_schema.tables WHERE engine='innodb';
 
243
 
 
244
#test valid values with innodb_file_per_table unset
 
245
set global innodb_file_per_table = off;
 
246
 
 
247
--error ER_CANT_CREATE_TABLE
 
248
create table t1 (id int primary key) engine = innodb key_block_size = 1;
 
249
show warnings;
 
250
--error ER_CANT_CREATE_TABLE
 
251
create table t2 (id int primary key) engine = innodb key_block_size = 2;
 
252
show warnings;
 
253
--error ER_CANT_CREATE_TABLE
 
254
create table t3 (id int primary key) engine = innodb key_block_size = 4;
 
255
show warnings;
 
256
--error ER_CANT_CREATE_TABLE
 
257
create table t4 (id int primary key) engine = innodb key_block_size = 8;
 
258
show warnings;
 
259
--error ER_CANT_CREATE_TABLE
 
260
create table t5 (id int primary key) engine = innodb key_block_size = 16;
 
261
show warnings;
 
262
--error ER_CANT_CREATE_TABLE
 
263
create table t6 (id int primary key) engine = innodb row_format = compressed;
 
264
show warnings;
 
265
--error ER_CANT_CREATE_TABLE
 
266
create table t7 (id int primary key) engine = innodb row_format = dynamic;
 
267
show warnings;
 
268
create table t8 (id int primary key) engine = innodb row_format = compact;
 
269
create table t9 (id int primary key) engine = innodb row_format = redundant;
 
270
 
 
271
SELECT table_schema, table_name, row_format
 
272
FROM information_schema.tables WHERE engine='innodb';
 
273
drop table t8, t9;
 
274
 
 
275
#test valid values with innodb_file_format unset
 
276
set global innodb_file_per_table = on;
 
277
set global innodb_file_format = `0`; 
 
278
 
 
279
--error ER_CANT_CREATE_TABLE
 
280
create table t1 (id int primary key) engine = innodb key_block_size = 1;
 
281
show warnings;
 
282
--error ER_CANT_CREATE_TABLE
 
283
create table t2 (id int primary key) engine = innodb key_block_size = 2;
 
284
show warnings;
 
285
--error ER_CANT_CREATE_TABLE
 
286
create table t3 (id int primary key) engine = innodb key_block_size = 4;
 
287
show warnings;
 
288
--error ER_CANT_CREATE_TABLE
 
289
create table t4 (id int primary key) engine = innodb key_block_size = 8;
 
290
show warnings;
 
291
--error ER_CANT_CREATE_TABLE
 
292
create table t5 (id int primary key) engine = innodb key_block_size = 16;
 
293
show warnings;
 
294
--error ER_CANT_CREATE_TABLE
 
295
create table t6 (id int primary key) engine = innodb row_format = compressed;
 
296
show warnings;
 
297
--error ER_CANT_CREATE_TABLE
 
298
create table t7 (id int primary key) engine = innodb row_format = dynamic;
 
299
show warnings;
 
300
create table t8 (id int primary key) engine = innodb row_format = compact;
 
301
create table t9 (id int primary key) engine = innodb row_format = redundant;
 
302
 
 
303
SELECT table_schema, table_name, row_format
 
304
FROM information_schema.tables WHERE engine='innodb';
 
305
drop table t8, t9;
 
306
 
 
307
eval set global innodb_file_per_table=$per_table;
 
308
eval set global innodb_file_format=$format;
 
309
#
 
310
# Testing of tablespace tagging
 
311
#
 
312
-- disable_info
 
313
set global innodb_file_per_table=on;
 
314
set global innodb_file_format=`Barracuda`;
 
315
set global innodb_file_format_check=`Antelope`;
 
316
create table normal_table (
 
317
  c1 int
 
318
) engine = innodb;
 
319
select @@innodb_file_format_check;
 
320
create table zip_table (
 
321
  c1 int
 
322
) engine = innodb key_block_size = 8;
 
323
select @@innodb_file_format_check;
 
324
set global innodb_file_format_check=`Antelope`;
 
325
select @@innodb_file_format_check;
 
326
-- disable_result_log
 
327
show table status;
 
328
-- enable_result_log
 
329
select @@innodb_file_format_check;
 
330
drop table normal_table, zip_table;
 
331
-- disable_result_log
 
332
 
 
333
#
 
334
# restore environment to the state it was before this test execution
 
335
#
 
336
 
 
337
-- disable_query_log
 
338
eval set global innodb_file_format=$format;
 
339
eval set global innodb_file_per_table=$per_table;
 
340
eval set global innodb_file_format_check=$innodb_file_format_check_orig;