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: 485
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
1=== added file 'Percona-Server/mysql-test/include/percona_show_ibd_size.inc'
2--- Percona-Server/mysql-test/include/percona_show_ibd_size.inc 1970-01-01 00:00:00 +0000
3+++ Percona-Server/mysql-test/include/percona_show_ibd_size.inc 2013-05-30 15:08:33 +0000
4@@ -0,0 +1,7 @@
5+perl;
6+ my $table = $ENV{'IBD_TO_CHECK'};
7+ my $tablespace = $ENV{'MYSQLD_DATADIR'}."test/".$table.".ibd";
8+ my $size = -s "$tablespace";
9+ print "The size of $table tablespace file in bytes: $size\n";
10+ exit(0)
11+EOF
12
13=== added file 'Percona-Server/mysql-test/suite/innodb/r/percona_ibd_size.result'
14--- Percona-Server/mysql-test/suite/innodb/r/percona_ibd_size.result 1970-01-01 00:00:00 +0000
15+++ Percona-Server/mysql-test/suite/innodb/r/percona_ibd_size.result 2013-05-30 15:08:33 +0000
16@@ -0,0 +1,48 @@
17+DROP TABLE IF EXISTS t1;
18+SET GLOBAL innodb_file_per_table=ON;
19+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
20+Empty table:
21+The size of t1 tablespace file in bytes: 98304
22+Rows inserted: 5000
23+The size of t1 tablespace file in bytes: 212992
24+Rows inserted: 10000
25+The size of t1 tablespace file in bytes: 344064
26+Rows inserted: 15000
27+The size of t1 tablespace file in bytes: 458752
28+Rows inserted: 20000
29+The size of t1 tablespace file in bytes: 589824
30+Rows inserted: 25000
31+The size of t1 tablespace file in bytes: 9437184
32+DROP TABLE t1;
33+CREATE TABLE t2 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
34+Empty table:
35+The size of t2 tablespace file in bytes: 98304
36+Rows inserted: 4
37+The size of t2 tablespace file in bytes: 196608
38+Rows inserted: 8
39+The size of t2 tablespace file in bytes: 327680
40+Rows inserted: 12
41+The size of t2 tablespace file in bytes: 458752
42+Rows inserted: 16
43+The size of t2 tablespace file in bytes: 589824
44+Rows inserted: 20
45+The size of t2 tablespace file in bytes: 9437184
46+DROP TABLE t2;
47+SET GLOBAL innodb_file_format='barracuda';
48+CREATE TABLE t3 (a INT PRIMARY KEY, b BLOB)
49+ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
50+Empty table:
51+The size of t3 tablespace file in bytes: 65536
52+Rows inserted: 8
53+The size of t3 tablespace file in bytes: 65536
54+Rows inserted: 16
55+The size of t3 tablespace file in bytes: 65536
56+Rows inserted: 24
57+The size of t3 tablespace file in bytes: 65536
58+Rows inserted: 32
59+The size of t3 tablespace file in bytes: 2097152
60+Rows inserted: 40
61+The size of t3 tablespace file in bytes: 2097152
62+DROP TABLE t3;
63+SET GLOBAL innodb_file_per_table=default;
64+SET GLOBAL innodb_file_format=default;
65
66=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_ibd_size.test'
67--- Percona-Server/mysql-test/suite/innodb/t/percona_ibd_size.test 1970-01-01 00:00:00 +0000
68+++ Percona-Server/mysql-test/suite/innodb/t/percona_ibd_size.test 2013-05-30 15:08:33 +0000
69@@ -0,0 +1,108 @@
70+#
71+# Test tablespace sizes for various schemas and row counts. We are especially
72+# interested in their sizes around 1MB size, where InnoDB switches from small to
73+# big tablespace handling.
74+# This is also a regression test for bug 1169494.
75+#
76+--source include/have_innodb.inc
77+
78+--disable_warnings
79+DROP TABLE IF EXISTS t1;
80+--enable_warnings
81+
82+let MYSQLD_DATADIR=`SELECT @@datadir`;
83+
84+SET GLOBAL innodb_file_per_table=ON;
85+
86+#
87+# Table 1: small rows
88+#
89+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
90+
91+let IBD_TO_CHECK=t1;
92+echo Empty table:;
93+--source include/percona_show_ibd_size.inc
94+
95+let $i = 0;
96+
97+--disable_query_log
98+BEGIN;
99+while ($i < 25000) {
100+ eval INSERT INTO t1 VALUES($i);
101+ inc $i;
102+ let $print= `SELECT $i MOD 5000`;
103+ if ($print == 0) {
104+ COMMIT;
105+ echo Rows inserted: $i;
106+ source include/percona_show_ibd_size.inc;
107+ BEGIN;
108+ }
109+}
110+COMMIT;
111+--enable_query_log
112+
113+DROP TABLE t1;
114+
115+
116+#
117+# Table 2: BLOB
118+#
119+CREATE TABLE t2 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
120+
121+let IBD_TO_CHECK=t2;
122+echo Empty table:;
123+--source include/percona_show_ibd_size.inc
124+
125+let $i = 0;
126+
127+--disable_query_log
128+BEGIN;
129+while ($i < 20) {
130+ eval INSERT INTO t2 VALUES($i, REPEAT('a', 30000));
131+ inc $i;
132+ let $print= `SELECT $i MOD 4`;
133+ if ($print == 0) {
134+ COMMIT;
135+ echo Rows inserted: $i;
136+ source include/percona_show_ibd_size.inc;
137+ BEGIN;
138+ }
139+}
140+COMMIT;
141+--enable_query_log
142+
143+DROP TABLE t2;
144+
145+#
146+# Table 3: compressed BLOB
147+#
148+SET GLOBAL innodb_file_format='barracuda';
149+CREATE TABLE t3 (a INT PRIMARY KEY, b BLOB)
150+ ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
151+
152+let IBD_TO_CHECK=t3;
153+echo Empty table:;
154+--source include/percona_show_ibd_size.inc
155+
156+let $i = 0;
157+
158+--disable_query_log
159+BEGIN;
160+while ($i < 40) {
161+ eval INSERT INTO t3 VALUES($i, REPEAT('a', 30000));
162+ inc $i;
163+ let $print= `SELECT $i MOD 8`;
164+ if ($print == 0) {
165+ COMMIT;
166+ echo Rows inserted: $i;
167+ source include/percona_show_ibd_size.inc;
168+ BEGIN;
169+ }
170+}
171+COMMIT;
172+--enable_query_log
173+
174+DROP TABLE t3;
175+
176+SET GLOBAL innodb_file_per_table=default;
177+SET GLOBAL innodb_file_format=default;
178
179=== modified file 'Percona-Server/storage/innobase/fsp/fsp0fsp.c'
180--- Percona-Server/storage/innobase/fsp/fsp0fsp.c 2013-02-15 11:07:07 +0000
181+++ Percona-Server/storage/innobase/fsp/fsp0fsp.c 2013-05-30 15:08:33 +0000
182@@ -2913,15 +2913,15 @@
183 ulint space, /*!< in: space id, must be != 0 */
184 fsp_header_t* space_header, /*!< in: header of that space,
185 x-latched */
186- ulint size, /*!< in: size of the tablespace in pages,
187- must be < FSP_EXTENT_SIZE / 2 */
188+ ulint size, /*!< in: size of the tablespace in
189+ pages, must be < FSP_EXTENT_SIZE */
190 mtr_t* mtr) /*!< in: mtr */
191 {
192 xdes_t* descr;
193 ulint n_used;
194
195 ut_a(space != 0);
196- ut_a(size < FSP_EXTENT_SIZE / 2);
197+ ut_a(size < FSP_EXTENT_SIZE);
198
199 descr = xdes_get_descriptor_with_space_hdr(space_header, space, 0,
200 mtr);
201@@ -3004,7 +3004,7 @@
202 try_again:
203 size = mtr_read_ulint(space_header + FSP_SIZE, MLOG_4BYTES, mtr);
204
205- if (size < FSP_EXTENT_SIZE / 2) {
206+ if (size < FSP_EXTENT_SIZE) {
207 /* Use different rules for small single-table tablespaces */
208 *n_reserved = 0;
209 return(fsp_reserve_free_pages(space, space_header, size, mtr));
210@@ -3019,11 +3019,8 @@
211 some of them will contain extent descriptor pages, and therefore
212 will not be free extents */
213
214- if (size <= free_limit) {
215- n_free_up = 0;
216- } else {
217- n_free_up = (size - free_limit) / FSP_EXTENT_SIZE;
218- }
219+ ut_ad(size >= free_limit);
220+ n_free_up = (size - free_limit) / FSP_EXTENT_SIZE;
221
222 if (n_free_up > 0) {
223 n_free_up--;

Subscribers

People subscribed via source and target branches