Debian Codegraph @

mysql-test/suite/innodb/t/innodb_bug11766634.test

raw
1 # Bug 11766634 59783: InnoDB data grows unexpectedly when inserting,
2 # truncating, inserting the same set of rows.
3 #
4 # Scenario:
5 # create table t1. Insert $recs records. check size of ibdata1.
6 # drop table t1. create table t1. Insert the same set of $recs
7 # records. The size of ibdata1 must not increase.
8 #
9
10 #Want to skip this test from daily Valgrind execution.
11 --source include/no_valgrind_without_big.inc
12 # Adding big test option for this test.
13 --source include/big_test.inc
14
15
16 --echo # This test case needs the innodb_file_per_table option to be disabled.
17 set global innodb_file_per_table = 0;
18 show variables like 'innodb_file_per_table';
19
20 create table t1 (f1 char(255)) engine innodb;
21 let $MYSQLD_DATADIR=`select @@datadir`;
22 let IBDATA1=$MYSQLD_DATADIR/ibdata1;
23 let $MYSQLD_TMPDIR = `SELECT @@tmpdir`;
24 let $rnd=`SELECT FLOOR(1 + (RAND() * 100000))`;
25 let TMPFILE=$MYSQLD_TMPDIR/bug11766634-$rnd.txt;
26
27 let $recs = 36262;
28
29 --disable_query_log
30 let $c = $recs;
31 start transaction;
32 while ($c)
33 {
34 insert into t1 values ('Hello World');
35 dec $c;
36 }
37 commit work;
38 --enable_query_log
39
40 perl;
41 my $filesize = -s $ENV{'IBDATA1'};
42 open FILE, ">" . $ENV{'TMPFILE'} or die $!;
43 print FILE "$filesize\n";
44 close(FILE);
45 EOF
46
47 drop table t1;
48 create table t1 (f1 char(255)) engine innodb;
49
50 --disable_query_log
51 let $c = $recs;
52 start transaction;
53 while ($c)
54 {
55 insert into t1 values ('Hello World');
56 dec $c;
57 }
58 commit work;
59 --enable_query_log
60
61 perl;
62 my $newfilesize = -s $ENV{'IBDATA1'};
63 open FILE, "<" . $ENV{'TMPFILE'} or die $!;
64 my @lines = <FILE>;
65 close(FILE);
66 die "File size read from temp file was 0!\n" if $lines[0] == 0;
67 my $diff = $newfilesize - $lines[0];
68 print "Difference in ibdata1 file size: $diff\n";
69 unlink($ENV{'TMPFILE'}) or die $!;
70 EOF
71
72 drop table t1;
73 set global innodb_file_per_table = 1;
74