1#
2# Various test cases for IO_CACHE tempfiles (file==-1) encryption
3#
4source include/have_file_key_management_plugin.inc;
5source include/have_sequence.inc;
6
7# Row binlog format to fill binlog cache faster
8source include/have_binlog_format_row.inc;
9
10source include/have_innodb.inc;
11
12select @@encrypt_tmp_files;
13
14#
15# MyISAM messing around with IO_CACHE::file
16#
17CREATE TABLE t1(a INT);
18INSERT INTO t1 VALUES(1),(2);
19DELETE FROM t1 WHERE a=1;
20OPTIMIZE TABLE t1;
21CHECK TABLE t1;
22DROP TABLE t1;
23
24#
25# filesort, my_b_pread, seeks in READ_CACHE
26#
27create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10)));
28insert into t1 (v) select concat(char(ascii('a')+s2.seq),repeat(' ',s1.seq))
29  from seq_0_to_9 as s1, seq_0_to_26 as s2;
30update t1 set c=v, t=v;
31select sql_big_result t,count(t) from t1 group by t limit 10;
32drop table t1;
33
34reset master;
35set @save_binlog_cache_size=@@global.binlog_cache_size;
36set global binlog_cache_size=8192;
37
38connect con1, localhost, root;
39
40#
41# Test the last half-filled block:
42# first write 3 blocks, then reinit the file and write one full and one
43# partial block. reading the second time must stop in the middle of the
44# second block, and NOT read till EOF.
45#
46create table t1 (a text) engine=innodb;
47start transaction;
48insert t1 select repeat(seq, 1000) from seq_1_to_15;
49commit;
50start transaction;
51insert t1 select repeat(seq, 1000) from seq_1_to_8;
52commit;
53
54disconnect con1;
55connect con2, localhost, root;
56
57#
58# Test reinit_io_cache(WRITE_CACHE) with non-zero seek_offset:
59# Start a transaction, write until the cache goes to disk,
60# create a savepoint, write more blocks to disk, rollback to savepoint.
61#
62create table t2 (a text) engine=innodb;
63start transaction;
64insert t2 select repeat(seq, 1000) from seq_1_to_15;
65savepoint foo;
66insert t2 select repeat(seq, 1000) from seq_16_to_30;
67rollback to savepoint foo;
68insert t2 select repeat(seq, 1000) from seq_31_to_40;
69commit;
70
71disconnect con2;
72connection default;
73
74flush binary logs;
75
76drop table t1, t2;
77
78set @@global.binlog_cache_size=@save_binlog_cache_size;
79
80let $MYSQLD_DATADIR= `select @@datadir`;
81exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL;
82
83select left(a, 10) from t1;
84select left(a, 10) from t2;
85drop table t1, t2;
86