Debian Codegraph @

mysql-test/suite/large_tests/t/innodb_innochecksum_3gb.test

raw
1 #****************************************************************
2 # WL6045: Improve Innochecksum
3 # Check Innochecksum with ibd file size 3GB
4 # When server --default_storage_engine=InnoDB & tab2.ibd (CRC32)
5 # When server --default_storage_engine=CRC32 & tab2.ibd (None)
6 # Precondition : This testcase assumes 3GB disk space exist
7 # on the server where, it is kick off.
8 # How to run this testcase:
9 # ./mtr --big-test --suite=large_tests --suite-timeout=6360
10 # --testcase-timeout=6000 innodb_innochecksum_3gb.test
11 #****************************************************************
12
13
14 let MYSQLD_BASEDIR= `SELECT @@basedir`;
15 let MYSQLD_DATADIR= `SELECT @@datadir`;
16
17 --disable_warnings
18 DROP TABLE IF EXISTS tab2;
19
20 SHOW variables like '%innodb_checksum_algorithm%';
21 #check the default engine is always InnoDB after restart
22 SELECT @@default_storage_engine;
23
24 CREATE TABLE tab2(col_1 CHAR (255) ,
25 col_2 VARCHAR (255), col_3 longtext,
26 col_4 longtext,col_5 BLOB,
27 col_6 LONGBLOB , col_7 bigint)
28 engine = innodb ;
29
30 #create index on the compress table
31 CREATE INDEX idx1 ON tab2(col_3(10));
32 CREATE INDEX idx2 ON tab2(col_4(10));
33 CREATE INDEX idx3 ON tab2(col_5(10));
34
35 --echo # Generate a input text file for loading the table
36 perl;
37 $count=0;
38 my $MYSQLD_TMPDIR= $ENV{'MYSQLTEST_VARDIR'}."/tmp";
39 opendir(MYSQLDTMP, $MYSQLD_TMPDIR) or die $!;
40 open OUT_FILE, ">", "$MYSQLD_TMPDIR/input.dat" or die $!;
41 while ($count <= 500){
42 print OUT_FILE "aaaaaaa \t bbbbbbb \t cccccccccc \t dddddd \t eeeeee \t fffff \t $count \n";
43 $count++;
44 }
45 close(OUT_FILE);
46 closedir(MYSQLDTMP);
47 EOF
48
49 --echo # check whether file exist
50 --file_exists $MYSQLTEST_VARDIR/tmp/input.dat
51
52 --echo # load the data into the table
53
54 --disable_query_log
55
56 let $i = 14000;
57 while ($i) {
58 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
59 eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/input.dat' IGNORE INTO TABLE tab2;
60 COMMIT;
61 dec $i;
62 }
63
64 --enable_query_log
65
66 # check the record count 7014000 ,to ensure ibd file size is 3GB
67 SELECT COUNT(*) FROM tab2;
68
69 --echo # Stop the server
70 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
71 --shutdown_server
72 --source include/wait_until_disconnected.inc
73
74 --echo # Rewrite the tab2.ibd file into new checksum=CRC32
75 --exec $INNOCHECKSUM --no-check --write=CRC32 $MYSQLD_DATADIR/test/tab2.ibd
76
77 --echo # Restart the DB server with default innodb_checksum_algorithm=InnoDB (Default)
78 --echo # no need to pass to the server.
79 --exec echo "restart: --default_storage_engine=InnoDB " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
80 --enable_reconnect
81 --source include/wait_until_connected_again.inc
82 --disable_reconnect
83
84 --echo # Load the with repeat function
85 SET @col_1 = repeat('A', 5);
86 SET @col_2 = repeat('B', 20);
87 SET @col_3 = repeat('D', 100);
88 SET @col_4 = repeat('E', 100);
89 SET @col_5 = repeat('F', 100);
90 SET @col_6 = repeat('G', 100);
91
92 --echo # Check the table status with DML
93 let $i = 1000;
94 eval INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
95 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,$i);
96
97 --echo # Check with Read operation by record count
98 SELECT COUNT(*) FROM tab2 where col_7=1000;
99
100 --echo # Stop the server
101 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
102 --shutdown_server
103 --source include/wait_until_disconnected.inc
104
105 --echo # Rewrite the tab2.ibd file into new checksum=None
106 --exec $INNOCHECKSUM --no-check -w None $MYSQLD_DATADIR/test/tab2.ibd
107
108 --echo # Check the page type summary with longform for *.ibd
109 --replace_regex /File.*.ibd/File::tab2.ibd/ /[0-9]+/#/
110 --exec $INNOCHECKSUM --page-type-summary $MYSQLD_DATADIR/test/tab2.ibd
111
112 --echo # Page type dump for tab2.ibd
113 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
114 --exec $INNOCHECKSUM -D $MYSQL_TMP_DIR/dump.txt $MYSQLD_DATADIR/test/tab2.ibd
115
116 --echo # check whether dump.txt file exist
117 --file_exists $MYSQL_TMP_DIR/dump.txt
118
119 --echo # Restart the DB server with default innodb_checksum_algorithm=CRC32
120 --exec echo "restart: --innodb_checksum_algorithm=crc32 --default_storage_engine=InnoDB " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
121 --enable_reconnect
122 --source include/wait_until_connected_again.inc
123 --disable_reconnect
124
125 # Check the server startup option of the checksum
126 SHOW variables like '%innodb_checksum_algorithm%';
127
128 --echo # Check the default engine is always InnoDB after restart
129 SELECT @@default_storage_engine;
130
131 --echo # Load the with repeat function
132 SET @col_1 = repeat('G', 5);
133 SET @col_2 = repeat('H', 20);
134 SET @col_3 = repeat('I', 100);
135 SET @col_4 = repeat('J', 100);
136 SET @col_5 = repeat('K', 100);
137 SET @col_6 = repeat('L', 100);
138
139 --echo # Check the table status with DML
140 let $i = 2000;
141 eval INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
142 VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,$i);
143
144 --echo # Check with Read operation that record count
145 SELECT COUNT(*) FROM tab2 where col_7=2000;
146
147 --enable_warnings
148 # Cleanup
149 DROP TABLE IF EXISTS tab2;