Merge lp:~laurynas-biveinis/percona-server/bug1169494-5.5 into lp:percona-server/5.5

Proposed by Laurynas Biveinis
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 526
Proposed branch: lp:~laurynas-biveinis/percona-server/bug1169494-5.5
Merge into: lp:percona-server/5.5
Diff against target: 223 lines (+169/-9)
4 files modified
Percona-Server/mysql-test/include/percona_show_ibd_size.inc (+7/-0)
Percona-Server/mysql-test/suite/innodb/r/percona_ibd_size.result (+48/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_ibd_size.test (+108/-0)
Percona-Server/storage/innobase/fsp/fsp0fsp.c (+6/-9)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/bug1169494-5.5
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Review via email: mp+166519@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Stewart Smith (stewart) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'Percona-Server/mysql-test/include/percona_show_ibd_size.inc'
--- Percona-Server/mysql-test/include/percona_show_ibd_size.inc 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/include/percona_show_ibd_size.inc 2013-05-30 15:08:33 +0000
@@ -0,0 +1,7 @@
1perl;
2 my $table = $ENV{'IBD_TO_CHECK'};
3 my $tablespace = $ENV{'MYSQLD_DATADIR'}."test/".$table.".ibd";
4 my $size = -s "$tablespace";
5 print "The size of $table tablespace file in bytes: $size\n";
6 exit(0)
7EOF
08
=== added file 'Percona-Server/mysql-test/suite/innodb/r/percona_ibd_size.result'
--- Percona-Server/mysql-test/suite/innodb/r/percona_ibd_size.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/r/percona_ibd_size.result 2013-05-30 15:08:33 +0000
@@ -0,0 +1,48 @@
1DROP TABLE IF EXISTS t1;
2SET GLOBAL innodb_file_per_table=ON;
3CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
4Empty table:
5The size of t1 tablespace file in bytes: 98304
6Rows inserted: 5000
7The size of t1 tablespace file in bytes: 212992
8Rows inserted: 10000
9The size of t1 tablespace file in bytes: 344064
10Rows inserted: 15000
11The size of t1 tablespace file in bytes: 458752
12Rows inserted: 20000
13The size of t1 tablespace file in bytes: 589824
14Rows inserted: 25000
15The size of t1 tablespace file in bytes: 9437184
16DROP TABLE t1;
17CREATE TABLE t2 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
18Empty table:
19The size of t2 tablespace file in bytes: 98304
20Rows inserted: 4
21The size of t2 tablespace file in bytes: 196608
22Rows inserted: 8
23The size of t2 tablespace file in bytes: 327680
24Rows inserted: 12
25The size of t2 tablespace file in bytes: 458752
26Rows inserted: 16
27The size of t2 tablespace file in bytes: 589824
28Rows inserted: 20
29The size of t2 tablespace file in bytes: 9437184
30DROP TABLE t2;
31SET GLOBAL innodb_file_format='barracuda';
32CREATE TABLE t3 (a INT PRIMARY KEY, b BLOB)
33ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
34Empty table:
35The size of t3 tablespace file in bytes: 65536
36Rows inserted: 8
37The size of t3 tablespace file in bytes: 65536
38Rows inserted: 16
39The size of t3 tablespace file in bytes: 65536
40Rows inserted: 24
41The size of t3 tablespace file in bytes: 65536
42Rows inserted: 32
43The size of t3 tablespace file in bytes: 2097152
44Rows inserted: 40
45The size of t3 tablespace file in bytes: 2097152
46DROP TABLE t3;
47SET GLOBAL innodb_file_per_table=default;
48SET GLOBAL innodb_file_format=default;
049
=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_ibd_size.test'
--- Percona-Server/mysql-test/suite/innodb/t/percona_ibd_size.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_ibd_size.test 2013-05-30 15:08:33 +0000
@@ -0,0 +1,108 @@
1#
2# Test tablespace sizes for various schemas and row counts. We are especially
3# interested in their sizes around 1MB size, where InnoDB switches from small to
4# big tablespace handling.
5# This is also a regression test for bug 1169494.
6#
7--source include/have_innodb.inc
8
9--disable_warnings
10DROP TABLE IF EXISTS t1;
11--enable_warnings
12
13let MYSQLD_DATADIR=`SELECT @@datadir`;
14
15SET GLOBAL innodb_file_per_table=ON;
16
17#
18# Table 1: small rows
19#
20CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
21
22let IBD_TO_CHECK=t1;
23echo Empty table:;
24--source include/percona_show_ibd_size.inc
25
26let $i = 0;
27
28--disable_query_log
29BEGIN;
30while ($i < 25000) {
31 eval INSERT INTO t1 VALUES($i);
32 inc $i;
33 let $print= `SELECT $i MOD 5000`;
34 if ($print == 0) {
35 COMMIT;
36 echo Rows inserted: $i;
37 source include/percona_show_ibd_size.inc;
38 BEGIN;
39 }
40}
41COMMIT;
42--enable_query_log
43
44DROP TABLE t1;
45
46
47#
48# Table 2: BLOB
49#
50CREATE TABLE t2 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
51
52let IBD_TO_CHECK=t2;
53echo Empty table:;
54--source include/percona_show_ibd_size.inc
55
56let $i = 0;
57
58--disable_query_log
59BEGIN;
60while ($i < 20) {
61 eval INSERT INTO t2 VALUES($i, REPEAT('a', 30000));
62 inc $i;
63 let $print= `SELECT $i MOD 4`;
64 if ($print == 0) {
65 COMMIT;
66 echo Rows inserted: $i;
67 source include/percona_show_ibd_size.inc;
68 BEGIN;
69 }
70}
71COMMIT;
72--enable_query_log
73
74DROP TABLE t2;
75
76#
77# Table 3: compressed BLOB
78#
79SET GLOBAL innodb_file_format='barracuda';
80CREATE TABLE t3 (a INT PRIMARY KEY, b BLOB)
81 ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
82
83let IBD_TO_CHECK=t3;
84echo Empty table:;
85--source include/percona_show_ibd_size.inc
86
87let $i = 0;
88
89--disable_query_log
90BEGIN;
91while ($i < 40) {
92 eval INSERT INTO t3 VALUES($i, REPEAT('a', 30000));
93 inc $i;
94 let $print= `SELECT $i MOD 8`;
95 if ($print == 0) {
96 COMMIT;
97 echo Rows inserted: $i;
98 source include/percona_show_ibd_size.inc;
99 BEGIN;
100 }
101}
102COMMIT;
103--enable_query_log
104
105DROP TABLE t3;
106
107SET GLOBAL innodb_file_per_table=default;
108SET GLOBAL innodb_file_format=default;
0109
=== modified file 'Percona-Server/storage/innobase/fsp/fsp0fsp.c'
--- Percona-Server/storage/innobase/fsp/fsp0fsp.c 2013-02-15 11:07:07 +0000
+++ Percona-Server/storage/innobase/fsp/fsp0fsp.c 2013-05-30 15:08:33 +0000
@@ -2913,15 +2913,15 @@
2913 ulint space, /*!< in: space id, must be != 0 */2913 ulint space, /*!< in: space id, must be != 0 */
2914 fsp_header_t* space_header, /*!< in: header of that space,2914 fsp_header_t* space_header, /*!< in: header of that space,
2915 x-latched */2915 x-latched */
2916 ulint size, /*!< in: size of the tablespace in pages,2916 ulint size, /*!< in: size of the tablespace in
2917 must be < FSP_EXTENT_SIZE / 2 */2917 pages, must be < FSP_EXTENT_SIZE */
2918 mtr_t* mtr) /*!< in: mtr */2918 mtr_t* mtr) /*!< in: mtr */
2919{2919{
2920 xdes_t* descr;2920 xdes_t* descr;
2921 ulint n_used;2921 ulint n_used;
29222922
2923 ut_a(space != 0);2923 ut_a(space != 0);
2924 ut_a(size < FSP_EXTENT_SIZE / 2);2924 ut_a(size < FSP_EXTENT_SIZE);
29252925
2926 descr = xdes_get_descriptor_with_space_hdr(space_header, space, 0,2926 descr = xdes_get_descriptor_with_space_hdr(space_header, space, 0,
2927 mtr);2927 mtr);
@@ -3004,7 +3004,7 @@
3004try_again:3004try_again:
3005 size = mtr_read_ulint(space_header + FSP_SIZE, MLOG_4BYTES, mtr);3005 size = mtr_read_ulint(space_header + FSP_SIZE, MLOG_4BYTES, mtr);
30063006
3007 if (size < FSP_EXTENT_SIZE / 2) {3007 if (size < FSP_EXTENT_SIZE) {
3008 /* Use different rules for small single-table tablespaces */3008 /* Use different rules for small single-table tablespaces */
3009 *n_reserved = 0;3009 *n_reserved = 0;
3010 return(fsp_reserve_free_pages(space, space_header, size, mtr));3010 return(fsp_reserve_free_pages(space, space_header, size, mtr));
@@ -3019,11 +3019,8 @@
3019 some of them will contain extent descriptor pages, and therefore3019 some of them will contain extent descriptor pages, and therefore
3020 will not be free extents */3020 will not be free extents */
30213021
3022 if (size <= free_limit) {3022 ut_ad(size >= free_limit);
3023 n_free_up = 0;3023 n_free_up = (size - free_limit) / FSP_EXTENT_SIZE;
3024 } else {
3025 n_free_up = (size - free_limit) / FSP_EXTENT_SIZE;
3026 }
30273024
3028 if (n_free_up > 0) {3025 if (n_free_up > 0) {
3029 n_free_up--;3026 n_free_up--;

Subscribers

People subscribed via source and target branches