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

Proposed by Laurynas Biveinis
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 364
Proposed branch: lp:~laurynas-biveinis/percona-server/bug1169494-5.6
Merge into: lp:percona-server/5.6
Diff against target: 253 lines (+172/-11)
5 files modified
Percona-Server/mysql-test/include/percona_show_ibd_size.inc (+7/-0)
Percona-Server/mysql-test/suite/innodb/r/innodb_wl6347_comp_indx_stat.result (+3/-3)
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.cc (+6/-8)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/bug1169494-5.6
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Review via email: mp+166520@code.launchpad.net

Description of the change

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:10:36 +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=== modified file 'Percona-Server/mysql-test/suite/innodb/r/innodb_wl6347_comp_indx_stat.result'
14--- Percona-Server/mysql-test/suite/innodb/r/innodb_wl6347_comp_indx_stat.result 2013-05-12 06:24:46 +0000
15+++ Percona-Server/mysql-test/suite/innodb/r/innodb_wl6347_comp_indx_stat.result 2013-05-30 15:10:36 +0000
16@@ -979,7 +979,7 @@
17 AND table_name='tab5' AND database_name='test'
18 AND index_name like 'idx%' ;
19 compress_stat 1
20-The size of the tab5.ibd file: 2097152
21+The size of the tab5.ibd file: 163840
22 # fetch the compressed page and check the stats
23 ===============
24 Fetch Records
25@@ -1005,7 +1005,7 @@
26 AND table_name='tab5' AND database_name='test'
27 AND index_name like 'idx%' ;
28 compress_stat 1
29-The size of the tab5.ibd file: 2097152
30+The size of the tab5.ibd file: 163840
31 # fetch the compressed same page once again and check the stats
32 # the stat figures should be same as above query
33 ===============
34@@ -1032,7 +1032,7 @@
35 AND table_name='tab5' AND database_name='test'
36 AND index_name like 'idx%' ;
37 compress_stat 1
38-The size of the tab5.ibd file: 2097152
39+The size of the tab5.ibd file: 163840
40 DROP TABLE tab5;
41 #reset the stat table before starting next testcase
42 SET GLOBAL innodb_cmp_per_index_enabled=0;
43
44=== added file 'Percona-Server/mysql-test/suite/innodb/r/percona_ibd_size.result'
45--- Percona-Server/mysql-test/suite/innodb/r/percona_ibd_size.result 1970-01-01 00:00:00 +0000
46+++ Percona-Server/mysql-test/suite/innodb/r/percona_ibd_size.result 2013-05-30 15:10:36 +0000
47@@ -0,0 +1,48 @@
48+DROP TABLE IF EXISTS t1;
49+SET GLOBAL innodb_file_per_table=ON;
50+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
51+Empty table:
52+The size of t1 tablespace file in bytes: 98304
53+Rows inserted: 5000
54+The size of t1 tablespace file in bytes: 212992
55+Rows inserted: 10000
56+The size of t1 tablespace file in bytes: 344064
57+Rows inserted: 15000
58+The size of t1 tablespace file in bytes: 458752
59+Rows inserted: 20000
60+The size of t1 tablespace file in bytes: 589824
61+Rows inserted: 25000
62+The size of t1 tablespace file in bytes: 9437184
63+DROP TABLE t1;
64+CREATE TABLE t2 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
65+Empty table:
66+The size of t2 tablespace file in bytes: 98304
67+Rows inserted: 4
68+The size of t2 tablespace file in bytes: 196608
69+Rows inserted: 8
70+The size of t2 tablespace file in bytes: 327680
71+Rows inserted: 12
72+The size of t2 tablespace file in bytes: 458752
73+Rows inserted: 16
74+The size of t2 tablespace file in bytes: 589824
75+Rows inserted: 20
76+The size of t2 tablespace file in bytes: 9437184
77+DROP TABLE t2;
78+SET GLOBAL innodb_file_format='barracuda';
79+CREATE TABLE t3 (a INT PRIMARY KEY, b BLOB)
80+ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
81+Empty table:
82+The size of t3 tablespace file in bytes: 65536
83+Rows inserted: 8
84+The size of t3 tablespace file in bytes: 65536
85+Rows inserted: 16
86+The size of t3 tablespace file in bytes: 65536
87+Rows inserted: 24
88+The size of t3 tablespace file in bytes: 65536
89+Rows inserted: 32
90+The size of t3 tablespace file in bytes: 2097152
91+Rows inserted: 40
92+The size of t3 tablespace file in bytes: 2097152
93+DROP TABLE t3;
94+SET GLOBAL innodb_file_per_table=default;
95+SET GLOBAL innodb_file_format=default;
96
97=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_ibd_size.test'
98--- Percona-Server/mysql-test/suite/innodb/t/percona_ibd_size.test 1970-01-01 00:00:00 +0000
99+++ Percona-Server/mysql-test/suite/innodb/t/percona_ibd_size.test 2013-05-30 15:10:36 +0000
100@@ -0,0 +1,108 @@
101+#
102+# Test tablespace sizes for various schemas and row counts. We are especially
103+# interested in their sizes around 1MB size, where InnoDB switches from small to
104+# big tablespace handling.
105+# This is also a regression test for bug 1169494.
106+#
107+--source include/have_innodb.inc
108+
109+--disable_warnings
110+DROP TABLE IF EXISTS t1;
111+--enable_warnings
112+
113+let MYSQLD_DATADIR=`SELECT @@datadir`;
114+
115+SET GLOBAL innodb_file_per_table=ON;
116+
117+#
118+# Table 1: small rows
119+#
120+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
121+
122+let IBD_TO_CHECK=t1;
123+echo Empty table:;
124+--source include/percona_show_ibd_size.inc
125+
126+let $i = 0;
127+
128+--disable_query_log
129+BEGIN;
130+while ($i < 25000) {
131+ eval INSERT INTO t1 VALUES($i);
132+ inc $i;
133+ let $print= `SELECT $i MOD 5000`;
134+ if ($print == 0) {
135+ COMMIT;
136+ echo Rows inserted: $i;
137+ source include/percona_show_ibd_size.inc;
138+ BEGIN;
139+ }
140+}
141+COMMIT;
142+--enable_query_log
143+
144+DROP TABLE t1;
145+
146+
147+#
148+# Table 2: BLOB
149+#
150+CREATE TABLE t2 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
151+
152+let IBD_TO_CHECK=t2;
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 < 20) {
161+ eval INSERT INTO t2 VALUES($i, REPEAT('a', 30000));
162+ inc $i;
163+ let $print= `SELECT $i MOD 4`;
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 t2;
175+
176+#
177+# Table 3: compressed BLOB
178+#
179+SET GLOBAL innodb_file_format='barracuda';
180+CREATE TABLE t3 (a INT PRIMARY KEY, b BLOB)
181+ ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
182+
183+let IBD_TO_CHECK=t3;
184+echo Empty table:;
185+--source include/percona_show_ibd_size.inc
186+
187+let $i = 0;
188+
189+--disable_query_log
190+BEGIN;
191+while ($i < 40) {
192+ eval INSERT INTO t3 VALUES($i, REPEAT('a', 30000));
193+ inc $i;
194+ let $print= `SELECT $i MOD 8`;
195+ if ($print == 0) {
196+ COMMIT;
197+ echo Rows inserted: $i;
198+ source include/percona_show_ibd_size.inc;
199+ BEGIN;
200+ }
201+}
202+COMMIT;
203+--enable_query_log
204+
205+DROP TABLE t3;
206+
207+SET GLOBAL innodb_file_per_table=default;
208+SET GLOBAL innodb_file_format=default;
209
210=== modified file 'Percona-Server/storage/innobase/fsp/fsp0fsp.cc'
211--- Percona-Server/storage/innobase/fsp/fsp0fsp.cc 2013-05-13 04:25:56 +0000
212+++ Percona-Server/storage/innobase/fsp/fsp0fsp.cc 2013-05-30 15:10:36 +0000
213@@ -2686,14 +2686,14 @@
214 fsp_header_t* space_header, /*!< in: header of that space,
215 x-latched */
216 ulint size, /*!< in: size of the tablespace in
217- pages, must be < FSP_EXTENT_SIZE/2 */
218+ pages, must be < FSP_EXTENT_SIZE */
219 mtr_t* mtr) /*!< in/out: mini-transaction */
220 {
221 xdes_t* descr;
222 ulint n_used;
223
224 ut_a(space != 0);
225- ut_a(size < FSP_EXTENT_SIZE / 2);
226+ ut_a(size < FSP_EXTENT_SIZE);
227
228 descr = xdes_get_descriptor_with_space_hdr(space_header, space, 0,
229 mtr);
230@@ -2773,7 +2773,7 @@
231 try_again:
232 size = mtr_read_ulint(space_header + FSP_SIZE, MLOG_4BYTES, mtr);
233
234- if (size < FSP_EXTENT_SIZE / 2) {
235+ if (size < FSP_EXTENT_SIZE) {
236 /* Use different rules for small single-table tablespaces */
237 *n_reserved = 0;
238 return(fsp_reserve_free_pages(space, space_header, size, mtr));
239@@ -2787,11 +2787,9 @@
240 /* Below we play safe when counting free extents above the free limit:
241 some of them will contain extent descriptor pages, and therefore
242 will not be free extents */
243- if (size <= free_limit) {
244- n_free_up = 0;
245- } else {
246- n_free_up = (size - free_limit) / FSP_EXTENT_SIZE;
247- }
248+
249+ ut_ad(size >= free_limit);
250+ n_free_up = (size - free_limit) / FSP_EXTENT_SIZE;
251
252 if (n_free_up > 0) {
253 n_free_up--;

Subscribers

People subscribed via source and target branches