summaryrefslogtreecommitdiff
path: root/storage/tokudb/mysql-test/tokudb/t/compressions.test
blob: cd2e405c13a786003c65237965895398b6a177f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
--source include/have_tokudb.inc

# The purpose of this test is to perform about as full of an end-to-end
# validation that the requested compression algo at the SQL layer is actually
# applied to the FT data files. The only practical way to check this is to use
# tokuftdump and look at the data files header value for compression_method.
# A side effect of this is that the existance of this test will ensure that at
# no time will the compression method IDs ever change, if they do, this test
# will fail and users data will be irreparably damaged.

# uncompressed - compression_method=0
CREATE TABLE t1 (a INT) ENGINE=TokuDB COMPRESSION=TOKUDB_UNCOMPRESSED;
--let $t1_file = `SELECT internal_file_name FROM information_schema.tokudb_file_map WHERE dictionary_name = './test/t1-main'`

# SNAPPY - compression_method=7
CREATE TABLE t2 (a INT) ENGINE=TokuDB COMPRESSION=TOKUDB_SNAPPY;
--let $t2_file = `SELECT internal_file_name FROM information_schema.tokudb_file_map WHERE dictionary_name = './test/t2-main'`

# QUICKLZ - compression_method=9
CREATE TABLE t3 (a INT) ENGINE=TokuDB COMPRESSION=TOKUDB_QUICKLZ;
--let $t3_file = `SELECT internal_file_name FROM information_schema.tokudb_file_map WHERE dictionary_name = './test/t3-main'`

# LZMA - compression_method=10
CREATE TABLE t4 (a INT) ENGINE=TokuDB COMPRESSION=TOKUDB_LZMA;
--let $t4_file = `SELECT internal_file_name FROM information_schema.tokudb_file_map WHERE dictionary_name = './test/t4-main'`

# ZLIB (without checksum) - compression_method=11
CREATE TABLE t5 (a INT) ENGINE=TokuDB COMPRESSION=TOKUDB_ZLIB;
--let $t5_file = `SELECT internal_file_name FROM information_schema.tokudb_file_map WHERE dictionary_name = './test/t5-main'`

--let $datadir = `SELECT @@global.datadir`

# To ensure we have correct headers written to FT data files and no chance of a
# race between header rotation and tokuftdump, lets just perform a clean server
# shutdown before we go rooting around in the FT files.
--source include/shutdown_mysqld.inc

--let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/dump

# uncompressed - compression_method=0
--exec $MYSQL_TOKUFTDUMP $datadir/$t1_file > $SEARCH_FILE
--let SEARCH_PATTERN=compression_method=0
--source include/search_pattern_in_file.inc

# SNAPPY - compression_method=7
--exec $MYSQL_TOKUFTDUMP $datadir/$t2_file > $SEARCH_FILE
--let SEARCH_PATTERN=compression_method=7
--source include/search_pattern_in_file.inc

# QUICKLZ - compression_method=9
--exec $MYSQL_TOKUFTDUMP $datadir/$t3_file > $SEARCH_FILE
--let SEARCH_PATTERN=compression_method=9
--source include/search_pattern_in_file.inc

# LZMA - compression_method=10
--exec $MYSQL_TOKUFTDUMP $datadir/$t4_file > $SEARCH_FILE
--let SEARCH_PATTERN=compression_method=10
--source include/search_pattern_in_file.inc

# ZLIB (without checksum) - compression_method=11
--exec $MYSQL_TOKUFTDUMP $datadir/$t5_file > $SEARCH_FILE
--let SEARCH_PATTERN=compression_method=11
--source include/search_pattern_in_file.inc

--remove_file $SEARCH_FILE
--source include/start_mysqld.inc

DROP TABLE t1, t2, t3, t4, t5;